Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2021-05-18 12:44:10 +02:00
commit 40ed79aa06
8 changed files with 132 additions and 58 deletions

View File

@ -460,9 +460,10 @@ $sql = 'SELECT';
if ($sall || $search_product_category > 0 || $search_user > 0) {
$sql = 'SELECT DISTINCT';
}
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax , s.address, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
$sql .= " typent.code as typent_code,";
$sql .= " ava.rowid as availability,";
$sql .= " country.code as country_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
$sql .= ' p.rowid, p.entity, p.note_private, p.total_ht, p.total_tva, p.total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut as status, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,';
$sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
@ -470,7 +471,7 @@ $sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date
$sql .= ' p.note_public, p.note_private,';
$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
$sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
$sql .= ' u.login';
$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ", sc.fk_soc, sc.fk_user";
}
@ -1335,9 +1336,15 @@ if ($resql) {
$companystatic->id = $obj->socid;
$companystatic->name = $obj->name;
$companystatic->name_alias = $obj->alias;
$companystatic->client = $obj->client;
$companystatic->code_client = $obj->code_client;
$companystatic->email = $obj->email;
$companystatic->phone = $obj->phone;
$companystatic->address = $obj->address;
$companystatic->zip = $obj->zip;
$companystatic->town = $obj->town;
$companystatic->country_code = $obj->country_code;
$projectstatic->id = $obj->project_id;
$projectstatic->ref = $obj->project_ref;
@ -1694,12 +1701,23 @@ if ($resql) {
$userstatic->id = $obj->fk_user_author;
$userstatic->login = $obj->login;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
$userstatic->email = $obj->email;
$userstatic->statut = $obj->statut;
$userstatic->entity = $obj->entity;
$userstatic->photo = $obj->photo;
$userstatic->office_phone = $obj->office_phone;
$userstatic->office_fax = $obj->office_fax;
$userstatic->user_mobile = $obj->user_mobile;
$userstatic->job = $obj->job;
$userstatic->gender = $obj->gender;
// Author
if (!empty($arrayfields['u.login']['checked'])) {
print '<td class="center nowraponall">';
print '<td>';
if ($userstatic->id) {
print $userstatic->getLoginUrl(1);
print $userstatic->getNomUrl(-1);
}
print "</td>\n";
if (!$i) {
@ -1731,7 +1749,9 @@ if ($resql) {
$userstatic->entity = $val['entity'];
$userstatic->photo = $val['photo'];
$userstatic->login = $val['login'];
$userstatic->phone = $val['phone'];
$userstatic->office_phone = $val['office_phone'];
$userstatic->office_fax = $val['office_fax'];
$userstatic->user_mobile = $val['user_mobile'];
$userstatic->job = $val['job'];
$userstatic->gender = $val['gender'];
//print '<div class="float">':

View File

@ -417,17 +417,18 @@ $sql = 'SELECT';
if ($sall || $search_product_category > 0 || $search_user > 0) {
$sql = 'SELECT DISTINCT';
}
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
$sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
$sql .= " country.code as country_code,";
$sql .= ' c.rowid, c.ref, c.total_ht, c.total_tva, c.total_ttc, c.ref_client, c.fk_user_author,';
$sql .= ' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva as multicurrency_total_vat, c.multicurrency_total_ttc,';
$sql .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
$sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
$sql .= " u.login,";
$sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method';
$sql .= ' ,c.fk_input_reason';
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
$sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method,';
$sql .= ' c.fk_input_reason';
if ($search_categ_cus) {
$sql .= ", cc.fk_categorie, cc.fk_soc";
}
@ -1383,10 +1384,16 @@ if ($resql) {
$nbprod = 0;
$companystatic->id = $obj->socid;
$companystatic->code_client = $obj->code_client;
$companystatic->name = $obj->name;
$companystatic->name_alias = $obj->alias;
$companystatic->client = $obj->client;
$companystatic->code_client = $obj->code_client;
$companystatic->email = $obj->email;
$companystatic->phone = $obj->phone;
$companystatic->address = $obj->address;
$companystatic->zip = $obj->zip;
$companystatic->town = $obj->town;
$companystatic->country_code = $obj->country_code;
if (!isset($getNomUrl_cache[$obj->socid])) {
$getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1, 'customer');
}
@ -1669,12 +1676,23 @@ if ($resql) {
$userstatic->id = $obj->fk_user_author;
$userstatic->login = $obj->login;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
$userstatic->email = $obj->email;
$userstatic->statut = $obj->statut;
$userstatic->entity = $obj->entity;
$userstatic->photo = $obj->photo;
$userstatic->office_phone = $obj->office_phone;
$userstatic->office_fax = $obj->office_fax;
$userstatic->user_mobile = $obj->user_mobile;
$userstatic->job = $obj->job;
$userstatic->gender = $obj->gender;
// Author
if (!empty($arrayfields['u.login']['checked'])) {
print '<td align="center">';
print '<td>';
if ($userstatic->id) {
print $userstatic->getLoginUrl(1);
print $userstatic->getNomUrl(-1);
} else {
print '&nbsp;';
}

View File

@ -467,7 +467,7 @@ if (!empty($conf->margin->enabled)) {
$bankaccountstatic = new Account($db);
$facturestatic = new Facture($db);
$formcompany = new FormCompany($db);
$thirdpartystatic = new Societe($db);
$companystatic = new Societe($db);
$sql = 'SELECT';
if ($sall || $search_product_category > 0 || $search_user > 0) {
@ -481,12 +481,12 @@ $sql .= ' f.datef, f.date_valid, f.date_lim_reglement as datelimite, f.module_so
$sql .= ' f.paye as paye, f.fk_statut, f.close_code,';
$sql .= ' f.datec as date_creation, f.tms as date_update, f.date_closing as date_closing,';
$sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,';
$sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
$sql .= " country.code as country_code,";
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
$sql .= " u.login";
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,';
$sql .= ' typent.code as typent_code,';
$sql .= ' state.code_departement as state_code, state.nom as state_name,';
$sql .= ' country.code as country_code,';
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
if (!$sall) {
@ -714,7 +714,7 @@ if (!$sall) {
$sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
$sql .= ' f.fk_user_author, f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva,';
$sql .= ' f.multicurrency_total_tva, f.multicurrency_total_ttc,';
$sql .= ' s.rowid, s.nom, s.name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,';
$sql .= ' s.rowid, s.nom, s.name_alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,';
$sql .= ' typent.code,';
$sql .= ' state.code_departement, state.nom,';
$sql .= ' country.code,';
@ -1539,16 +1539,22 @@ if ($resql) {
$facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
$facturestatic->situation_counter = $obj->situation_counter;
}
$thirdpartystatic->id = $obj->socid;
$thirdpartystatic->name = $obj->name;
$thirdpartystatic->client = $obj->client;
$thirdpartystatic->fournisseur = $obj->fournisseur;
$thirdpartystatic->code_client = $obj->code_client;
$thirdpartystatic->code_compta_client = $obj->code_compta_client;
$thirdpartystatic->code_fournisseur = $obj->code_fournisseur;
$thirdpartystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
$thirdpartystatic->email = $obj->email;
$thirdpartystatic->country_code = $obj->country_code;
$companystatic->id = $obj->socid;
$companystatic->name = $obj->name;
$companystatic->name_alias = $obj->alias;
$companystatic->client = $obj->client;
$companystatic->fournisseur = $obj->fournisseur;
$companystatic->code_client = $obj->code_client;
$companystatic->code_compta_client = $obj->code_compta_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
$companystatic->email = $obj->email;
$companystatic->phone = $obj->phone;
$companystatic->fax = $obj->fax;
$companystatic->address = $obj->address;
$companystatic->zip = $obj->zip;
$companystatic->town = $obj->town;
$companystatic->country_code = $obj->country_code;
$projectstatic->id = $obj->project_id;
$projectstatic->ref = $obj->project_ref;
@ -1570,10 +1576,10 @@ if ($resql) {
$multicurrency_remaintopay = 0;
}
if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) { // If credit note closed, we take into account the amount not yet consummed
$remaincreditnote = $discount->getAvailableDiscounts($thirdpartystatic, '', 'rc.fk_facture_source='.$facturestatic->id);
$remaincreditnote = $discount->getAvailableDiscounts($companystatic, '', 'rc.fk_facture_source='.$facturestatic->id);
$remaintopay = -$remaincreditnote;
$totalpay = price2num($facturestatic->total_ttc - $remaintopay);
$multicurrency_remaincreditnote = $discount->getAvailableDiscounts($thirdpartystatic, '', 'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
$multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic, '', 'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
$multicurrency_remaintopay = -$multicurrency_remaincreditnote;
$multicurrency_totalpay = price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
}
@ -1704,9 +1710,9 @@ if ($resql) {
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="tdoverflowmax200">';
if ($contextpage == 'poslist') {
print $thirdpartystatic->name;
print $companystatic->name;
} else {
print $thirdpartystatic->getNomUrl(1, 'customer');
print $companystatic->getNomUrl(1, 'customer');
}
print '</td>';
if (!$i) {
@ -1878,13 +1884,25 @@ if ($resql) {
$totalarray['val']['f.total_ttc'] += $obj->total_ttc;
}
$userstatic->id = $obj->fk_user_author;
$userstatic->login = $obj->login;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
$userstatic->email = $obj->email;
$userstatic->statut = $obj->statut;
$userstatic->entity = $obj->entity;
$userstatic->photo = $obj->photo;
$userstatic->office_phone = $obj->office_phone;
$userstatic->office_fax = $obj->office_fax;
$userstatic->user_mobile = $obj->user_mobile;
$userstatic->job = $obj->job;
$userstatic->gender = $obj->gender;
// Author
if (!empty($arrayfields['u.login']['checked'])) {
$userstatic->id = $obj->fk_user_author;
$userstatic->login = $obj->login;
print '<td class="center tdoverflowmax100">';
print '<td>';
if ($userstatic->id) {
print $userstatic->getLoginUrl(1);
print $userstatic->getNomUrl(-1);
} else {
print '&nbsp;';
}

View File

@ -38,7 +38,7 @@ if (!empty($conf->projet->enabled)) {
}
// Load translation files required by the page
$langs->loadLangs(array('compta', 'banks', 'bills', 'hrm'));
$langs->loadLangs(array('compta', 'banks', 'bills', 'hrm', 'projects'));
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');

View File

@ -297,7 +297,7 @@ if (empty($reshook)) {
* View
*/
$socstatic = new Societe($db);
$companystatic = new Societe($db);
$form = new Form($db);
$formother = new FormOther($db);
$formproject = new FormProjets($db);
@ -330,12 +330,13 @@ if (count($listofprojectcontacttype) == 0) {
}
$distinct = 'DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once.
$sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut as status, p.fk_opp_status, p.public, p.fk_user_creat";
$sql .= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, (p.opp_amount*p.opp_percent/100) as opp_weighted_amount, p.tms as date_update, p.budget_amount ";
$sql .= ", p.usage_opportunity, p.usage_task, p.usage_bill_time, p.usage_organize_event";
$sql .= ", accept_conference_suggestions, accept_booth_suggestions, price_registration, price_booth";
$sql .= ", s.rowid as socid, s.nom as name, s.email";
$sql .= ", cls.code as opp_status_code";
$sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut as status, p.fk_opp_status, p.public, p.fk_user_creat,";
$sql .= " p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, (p.opp_amount*p.opp_percent/100) as opp_weighted_amount, p.tms as date_update, p.budget_amount,";
$sql .= " p.usage_opportunity, p.usage_task, p.usage_bill_time, p.usage_organize_event,";
$sql .= " accept_conference_suggestions, accept_booth_suggestions, price_registration, price_booth,";
$sql .= " s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.code_client,";
$sql .= " country.code as country_code,";
$sql .= " cls.code as opp_status_code";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
@ -355,6 +356,7 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls on p.fk_opp_status = cls.rowid";
// We'll need this table joined to the select in order to filter by sale
// No check is done on company permission because readability is managed by public status of project and assignement.
@ -978,9 +980,17 @@ while ($i < min($num, $limit)) {
$userAccess = $object->restrictedProjectArea($user); // why this ?
if ($userAccess >= 0) {
$socstatic->id = $obj->socid;
$socstatic->name = $obj->name;
$socstatic->email = $obj->email;
$companystatic->id = $obj->socid;
$companystatic->name = $obj->name;
$companystatic->name_alias = $obj->alias;
$companystatic->client = $obj->client;
$companystatic->code_client = $obj->code_client;
$companystatic->email = $obj->email;
$companystatic->phone = $obj->phone;
$companystatic->address = $obj->address;
$companystatic->zip = $obj->zip;
$companystatic->town = $obj->town;
$companystatic->country_code = $obj->country_code;
print '<tr class="oddeven">';
@ -1009,7 +1019,7 @@ while ($i < min($num, $limit)) {
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="tdoverflowmax100">';
if ($obj->socid) {
print $socstatic->getNomUrl(1);
print $companystatic->getNomUrl(1);
} else {
print '&nbsp;';
}
@ -1022,9 +1032,9 @@ while ($i < min($num, $limit)) {
if (!empty($arrayfields['commercial']['checked'])) {
print '<td>';
if ($obj->socid) {
$socstatic->id = $obj->socid;
$socstatic->name = $obj->name;
$listsalesrepresentatives = $socstatic->getSalesRepresentatives($user);
$companystatic->id = $obj->socid;
$companystatic->name = $obj->name;
$listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
$nbofsalesrepresentative = count($listsalesrepresentatives);
if ($nbofsalesrepresentative > 6) {
// We print only number
@ -1041,7 +1051,9 @@ while ($i < min($num, $limit)) {
$userstatic->entity = $val['entity'];
$userstatic->photo = $val['photo'];
$userstatic->login = $val['login'];
$userstatic->phone = $val['phone'];
$userstatic->office_phone = $val['office_phone'];
$userstatic->office_fax = $val['office_fax'];
$userstatic->user_mobile = $val['user_mobile'];
$userstatic->job = $val['job'];
$userstatic->gender = $val['gender'];
print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);

View File

@ -359,7 +359,9 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->salaries-
* View
*/
llxHeader("", $langs->trans("Salary"));
$title = $langs->trans('Salary')." - ".$langs->trans('Card');
$help_url = "";
llxHeader("", $title, $help_url);
$form = new Form($db);
if (!empty($conf->projet->enabled)) $formproject = new FormProjets($db);

View File

@ -91,7 +91,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
$form = new Form($db);
llxHeader("", $langs->trans("SalaryPayment"));
$title = $langs->trans('Salary')." - ".$langs->trans('Documents');
$help_url = "";
llxHeader("", $title, $help_url);
if ($object->id) {
$object->fetch_thirdparty();

View File

@ -53,7 +53,9 @@ restrictedArea($user, 'salaries', $object->id, 'salary', '');
* View
*/
llxHeader("", $langs->trans("SalaryPayment"));
$title = $langs->trans('Salary')." - ".$langs->trans('Info');
$help_url = "";
llxHeader("", $title, $help_url);
$object = new Salary($db);
$object->fetch($id);