diff --git a/ChangeLog b/ChangeLog
index 3f5fad835f7..1c0e96fc27c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,7 @@ For users:
NEW: Online proposal signature
NEW: Can define some max limit on expense report (per period, per type or expense, ...)
NEW: Allow the use of __NEWREF__ to get for example the new reference a draft order will get after validation.
+NEW: Add option to disable globaly some notifications emails.
NEW: #18326 Workflow: Close order on shipment closing.
NEW: #18401 Add __NEWREF__ subtitute to get new object reference.
NEW: #18403 Add __URL_SHIPMENT__ substitute to get the URL of a shipment
diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt
index cce6351950c..7ce22e790c3 100644
--- a/dev/dolibarr_changes.txt
+++ b/dev/dolibarr_changes.txt
@@ -168,6 +168,18 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php
- protected $default_monospaced_font = 'courier';
+ protected $default_monospaced_font = 'freemono';
+* In tecnickcom/tcpdf/include/tcpdf_static, in function intToRoman, right at the beginning
+ of the function, replace:
+
+ $roman = '';
+
+with:
+
+ $roman = '';
+ if ($number >= 4000) {
+ // do not represent numbers above 4000 in Roman numerals
+ return strval($number);
+ }
diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php
index c9849f9f54f..c2ac133069d 100644
--- a/htdocs/accountancy/admin/account.php
+++ b/htdocs/accountancy/admin/account.php
@@ -38,6 +38,7 @@ $cancel = GETPOST('cancel', 'alpha');
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int');
$massaction = GETPOST('massaction', 'aZ09');
+$optioncss = GETPOST('optioncss', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingaccountlist'; // To manage different context of search
$search_account = GETPOST('search_account', 'alpha');
@@ -51,14 +52,14 @@ $confirm = GETPOST('confirm', 'alpha');
$chartofaccounts = GETPOST('chartofaccounts', 'int');
-$permissiontoadd = $user->rights->accounting->chartofaccount;
-$permissiontodelete = $user->rights->accounting->chartofaccount;
+$permissiontoadd = !empty($user->rights->accounting->chartofaccount);
+$permissiontodelete = !empty($user->rights->accounting->chartofaccount);
// Security check
if ($user->socid > 0) {
accessforbidden();
}
-if (!$user->rights->accounting->chartofaccount) {
+if (empty($user->rights->accounting->chartofaccount)) {
accessforbidden();
}
@@ -438,43 +439,37 @@ if ($resql) {
print $searchpicto;
print '';
print '';
- $totalarray = array();
print '
';
} else {
$tmpaction = 'view';
- $parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
+ $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors;
diff --git a/htdocs/accountancy/admin/closure.php b/htdocs/accountancy/admin/closure.php
index 8efb869ffaf..437ff1b7116 100644
--- a/htdocs/accountancy/admin/closure.php
+++ b/htdocs/accountancy/admin/closure.php
@@ -109,7 +109,7 @@ foreach ($list_account_main as $key) {
print '';
// Value
print '
'; // Do not force class=right, or it align also the content of the select box
- print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
+ print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1);
print '
'; // Do not force class=right, or it align also the content of the select box
- print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts');
+ print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts');
print '
'."\n";
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 775e2cd2093..4a5a09a3461 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -220,7 +220,7 @@ $tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.position FR
$tabsql[22] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
$tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
$tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
-$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity('c_type_container').")";
+$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity = ".getEntity($tabname[25]);
//$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
$tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm";
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
@@ -233,7 +233,7 @@ $tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PR
$tabsql[35] = "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c";
$tabsql[36] = "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
$tabsql[37] = "SELECT r.rowid, r.code, r.sortorder, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
-$tabsql[38] = "SELECT rowid, entity, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
+$tabsql[38] = "SELECT s.rowid, s.entity, s.code, s.label, s.url, s.icon, s.active FROM ".MAIN_DB_PREFIX."c_socialnetworks as s WHERE s.entity = ".getEntity($tabname[38]);
$tabsql[39] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel";
$tabsql[40] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcommcontact";
$tabsql[41] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_transport_mode";
diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php
index 5e7a229fee3..25446dbed4d 100644
--- a/htdocs/admin/dolistore/class/dolistore.class.php
+++ b/htdocs/admin/dolistore/class/dolistore.class.php
@@ -307,7 +307,7 @@ class Dolistore
}
} else {
//need update
- $version = ''.$langs->trans(
+ $version = ''.$langs->trans(
'CompatibleAfterUpdate',
DOL_VERSION,
$product->dolibarr_min,
diff --git a/htdocs/admin/loan.php b/htdocs/admin/loan.php
index 0769ee5c0a0..59b7eb8b463 100644
--- a/htdocs/admin/loan.php
+++ b/htdocs/admin/loan.php
@@ -105,7 +105,7 @@ foreach ($list as $key) {
// Value
print '
';
if (!empty($conf->accounting->enabled)) {
- print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
+ print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1);
} else {
print '';
}
diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php
index 9c5418ac19d..1283c5698d3 100644
--- a/htdocs/admin/mails.php
+++ b/htdocs/admin/mails.php
@@ -829,23 +829,23 @@ if ($action == 'edit') {
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') {
if (!empty($conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD)) {
// List of string to add in SPF if the setup use the mail method. Example 'include:sendgrid.net include:spf.mydomain.com'
- $text .= ($text ? '
' : '').''.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD);
} else {
// MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS is list of IPs where email is sent from. Example: '1.2.3.4, [aaaa:bbbb:cccc:dddd]'.
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS)) {
// List of IP show as record to add in SPF if we use the mail method
- $text .= ($text ? '
' : '').''.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
}
}
} else {
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS)) {
// List of IP show as record to add as allowed IP if we use the smtp method. Value is '1.2.3.4, [aaaa:bbbb:cccc:dddd]'
// TODO Add a key to allow to show the IP/name of server detected dynamically
- $text .= ($text ? '
' : '').''.$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
}
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD)) { // Should be required only if you have preset the Dolibarr to use your own SMTP and you want to warn users to update their domain name to match your SMTP server.
// List of string to add in SPF if we use the smtp method. Example 'include:spf.mydomain.com'
- $text .= ($text ? '
';
print '';
diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php
index 4dd2fbad58e..c8a2a02498c 100644
--- a/htdocs/admin/tools/export.php
+++ b/htdocs/admin/tools/export.php
@@ -90,7 +90,7 @@ $_SESSION["commandbackuptorun"] = '';
$_SESSION["commandbackupresult"] = '';
// Increase limit of time. Works only if we are not in safe mode
-$ExecTimeLimit = 600; // Set it to 0 to not use a forced time limit
+$ExecTimeLimit = 600; // Set it to 0 to not use a forced time limit
if (!empty($ExecTimeLimit)) {
$err = error_reporting();
error_reporting(0); // Disable all errors
diff --git a/htdocs/admin/workstation.php b/htdocs/admin/workstation.php
index 83241f2a9e2..e89cbb2fd41 100755
--- a/htdocs/admin/workstation.php
+++ b/htdocs/admin/workstation.php
@@ -26,8 +26,8 @@
require "../main.inc.php";
// Libraries
-require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
-require_once DOL_DOCUMENT_ROOT . '/workstation/lib/workstation.lib.php';
+require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
+require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation.lib.php';
//require_once "../class/myclass.class.php";
// Translations
diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php
index f10c7b10b48..3cd8d3e0774 100644
--- a/htdocs/api/class/api_documents.class.php
+++ b/htdocs/api/class/api_documents.class.php
@@ -497,11 +497,11 @@ class Documents extends DolibarrApi
throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(!empty($object->ref) ? ' or Ref '.$object->ref : '').' does not return any document.');
} else {
if (($object->id) > 0 && !empty($modulepart)) {
- require_once DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php';
+ require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
$ecmfile = new EcmFiles($this->db);
$result = $ecmfile->fetchAll('', '', 0, 0, array('t.src_object_type' => $modulepart, 't.src_object_id' => $object->id));
if ($result < 0) {
- throw new RestException(503, 'Error when retrieve ecm list : ' . $this->db->lasterror());
+ throw new RestException(503, 'Error when retrieve ecm list : '.$this->db->lasterror());
} elseif (is_array($ecmfile->lines) && count($ecmfile->lines) > 0) {
$filearray['ecmfiles_infos'] = $ecmfile->lines;
}
diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php
index b2473409b5b..35c0ffcff88 100644
--- a/htdocs/asset/card.php
+++ b/htdocs/asset/card.php
@@ -316,8 +316,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$filename = dol_sanitizeFileName($object->ref);
$filedir = $conf->contrat->dir_output."/".dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
- $genallowed = $user->rights->asset->read; // If you can read, you can build the PDF to read content
- $delallowed = $user->rights->asset->write; // If you can create/edit, you can remove a file on card
+ $genallowed = $user->rights->asset->read; // If you can read, you can build the PDF to read content
+ $delallowed = $user->rights->asset->write; // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('asset', $filename, $filedir, $urlsource, 0, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
@@ -325,7 +325,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$linktoelem = $form->showLinkToObjectBlock($object, null, array('asset'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
- print '
';
+ print '';
}
}
diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php
index 2cb4d972493..6bfd655b62d 100644
--- a/htdocs/barcode/printsheet.php
+++ b/htdocs/barcode/printsheet.php
@@ -25,7 +25,7 @@
if (!empty($_POST['mode']) && $_POST['mode'] === 'label') { // Page is called to build a PDF and output, we must ne renew the token.
if (!defined('NOTOKENRENEWAL')) {
- define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
+ define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
}
}
@@ -277,10 +277,10 @@ dol_htmloutput_errors($mesg);
//print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").' ';
//print ' ';
-print '\n";
+ ?>
+
+
+
+ id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
- print '
';
$coldisplay++;
echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
@@ -111,7 +119,8 @@ $coldisplay++;
echo $line->efficiency;
print '
';
@@ -166,6 +175,93 @@ if ($action == 'selectlines') {
print '';
+// Select of all the sub-BOM lines
+$sql = 'SELECT rowid, fk_bom_child, fk_product FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl';
+$sql.= ' WHERE fk_bom ='. (int) $tmpbom->id;
+$resql = $object->db->query($sql);
+
+if ($resql) {
+ // Loop on all the sub-BOM lines if they exist
+ while ($obj = $object->db->fetch_object($resql)) {
+ $sub_bom_product = new Product($object->db);
+ $sub_bom_product->fetch($obj->fk_product);
+
+ $sub_bom = new BOM($object->db);
+ $sub_bom->fetch($obj->fk_bom_child);
+
+ $sub_bom_line = new BOMLine($object->db);
+ $sub_bom_line->fetch($obj->rowid);
+
+ //If hidden conf is set, we show directly all the sub-BOM lines
+ if (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT)) {
+ print '
';
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'order', $socid, 1);
- print '
';
+ print '';
}
// Presend form
diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php
index 0887c22a8f3..6d0b5a5d297 100644
--- a/htdocs/commande/class/api_orders.class.php
+++ b/htdocs/commande/class/api_orders.class.php
@@ -981,6 +981,7 @@ class Orders extends DolibarrApi
if (!DolibarrApiAccess::$user->rights->expedition->lire) {
throw new RestException(401);
}
+ $obj_ret = array();
$sql = "SELECT e.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."expedition as e";
$sql .= " JOIN ".MAIN_DB_PREFIX."expeditiondet as edet";
@@ -1054,7 +1055,6 @@ class Orders extends DolibarrApi
if ($result <= 0) {
throw new RestException(500, 'Error on creating expedition lines:'.$this->db->lasterror());
}
- $i++;
}
return $shipment->id;
}
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index e3675129198..9b315698527 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -2678,16 +2678,16 @@ class Commande extends CommonOrder
$sql = "SELECT s.rowid, s.nom as name, s.client,";
$sql .= " c.rowid as cid, c.ref";
- if (!$user->rights->societe->client->voir && !$socid) {
+ if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", sc.fk_soc, sc.fk_user";
}
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
- if (!$user->rights->societe->client->voir && !$socid) {
+ if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.entity IN (".getEntity('commande').")";
$sql .= " AND c.fk_soc = s.rowid";
- if (!$user->rights->societe->client->voir && !$socid) { //restriction
+ if (empty($user->rights->societe->client->voir) && !$socid) { //restriction
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
@@ -3505,7 +3505,7 @@ class Commande extends CommonOrder
$sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.date_livraison as delivery_date, c.fk_statut, c.total_ht";
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
- if (!$user->rights->societe->client->voir && !$user->socid) {
+ if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
$clause = " AND";
@@ -3915,7 +3915,7 @@ class Commande extends CommonOrder
$sql = "SELECT count(co.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."commande as co";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON co.fk_soc = s.rowid";
- if (!$user->rights->societe->client->voir && !$user->socid) {
+ if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
$clause = "AND";
diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php
index 8ac89d5a18f..d02d56175ff 100644
--- a/htdocs/commande/class/commandestats.class.php
+++ b/htdocs/commande/class/commandestats.class.php
@@ -93,7 +93,7 @@ class CommandeStats extends Stats
//$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;
$this->where .= ($this->where ? ' AND ' : '').'c.entity IN ('.getEntity('commande').')';
- if (!$user->rights->societe->client->voir && !$this->socid) {
+ if (empty($user->rights->societe->client->voir) && !$this->socid) {
$this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($this->socid) {
@@ -128,7 +128,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%m') as dm, COUNT(*) as nb";
$sql .= " FROM ".$this->from;
- if (!$user->rights->societe->client->voir && !$this->socid) {
+ if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
@@ -153,7 +153,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")";
$sql .= " FROM ".$this->from;
- if (!$user->rights->societe->client->voir && !$this->socid) {
+ if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
@@ -177,7 +177,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%m') as dm, SUM(c.".$this->field.")";
$sql .= " FROM ".$this->from;
- if (!$user->rights->societe->client->voir && !$this->socid) {
+ if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
@@ -202,7 +202,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%m') as dm, AVG(c.".$this->field.")";
$sql .= " FROM ".$this->from;
- if (!$user->rights->societe->client->voir && !$this->socid) {
+ if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
@@ -225,7 +225,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%Y') as year, COUNT(*) as nb, SUM(c.".$this->field.") as total, AVG(".$this->field.") as avg";
$sql .= " FROM ".$this->from;
- if (!$user->rights->societe->client->voir && !$this->socid) {
+ if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
@@ -249,7 +249,7 @@ class CommandeStats extends Stats
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
$sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
- if (!$user->rights->societe->client->voir && !$user->socid) {
+ if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php
index 5b9705209c5..a4d857a47fd 100644
--- a/htdocs/commande/contact.php
+++ b/htdocs/commande/contact.php
@@ -161,9 +161,10 @@ if ($id > 0 || !empty($ref)) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
- $morehtmlref .= '';
- $morehtmlref .= $proj->ref;
- $morehtmlref .= '';
+ $morehtmlref .= ' : '.$proj->getNomUrl(1);
+ if ($proj->title) {
+ $morehtmlref .= ' - '.$proj->title;
+ }
} else {
$morehtmlref .= '';
}
diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php
index 3ecaa0fbee1..96efda7c187 100644
--- a/htdocs/commande/customer.php
+++ b/htdocs/commande/customer.php
@@ -77,16 +77,16 @@ $thirdpartystatic = new Societe($db);
$sql = "SELECT s.rowid, s.nom as name, s.client, s.town, s.datec, s.datea";
$sql .= ", st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta ";
-if (!$user->rights->societe->client->voir && !$socid) {
+if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", sc.fk_soc, sc.fk_user ";
}
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st, ".MAIN_DB_PREFIX."commande as c";
-if (!$user->rights->societe->client->voir && !$socid) {
+if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE s.fk_stcomm = st.id AND c.fk_soc = s.rowid";
$sql .= " AND s.entity IN (".getEntity('societe').")";
-if (!$user->rights->societe->client->voir && !$socid) {
+if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if (GETPOST("search_nom")) {
diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php
index 7eb835fe938..b2b024f686a 100644
--- a/htdocs/commande/document.php
+++ b/htdocs/commande/document.php
@@ -153,9 +153,10 @@ if ($id > 0 || !empty($ref)) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
- $morehtmlref .= '';
- $morehtmlref .= $proj->ref;
- $morehtmlref .= '';
+ $morehtmlref .= ' : '.$proj->getNomUrl(1);
+ if ($proj->title) {
+ $morehtmlref .= ' - '.$proj->title;
+ }
} else {
$morehtmlref .= '';
}
diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php
index a794d79e743..03644fe5690 100644
--- a/htdocs/commande/index.php
+++ b/htdocs/commande/index.php
@@ -94,7 +94,7 @@ if (!empty($conf->commande->enabled)) {
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$socid) {
+ if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.fk_soc = s.rowid";
@@ -103,7 +103,7 @@ if (!empty($conf->commande->enabled)) {
if ($socid) {
$sql .= " AND c.fk_soc = ".((int) $socid);
}
- if (!$user->rights->societe->client->voir && !$socid) {
+ if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
@@ -146,7 +146,7 @@ if (!empty($conf->commande->enabled)) {
}
-print '
';
+print '
';
$max = 5;
@@ -162,7 +162,7 @@ $sql .= ", s.code_client";
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c,";
$sql .= " ".MAIN_DB_PREFIX."societe as s";
-if (!$user->rights->societe->client->voir && !$socid) {
+if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.fk_soc = s.rowid";
@@ -171,7 +171,7 @@ $sql .= " AND c.entity IN (".getEntity('commande').")";
if ($socid) {
$sql .= " AND c.fk_soc = ".((int) $socid);
}
-if (!$user->rights->societe->client->voir && !$socid) {
+if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " ORDER BY c.tms DESC";
@@ -246,7 +246,7 @@ if (!empty($conf->commande->enabled)) {
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$socid) {
+ if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.fk_soc = s.rowid";
@@ -255,7 +255,7 @@ if (!empty($conf->commande->enabled)) {
if ($socid) {
$sql .= " AND c.fk_soc = ".((int) $socid);
}
- if (!$user->rights->societe->client->voir && !$socid) {
+ if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " ORDER BY c.rowid DESC";
@@ -335,7 +335,7 @@ if (!empty($conf->commande->enabled)) {
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$socid) {
+ if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.fk_soc = s.rowid";
@@ -344,7 +344,7 @@ if (!empty($conf->commande->enabled)) {
if ($socid) {
$sql .= " AND c.fk_soc = ".((int) $socid);
}
- if (!$user->rights->societe->client->voir && !$socid) {
+ if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " ORDER BY c.rowid DESC";
@@ -414,7 +414,7 @@ if (!empty($conf->commande->enabled)) {
}
-print '
';
+print '';
$parameters = array('user' => $user);
$reshook = $hookmanager->executeHooks('dashboardOrders', $parameters, $object); // Note that $action and $object may have been modified by hook
diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php
index d9221096392..38d8beba2ec 100644
--- a/htdocs/commande/info.php
+++ b/htdocs/commande/info.php
@@ -106,9 +106,10 @@ if (!empty($conf->projet->enabled)) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
- $morehtmlref .= '';
- $morehtmlref .= $proj->ref;
- $morehtmlref .= '';
+ $morehtmlref .= ' : '.$proj->getNomUrl(1);
+ if ($proj->title) {
+ $morehtmlref .= ' - '.$proj->title;
+ }
} else {
$morehtmlref .= '';
}
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 4e8a18821ff..503c125b59c 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -465,7 +465,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = c.fk_projet";
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON c.fk_user_author = u.rowid';
// We'll need this table joined to the select in order to filter by sale
-if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) {
+if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
if ($search_user > 0) {
@@ -486,7 +486,7 @@ if ($search_product_category > 0) {
if ($socid > 0) {
$sql .= ' AND s.rowid = '.((int) $socid);
}
-if (!$user->rights->societe->client->voir && !$socid) {
+if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($search_ref) {
diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php
index c3218c8cbe8..55140c30ae2 100644
--- a/htdocs/commande/note.php
+++ b/htdocs/commande/note.php
@@ -125,9 +125,10 @@ if ($id > 0 || !empty($ref)) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
- $morehtmlref .= '';
- $morehtmlref .= $proj->ref;
- $morehtmlref .= '';
+ $morehtmlref .= ' : '.$proj->getNomUrl(1);
+ if ($proj->title) {
+ $morehtmlref .= ' - '.$proj->title;
+ }
} else {
$morehtmlref .= '';
}
diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php
index a9c38e1531c..8a3a6a142aa 100644
--- a/htdocs/commande/stats/index.php
+++ b/htdocs/commande/stats/index.php
@@ -42,7 +42,7 @@ $mode = GETPOSTISSET("mode") ? GETPOST("mode", 'aZ09') : 'customer';
if ($mode == 'customer' && !$user->rights->commande->lire) {
accessforbidden();
}
-if ($mode == 'supplier' && !$user->rights->fournisseur->commande->lire) {
+if ($mode == 'supplier' && empty($user->rights->fournisseur->commande->lire)) {
accessforbidden();
}
@@ -112,7 +112,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
// $data = array(array('Lib',val1,val2,val3),...)
-if (!$user->rights->societe->client->voir || $user->socid) {
+if (empty($user->rights->societe->client->voir) || $user->socid) {
$filenamenb = $dir.'/ordersnbinyear-'.$user->id.'-'.$year.'.png';
if ($mode == 'customer') {
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$user->id.'-'.$year.'.png';
@@ -158,7 +158,7 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear);
//var_dump($data);
// $data = array(array('Lib',val1,val2,val3),...)
-if (!$user->rights->societe->client->voir || $user->socid) {
+if (empty($user->rights->societe->client->voir) || $user->socid) {
$filenameamount = $dir.'/ordersamountinyear-'.$user->id.'-'.$year.'.png';
if ($mode == 'customer') {
$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$user->id.'-'.$year.'.png';
@@ -202,7 +202,7 @@ if (!$mesg) {
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
-if (!$user->rights->societe->client->voir || $user->socid) {
+if (empty($user->rights->societe->client->voir) || $user->socid) {
$filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
if ($mode == 'customer') {
$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png';
@@ -401,7 +401,7 @@ print '
';
print '
';
-print '
';
+print '
';
// Show graphs
@@ -418,7 +418,7 @@ if ($mesg) {
print '';
-print '
';
+print '';
print '';
print dol_get_fiche_end();
diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php
index fddf7a2879f..8abbdaa0dd3 100644
--- a/htdocs/compta/accounting-files.php
+++ b/htdocs/compta/accounting-files.php
@@ -578,7 +578,7 @@ print ' ';
foreach ($listofchoices as $choice => $val) {
if (empty($val['enabled'])) {
- continue; // list not qualified
+ continue; // list not qualified
}
$disabled = '';
if (empty($val['perms'])) {
diff --git a/htdocs/compta/bank/account_statement_document.php b/htdocs/compta/bank/account_statement_document.php
index 03209ad7673..0a979e01d39 100644
--- a/htdocs/compta/bank/account_statement_document.php
+++ b/htdocs/compta/bank/account_statement_document.php
@@ -120,6 +120,8 @@ if (GETPOST("rel") == 'prev') {
$found = true;
}
+$permissiontoadd = $user->rights->banque->modifier; // Used by the include of actions_dellink.inc.php
+
/*
* Actions
diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php
index d771b307234..36a9d17315a 100644
--- a/htdocs/compta/bank/annuel.php
+++ b/htdocs/compta/bank/annuel.php
@@ -448,9 +448,9 @@ if ($result < 0) {
print '
'; // do not use class="center" here, it will have no effect for the js graph inside.
print $show1;
- print '
'; // do not use class="center" here, it will have no effect for the js graph inside.
+ print '
'; // do not use class="center" here, it will have no effect for the js graph inside.
print $show2;
- print '
';
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'invoice', $socid, 1);
- print '
';
+ print '';
}
diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php
index b589607ac37..100334e046a 100644
--- a/htdocs/compta/facture/class/facture-rec.class.php
+++ b/htdocs/compta/facture/class/facture-rec.class.php
@@ -126,8 +126,8 @@ class FactureRec extends CommonInvoice
public $suspended; // status
- public $auto_validate; // 0 to create in draft, 1 to create and validate the new invoice
- public $generate_pdf; // 1 to generate PDF on invoice generation (default)
+ public $auto_validate; // 0 to create in draft, 1 to create and validate the new invoice
+ public $generate_pdf; // 1 to generate PDF on invoice generation (default)
/**
* @var int 1 if status is draft
@@ -712,12 +712,12 @@ class FactureRec extends CommonInvoice
//$line->code_ventilation = $objp->fk_code_ventilation;
$line->fk_product_fournisseur_price = $objp->fk_product_fournisseur_price;
- $line->fk_fournprice = $objp->fk_product_fournisseur_price; // For backward compatibility
+ $line->fk_fournprice = $objp->fk_product_fournisseur_price; // For backward compatibility
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $objp->fk_product_fournisseur_price, $objp->pa_ht);
$line->buyprice = $marginInfos[0];
- $line->pa_ht = $marginInfos[0]; // For backward compatibility
+ $line->pa_ht = $marginInfos[0]; // For backward compatibility
$line->marge_tx = $marginInfos[1];
$line->marque_tx = $marginInfos[2];
$line->rang = $objp->rang;
@@ -1930,14 +1930,14 @@ class FactureLigneRec extends CommonInvoiceLine
public $fk_product_fournisseur_price;
- public $fk_fournprice; // For backward compatibility
+ public $fk_fournprice; // For backward compatibility
public $rang;
public $desc;
public $description;
- public $fk_product_type; // Use instead product_type
+ public $fk_product_type; // Use instead product_type
public $fk_contract_line;
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 4b49c88f8ca..04c1383c4a5 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -1560,8 +1560,11 @@ class Facture extends CommonInvoice
$hookmanager->initHooks(array('invoicedao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result, 'notooltip' => $notooltip, 'addlinktonotes' => $addlinktonotes, 'save_lastsearch_value'=> $save_lastsearch_value, 'target' => $target);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
- if ($reshook > 0) $result = $hookmanager->resPrint;
- else $result .= $hookmanager->resPrint;
+ if ($reshook > 0) {
+ $result = $hookmanager->resPrint;
+ } else {
+ $result .= $hookmanager->resPrint;
+ }
return $result;
}
@@ -4055,16 +4058,16 @@ class Facture extends CommonInvoice
$sql = "SELECT s.rowid, s.nom as name, s.client,";
$sql .= " f.rowid as fid, f.ref as ref, f.datef as df";
- if (!$user->rights->societe->client->voir && !$socid) {
+ if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", sc.fk_soc, sc.fk_user";
}
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f";
- if (!$user->rights->societe->client->voir && !$socid) {
+ if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
$sql .= " AND f.fk_soc = s.rowid";
- if (!$user->rights->societe->client->voir && !$socid) { //restriction
+ if (empty($user->rights->societe->client->voir) && !$socid) { //restriction
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
@@ -4254,7 +4257,7 @@ class Facture extends CommonInvoice
$sql = "SELECT f.rowid, f.date_lim_reglement as datefin,f.fk_statut, f.total_ht";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
- if (!$user->rights->societe->client->voir && !$user->socid) {
+ if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON f.fk_soc = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
$clause = " AND";
@@ -4501,7 +4504,7 @@ class Facture extends CommonInvoice
$sql = "SELECT count(f.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
- if (!$user->rights->societe->client->voir && !$user->socid) {
+ if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
$clause = "AND";
diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php
index 1e6457104ea..a54cd1a6668 100644
--- a/htdocs/compta/facture/class/facturestats.class.php
+++ b/htdocs/compta/facture/class/facturestats.class.php
@@ -85,7 +85,7 @@ class FactureStats extends Stats
$this->where = " f.fk_statut >= 0";
$this->where .= " AND f.entity IN (".getEntity('invoice').")";
- if (!$user->rights->societe->client->voir && !$this->socid) {
+ if (empty($user->rights->societe->client->voir) && !$this->socid) {
$this->where .= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($mode == 'customer') {
@@ -129,7 +129,7 @@ class FactureStats extends Stats
$sql = "SELECT date_format(f.datef,'%m') as dm, COUNT(*) as nb";
$sql .= " FROM ".$this->from;
- if (!$user->rights->societe->client->voir && !$this->socid) {
+ if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
@@ -155,7 +155,7 @@ class FactureStats extends Stats
$sql = "SELECT date_format(f.datef,'%Y') as dm, COUNT(*), SUM(c.".$this->field.")";
$sql .= " FROM ".$this->from;
- if (!$user->rights->societe->client->voir && !$this->socid) {
+ if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
@@ -180,7 +180,7 @@ class FactureStats extends Stats
$sql = "SELECT date_format(datef,'%m') as dm, SUM(f.".$this->field.")";
$sql .= " FROM ".$this->from;
- if (!$user->rights->societe->client->voir && !$this->socid) {
+ if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
@@ -206,7 +206,7 @@ class FactureStats extends Stats
$sql = "SELECT date_format(datef,'%m') as dm, AVG(f.".$this->field.")";
$sql .= " FROM ".$this->from;
- if (!$user->rights->societe->client->voir && !$this->socid) {
+ if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
@@ -229,7 +229,7 @@ class FactureStats extends Stats
$sql = "SELECT date_format(datef,'%Y') as year, COUNT(*) as nb, SUM(f.".$this->field.") as total, AVG(f.".$this->field.") as avg";
$sql .= " FROM ".$this->from;
- if (!$user->rights->societe->client->voir && !$this->socid) {
+ if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
@@ -253,7 +253,7 @@ class FactureStats extends Stats
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
$sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
- if (!$user->rights->societe->client->voir && !$this->socid) {
+ if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
@@ -281,7 +281,7 @@ class FactureStats extends Stats
$startYear = $endYear - $numberYears;
$sql = "SELECT date_format(datef,'%Y') as dm, SUM(f.".$this->field.")";
$sql .= " FROM ".$this->from;
- if (!$user->rights->societe->client->voir && !$this->socid) {
+ if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php
index 4381557cd28..c921a9f51b2 100644
--- a/htdocs/compta/facture/contact.php
+++ b/htdocs/compta/facture/contact.php
@@ -100,6 +100,16 @@ if ($action == 'addcontact' && $user->rights->facture->creer) {
* View
*/
+if (empty($object->id)) {
+ llxHeader();
+ $head = facture_prepare_head($object);
+ $langs->load('errors');
+ echo dol_get_fiche_head($head, 'contact', $langs->trans("InvoiceCustomer"), -1, 'bill'),
+ '
';
+print '';
// End of page
llxFooter();
diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php
index f2f192271ac..b5aca49aaae 100644
--- a/htdocs/compta/resultat/clientfourn.php
+++ b/htdocs/compta/resultat/clientfourn.php
@@ -9,6 +9,7 @@
* Copyright (C) 2014 Florian Henry
* Copyright (C) 2018 Frédéric France
* Copyright (C) 2020 Maxime DEMAREST
+ * Copyright (C) 2021 Alexandre Spangaro
*
* 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
@@ -33,6 +34,7 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
+require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@@ -366,7 +368,7 @@ if ($modecompta == 'BOOKKEEPING') {
}
} else {
/*
- * Factures clients
+ * Customer invoices
*/
print '
'.$langs->trans("CustomersInvoices").'
';
@@ -386,8 +388,8 @@ if ($modecompta == 'BOOKKEEPING') {
}
} elseif ($modecompta == 'RECETTES-DEPENSES') {
/*
- * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
- * vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
+ * List of payments (old payments are not seen by this query because, on older versions, they were not linked via payment_invoice.
+ * old versions, they were not linked via payment_invoice. They are added later)
*/
$sql = "SELECT s.nom as name, s.rowid as socid, sum(pf.amount) as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
@@ -434,7 +436,7 @@ if ($modecompta == 'BOOKKEEPING') {
dol_print_error($db);
}
- // On ajoute les paiements clients anciennes version, non lie par paiement_facture
+ // We add the old customer payments, not linked by payment_invoice
if ($modecompta == 'RECETTES-DEPENSES') {
$sql = "SELECT 'Autres' as name, '0' as idp, sum(p.amount) as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
@@ -673,7 +675,7 @@ if ($modecompta == 'BOOKKEEPING') {
/*
- * Charges sociales non deductibles
+ * Social / Fiscal contributions who are not deductible
*/
print '
';
+} else {
+ // Menu with list of bookmarks
+ $sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
+ $sql .= " WHERE (fk_user = ".((int) $user->id)." OR fk_user is NULL OR fk_user = 0)";
+ $sql .= " AND entity IN (".getEntity('bookmarks').")";
+ $sql .= " ORDER BY position";
+ if ($resql = $db->query($sql)) {
+ $bookmarkList = '