Merge remote-tracking branch 'Dolibarr/11.0' into 11

This commit is contained in:
Francis Appels 2020-02-20 16:32:10 +01:00
commit 145caacbea
55 changed files with 496 additions and 246 deletions

View File

@ -1554,7 +1554,7 @@ class BookKeeping extends CommonObject
$sql .= " WHERE piece_num = ".$piecenum;
$sql .= " AND entity IN (".getEntity('accountancy').")";
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
@ -1568,7 +1568,7 @@ class BookKeeping extends CommonObject
$this->date_creation = $obj->date_creation;
} else {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR);
dol_syslog(__METHOD__.$this->error, LOG_ERR);
return -1;
}
@ -1622,7 +1622,7 @@ class BookKeeping extends CommonObject
$sql .= " WHERE piece_num = ".$piecenum;
$sql .= " AND entity IN (".getEntity('accountancy').")";
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
while ($obj = $this->db->fetch_object($result)) {
@ -1654,7 +1654,7 @@ class BookKeeping extends CommonObject
}
} else {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR);
dol_syslog(__METHOD__.$this->error, LOG_ERR);
return -1;
}

View File

@ -831,7 +831,7 @@ if ($action == 'create')
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="donotclearsession" value="1">';
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : htmlentities($_SERVER["HTTP_REFERER"])).'">';
if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) print '<input type="hidden" name="actioncode" value="'.dol_getIdFromCode($db, 'AC_OTH', 'c_actioncomm').'">';
if (GETPOST("actioncode", 'aZ09') == 'AC_RDV') print load_fiche_titre($langs->trans("AddActionRendezVous"), '', 'title_agenda');
@ -1053,7 +1053,7 @@ if ($action == 'create')
$numproject = $formproject->select_projects((!empty($societe->id) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1);
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>';
$urloption = '?action=create';
$urloption = '?action=create&donotclearsession=1';
$url = dol_buildpath('comm/action/card.php', 2).$urloption;
// update task list
@ -1232,7 +1232,7 @@ if ($id > 0)
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="ref_ext" value="'.$object->ref_ext.'">';
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : htmlentities($_SERVER["HTTP_REFERER"])).'">';
if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">';
dol_fiche_head($head, 'card', $langs->trans("Action"), 0, 'action');
@ -1473,7 +1473,7 @@ if ($id > 0)
{
print '<td id="project-task-input-container" >';
$urloption = '?action=create'; // we use create not edit for more flexibility
$urloption = '?action=create&donotclearsession=1'; // we use create not edit for more flexibility
$url = DOL_URL_ROOT.'/comm/action/card.php'.$urloption;
// update task list

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -149,6 +150,9 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
$sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
$sql .= ", s.code_client";
$sql .= ", s.email";
$sql .= ", s.entity";
$sql .= ", s.code_compta";
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -193,6 +197,9 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas = $obj->canvas;
$companystatic->entity = $obj->entity;
$companystatic->email = $obj->email;
$companystatic->code_compta = $obj->code_compta;
print $companystatic->getNomUrl(1, 'customer', 16);
print '</td>';
print '<td class="nowrap right">'.price($obj->total_ht).'</td></tr>';
@ -233,6 +240,9 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
$sql = "SELECT p.rowid, p.ref, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
$sql .= ", s.code_client";
$sql .= ", s.code_fournisseur";
$sql .= ", s.entity";
$sql .= ", s.email";
$sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -276,6 +286,8 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas = $obj->canvas;
$companystatic->entity = $obj->entity;
$companystatic->email = $obj->email;
print $companystatic->getNomUrl(1, 'supplier', 16);
print '</td>';
print '<td class="nowrap right">'.price($obj->total_ht).'</td></tr>';
@ -315,6 +327,9 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
$sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
$sql .= ", s.code_client";
$sql .= ", s.email";
$sql .= ", s.entity";
$sql .= ", s.code_compta";
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -358,6 +373,8 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas = $obj->canvas;
$companystatic->email = $obj->email;
$companystatic->entity = $obj->entity;
print $companystatic->getNomUrl(1, 'customer', 16);
print '</td>';
if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
@ -404,6 +421,8 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande-
$sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
$sql .= ", s.code_client";
$sql .= ", s.code_fournisseur";
$sql .= ", s.entity";
$sql .= ", s.email";
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -447,6 +466,8 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande-
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas = $obj->canvas;
$companystatic->entity = $obj->entity;
$companystatic->email = $obj->email;
print $companystatic->getNomUrl(1, 'supplier', 16);
print '</td>';
if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
@ -496,6 +517,9 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire)
$sql = "SELECT s.rowid, s.nom as name, s.client, s.datec, s.tms, s.canvas";
$sql .= ", s.code_client";
$sql .= ", s.code_compta";
$sql .= ", s.entity";
$sql .= ", s.email";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE s.client IN (1, 2, 3)";
@ -532,6 +556,9 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire)
$companystatic->code_client = $objp->code_client;
$companystatic->code_fournisseur = $objp->code_fournisseur;
$companystatic->canvas = $objp->canvas;
$companystatic->code_compta = $objp->code_compta;
$companystatic->entity = $objp->entity;
$companystatic->email = $objp->email;
print '<tr class="oddeven">';
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 48).'</td>';
print '<td class="right" nowrap>';
@ -560,6 +587,8 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->societe->lire)
$sql = "SELECT s.nom as name, s.rowid, s.datec as dc, s.canvas, s.tms as dm";
$sql .= ", s.code_fournisseur";
$sql .= ", s.entity";
$sql .= ", s.email";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE s.fournisseur = 1";
@ -591,6 +620,8 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->societe->lire)
$companystatic->code_client = $objp->code_client;
$companystatic->code_fournisseur = $objp->code_fournisseur;
$companystatic->canvas = $objp->canvas;
$companystatic->entity = $objp->entity;
$companystatic->email = $objp->email;
print '<tr class="oddeven">';
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'supplier', 44).'</td>';
print '<td class="right">'.dol_print_date($db->jdate($objp->dm), 'day').'</td>';
@ -636,6 +667,8 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TOD
$sql = "SELECT s.nom as name, s.rowid, s.canvas, ";
$sql .= ", s.code_client";
$sql .= ", s.entity";
$sql .= ", s.email";
$sql .= " c.statut, c.rowid as contratid, p.ref, c.mise_en_service as datemes, c.fin_validite as datefin, c.date_cloture as dateclo";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."contrat as c";
@ -673,6 +706,8 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TOD
$companystatic->code_client = $objp->code_client;
$companystatic->code_fournisseur = $objp->code_fournisseur;
$companystatic->canvas = $objp->canvas;
$companystatic->entity = $objp->entity;
$companystatic->email = $objp->email;
print $companystatic->getNomUrl(1, 'customer', 44);
print '</td>'."\n";
print "<td class=\"right\">".$staticcontrat->LibStatut($obj->statut, 3)."</td></tr>\n";
@ -697,6 +732,8 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
$langs->load("propal");
$sql = "SELECT s.nom as name, s.rowid, s.code_client";
$sql .= ", s.entity";
$sql .= ", s.email";
$sql .= ", p.rowid as propalid, p.entity, p.total as total_ttc, p.total_ht, p.tva as total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."propal as p";
@ -760,6 +797,8 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas = $obj->canvas;
$companystatic->entity = $obj->entity;
$companystatic->email = $obj->email;
print $companystatic->getNomUrl(1, 'customer', 44);
print '</td>';
print '<td class="right">';
@ -802,6 +841,8 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
$sql = "SELECT s.nom as name, s.rowid, c.rowid as commandeid, c.total_ttc, c.total_ht, c.tva as total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed";
$sql .= ", s.code_client";
$sql .= ", s.entity";
$sql .= ", s.email";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."commande as c";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -864,6 +905,8 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas = $obj->canvas;
$companystatic->entity = $obj->entity;
$companystatic->email = $obj->email;
print $companystatic->getNomUrl(1, 'customer', 44);
print '</td>';
print '<td class="right">';

View File

@ -65,7 +65,7 @@ class FormAdvTargetEmailing extends Form
$sql .= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
$sql .= " WHERE active > 0";
$sql .= " ORDER BY sortorder";
dol_syslog(get_class($this).'::multiselectProspectionStatus sql='.$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
@ -111,7 +111,6 @@ class FormAdvTargetEmailing extends Form
$sql .= " WHERE active = 1 AND code<>''";
$sql .= " ORDER BY code ASC";
dol_syslog(get_class($this)."::select_country sql=".$sql);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
@ -260,7 +259,6 @@ class FormAdvTargetEmailing extends Form
}
// $sql.= ' WHERE entity = '.$conf->entity;
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
@ -297,7 +295,7 @@ class FormAdvTargetEmailing extends Form
$sql = "SELECT rowid, code, label as civilite, active FROM ".MAIN_DB_PREFIX."c_civility";
$sql .= " WHERE active = 1";
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
@ -385,7 +383,7 @@ class FormAdvTargetEmailing extends Form
$sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."categorie";
$sql .= " WHERE type=".$type;
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
@ -432,7 +430,7 @@ class FormAdvTargetEmailing extends Form
$sql .= " WHERE type_element='$type_element'";
$sql .= " ORDER BY c.name";
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$out .= '<select id="'.$htmlname.'" class="flat'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'">';

View File

@ -164,8 +164,8 @@ $arrayfields = array(
'p.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
'p.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0),
'p.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
'p.total_ht_invoiced'=>array('label'=>$langs->trans("AmountInvoicedHT"), 'checked'=>0, 'enabled'=>$conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT),
'p.total_invoiced'=>array('label'=>$langs->trans("AmountInvoicedTTC"), 'checked'=>0, 'enabled'=>$conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT),
'p.total_ht_invoiced'=>array('label'=>"AmountInvoicedHT", 'checked'=>0, 'enabled'=>$conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT),
'p.total_invoiced'=>array('label'=>"AmountInvoicedTTC", 'checked'=>0, 'enabled'=>$conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT),
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10),
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>1),
'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),

View File

@ -77,7 +77,22 @@ if ($user->socid > 0) {
accessforbidden();
}
$entity = GETPOST('entity', 'int') ?GETPOST('entity', 'int') : $conf->entity;
// Define $arrayofentities if multientity is set.
$arrayofentities = array();
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
$arrayofentities = $mc->getEntitiesList();
}
$entity = (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : (GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $conf->entity));
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
if (empty($entity) && ! empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) {
$entity = '0,'.join(',', array_keys($arrayofentities));
}
}
if (empty($entity)) $entity = $conf->entity;
$error = 0;
/*
@ -108,42 +123,42 @@ if (($action == "searchfiles" || $action == "dl")) {
$wheretail = " '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'";
// Customer invoices
$sql = "SELECT t.rowid as id, t.ref, t.paye as paid, total as total_ht, total_ttc, tva as total_vat, fk_soc, t.datef as date, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum";
$sql = "SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, total as total_ht, total_ttc, tva as total_vat, fk_soc, t.datef as date, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
$sql .= " WHERE datef between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
$sql .= " AND t.fk_statut <> ".Facture::STATUS_DRAFT;
$sql .= " UNION ALL";
// Vendor invoices
$sql .= " SELECT t.rowid as id, t.ref, paye as paid, total_ht, total_ttc, total_tva as total_vat, fk_soc, datef as date, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum";
$sql .= " SELECT t.rowid as id, t.entity, t.ref, paye as paid, total_ht, total_ttc, total_tva as total_vat, fk_soc, datef as date, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
$sql .= " WHERE datef between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
$sql .= " AND t.fk_statut <> ".FactureFournisseur::STATUS_DRAFT;
$sql .= " UNION ALL";
// Expense reports
$sql .= " SELECT t.rowid as id, t.ref, paid, total_ht, total_ttc, total_tva as total_vat, fk_user_author as fk_soc, date_fin as date, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
$sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, total_ht, total_ttc, total_tva as total_vat, fk_user_author as fk_soc, date_fin as date, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user_author LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country";
$sql .= " WHERE date_fin between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
$sql .= " AND t.fk_statut <> ".ExpenseReport::STATUS_DRAFT;
$sql .= " UNION ALL";
// Donations
$sql .= " SELECT t.rowid as id, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, datedon as date, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
$sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, datedon as date, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
$sql .= " FROM ".MAIN_DB_PREFIX."don as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = t.fk_country";
$sql .= " WHERE datedon between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
$sql .= " AND t.fk_statut <> ".Don::STATUS_DRAFT;
$sql .= " UNION ALL";
// Paiements of salaries
$sql .= " SELECT t.rowid as id, t.ref as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, datep as date, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
$sql .= " SELECT t.rowid as id, t.entity, t.ref as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, datep as date, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country";
$sql .= " WHERE datep between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
//$sql.=" AND fk_statut <> ".PaymentSalary::STATUS_DRAFT;
$sql .= " UNION ALL";
// Social contributions
$sql .= " SELECT t.rowid as id, t.libelle as ref, paye as paid, amount as total_ht, amount as total_ttc, 0 as total_tva, 0 as fk_soc, date_creation as date, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum";
$sql .= " SELECT t.rowid as id, t.entity, t.libelle as ref, paye as paid, amount as total_ht, amount as total_ttc, 0 as total_tva, 0 as fk_soc, date_creation as date, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum";
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as t";
$sql .= " WHERE date_creation between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
@ -228,6 +243,7 @@ if (($action == "searchfiles" || $action == "dl")) {
{
$nofile = array();
$nofile['id'] = $objd->id;
$nofile['entity'] = $objd->entity;
$nofile['date'] = $db->idate($objd->date);
$nofile['paid'] = $objd->paid;
$nofile['amount_ht'] = $objd->total_ht;
@ -248,6 +264,7 @@ if (($action == "searchfiles" || $action == "dl")) {
foreach ($files as $key => $file)
{
$file['id'] = $objd->id;
$file['entity'] = $objd->entity;
$file['date'] = $db->idate($objd->date);
$file['paid'] = $objd->paid;
$file['amount_ht'] = $objd->total_ht;
@ -314,6 +331,10 @@ if ($result && $action == "dl" && !$error)
dol_mkdir($dirfortmpfile);
$log = $langs->transnoentitiesnoconv("Type");
if (!empty($conf->multicompany->enabled) && is_object($mc))
{
$log .= ','.$langs->transnoentitiesnoconv("Entity");
}
$log .= ','.$langs->transnoentitiesnoconv("Date");
$log .= ','.$langs->transnoentitiesnoconv("Ref");
$log .= ','.$langs->transnoentitiesnoconv("TotalHT");
@ -342,6 +363,10 @@ if ($result && $action == "dl" && !$error)
}
$log .= $file['item'];
if (!empty($conf->multicompany->enabled) && is_object($mc))
{
$log .= ','.(empty($arrayofentities[$file['entity']]) ? $file['entity'] : $arrayofentities[$file['entity']]);
}
$log .= ','.dol_print_date($file['date'], 'dayrfc');
$log .= ','.$file['ref'];
$log .= ','.$file['amount_ht'];
@ -383,11 +408,13 @@ $form = new Form($db);
$userstatic = new User($db);
$title = $langs->trans("ComptaFiles").' - '.$langs->trans("List");
$help_url = '';
llxHeader('', $title, $help_url);
$h = 0;
$head[$h][0] = $_SERVER["PHP_SELF"].$varlink;
$head = array();
$head[$h][0] = $_SERVER["PHP_SELF"];
$head[$h][1] = $langs->trans("AccountantFiles");
$head[$h][2] = 'AccountancyFiles';
@ -400,13 +427,18 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
print $langs->trans("ReportPeriod").': '.$form->selectDate($date_start, 'date_start', 0, 0, 0, "", 1, 1, 0);
print ' - '.$form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0)."\n</a>";
// Export is for current company only !
// Export is for current company only
if (!empty($conf->multicompany->enabled) && is_object($mc))
{
$mc->getInfo($conf->entity);
print '<span class="marginleftonly marginrightonly">('.$langs->trans("Entity").' : ';
$mc->dao->getEntities();
$mc->dao->fetch($conf->entity);
print $mc->dao->label;
print "<td>";
if (! empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) {
print $mc->select_entities(GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $mc->id, 'search_entity', '', false, false, false, false, true);
} else {
print $mc->label;
}
print "</td>";
print ")</span>\n";
}

View File

@ -286,11 +286,14 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
else print $langs->trans("NotDefined");
print "</td>";
print "<td>".$ref."</td>";
if($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED ){
if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED) {
if($obj->family == 'invoice'){
$mc->getInfo($obj->entity);
print "<td>".$mc->label."</td>";
}else print "<td></td>";
}
else {
print "<td></td>";
}
}
print "<td>".$refcomp."</td>";
if ($obj->total_ttc < 0) { print '<td class="nowrap right">'.price(abs($total_ttc))."</td><td>&nbsp;</td>"; };

View File

@ -101,6 +101,9 @@ $usehm = (!empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? $conf->global-
$object = new Facture($db);
$extrafields = new ExtraFields($db);
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
// Load object
if ($id > 0 || !empty($ref)) {
if ($action != 'add') {
@ -138,6 +141,7 @@ $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isd
/*
* Actions
*/

View File

@ -95,6 +95,8 @@ if (empty($reshook))
$totalpayment = 0;
$multicurrency_totalpayment = 0;
$atleastonepaymentnotnull = 0;
$formquestion = array();
$i = 0;
// Generate payment array and check if there is payment higher than invoice and payment date before invoice date
$tmpinvoice = new Facture($db);
@ -214,7 +216,7 @@ if (empty($reshook))
{
$error = 0;
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$db->begin();
@ -260,8 +262,10 @@ if (empty($reshook))
$paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
$paiement->paiementid = dol_getIdFromCode($db, GETPOST('paiementcode'), 'c_paiement', 'code', 'id', 1);
$paiement->num_paiement = GETPOST('num_paiement', 'alpha');
$paiement->note = GETPOST('comment', 'alpha');
$paiement->num_payment = GETPOST('num_paiement', 'alpha');
$paiement->note_private = GETPOST('comment', 'alpha');
$paiement->num_paiement = $paiement->num_payment; // For bacward compatibility
$paiement->note = $paiement->note_private; // For bacward compatibility
if (!$error)
{

View File

@ -218,6 +218,8 @@ if (empty($reshook))
$object->priv = GETPOST("priv", 'int');
$object->note_public = GETPOST("note_public", 'none');
$object->note_private = GETPOST("note_private", 'none');
$object->roles = GETPOST("roles", 'array');
$object->statut = 1; //Defult status to Actif
// Note: Correct date should be completed with location to have exact GM time of birth.

View File

@ -354,7 +354,7 @@ class Contact extends CommonObject
if (!$error)
{
$result = $this->update($this->id, $user, 1, 'add');
$result = $this->update($this->id, $user, 1, 'add'); // This include updateRoles(), ...
if ($result < 0)
{
$error++;
@ -1602,7 +1602,7 @@ class Contact extends CommonObject
$sql .= " AND tc.source = 'external' AND tc.active=1";
$sql .= " AND sc.entity IN (".getEntity('societe').')';
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$this->roles = array();
$resql = $this->db->query($sql);
@ -1639,6 +1639,10 @@ class Contact extends CommonObject
{
$tab = array();
if ($element == 'action') {
$element = 'agenda';
}
$sql = "SELECT sc.fk_socpeople as id, sc.fk_c_type_contact";
$sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact tc";
$sql .= ", ".MAIN_DB_PREFIX."societe_contacts sc";
@ -1647,7 +1651,7 @@ class Contact extends CommonObject
$sql .= " AND tc.element='".$element."'";
$sql .= " AND tc.active=1";
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
@ -1687,7 +1691,7 @@ class Contact extends CommonObject
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_contacts WHERE fk_soc=".$this->socid." AND fk_socpeople=".$this->id; ;
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$result = $this->db->query($sql);
if (!$result) {
$this->errors[] = $this->db->lasterror().' sql='.$sql;
@ -1707,7 +1711,7 @@ class Contact extends CommonObject
$sql .= $valRoles." , ";
$sql .= $this->id;
$sql .= ")";
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$result = $this->db->query($sql);
if (!$result)

View File

@ -95,7 +95,7 @@ class box_clients extends ModeleBoxes
$sql.= ", s.code_compta_fournisseur";
$sql.= ", s.logo";
$sql.= ", s.email";
$sql.= ", s.datec, s.tms, s.status";
$sql.= ", s.datec, s.tms, s.status, s.entity";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.client IN (1, 3)";
@ -127,6 +127,7 @@ class box_clients extends ModeleBoxes
$thirdpartystatic->fournisseur = $objp->fournisseur;
$thirdpartystatic->logo = $objp->logo;
$thirdpartystatic->email = $objp->email;
$thirdpartystatic->entity = $objp->entity;
$this->info_box_contents[$line][] = array(
'td' => '',

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2004-2006 Destailleur Laurent <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2019 Frederic France <frederic.france@free.fr>
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -86,7 +87,7 @@ class box_fournisseurs extends ModeleBoxes
{
$sql = "SELECT s.nom as name, s.rowid as socid, s.datec, s.tms, s.status,";
$sql.= " s.code_fournisseur, s.email as semail,";
$sql.= " s.logo";
$sql.= " s.logo, s.code_compta_fournisseur, s.entity";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.fournisseur = 1";
@ -112,6 +113,8 @@ class box_fournisseurs extends ModeleBoxes
$thirdpartytmp->email = $objp->semail;
$thirdpartytmp->code_client = $objp->code_client;
$thirdpartytmp->logo = $objp->logo;
$thirdpartytmp->code_compta_fournisseur = $objp->code_compta_fournisseur;
$thirdpartytmp->entity = $objp->entity;
$this->info_box_contents[$line][] = array(
'td' => '',

View File

@ -96,7 +96,7 @@ class box_project extends ModeleBoxes
$projectsListId='';
if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
$sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public";
$sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut as status, p.public";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql.= " WHERE p.entity IN (".getEntity('project').")"; // Only current entity or severals if permission ok
$sql.= " AND p.fk_statut = 1"; // Only open projects
@ -117,6 +117,7 @@ class box_project extends ModeleBoxes
$projectstatic->ref = $objp->ref;
$projectstatic->title = $objp->title;
$projectstatic->public = $objp->public;
$projectstatic->statut = $objp->status;
$this->info_box_contents[$i][] = array(
'td' => 'class="nowraponall"',
@ -152,6 +153,7 @@ class box_project extends ModeleBoxes
$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => round(0));
$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => "N/A&nbsp;");
}
$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => $projectstatic->getLibStatut(3));
$i++;
}
@ -166,22 +168,26 @@ class box_project extends ModeleBoxes
// Add the sum à the bottom of the boxes
$this->info_box_contents[$i][] = array(
'td' => '',
'td' => 'class="liste_total"',
'text' => $langs->trans("Total")."&nbsp;".$textHead,
'text' => "&nbsp;",
);
$this->info_box_contents[$i][] = array(
'td' => 'class="right" ',
'td' => 'class="right liste_total" ',
'text' => round($num, 0)."&nbsp;".$langs->trans("Projects"),
);
$this->info_box_contents[$i][] = array(
'td' => 'class="right" ',
'td' => 'class="right liste_total" ',
'text' => (($max < $num) ? '' : (round($totalnbTask, 0)."&nbsp;".$langs->trans("Tasks"))),
);
$this->info_box_contents[$i][] = array(
'td' => '',
'td' => 'class="liste_total"',
'text' => "&nbsp;",
);
$this->info_box_contents[$i][] = array(
'td' => 'class="liste_total"',
'text' => "&nbsp;",
);
}
/**

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2019 Frederic France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -84,7 +85,7 @@ class box_propales extends ModeleBoxes
if ($user->rights->propale->lire)
{
$sql = "SELECT s.nom as name, s.rowid as socid, s.code_client, s.logo, s.email,";
$sql = "SELECT s.nom as name, s.rowid as socid, s.code_client, s.logo, s.entity, s.email,";
$sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
@ -122,6 +123,7 @@ class box_propales extends ModeleBoxes
$societestatic->code_client = $objp->code_client;
$societestatic->logo = $objp->logo;
$societestatic->email = $objp->email;
$societestatic->entity = $objp->entity;
$late = '';
if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) {

View File

@ -86,6 +86,7 @@ class box_task extends ModeleBoxes
$form = new Form($this->db);
$cookie_name = 'boxfilter_task';
$boxcontent = '';
$socid = $user->socid;
$textHead = $langs->trans("CurentlyOpenedTasks");
@ -97,7 +98,6 @@ class box_task extends ModeleBoxes
$filterValue = $_COOKIE[$cookie_name];
}
if ($filterValue == 'im_task_contact') {
$textHead .= ' : '.$langs->trans("WhichIamLinkedTo");
}
@ -143,6 +143,10 @@ class box_task extends ModeleBoxes
);
// Get list of project id allowed to user (in a string list separated by coma)
$projectsListId = '';
if (!$user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
$sql = "SELECT pt.rowid, pt.ref, pt.fk_projet, pt.fk_task_parent, pt.datec, pt.dateo, pt.datee, pt.datev, pt.label, pt.description, pt.duration_effective, pt.planned_workload, pt.progress";
$sql .= ", p.rowid project_id, p.ref project_ref, p.title project_title";
@ -163,7 +167,7 @@ class box_task extends ModeleBoxes
$sql .= " AND p.fk_statut = ".Project::STATUS_VALIDATED;
$sql .= " AND (pt.progress < 100 OR pt.progress IS NULL ) "; // 100% is done and not displayed
$sql .= " AND p.usage_task = 1 ";
if (!$user->rights->projet->all->lire) $sql .= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users
$sql .= " ORDER BY pt.datee ASC, pt.dateo ASC";
$sql .= $this->db->plimit($max, 0);

View File

@ -144,6 +144,9 @@ class CMailFile
}
}
// Add autocopy to (Note: Adding bcc for specific modules are also done from pages)
if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) $addr_bcc .= ($addr_bcc ? ', ' : '').$conf->global->MAIN_MAIL_AUTOCOPY_TO;
$this->subject = $subject;
$this->addr_to = $to;
$this->addr_from = $from;
@ -268,9 +271,6 @@ class CMailFile
}
}
// Add autocopy to (Note: Adding bcc for specific modules are also done from pages)
if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) $addr_bcc .= ($addr_bcc ? ', ' : '').$conf->global->MAIN_MAIL_AUTOCOPY_TO;
// We set all data according to choosed sending method.
// We also set a value for ->msgid
if ($this->sendmode == 'mail')

View File

@ -1080,7 +1080,7 @@ abstract class CommonObject
* Get array of all contacts for an object
*
* @param int $status Status of links to get (-1=all)
* @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user)
* @param string $source Source of contact: 'external' or 'thirdparty' (llx_socpeople) or 'internal' (llx_user)
* @param int $list 0:Return array contains all properties, 1:Return array contains just id
* @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...)
* @return array|int Array of contacts, -1 if error
@ -1242,14 +1242,15 @@ abstract class CommonObject
/**
* Return array with list of possible values for type of contacts
*
* @param string $source 'internal', 'external' or 'all'
* @param int $option 0=Return array id->label, 1=Return array code->label
* @param int $activeonly 0=all status of contact, 1=only the active
* @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE')
* @param string $element Filter Element Type
* @return array Array list of type of contacts (id->label if option=0, code->label if option=1)
* @param string $source 'internal', 'external' or 'all'
* @param int $option 0=Return array id->label, 1=Return array code->label
* @param int $activeonly 0=all status of contact, 1=only the active
* @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE')
* @param string $element Filter on 1 element type
* @param string $excludeelement Exclude 1 element type. Example: 'agenda'
* @return array Array list of type of contacts (id->label if option=0, code->label if option=1)
*/
public function listeTypeContacts($source = 'internal', $option = 0, $activeonly = 0, $code = '', $element = '')
public function listeTypeContacts($source = 'internal', $option = 0, $activeonly = 0, $code = '', $element = '', $excludeelement = '')
{
// phpcs:enable
global $langs, $conf;
@ -1260,8 +1261,12 @@ abstract class CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc";
$sqlWhere = array();
if (!empty($element))
if (!empty($element)) {
$sqlWhere[] = " tc.element='".$this->db->escape($element)."'";
}
if (!empty($excludeelement)) {
$sqlWhere[] = " tc.element <> '".$this->db->escape($excludeelement)."'";
}
if ($activeonly == 1)
$sqlWhere[] = " tc.active=1"; // only the active types
@ -1278,24 +1283,25 @@ abstract class CommonObject
$sql .= $this->db->order('tc.element, tc.position', 'ASC');
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
if ($num > 0) {
while ($obj = $this->db->fetch_object($resql)) {
$modulename = $obj->element;
if (strpos($obj->element, 'project') !== false) {
$element = 'projet';
$modulename = 'projet';
} elseif ($obj->element == 'contrat') {
$element = 'contract';
} elseif ($obj->element == 'action') {
$modulename = 'agenda';
} elseif (strpos($obj->element, 'supplier') !== false && $obj->element != 'supplier_proposal') {
$element = 'fournisseur';
$modulename = 'fournisseur';
} elseif (strpos($obj->element, 'supplier') !== false && $obj->element != 'supplier_proposal') {
$element = 'fournisseur';
} else {
$element = $obj->element;
$modulename = 'fournisseur';
}
if ($conf->{$element}->enabled) {
if ($conf->{$modulename}->enabled) {
$libelle_element = $langs->trans('ContactDefault_'.$obj->element);
$transkey = "TypeContact_".$this->element."_".$source."_".$obj->code;
$libelle_type = ($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->libelle);
@ -1701,7 +1707,7 @@ abstract class CommonObject
$sql .= " WHERE ".$id_field." = ".$id;
dol_syslog(get_class($this)."::".__FUNCTION__."", LOG_DEBUG);
dol_syslog(__METHOD__."", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
@ -5547,7 +5553,7 @@ abstract class CommonObject
if ($error)
{
dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR);
dol_syslog(__METHOD__.$this->error, LOG_ERR);
$this->db->rollback();
return -1;
}

View File

@ -2432,6 +2432,7 @@ class Form
$outlabel = $objp->label;
$outdesc = $objp->description;
$outbarcode = $objp->barcode;
$outpbq = empty($objp->price_by_qty_rowid) ? '' : $objp->price_by_qty_rowid;
$outtype = $objp->fk_product_type;
$outdurationvalue = $outtype == Product::TYPE_SERVICE ?substr($objp->duration, 0, dol_strlen($objp->duration) - 1) : '';
@ -2479,7 +2480,7 @@ class Form
$opt .= ($objp->rowid == $selected) ? ' selected' : '';
if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0)
{
$opt .= ' pbq="'.$objp->price_by_qty_rowid.'" data-pbq="'.$objp->price_by_qty_rowid.'" data-pbqqty="'.$objp->price_by_qty_quantity.'" data-pbqpercent="'.$objp->price_by_qty_remise_percent.'"';
$opt .= ' pbq="'.$objp->price_by_qty_rowid.'" data-pbq="'.$objp->price_by_qty_rowid.'" data-pbqup="'.$objp->price_by_qty_unitprice.'" data-pbqbase="'.$objp->price_by_qty_price_base_type.'" data-pbqqty="'.$objp->price_by_qty_quantity.'" data-pbqpercent="'.$objp->price_by_qty_remise_percent.'"';
}
if (!empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)))
{
@ -2665,7 +2666,7 @@ class Form
}
$opt .= "</option>\n";
$optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit);
$optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'pbq'=>$outpbq);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

View File

@ -452,12 +452,12 @@ class FormAccounting extends Form
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " WHERE entity IN (" . getEntity('accountancy') . ")";
$sql .= " ORDER BY date_format(doc_date, '%Y')";
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR);
dol_syslog(__METHOD__.$this->error, LOG_ERR);
return -1;
}
while ($obj = $this->db->fetch_object($resql)) {

View File

@ -767,7 +767,7 @@ class FormCompany extends Form
if ($rendermode === 'edit')
{
$contactType = $contact->listeTypeContacts('external', '', 1);
$contactType = $contact->listeTypeContacts('external', '', 1, '', '', 'agenda'); // We exclude agenda as there is no contact on such element
if (count($selected) > 0) {
$newselected = array();
foreach ($selected as $key=>$val) {

View File

@ -107,6 +107,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
}
}
});
$("input#search_'.$htmlname.'").autocomplete({
source: function( request, response ) {
$.get("'.$url.($urloption?'?'.$urloption:'').'", { '.$htmlname.': request.term }, function(data){

View File

@ -817,7 +817,7 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0)
* With native = 1: Use PHP clone. Property that are reference are same pointer. This means $this->db of new object is still valid but point to same this->db than original object.
*
* @param object $object Object to clone
* @param int $native Native method or full isolation method
* @param int $native 0=Full isolation method, 1=Native PHP method
* @return object Clone object
* @see https://php.net/manual/language.oop5.cloning.php
*/

View File

@ -548,7 +548,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
if ($menu_array[$i]['enabled']) // Enabled so visible
{
print '<div class="menu_titre">'.$tabstring;
if ($shorturlwithoutparam) print '<a class="vmenu" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
if ($shorturlwithoutparam) print '<a class="vmenu" title="'.dol_escape_htmltag($menu_array[$i]['titre']).'" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
else print '<span class="vmenu">';
print ($menu_array[$i]['prefix'] ? $menu_array[$i]['prefix'] : '').$menu_array[$i]['titre'];
if ($shorturlwithoutparam) print '</a>';
@ -580,7 +580,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') // Enabled so visible, except if parent was not enabled.
{
print '<div class="menu_contenu'.$cssmenu.'">'.$tabstring;
if ($shorturlwithoutparam) print '<a class="vsmenu" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
if ($shorturlwithoutparam) print '<a class="vsmenu" title="'.dol_escape_htmltag($menu_array[$i]['titre']).'" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
else print '<span class="vsmenu">';
print $menu_array[$i]['titre'];
if ($shorturlwithoutparam) print '</a>';

View File

@ -1683,11 +1683,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
elseif ($conf->global->PROJECT_USE_OPPORTUNITIES == 1)
{
$newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $showmode, '', 'project', 'list');
$newmenu->add('/projet/list.php?mainmenu=project&amp;leftmenu=list&search_opp_status=openedopp&search_status=99&contextpage=lead', $langs->trans("ListOpenLeads"), 2, $showmode);
$newmenu->add('/projet/list.php?mainmenu=project&amp;leftmenu=list&search_usage_opportunity=1&search_status=99&contextpage=lead', $langs->trans("ListOpenLeads"), 2, $showmode);
$newmenu->add('/projet/list.php?mainmenu=project&amp;leftmenu=list&search_opp_status=notopenedopp&search_status=99&contextpage=project', $langs->trans("ListOpenProjects"), 2, $showmode);
}
elseif ($conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only
$newmenu->add('/projet/list.php?mainmenu=project&amp;leftmenu=list&search_opp_status=openedopp&search_status=99', $langs->trans("List"), 2, $showmode);
$newmenu->add('/projet/list.php?mainmenu=project&amp;leftmenu=list&search_usage_opportunity=1&search_status=99', $langs->trans("List"), 2, $showmode);
}
$newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire);
@ -2027,7 +2027,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if ($menu_array[$i]['enabled']) // Enabled so visible
{
print '<div class="menu_titre">'.$tabstring;
if ($shorturlwithoutparam) print '<a class="vmenu" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
if ($shorturlwithoutparam) print '<a class="vmenu" title="'.dol_escape_htmltag($menu_array[$i]['titre']).'" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
else print '<span class="vmenu">';
print ($menu_array[$i]['prefix'] ? $menu_array[$i]['prefix'] : '').$menu_array[$i]['titre'];
if ($shorturlwithoutparam) print '</a>';
@ -2059,7 +2059,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') // Enabled so visible, except if parent was not enabled.
{
print '<div class="menu_contenu'.$cssmenu.'">'.$tabstring;
if ($shorturlwithoutparam) print '<a class="vsmenu" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
if ($shorturlwithoutparam) print '<a class="vsmenu" title="'.dol_escape_htmltag($menu_array[$i]['titre']).'" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
else print '<span class="vsmenu">';
print $menu_array[$i]['titre'];
if ($shorturlwithoutparam) print '</a>';

View File

@ -187,7 +187,7 @@ class MailingTargets // This can't be abstract as it is used for some method
$sql.= (empty($targetarray['source_id']) ? 'null' : "'".$this->db->escape($targetarray['source_id'])."'").",";
$sql .= "'".$this->db->escape(dol_hash($targetarray['email'].';'.$targetarray['lastname'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',";
$sql .= "'".$this->db->escape($targetarray['source_type'])."')";
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$result=$this->db->query($sql);
if ($result)
{
@ -207,7 +207,7 @@ class MailingTargets // This can't be abstract as it is used for some method
}
}
dol_syslog(get_class($this)."::".__METHOD__.": mailing ".$j." targets added");
dol_syslog(__METHOD__.": mailing ".$j." targets added");
/*
//Update the status to show thirdparty mail that don't want to be contacted anymore'
@ -215,7 +215,7 @@ class MailingTargets // This can't be abstract as it is used for some method
$sql .= " SET statut=3";
$sql .= " WHERE fk_mailing=".$mailing_id." AND email in (SELECT email FROM ".MAIN_DB_PREFIX."societe where fk_stcomm=-1)";
$sql .= " AND source_type='thirdparty'";
dol_syslog(get_class($this)."::".__METHOD__.": mailing update status to display thirdparty mail that do not want to be contacted");
dol_syslog(__METHOD__.": mailing update status to display thirdparty mail that do not want to be contacted");
$result=$this->db->query($sql);
//Update the status to show contact mail that don't want to be contacted anymore'
@ -223,7 +223,7 @@ class MailingTargets // This can't be abstract as it is used for some method
$sql .= " SET statut=3";
$sql .= " WHERE fk_mailing=".$mailing_id." AND source_type='contact' AND (email in (SELECT sc.email FROM ".MAIN_DB_PREFIX."socpeople AS sc ";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid=sc.fk_soc WHERE s.fk_stcomm=-1 OR no_email=1))";
dol_syslog(get_class($this)."::".__METHOD__.": mailing update status to display contact mail that do not want to be contacted",LOG_DEBUG);
dol_syslog(__METHOD__.": mailing update status to display contact mail that do not want to be contacted",LOG_DEBUG);
$result=$this->db->query($sql);
*/
@ -231,7 +231,7 @@ class MailingTargets // This can't be abstract as it is used for some method
$sql .= " SET statut=3";
$sql .= " WHERE fk_mailing=".$mailing_id." AND email IN (SELECT mu.email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe AS mu WHERE mu.entity IN ('".getEntity('mailing')."'))";
dol_syslog(get_class($this)."::".__METHOD__.":mailing update status to display emails that do not want to be contacted anymore", LOG_DEBUG);
dol_syslog(__METHOD__.":mailing update status to display emails that do not want to be contacted anymore", LOG_DEBUG);
$result=$this->db->query($sql);
if (! $result)
{

View File

@ -217,17 +217,26 @@ class modProjet extends DolibarrModules
$this->export_permission[$r]=array(array("projet","export"));
$this->export_dependencies_array[$r]=array('projecttask'=>'pt.rowid', 'task_time'=>'ptt.rowid');
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom::thirdparty",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label',
's.phone'=>'Text','s.email'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text',
'p.rowid'=>"List:projet:ref::project",'p.ref'=>"Text",'p.title'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.opp_amount'=>'Numeric','p.description'=>"Text",'p.entity'=>'Numeric',
'pt.rowid'=>'Numeric','pt.ref'=>'Text','pt.label'=>'Text','pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text",
'ptt.rowid'=>'Numeric','ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text");
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company',
's.phone'=>'company','s.email'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company');
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country',
's.phone'=>'Phone','s.email'=>'Email','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode',
'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.title'=>'ProjectLabel', 'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.opp_amount'=>'OpportunityAmount','p.description'=>"Description");
$this->export_TypeFields_array[$r]=array(
's.rowid'=>"List:societe:nom::thirdparty",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label',
's.phone'=>'Text','s.email'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text',
'p.rowid'=>"List:projet:ref::project",'p.ref'=>"Text",'p.title'=>"Text",
'p.usage_opportunity'=>'Boolean', 'p.usage_task'=>'Boolean', 'p.usage_bill_time'=>'Boolean',
'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.opp_amount'=>'Numeric','p.description'=>"Text",'p.entity'=>'Numeric',
'pt.rowid'=>'Numeric','pt.ref'=>'Text','pt.label'=>'Text','pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text",
'ptt.rowid'=>'Numeric','ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text"
);
$this->export_entities_array[$r]=array(
's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company',
's.phone'=>'company','s.email'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company'
);
$this->export_fields_array[$r]=array(
's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country',
's.phone'=>'Phone','s.email'=>'Email','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode',
'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.title'=>'ProjectLabel',
'p.usage_opportunity'=>'ProjectFollowOpportunity', 'p.usage_task'=>'ProjectFollowTasks', 'p.usage_bill_time'=>'BillTime',
'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.opp_amount'=>'OpportunityAmount','p.description'=>"Description"
);
// Add multicompany field
if (! empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED))
{
@ -254,8 +263,11 @@ class modProjet extends DolibarrModules
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
// End add extra fields
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('ptt.rowid'=>'IdTaskTime','ptt.task_date'=>'TaskTimeDate','ptt.task_duration'=>"TimesSpent",'ptt.fk_user'=>"TaskTimeUser",'ptt.note'=>"TaskTimeNote"));
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('ptt.rowid'=>'task_time','ptt.task_date'=>'task_time','ptt.task_duration'=>"task_time",'ptt.fk_user'=>"task_time",'ptt.note'=>"task_time"));
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('ptt.rowid'=>'task_time','ptt.task_date'=>'task_time','ptt.task_duration'=>"task_time",'ptt.fk_user'=>"task_time",'ptt.note'=>"task_time"));
if (empty($conf->global->PROJECT_HIDE_TASKS)) {
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('f.ref'=>"Billed"));
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('f.ref'=>"task_time"));
}
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'projet as p';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet_extrafields as extra ON p.rowid = extra.fk_object';
@ -264,6 +276,9 @@ class modProjet extends DolibarrModules
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet_task_extrafields as extra2 ON pt.rowid = extra2.fk_object';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task";
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON p.fk_soc = s.rowid';
if (empty($conf->global->PROJECT_HIDE_TASKS)) {
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture as f ON ptt.invoice_id = f.rowid';
}
$this->export_sql_end[$r] .=" WHERE p.entity IN (".getEntity('project').")";

View File

@ -73,7 +73,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
//print $key.'-'.$enabled.'-'.$perms.'-'.$label.$_POST["options_" . $key].'<br>'."\n";
if (empty($enabled)) continue; // 0 = Never visible field
if (abs($enabled) != 1 && abs($enabled) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
if (abs($enabled) != 1 && abs($enabled) != 3 && abs($enabled) != 5) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
if (empty($perms)) continue; // 0 = Not visible
// Load language if required
@ -135,7 +135,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
if ($object->element == 'productlot') $permok = $user->rights->stock->creer;
if ($object->element == 'facturerec') $permok = $user->rights->facture->creer;
if (($object->statut == 0 || !empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key]))
&& $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key)
&& $permok && $enabled != 5 && ($action != 'edit_extras' || GETPOST('attribute') != $key)
&& empty($extrafields->attributes[$object->table_element]['computed'][$key]))
{
$fieldid = 'id';

View File

@ -541,6 +541,7 @@ if (!empty($usemargins) && $user->rights->margins->creer)
else if (npRate == "np_markRate")
price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100));
}
$("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value
return true;
@ -552,26 +553,26 @@ if (!empty($usemargins) && $user->rights->margins->creer)
/* JQuery for product free or predefined select */
jQuery(document).ready(function() {
jQuery("#price_ht").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') {
jQuery("#price_ttc").val('');
jQuery("#multicurrency_subprice").val('');
}
jQuery("#price_ht").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') {
jQuery("#price_ttc").val('');
jQuery("#multicurrency_subprice").val('');
}
});
jQuery("#price_ttc").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
jQuery("#price_ht").val('');
jQuery("#multicurrency_subprice").val('');
}
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
jQuery("#price_ht").val('');
jQuery("#multicurrency_subprice").val('');
}
});
jQuery("#multicurrency_subprice").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
jQuery("#price_ht").val('');
jQuery("#price_ttc").val('');
}
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
jQuery("#price_ht").val('');
jQuery("#price_ttc").val('');
}
});
$("#prod_entry_mode_free").on( "click", function() {
@ -630,15 +631,24 @@ if (!empty($usemargins) && $user->rights->margins->creer)
if (empty($conf->global->MAIN_DISABLE_EDIT_PREDEF_PRICEHT) && empty($senderissupplier))
{
?>
// Get the HT price for the product and display it
console.log("Load price without tax and set it into #price_ht");
$.post('<?php echo DOL_URL_ROOT; ?>/product/ajax/products.php?action=fetch',
{ 'id': $(this).val(), 'socid' : <?php print $object->socid; ?> },
function(data) { jQuery("#price_ht").val(data.price_ht); },
'json'
);
var pbq = parseInt($('option:selected', this).attr('data-pbq'));
if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && ! isNaN(pbq) && pbq > 0)
{
console.log("We are in a price per qty context, we do not call ajax/product");
} else {
// Get the HT price for the product and display it
console.log("Load price without tax and set it into #price_ht for id="+$(this).val()+" socid=<?php print $object->socid; ?>");
$.post('<?php echo DOL_URL_ROOT; ?>/product/ajax/products.php?action=fetch',
{ 'id': $(this).val(), 'socid': <?php print $object->socid; ?> },
function(data) {
jQuery("#price_ht").val(data.price_ht);
},
'json'
);
}
<?php
}
if (!empty($usemargins) && $user->rights->margins->creer)
{
$langs->load('stocks');
@ -744,15 +754,20 @@ if (!empty($usemargins) && $user->rights->margins->creer)
}
?>
/* To process customer price per quantity */
/* To process customer price per quantity (CUSTOMER_PRICE_PER_QTY works only if combo product is not an ajax after x key pressed) */
var pbq = parseInt($('option:selected', this).attr('data-pbq'));
var pbqup = parseInt($('option:selected', this).attr('data-pbqup'));
var pbqbase = $('option:selected', this).attr('data-pbqbase');
var pbqqty = parseFloat($('option:selected', this).attr('data-pbqqty'));
var pbqpercent = parseFloat($('option:selected', this).attr('data-pbqpercent'));
if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && typeof pbq !== "undefined")
if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && ! isNaN(pbq) && pbq > 0)
{
console.log("We choose a price by quanty price_by_qty id = "+pbq+" price_by_qty qty = "+pbqqty+" price_by_qty percent = "+pbqpercent);
var pbqupht = pbqup; /* TODO support of price per qty TTC not yet available */
console.log("We choose a price by quanty price_by_qty id = "+pbq+" price_by_qty upht = "+pbqupht+" price_by_qty qty = "+pbqqty+" price_by_qty percent = "+pbqpercent);
jQuery("#pbq").val(pbq);
jQuery("#price_ht").val(pbqupht);
if (jQuery("#qty").val() < pbqqty)
{
jQuery("#qty").val(pbqqty);
@ -809,7 +824,6 @@ if (!empty($usemargins) && $user->rights->margins->creer)
jQuery("#price_ht").val('').hide();
jQuery("#multicurrency_price_ht").val('').hide();
<?php } ?>
jQuery("#price_ht").val('');
jQuery("#price_ttc, #fourn_ref, #tva_tx, #title_vat, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").hide();
jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").hide();
jQuery("#buying_price").show();

View File

@ -1,10 +1,11 @@
<?php
/* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
/*
* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -13,7 +14,7 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
@ -21,29 +22,31 @@
*/
/**
* \file htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php
* \ingroup agenda
* \brief Trigger file for company - contactroles
* \file htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php
* \ingroup agenda
* \brief Trigger file for company - contactroles
*/
require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/triggers/dolibarrtriggers.class.php';
/**
* Class of triggered functions for agenda module
* Class of triggered functions for agenda module
*/
class InterfaceContactRoles extends DolibarrTriggers
{
public $family = 'agenda';
public $description = "Triggers of this module auto link contact to company.";
/**
* Version of the trigger
*
* @var string
*/
public $version = self::VERSION_DOLIBARR;
/**
*
* @var string Image of the trigger
*/
public $picto = 'action';
@ -53,56 +56,56 @@ class InterfaceContactRoles extends DolibarrTriggers
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* Following properties may be set before calling trigger. The may be completed by this trigger to be used for writing the event into database:
* $object->socid or $object->fk_soc(id of thirdparty)
* $object->element (element type of object)
* $object->socid or $object->fk_soc(id of thirdparty)
* $object->element (element type of object)
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
if ($action === 'PROPAL_CREATE' || $action === 'ORDER_CREATE' || $action === 'BILL_CREATE'
|| $action === 'ORDER_SUPPLIER_CREATE' || $action === 'BILL_SUPPLIER_CREATE' || $action === 'PROPOSAL_SUPPLIER_CREATE'
|| $action === 'CONTRACT_CREATE' || $action === 'FICHINTER_CREATE' || $action === 'PROJECT_CREATE' || $action === 'TICKET_CREATE') {
dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
if ($action === 'PROPAL_CREATE' || $action === 'ORDER_CREATE' || $action === 'BILL_CREATE' || $action === 'ORDER_SUPPLIER_CREATE' || $action === 'BILL_SUPPLIER_CREATE'
|| $action === 'CONTRACT_CREATE' || $action === 'FICHINTER_CREATE' || $action === 'PROJECT_CREATE' || $action === 'TICKET_CREATE' || $action === 'ACTION_CREATE') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$socid=(property_exists($object, 'socid')?$object->socid:$object->fk_soc);
$socid = (property_exists($object, 'socid') ? $object->socid : $object->fk_soc);
if (! empty($socid) && $socid > 0) {
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
$contactdefault = new Contact($this->db);
$contactdefault->socid=$socid;
$contactdefault->socid = $socid;
$TContact = $contactdefault->getContactRoles($object->element);
$TContactAlreadyLinked = array();
if ($object->id > 0)
{
$class = get_class($object);
$cloneFrom = new $class($this->db);
$r = $cloneFrom->fetch($object->id);
if (is_array($TContact) && ! empty($TContact)) {
$TContactAlreadyLinked = array();
if ($object->id > 0) {
$cloneFrom = dol_clone($object, 1);
if (!empty($cloneFrom->id)) $TContactAlreadyLinked = array_merge($cloneFrom->liste_contact(-1, 'external'), $cloneFrom->liste_contact(-1, 'internal'));
}
if (! empty($cloneFrom->id)) {
$TContactAlreadyLinked = array_merge($cloneFrom->liste_contact(- 1, 'external'), $cloneFrom->liste_contact(- 1, 'internal'));
}
}
if (is_array($TContact))
{
foreach($TContact as $i => $infos) {
foreach ($TContact as $i => $infos) {
foreach ($TContactAlreadyLinked as $contactData) {
if ($contactData['id'] == $infos['fk_socpeople'] && $contactData['fk_c_type_contact'] == $infos['type_contact']) unset($TContact[$i]);
if ($contactData['id'] == $infos['fk_socpeople'] && $contactData['fk_c_type_contact'] == $infos['type_contact'])
unset($TContact[$i]);
}
}
$nb = 0;
foreach($TContact as $infos) {
foreach ($TContact as $infos) {
$res = $object->add_contact($infos['fk_socpeople'], $infos['type_contact']);
if ($res > 0) $nb++;
if ($res > 0)
$nb ++;
}
if($nb > 0) {
if ($nb > 0) {
setEventMessages($langs->trans('ContactAddedAutomatically', $nb), null, 'mesgs');
}
}

View File

@ -547,7 +547,7 @@ class Export
$indice=0;
asort($array_selected);
dol_syslog(get_class($this)."::".__FUNCTION__." ".$model.", ".$datatoexport.", ".implode(",", $array_selected));
dol_syslog(__METHOD__." ".$model.", ".$datatoexport.", ".implode(",", $array_selected));
// Check parameters or context properties
if (empty($this->array_export_fields) || ! is_array($this->array_export_fields))
@ -588,7 +588,7 @@ class Export
// Run the sql
$this->sqlusedforexport=$sql;
dol_syslog(get_class($this)."::".__FUNCTION__."", LOG_DEBUG);
dol_syslog(__METHOD__."", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{

View File

@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/export/modules_export.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// Load translation files required by the page
$langs->loadlangs(array('admin', 'exports', 'other', 'users', 'companies', 'projects', 'suppliers', 'products', 'bank'));
$langs->loadlangs(array('admin', 'exports', 'other', 'users', 'companies', 'projects', 'suppliers', 'products', 'bank', 'bills'));
// Everybody should be able to go on this page
//if (! $user->admin)

View File

@ -159,17 +159,14 @@ else
/*
* Legends / Status
*
* Motivo: Mostrar todos os Status e dar a possibilidade de filtrar apenas um deles
* Reason: Show all Status and give the possibility to filter only one
*/
$sql = "SELECT count(cf.rowid), fk_statut";
$sql = "SELECT count(cf.rowid) as nb, cf.fk_statut";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE cf.fk_soc = s.rowid";
$sql .= " AND s.entity = ".$conf->entity;
$sql.= " AND cf.entity IN (".getEntity("supplier_order").")"; // Thirdparty sharing is mandatory with supplier order sharing
if ($user->socid) $sql .= ' AND cf.fk_soc = '.$user->socid;
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
$sql .= " GROUP BY cf.fk_statut";
@ -189,11 +186,11 @@ if ($resql)
while ($i < $num)
{
$row = $db->fetch_row($resql);
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td>'.$commandestatic->LibStatut($row[1]).'</td>';
print '<td class="right"><a href="list.php?statut='.$row[1].'">'.$row[0].' '.$commandestatic->LibStatut($row[1], 3).'</a></td>';
print '<td>'.$commandestatic->LibStatut($obj->nb).'</td>';
print '<td class="right"><a href="list.php?statut='.$obj->fk_statut.'">'.$obj->nb.' '.$commandestatic->LibStatut($obj->fk_statut, 3).'</a></td>';
print "</tr>\n";
$i++;
@ -218,7 +215,7 @@ if (!empty($conf->fournisseur->enabled))
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity = ".$conf->entity;
$sql .= " AND c.entity IN (".getEntity("supplier_order").")"; // Thirdparty sharing is mandatory with supplier order sharing
$sql .= " AND c.fk_statut = 0";
if (!empty($socid)) $sql .= " AND c.fk_soc = ".$socid;
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
@ -254,17 +251,25 @@ if (!empty($conf->fournisseur->enabled))
/*
* List of users allowed
*/
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.email";
$sql .= " FROM ".MAIN_DB_PREFIX."user as u,";
$sql .= " ".MAIN_DB_PREFIX."user_rights as ur";
$sql .= ", ".MAIN_DB_PREFIX."rights_def as rd";
$sql .= " WHERE u.rowid = ur.fk_user";
$sql .= " AND (u.entity IN (0,".$conf->entity.")";
$sql .= " AND rd.entity = ".$conf->entity.")";
$sql .= " AND ur.fk_id = rd.id";
$sql .= " AND module = 'fournisseur'";
$sql .= " AND perms = 'commande'";
$sql .= " AND subperms = 'approuver'";
$sql = "SELECT";
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
$sql .= " DISTINCT";
}
$sql.= " u.rowid, u.lastname, u.firstname, u.email, u.statut";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
{
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
$sql.= " WHERE ((ug.fk_user = u.rowid";
$sql.= " AND ug.entity IN (".getEntity('usergroup')."))";
$sql.= " OR u.entity = 0)"; // Show always superadmin
}
else
{
$sql.= " WHERE (u.entity IN (".getEntity('user').")";
}
$sql.= " AND u.fk_soc IS NULL"; // An external user can not approved
$resql = $db->query($sql);
if ($resql)
@ -281,15 +286,23 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td>';
$userstatic = new User($db);
$userstatic->id = $obj->rowid;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
$userstatic->email = $obj->email;
print $userstatic->getNomUrl(1);
print '</td>';
print "</tr>\n";
$userstatic->getrights('fournisseur');
if (! empty($userstatic->rights->fournisseur->commande->approuver))
{
print '<tr class="oddeven">';
print '<td>';
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
$userstatic->email = $obj->email;
$userstatic->statut = $obj->statut;
print $userstatic->getNomUrl(1);
print '</td>';
print "</tr>\n";
}
$i++;
}
print "</table></div><br>";

View File

@ -917,6 +917,10 @@ if (empty($reshook))
}
}
}
elseif (!empty($object->origin) && !empty($object->origin_id))
{
$object->linkedObjectsIds[$object->origin] = $object->origin_id;
}
$id = $object->create($user);

View File

@ -297,9 +297,13 @@ if (empty($reshook))
$paiement->datepaye = $datepaye;
$paiement->amounts = $amounts; // Array of amounts
$paiement->multicurrency_amounts = $multicurrency_amounts;
$paiement->paiementid = $_POST['paiementid'];
$paiement->num_paiement = $_POST['num_paiement'];
$paiement->note = $_POST['comment'];
$paiement->paiementid = GETPOST('paiementid', 'int');
$paiement->num_payment = GETPOST('num_paiement', 'alpha');
$paiement->note_private = GETPOST('comment', 'alpha');
$paiement->num_paiement = $paiement->num_payment; // For bacward compatibility
$paiement->note = $paiement->note_private; // For bacward compatibility
if (!$error)
{
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices') == 'on' ? 1 : 0), $thirdparty);

View File

@ -1973,4 +1973,5 @@ NotAPublicIp=Not a public IP
MakeAnonymousPing=Make an anonymous Ping '+1' to the Dolibarr foundation server (done 1 time only after installation) to allow the foundation to count the number of Dolibarr installation.
FeatureNotAvailableWithReceptionModule=Feature not available when module Reception is enabled
EmailTemplate=Template for email
EMailsWillHaveMessageID=Emails will have a tag 'References' matching this syntax
EMailsWillHaveMessageID=Emails will have a tag 'References' matching this syntax
FafaIconSocialNetworksDesc=Enter here the code of a FontAwesome icon. If you don't know what is FontAwesome, you can use the generic value fa-address-book.

View File

@ -352,6 +352,8 @@ PriceUTTC=U.P. (inc. tax)
Amount=Amount
AmountInvoice=Invoice amount
AmountInvoiced=Amount invoiced
AmountInvoicedHT=Amount invoiced (incl. tax)
AmountInvoicedTTC=Amount invoiced (excl. tax)
AmountPayment=Payment amount
AmountHTShort=Amount (excl.)
AmountTTCShort=Amount (inc. tax)
@ -1010,7 +1012,7 @@ ContactDefault_project=Project
ContactDefault_project_task=Task
ContactDefault_propal=Proposal
ContactDefault_supplier_proposal=Supplier Proposal
ContactDefault_ticketsup=Ticket
ContactDefault_ticket=Ticket
ContactAddedAutomatically=Contact added from contact thirdparty roles
More=More
ShowDetails=Show details

View File

@ -363,7 +363,7 @@ UsePercentageVariations=Use percentage variations
PercentageVariation=Percentage variation
ErrorDeletingGeneratedProducts=There was an error while trying to delete existing product variants
NbOfDifferentValues=No. of different values
NbProducts=No. of products
NbProducts=Number of products
ParentProduct=Parent product
HideChildProducts=Hide variant products
ShowChildProducts=Show variant products

View File

@ -39,8 +39,8 @@ ShowProject=Show project
ShowTask=Show task
SetProject=Set project
NoProject=No project defined or owned
NbOfProjects=No. of projects
NbOfTasks=No. of tasks
NbOfProjects=Number of projects
NbOfTasks=Number of tasks
TimeSpent=Time spent
TimeSpentByYou=Time spent by you
TimeSpentByUser=Time spent by user

View File

@ -2031,7 +2031,7 @@ function top_menu_search()
<a class="dropdown-toggle login-dropdown-a" data-toggle="dropdown" href="#" title="'.$langs->trans('Search').' ('.$langs->trans('SearchMenuShortCut').')">
<i class="fa fa-search" ></i>
</a>
<div class="dropdown-menu">
<div class="dropdown-search">
'.$dropDownHtml.'
</div>
</div>';
@ -2062,7 +2062,8 @@ function top_menu_search()
// close drop down
$(document).on("click", function(event) {
if (!$(event.target).closest("#topmenu-global-search-dropdown").length) {
if (!$(event.target).closest("#topmenu-global-search-dropdown").length) {
console.log("click close");
// Hide the menus.
$("#topmenu-global-search-dropdown").removeClass("open");
}
@ -2070,6 +2071,7 @@ function top_menu_search()
// Open drop down
$("#topmenu-global-search-dropdown .dropdown-toggle").on("click", function(event) {
console.log("click open");
openGlobalSearchDropDown();
});

View File

@ -1235,10 +1235,10 @@ else
// Accountancy_code_sell
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
print '<td>';
if ($type = 0) {
$accountancy_code_sell = (GETPOSTISSET('accountancy_code_sell') ?GETPOST('accountancy_code_sell', 'alpha') : $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT);
if ($type == 0) {
$accountancy_code_sell = (GETPOSTISSET('accountancy_code_sell') ? GETPOST('accountancy_code_sell', 'alpha') : $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT);
} else {
$accountancy_code_sell = (GETPOSTISSET('accountancy_code_sell') ?GETPOST('accountancy_code_sell', 'alpha') : $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT);
$accountancy_code_sell = (GETPOSTISSET('accountancy_code_sell') ? GETPOST('accountancy_code_sell', 'alpha') : $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT);
}
print $formaccounting->select_account($accountancy_code_sell, 'accountancy_code_sell', 1, null, 1, 1, '');
print '</td></tr>';
@ -1248,10 +1248,10 @@ else
{
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
print '<td>';
if ($type = 0) {
$accountancy_code_sell_intra = (GETPOSTISSET('accountancy_code_sell_intra') ?GETPOST('accountancy_code_sell_intra', 'alpha') : $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT);
if ($type == 0) {
$accountancy_code_sell_intra = (GETPOSTISSET('accountancy_code_sell_intra') ? GETPOST('accountancy_code_sell_intra', 'alpha') : $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT);
} else {
$accountancy_code_sell_intra = (GETPOSTISSET('accountancy_code_sell_intra') ?GETPOST('accountancy_code_sell_intra', 'alpha') : $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT);
$accountancy_code_sell_intra = (GETPOSTISSET('accountancy_code_sell_intra') ? GETPOST('accountancy_code_sell_intra', 'alpha') : $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT);
}
print $formaccounting->select_account($accountancy_code_sell_intra, 'accountancy_code_sell_intra', 1, null, 1, 1, '');
print '</td></tr>';
@ -1260,11 +1260,11 @@ else
// Accountancy_code_sell_export
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellExportCode").'</td>';
print '<td>';
if ($type = 0)
if ($type == 0)
{
$accountancy_code_sell_export = (GETPOST('accountancy_code_sell_export') ?GETPOST('accountancy_code_sell_export', 'alpha') : $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT);
$accountancy_code_sell_export = (GETPOST('accountancy_code_sell_export') ? GETPOST('accountancy_code_sell_export', 'alpha') : $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT);
} else {
$accountancy_code_sell_export = (GETPOST('accountancy_code_sell_export') ?GETPOST('accountancy_code_sell_export', 'alpha') : $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT);
$accountancy_code_sell_export = (GETPOST('accountancy_code_sell_export') ? GETPOST('accountancy_code_sell_export', 'alpha') : $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT);
}
print $formaccounting->select_account($accountancy_code_sell_export, 'accountancy_code_sell_export', 1, null, 1, 1, '');
print '</td></tr>';

View File

@ -1457,7 +1457,7 @@ class Product extends CommonObject
$sql .= "$field = '".$this->db->escape($value)."'";
$sql .= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::".__FUNCTION__." sql=".$sql, LOG_DEBUG);
dol_syslog(__METHOD__." sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {

View File

@ -120,7 +120,7 @@ class Propalmergepdfproduct extends CommonObject
$this->db->begin();
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
@ -187,7 +187,7 @@ class Propalmergepdfproduct extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product as t";
$sql.= " WHERE t.rowid = ".$id;
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
@ -252,7 +252,7 @@ class Propalmergepdfproduct extends CommonObject
$sql.= " AND t.lang = '".$lang."'";
}
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
@ -332,7 +332,7 @@ class Propalmergepdfproduct extends CommonObject
$this->db->begin();
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
@ -406,7 +406,7 @@ class Propalmergepdfproduct extends CommonObject
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product";
$sql.= " WHERE rowid=".$this->id;
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
}
@ -472,7 +472,7 @@ class Propalmergepdfproduct extends CommonObject
$sql.= " AND lang='".$lang_id."'";
}
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
}
@ -531,7 +531,7 @@ class Propalmergepdfproduct extends CommonObject
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product";
$sql.= " WHERE fk_product=".$this->fk_product." AND file_name='".$this->db->escape($this->file_name)."'";
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
}

View File

@ -262,12 +262,12 @@ if (empty($reshook))
$object->socid = GETPOST('socid', 'int');
$object->description = GETPOST('description', 'none'); // Do not use 'alpha' here, we want field as it is
$object->public = GETPOST('public', 'alpha');
$object->date_start = empty($_POST["projectstart"]) ? '' : $date_start;
$object->date_end = empty($_POST["projectend"]) ? '' : $date_end;
if (isset($_POST['opp_amount'])) $object->opp_amount = price2num(GETPOST('opp_amount', 'alpha'));
if (isset($_POST['budget_amount'])) $object->budget_amount = price2num(GETPOST('budget_amount', 'alpha'));
if (isset($_POST['opp_status'])) $object->opp_status = $opp_status;
if (isset($_POST['opp_percent'])) $object->opp_percent = $opp_percent;
$object->date_start = (! GETPOST('projectstart')) ? '' : $date_start;
$object->date_end = (! GETPOST('projectend')) ? '' : $date_end;
if (GETPOSTISSET('opp_amount')) $object->opp_amount = price2num(GETPOST('opp_amount', 'alpha'));
if (GETPOSTISSET('budget_amount')) $object->budget_amount = price2num(GETPOST('budget_amount', 'alpha'));
if (GETPOSTISSET('opp_status')) $object->opp_status = $opp_status;
if (GETPOSTISSET('opp_percent')) $object->opp_percent = $opp_percent;
$object->usage_opportunity = (GETPOST('usage_opportunity', 'alpha') == 'on' ? 1 : 0);
$object->usage_task = (GETPOST('usage_task', 'alpha') == 'on' ? 1 : 0);
$object->usage_bill_time = (GETPOST('usage_bill_time', 'alpha') == 'on' ? 1 : 0);

View File

@ -829,7 +829,7 @@ foreach ($listofreferent as $key => $value)
$addform.='<div class="inline-block valignmiddle">';
if ($testnew) $addform.='<a class="buttonxxx" href="'.$urlnew.'"><span class="valignmiddle text-plus-circle">'.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
elseif (empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) {
$addform.='<a class="buttonxxx buttonRefused" disabled="disabled" href="#"><span class="valignmiddle text-plus-circle">'.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
$addform.='<a class="buttonxxx buttonRefused" disabled="disabled" href="#"><span class="valignmiddle text-plus-circle">'.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
}
$addform.='<div>';
}

View File

@ -21,7 +21,7 @@
Sorry. You are not allowed to access this resource.
<br>
<?php print isset($_SERVER["HTTP_REFERER"])?'You come from '.$_SERVER["HTTP_REFERER"].'.':''; ?>
<?php print isset($_SERVER["HTTP_REFERER"])?'You come from '.htmlentities($_SERVER["HTTP_REFERER"]).'.':''; ?>
<hr>

View File

@ -21,7 +21,7 @@
You requested a website or a page that does not exists.
<br>
<?php print isset($_SERVER["HTTP_REFERER"])?'You come from '.$_SERVER["HTTP_REFERER"].'.':''; ?>
<?php print isset($_SERVER["HTTP_REFERER"])?'You come from '.htmlentities($_SERVER["HTTP_REFERER"]).'.':''; ?>
<hr>

View File

@ -238,7 +238,10 @@ $max = 15;
$sql = "SELECT s.rowid, s.nom as name, s.email, s.client, s.fournisseur";
$sql .= ", s.code_client";
$sql .= ", s.code_fournisseur";
$sql .= ", s.code_compta_fournisseur";
$sql .= ", s.code_compta";
$sql .= ", s.logo";
$sql .= ", s.entity";
$sql .= ", s.canvas, s.tms as date_modification, s.status as status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -285,6 +288,9 @@ if ($result)
$thirdparty_static->code_fournisseur = $objp->code_fournisseur;
$thirdparty_static->canvas = $objp->canvas;
$thirdparty_static->email = $objp->email;
$thirdparty_static->entity = $objp->entity;
$thirdparty_static->code_compta_fournisseur = $objp->code_compta_fournisseur;
$thirdparty_static->code_compta = $objp->code_compta;
print '<tr class="oddeven">';
// Name

View File

@ -10,6 +10,7 @@
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -390,6 +391,7 @@ if ($resql)
else dol_print_error($db);
$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, s.logo,";
$sql.= " s.entity,";
$sql.= " st.libelle as stcomm, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,";
$sql.= " s.email, s.phone, s.fax, s.url, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.idprof5 as idprof5, s.idprof6 as idprof6, s.tva_intra, s.fk_pays,";
$sql.= " s.tms as date_update, s.datec as date_creation,";
@ -1026,6 +1028,7 @@ while ($i < min($num, $limit))
$companystatic->fk_prospectlevel = $obj->fk_prospectlevel;
$companystatic->fk_parent = $obj->fk_parent;
$companystatic->entity = $obj->entity;
print '<tr class="oddeven"';
if ($contextpage == 'poslist')

View File

@ -1069,7 +1069,7 @@ class SupplierProposal extends CommonObject
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('PROPAL_SUPPLIER_CREATE', $user);
$result = $this->call_trigger('PROPOSAL_SUPPLIER_CREATE', $user);
if ($result < 0) { $error++; }
// End call triggers
}
@ -2834,7 +2834,7 @@ class SupplierProposalLine extends CommonObjectLine
// From llx_product
/**
* @deprecated
* @see product_ref
* @see $product_ref
*/
public $ref;

View File

@ -5,10 +5,60 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
* Dropdown of user popup
*/
.open>.dropdown-menu{
button.dropdown-item.global-search-item {
outline: none;
}
.open>.dropdown-search, .open>.dropdown-bookmark, .open>.dropdown-menu{
display: block;
}
.dropdown-search {
border-color: #eee;
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
margin: 2px 0 0;
font-size: 14px;
text-align: left;
list-style: none;
background-color: #fff;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 1px solid #ccc;
border: 1px solid rgba(0,0,0,.15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
box-shadow: 0 6px 12px rgba(0,0,0,.175);
}
.dropdown-bookmark {
border-color: #eee;
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
margin: 2px 0 0;
font-size: 14px;
text-align: left;
list-style: none;
background-color: #fff;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 1px solid #ccc;
border: 1px solid rgba(0,0,0,.15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
box-shadow: 0 6px 12px rgba(0,0,0,.175);
}
.dropdown-menu {
border-color: #eee;
@ -34,7 +84,6 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
}
.dropdown-toggle{
text-decoration: none !important;
}
@ -177,7 +226,8 @@ a.top-menu-dropdown-link {
.dropdown-body::-webkit-scrollbar-thumb {
-webkit-border-radius: 0;
border-radius: 0;
background: rgb(<?php echo $colorbackhmenu1 ?>);
/* background: rgb(<?php echo $colorbackhmenu1 ?>); */
background: #aaa;
}
.dropdown-body::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);

View File

@ -1539,6 +1539,7 @@ div#id-top {
<?php } else { ?>
background: rgb(<?php echo $colorbackhmenu1 ?>);
background-image: linear-gradient(-45deg, <?php echo colorAdjustBrightness(colorArrayToHex(colorStringToArray($colorbackhmenu1)), '5'); ?>, rgb(<?php echo $colorbackhmenu1 ?>));
/* box-shadow: 0px 0px 5px #eee; */
<?php } ?>
}
@ -4764,6 +4765,11 @@ div.dataTables_length select {
/* Select2 */
/* ============================================================================== */
.select2-container--default .select2-results__option--highlighted[aria-selected] {
background-color: rgb(<?php echo $colorbackhmenu1 ?>);
color: #<?php echo $colortextbackhmenu; ?>;
}
.select2-container--focus span.select2-selection.select2-selection--single {
border-bottom: 1px solid #666 !important;
}

View File

@ -289,7 +289,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
* Last salaries
*/
if (!empty($conf->salaries->enabled) &&
($user->rights->salaries->read && $object->id == $user->id)
( ($object->fk_user == $user->id) || ($user->rights->salaries->read && $object->id == $user->id) )
)
{
$salary = new PaymentSalary($db);

View File

@ -3347,7 +3347,7 @@ class User extends CommonObject
$sql .= $this->db->order($sortfield, $sortorder);
if ($limit) $sql .= $this->db->plimit($limit + 1, $offset);
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)

View File

@ -158,6 +158,19 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
$filecontent=file_get_contents($file['fullname']);
$ok=true;
$matches=array();
// Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request.
preg_match_all('/'.preg_quote('get_class($this)."::".__METHOD__', '/').'/', $filecontent, $matches, PREG_SET_ORDER);
foreach($matches as $key => $val)
{
$ok=false;
break;
}
//print __METHOD__." Result for checking we don't have non escaped string in sql requests for file ".$file."\n";
$this->assertTrue($ok, 'Found string get_class($this)."::".__METHOD__ that must be replaced with __METHOD__ only in '.$file['fullname']);
//exit;
$ok=true;
$matches=array();
// Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request.