Coder Social home page Coder Social logo

Comments (2)

newmips avatar newmips commented on June 19, 2024
  1. Make a link between employee and user
select entity employee
add field SalesRep related to user using login
  1. In Customer route, execute a promise to select employee ID for current user ; something like...
var promises = [];

  promises.push(new Promise(function(resolve, reject){
  var query = "SELECT id AS employee_id"
  		+ " FROM 1_e_employee"
  		+ " WHERE fk_id_user_employee=" + req.session.passport.user.id;
  models.sequelize.query(query, {type: models.sequelize.QueryTypes.SELECT}).then(function (result) {
  	if(result[0].employee_id === null) employee_id = "";
  	resolve({employee_id: result});
  });
}));

  Promise.all(promises).then(function (results) {
  for (var i = 0; i < results.length; i++)
  	for (var prop in results[i])
  		data[prop] = results[i][prop];

  data.toastr = req.session.toastr;
  req.session.toastr = [];
  res.render('e_employee/create_form', data);
});
  1. Send data to page and set value of SalesRep with ID you have retrieved
    <input name="f_salesrep" value="{employee_id}" />

from newmips.

alaindebecker avatar alaindebecker commented on June 19, 2024

Ok, Let me ask the question with a different wording:

I have an entity Assuance with a field Contact referring to an other entity. Naturally, the Contact depends on the login user.

How much would it cost to teach Mipsy to write the code mentioned in the part 2 of your solution ?

Naturally, this cost will probably include the analysis and public discussion required to make the solution sufficiently generic to be worth to include in the OpenSource code.

from newmips.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.