From 2fdc6d9461bbc8b6943ac8e6ecad5e65ba86cda5 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 4 Jun 2021 11:35:12 +0200 Subject: [PATCH 001/374] NEW : rewrite bind accountancy code finding on customer invoice --- htdocs/accountancy/admin/account.php | 2 +- .../class/accountingaccount.class.php | 556 ++++++++++++------ htdocs/accountancy/customer/list.php | 189 ++---- 3 files changed, 420 insertions(+), 327 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 6f510ad3706..1f7f8892cad 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -195,7 +195,7 @@ if (empty($reshook)) { } elseif ($action == 'enable' && $permissiontoadd) { if ($accounting->fetch($id)) { $mode = GETPOST('mode', 'int'); - $result = $accounting->account_activate($id, $mode); + $result = $accounting->accountActivate($id, $mode); } $action = 'update'; if ($result < 0) { diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 28601380ac1..c4a11fb6565 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -26,6 +26,9 @@ * \brief File of class to manage accounting accounts */ +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; /** * Class to manage accounting accounts */ @@ -140,6 +143,11 @@ class AccountingAccount extends CommonObject */ public $reconcilable; + /** + * @var array cache array + */ + private $accountingaccount_codetotid_cache = array(); + /** * Constructor * @@ -150,83 +158,14 @@ class AccountingAccount extends CommonObject global $conf; $this->db = $db; - $this->next_prev_filter = 'fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$conf->global->CHARTOFACCOUNTS.')'; // Used to add a filter in Form::showrefnav method - } - - /** - * Load record in memory - * - * @param int $rowid Id - * @param string $account_number Account number - * @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active char of account - * @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC' (better and faster than previous parameter if you have chart of account code). - * @return int <0 if KO, 0 if not found, Id of record if OK and found - */ - public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0, $limittoachartaccount = '') - { - global $conf; - - if ($rowid || $account_number) { - $sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.account_number, a.account_parent, a.label, a.labelshort, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active, a.reconcilable"; - $sql .= ", ca.label as category_label"; - $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as a"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as ca ON a.fk_accounting_category = ca.rowid"; - $sql .= " WHERE"; - if ($rowid) { - $sql .= " a.rowid = ".(int) $rowid; - } elseif ($account_number) { - $sql .= " a.account_number = '".$this->db->escape($account_number)."'"; - $sql .= " AND a.entity = ".$conf->entity; - } - if (!empty($limittocurrentchart)) { - $sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$this->db->escape($conf->global->CHARTOFACCOUNTS).')'; - } - if (!empty($limittoachartaccount)) { - $sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'"; - } - - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) { - $obj = $this->db->fetch_object($result); - - if ($obj) { - $this->id = $obj->rowid; - $this->rowid = $obj->rowid; - $this->ref = $obj->account_number; - $this->datec = $obj->datec; - $this->tms = $obj->tms; - $this->fk_pcg_version = $obj->fk_pcg_version; - $this->pcg_type = $obj->pcg_type; - $this->account_number = $obj->account_number; - $this->account_parent = $obj->account_parent; - $this->label = $obj->label; - $this->labelshort = $obj->labelshort; - $this->account_category = $obj->fk_accounting_category; - $this->account_category_label = $obj->category_label; - $this->fk_user_author = $obj->fk_user_author; - $this->fk_user_modif = $obj->fk_user_modif; - $this->active = $obj->active; - $this->status = $obj->active; - $this->reconcilable = $obj->reconcilable; - - return $this->id; - } else { - return 0; - } - } else { - $this->error = "Error ".$this->db->lasterror(); - $this->errors[] = "Error ".$this->db->lasterror(); - } - } - return -1; + $this->next_prev_filter = 'fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; // Used to add a filter in Form::showrefnav method } /** * Insert new accounting account in chart of accounts * - * @param User $user User making action - * @param int $notrigger Disable triggers + * @param User $user User making action + * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ public function create($user, $notrigger = 0) @@ -259,7 +198,7 @@ class AccountingAccount extends CommonObject // Put here code to add control on parameters values // Insert request - $sql = "INSERT INTO ".MAIN_DB_PREFIX."accounting_account("; + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_account("; $sql .= "datec"; $sql .= ", entity"; $sql .= ", fk_pcg_version"; @@ -273,31 +212,31 @@ class AccountingAccount extends CommonObject $sql .= ", active"; $sql .= ", reconcilable"; $sql .= ") VALUES ("; - $sql .= " '".$this->db->idate($now)."'"; - $sql .= ", ".$conf->entity; - $sql .= ", ".(empty($this->fk_pcg_version) ? 'NULL' : "'".$this->db->escape($this->fk_pcg_version)."'"); - $sql .= ", ".(empty($this->pcg_type) ? 'NULL' : "'".$this->db->escape($this->pcg_type)."'"); - $sql .= ", ".(empty($this->account_number) ? 'NULL' : "'".$this->db->escape($this->account_number)."'"); - $sql .= ", ".(empty($this->account_parent) ? 0 : (int) $this->account_parent); - $sql .= ", ".(empty($this->label) ? "''" : "'".$this->db->escape($this->label)."'"); - $sql .= ", ".(empty($this->labelshort) ? "''" : "'".$this->db->escape($this->labelshort)."'"); - $sql .= ", ".(empty($this->account_category) ? 0 : (int) $this->account_category); - $sql .= ", ".$user->id; - $sql .= ", ".(int) $this->active; - $sql .= ", ".(int) $this->reconcilable; + $sql .= " '" . $this->db->idate($now) . "'"; + $sql .= ", " . $conf->entity; + $sql .= ", " . (empty($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'"); + $sql .= ", " . (empty($this->pcg_type) ? 'NULL' : "'" . $this->db->escape($this->pcg_type) . "'"); + $sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->db->escape($this->account_number) . "'"); + $sql .= ", " . (empty($this->account_parent) ? 0 : (int) $this->account_parent); + $sql .= ", " . (empty($this->label) ? "''" : "'" . $this->db->escape($this->label) . "'"); + $sql .= ", " . (empty($this->labelshort) ? "''" : "'" . $this->db->escape($this->labelshort) . "'"); + $sql .= ", " . (empty($this->account_category) ? 0 : (int) $this->account_category); + $sql .= ", " . $user->id; + $sql .= ", " . (int) $this->active; + $sql .= ", " . (int) $this->reconcilable; $sql .= ")"; $this->db->begin(); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { $error++; - $this->errors[] = "Error ".$this->db->lasterror(); + $this->errors[] = "Error " . $this->db->lasterror(); } if (!$error) { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."accounting_account"); + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_account"); // Uncomment this and change MYOBJECT to your own tag if you // want this action to call a trigger. @@ -313,8 +252,8 @@ class AccountingAccount extends CommonObject // Commit or rollback if ($error) { foreach ($this->errors as $errmsg) { - dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); - $this->error .= ($this->error ? ', '.$errmsg : $errmsg); + dol_syslog(get_class($this) . "::create " . $errmsg, LOG_ERR); + $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); } $this->db->rollback(); return -1 * $error; @@ -327,7 +266,7 @@ class AccountingAccount extends CommonObject /** * Update record * - * @param User $user Use making update + * @param User $user Use making update * @return int <0 if KO, >0 if OK */ public function update($user) @@ -339,20 +278,20 @@ class AccountingAccount extends CommonObject $this->db->begin(); - $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account "; - $sql .= " SET fk_pcg_version = ".($this->fk_pcg_version ? "'".$this->db->escape($this->fk_pcg_version)."'" : "null"); - $sql .= " , pcg_type = ".($this->pcg_type ? "'".$this->db->escape($this->pcg_type)."'" : "null"); - $sql .= " , account_number = '".$this->db->escape($this->account_number)."'"; - $sql .= " , account_parent = ".(int) $this->account_parent; - $sql .= " , label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "''"); - $sql .= " , labelshort = ".($this->labelshort ? "'".$this->db->escape($this->labelshort)."'" : "''"); - $sql .= " , fk_accounting_category = ".(empty($this->account_category) ? 0 : (int) $this->account_category); - $sql .= " , fk_user_modif = ".((int) $user->id); - $sql .= " , active = ".(int) $this->active; - $sql .= " , reconcilable = ".(int) $this->reconcilable; - $sql .= " WHERE rowid = ".((int) $this->id); + $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account "; + $sql .= " SET fk_pcg_version = " . ($this->fk_pcg_version ? "'" . $this->db->escape($this->fk_pcg_version) . "'" : "null"); + $sql .= " , pcg_type = " . ($this->pcg_type ? "'" . $this->db->escape($this->pcg_type) . "'" : "null"); + $sql .= " , account_number = '" . $this->db->escape($this->account_number) . "'"; + $sql .= " , account_parent = " . (int) $this->account_parent; + $sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "''"); + $sql .= " , labelshort = " . ($this->labelshort ? "'" . $this->db->escape($this->labelshort) . "'" : "''"); + $sql .= " , fk_accounting_category = " . (empty($this->account_category) ? 0 : (int) $this->account_category); + $sql .= " , fk_user_modif = " . ((int) $user->id); + $sql .= " , active = " . (int) $this->active; + $sql .= " , reconcilable = " . (int) $this->reconcilable; + $sql .= " WHERE rowid = " . ((int) $this->id); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { $this->db->commit(); @@ -364,38 +303,6 @@ class AccountingAccount extends CommonObject } } - /** - * Check usage of accounting code - * - * @return int <0 if KO, >0 if OK - */ - public function checkUsage() - { - global $langs; - - $sql = "(SELECT fk_code_ventilation FROM ".MAIN_DB_PREFIX."facturedet"; - $sql .= " WHERE fk_code_ventilation=".$this->id.")"; - $sql .= "UNION"; - $sql .= " (SELECT fk_code_ventilation FROM ".MAIN_DB_PREFIX."facture_fourn_det"; - $sql .= " WHERE fk_code_ventilation=".$this->id.")"; - - dol_syslog(get_class($this)."::checkUsage sql=".$sql, LOG_DEBUG); - $resql = $this->db->query($sql); - - if ($resql) { - $num = $this->db->num_rows($resql); - if ($num > 0) { - $this->error = $langs->trans('ErrorAccountancyCodeIsAlreadyUse'); - return 0; - } else { - return 1; - } - } else { - $this->error = $this->db->lasterror(); - return -1; - } - } - /** * Delete object in database * @@ -413,22 +320,22 @@ class AccountingAccount extends CommonObject $this->db->begin(); if (!$error) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."accounting_account"; - $sql .= " WHERE rowid=".((int) $this->id); + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "accounting_account"; + $sql .= " WHERE rowid=" . ((int) $this->id); - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this) . "::delete sql=" . $sql); $resql = $this->db->query($sql); if (!$resql) { $error++; - $this->errors[] = "Error ".$this->db->lasterror(); + $this->errors[] = "Error " . $this->db->lasterror(); } } // Commit or rollback if ($error) { foreach ($this->errors as $errmsg) { - dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); - $this->error .= ($this->error ? ', '.$errmsg : $errmsg); + dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR); + $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); } $this->db->rollback(); return -1 * $error; @@ -441,23 +348,55 @@ class AccountingAccount extends CommonObject } } + /** + * Check usage of accounting code + * + * @return int <0 if KO, >0 if OK + */ + public function checkUsage() + { + global $langs; + + $sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet"; + $sql .= " WHERE fk_code_ventilation=" . $this->id . ")"; + $sql .= "UNION"; + $sql .= " (SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facture_fourn_det"; + $sql .= " WHERE fk_code_ventilation=" . $this->id . ")"; + + dol_syslog(get_class($this) . "::checkUsage sql=" . $sql, LOG_DEBUG); + $resql = $this->db->query($sql); + + if ($resql) { + $num = $this->db->num_rows($resql); + if ($num > 0) { + $this->error = $langs->trans('ErrorAccountancyCodeIsAlreadyUse'); + return 0; + } else { + return 1; + } + } else { + $this->error = $this->db->lasterror(); + return -1; + } + } + /** * Return clicable name (with picto eventually) * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param int $withlabel 0=No label, 1=Include label of account - * @param int $nourl 1=Disable url - * @param string $moretitle Add more text to title tooltip - * @param int $notooltip 1=Disable tooltip - * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking - * @param int $withcompletelabel 0=Short label (field short label), 1=Complete label (field label) - * @param string $option 'ledger', 'journals', 'accountcard' - * @return string String with URL + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto + * @param int $withlabel 0=No label, 1=Include label of account + * @param int $nourl 1=Disable url + * @param string $moretitle Add more text to title tooltip + * @param int $notooltip 1=Disable tooltip + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int $withcompletelabel 0=Short label (field short label), 1=Complete label (field label) + * @param string $option 'ledger', 'journals', 'accountcard' + * @return string String with URL */ public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1, $withcompletelabel = 0, $option = '') { global $langs, $conf; - require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; + require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; if (!empty($conf->dol_no_mouse_hover)) { $notooltip = 1; // Force disable tooltips @@ -465,15 +404,16 @@ class AccountingAccount extends CommonObject $result = ''; - $url = ''; $labelurl = ''; + $url = ''; + $labelurl = ''; if (empty($option) || $option == 'ledger') { - $url = DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start='.urlencode($this->account_number).'&search_accountancy_code_end='.urlencode($this->account_number); + $url = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start=' . urlencode($this->account_number) . '&search_accountancy_code_end=' . urlencode($this->account_number); $labelurl = $langs->trans("ShowAccountingAccountInLedger"); } elseif ($option == 'journals') { - $url = DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?search_accountancy_code_start='.urlencode($this->account_number).'&search_accountancy_code_end='.urlencode($this->account_number); + $url = DOL_URL_ROOT . '/accountancy/bookkeeping/list.php?search_accountancy_code_start=' . urlencode($this->account_number) . '&search_accountancy_code_end=' . urlencode($this->account_number); $labelurl = $langs->trans("ShowAccountingAccountInJournals"); } elseif ($option == 'accountcard') { - $url = DOL_URL_ROOT.'/accountancy/admin/card.php?id='.urlencode($this->id); + $url = DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . urlencode($this->id); $labelurl = $langs->trans("ShowAccountingAccount"); } @@ -495,29 +435,29 @@ class AccountingAccount extends CommonObject $labeltoshow = $this->labelshort; } - $label = ''.$labelurl.''; + $label = '' . $labelurl . ''; if (!empty($this->account_number)) { - $label .= '
'.$langs->trans('AccountAccounting').': '.length_accountg($this->account_number); + $label .= '
' . $langs->trans('AccountAccounting') . ': ' . length_accountg($this->account_number); } if (!empty($labeltoshow)) { - $label .= '
'.$langs->trans('Label').': '.$labeltoshow; + $label .= '
' . $langs->trans('Label') . ': ' . $labeltoshow; } if ($moretitle) { - $label .= ' - '.$moretitle; + $label .= ' - ' . $moretitle; } $linkclose = ''; if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $labelurl; - $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"'; $linkclose .= ' class="classfortooltip"'; } - $linkstart = ''; + $linkstart = ''; $linkend = ''; if ($nourl) { @@ -528,17 +468,17 @@ class AccountingAccount extends CommonObject $label_link = length_accountg($this->account_number); if ($withlabel) { - $label_link .= ' - '.($nourl ? '' : '').$labeltoshow.($nourl ? '' : ''); + $label_link .= ' - ' . ($nourl ? '' : '') . $labeltoshow . ($nourl ? '' : ''); } if ($withpicto) { - $result .= ($linkstart.img_object(($notooltip ? '' : $label), $picto, ($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1).$linkend); + $result .= ($linkstart . img_object(($notooltip ? '' : $label), $picto, ($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1) . $linkend); } if ($withpicto && $withpicto != 2) { $result .= ' '; } if ($withpicto != 2) { - $result .= $linkstart.$label_link.$linkend; + $result .= $linkstart . $label_link . $linkend; } return $result; } @@ -552,10 +492,10 @@ class AccountingAccount extends CommonObject public function info($id) { $sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'accounting_account as a'; - $sql .= ' WHERE a.rowid = '.((int) $id); + $sql .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as a'; + $sql .= ' WHERE a.rowid = ' . ((int) $id); - dol_syslog(get_class($this).'::info sql='.$sql); + dol_syslog(get_class($this) . '::info sql=' . $sql); $result = $this->db->query($sql); if ($result) { @@ -584,8 +524,8 @@ class AccountingAccount extends CommonObject /** * Deactivate an account (for status active or status reconcilable) * - * @param int $id Id - * @param int $mode 0=field active, 1=field reconcilable + * @param int $id Id + * @param int $mode 0=field active, 1=field reconcilable * @return int <0 if KO, >0 if OK */ public function accountDeactivate($id, $mode = 0) @@ -600,11 +540,11 @@ class AccountingAccount extends CommonObject if ($result > 0) { $this->db->begin(); - $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account "; - $sql .= "SET ".$fieldtouse." = '0'"; - $sql .= " WHERE rowid = ".$this->db->escape($id); + $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account "; + $sql .= "SET " . $fieldtouse . " = '0'"; + $sql .= " WHERE rowid = " . $this->db->escape($id); - dol_syslog(get_class($this)."::accountDeactivate ".$fieldtouse." sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this) . "::accountDeactivate " . $fieldtouse . " sql=" . $sql, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -620,15 +560,15 @@ class AccountingAccount extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** * Account activated * - * @param int $id Id - * @param int $mode 0=field active, 1=field reconcilable + * @param int $id Id + * @param int $mode 0=field active, 1=field reconcilable * @return int <0 if KO, >0 if OK */ - public function account_activate($id, $mode = 0) + public function accountActivate($id, $mode = 0) { // phpcs:enable $this->db->begin(); @@ -638,11 +578,11 @@ class AccountingAccount extends CommonObject $fieldtouse = 'reconcilable'; } - $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account"; - $sql .= " SET ".$fieldtouse." = '1'"; - $sql .= " WHERE rowid = ".$this->db->escape($id); + $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account"; + $sql .= " SET " . $fieldtouse . " = '1'"; + $sql .= " WHERE rowid = " . $this->db->escape($id); - dol_syslog(get_class($this)."::account_activate ".$fieldtouse." sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this) . "::accountActivate " . $fieldtouse . " sql=" . $sql, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { $this->db->commit(); @@ -654,12 +594,11 @@ class AccountingAccount extends CommonObject } } - /** * Retourne le libelle du statut d'un user (actif, inactif) * - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto - * @return string Label of status + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status */ public function getLibStatut($mode = 0) { @@ -670,9 +609,9 @@ class AccountingAccount extends CommonObject /** * Renvoi le libelle d'un statut donne * - * @param int $status Id status - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto - * @return string Label of status + * @param int $status Id status + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status */ public function LibStatut($status, $mode = 0) { @@ -694,9 +633,9 @@ class AccountingAccount extends CommonObject } } elseif ($mode == 2) { if ($status == 1) { - return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); + return img_picto($langs->trans('Enabled'), 'statut4') . ' ' . $langs->trans('Enabled'); } elseif ($status == 0) { - return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); + return img_picto($langs->trans('Disabled'), 'statut5') . ' ' . $langs->trans('Disabled'); } } elseif ($mode == 3) { if ($status == 1) { @@ -706,16 +645,241 @@ class AccountingAccount extends CommonObject } } elseif ($mode == 4) { if ($status == 1) { - return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); + return img_picto($langs->trans('Enabled'), 'statut4') . ' ' . $langs->trans('Enabled'); } elseif ($status == 0) { - return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); + return img_picto($langs->trans('Disabled'), 'statut5') . ' ' . $langs->trans('Disabled'); } } elseif ($mode == 5) { if ($status == 1) { - return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); + return $langs->trans('Enabled') . ' ' . img_picto($langs->trans('Enabled'), 'statut4'); } elseif ($status == 0) { - return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); + return $langs->trans('Disabled') . ' ' . img_picto($langs->trans('Disabled'), 'statut5'); } } } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + + /** + * Return Suggest accounting accounts to bind + * + * @param Societe $thirdparty Societe Object seller or Buyers + * @param Product $product Product object sell or buy + * @param Facture $facture Facture + * @param FactureLigne $factureDet Facture Det + * @param array $accountingAccount array of Account account + * + * @return array Accounting accounts suggested + */ + public function getAccountingCodeToBind(Societe $thirdparty, Product $product, Facture $facture, FactureLigne $factureDet, $accountingAccount = array()) + { + global $mysoc, $conf; + global $hookmanager; + + // Instantiate hooks for external modules + $hookmanager->initHooks(array('accoutancyBindingCalculation')); + + // Execute hook accoutancyBindingCalculation + $parameters = array('thirdparty' => $thirdparty, 'product' => $product, 'facture' => $facture, 'factureDet' => $factureDet ,'accountingAccount'=>$accountingAccount); + $reshook = $hookmanager->executeHooks('accoutancyBindingCalculation', $parameters); // Note that $action and $object may have been modified by some hooks + + if (empty($reshook)) { + require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; + $isBuyerInEEC = isInEEC($thirdparty); + $isSellerInEEC = isInEEC($mysoc); + $code_sell_l = ''; + $code_sell_p = ''; + $code_sell_t = ''; + $suggestedid = ''; + + // Level 1: Search suggested default account for product/service + $suggestedaccountingaccountbydefaultfor = ''; + if ($factureDet->product_type == 1) { + if ($thirdparty->country_code == $mysoc->country_code || empty($thirdparty->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) + $code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : ''); + $suggestedaccountingaccountbydefaultfor = ''; + } else { + if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) { // European intravat sale, but with a VAT + $code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : ''); + $suggestedaccountingaccountbydefaultfor = 'eecwithvat'; + } elseif ($isSellerInEEC && $isBuyerInEEC && empty($thirdparty->tva_intra)) { // European intravat sale, without VAT intra community number + $code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : ''); + $suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber'; + } elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale + $code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : ''); + $suggestedaccountingaccountbydefaultfor = 'eec'; + } else { // Foreign sale + $code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : ''); + $suggestedaccountingaccountbydefaultfor = 'export'; + } + } + } elseif ($factureDet->product_type == 0) { + if ($thirdparty->country_code == $mysoc->country_code || empty($thirdparty->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) + $code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : ''); + $suggestedaccountingaccountbydefaultfor = ''; + } else { + if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) { // European intravat sale, but with a VAT + $code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : ''); + $suggestedaccountingaccountbydefaultfor = 'eecwithvat'; + } elseif ($isSellerInEEC && $isBuyerInEEC && empty($thirdparty->tva_intra)) { // European intravat sale, without VAT intra community number + $code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : ''); + $suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber'; + } elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale + $code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : ''); + $suggestedaccountingaccountbydefaultfor = 'eec'; + } else { + $code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : ''); + $suggestedaccountingaccountbydefaultfor = 'export'; + } + } + } + if ($code_sell_l == -1) { + $code_sell_l = ''; + } + + // Level 2: Search suggested account for product/service (similar code exists in page index.php to make automatic binding) + $suggestedaccountingaccountfor = ''; + if (($thirdparty->country_code == $mysoc->country_code) || empty($thirdparty->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) + $code_sell_p = $product->accountancy_code_sell; + $suggestedid = $accountingAccount['dom']; + $suggestedaccountingaccountfor = ''; + } else { + if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) { // European intravat sale, but with VAT + $code_sell_p = $product->accountancy_code_sell; + $suggestedid = $accountingAccount['dom']; + $suggestedaccountingaccountfor = 'eecwithvat'; + } elseif ($isSellerInEEC && $isBuyerInEEC && empty($thirdparty->tva_intra)) { // European intravat sale, without VAT intra community number + $code_sell_p = $product->accountancy_code_sell; + $suggestedid = $accountingAccount['dom']; // There is a doubt for this case. Is it an error on vat or we just forgot to fill vat number ? + $suggestedaccountingaccountfor = 'eecwithoutvatnumber'; + } elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale + $code_sell_p = $product->accountancy_code_sell_intra; + $suggestedid = $accountingAccount['intra']; + $suggestedaccountingaccountfor = 'eec'; + } else { // Foreign sale + $code_sell_p = $product->accountancy_code_sell_export; + $suggestedid = $accountingAccount['export']; + $suggestedaccountingaccountfor = 'export'; + } + } + + // Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding) + if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { + if (!empty($thirdparty->code_compta)) { + $code_sell_t = $thirdparty->code_compta; + $suggestedid = $accountingAccount['thirdparty']; + $suggestedaccountingaccountfor = ''; + } + } + + // Manage Deposit + if ($factureDet->desc == "(DEPOSIT)") { + $accountdeposittoventilated = new self($this->db); + $result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1); + if ($result < 0) { + return -1; + } + + $code_sell_l = $accountdeposittoventilated->ref; + $suggestedid = $accountdeposittoventilated->rowid; + } + + if (empty($suggestedid) && empty($code_sell_p) && !empty($code_sell_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC)) { + if (empty($this->accountingaccount_codetotid_cache[$code_sell_l])) { + $tmpaccount = new self($this->db); + $result = $tmpaccount->fetch(0, $code_sell_l, 1); + if ($result < 0) { + return -1; + } + if ($tmpaccount->id > 0) { + $suggestedid = $tmpaccount->id; + } + $this->accountingaccount_codetotid_cache[$code_sell_l] = $tmpaccount->id; + } else { + $suggestedid = $this->accountingaccount_codetotid_cache[$code_sell_l]; + } + } + } else { + if (is_array($hookmanager->resArray) && !empty($hookmanager->resArray)) { + return $hookmanager->resArray; + } + } + return array( + 'suggestedaccountingaccountbydefaultfor' => $suggestedaccountingaccountbydefaultfor, + 'suggestedaccountingaccountfor' => $suggestedaccountingaccountfor, + 'suggestedid' => $suggestedid, + 'code_sell_l' => $code_sell_l, + 'code_sell_p' => $code_sell_p, + 'code_sell_t' => $code_sell_t, + ); + } + + /** + * Load record in memory + * + * @param int $rowid Id + * @param string $account_number Account number + * @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active char of account + * @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC' (better and faster than previous parameter if you have chart of account code). + * @return int <0 if KO, 0 if not found, Id of record if OK and found + */ + public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0, $limittoachartaccount = '') + { + global $conf; + + if ($rowid || $account_number) { + $sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.account_number, a.account_parent, a.label, a.labelshort, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active, a.reconcilable"; + $sql .= ", ca.label as category_label"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as a"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_accounting_category as ca ON a.fk_accounting_category = ca.rowid"; + $sql .= " WHERE"; + if ($rowid) { + $sql .= " a.rowid = " . (int) $rowid; + } elseif ($account_number) { + $sql .= " a.account_number = '" . $this->db->escape($account_number) . "'"; + $sql .= " AND a.entity = " . $conf->entity; + } + if (!empty($limittocurrentchart)) { + $sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $this->db->escape($conf->global->CHARTOFACCOUNTS) . ')'; + } + if (!empty($limittoachartaccount)) { + $sql .= " AND a.fk_pcg_version = '" . $this->db->escape($limittoachartaccount) . "'"; + } + + dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) { + $obj = $this->db->fetch_object($result); + + if ($obj) { + $this->id = $obj->rowid; + $this->rowid = $obj->rowid; + $this->ref = $obj->account_number; + $this->datec = $obj->datec; + $this->tms = $obj->tms; + $this->fk_pcg_version = $obj->fk_pcg_version; + $this->pcg_type = $obj->pcg_type; + $this->account_number = $obj->account_number; + $this->account_parent = $obj->account_parent; + $this->label = $obj->label; + $this->labelshort = $obj->labelshort; + $this->account_category = $obj->fk_accounting_category; + $this->account_category_label = $obj->category_label; + $this->fk_user_author = $obj->fk_user_author; + $this->fk_user_modif = $obj->fk_user_modif; + $this->active = $obj->active; + $this->status = $obj->active; + $this->reconcilable = $obj->reconcilable; + + return $this->id; + } else { + return 0; + } + } else { + $this->error = "Error " . $this->db->lasterror(); + $this->errors[] = "Error " . $this->db->lasterror(); + } + } + return -1; + } } diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 4df8d6b9b15..e165cc3d8b1 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -45,6 +45,7 @@ $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); +$optioncss = GETPOST('optioncss', 'alpha'); // Select Box $mesCasesCochees = GETPOST('toselect', 'array'); @@ -96,6 +97,7 @@ if (!$sortorder) { $hookmanager->initHooks(array('accountancycustomerlist')); $formaccounting = new FormAccounting($db); +$accountingAccount = new AccountingAccount($db); $chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version'); @@ -510,17 +512,17 @@ if ($result) { $thirdpartystatic = new Societe($db); $facture_static = new Facture($db); + $facture_static_det = new FactureLigne($db); $product_static = new Product($db); - $isSellerInEEC = isInEEC($mysoc); $accountingaccount_codetotid_cache = array(); while ($i < min($num_lines, $limit)) { $objp = $db->fetch_object($result); - $objp->code_sell_l = ''; - $objp->code_sell_p = ''; + $code_sell_l = ''; + $code_sell_p = ''; $thirdpartystatic->id = $objp->socid; $thirdpartystatic->name = $objp->name; @@ -532,6 +534,8 @@ if ($result) { $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; $thirdpartystatic->email = $objp->email; $thirdpartystatic->country_code = $objp->country_code; + $thirdpartystatic->tva_intra = $objp->tva_intra; + $thirdpartystatic->code_compta = $objp->company_code_sell; $product_static->ref = $objp->product_ref; $product_static->id = $objp->product_id; @@ -545,158 +549,96 @@ if ($result) { $product_static->accountancy_code_buy = $objp->code_buy; $product_static->accountancy_code_buy_intra = $objp->code_buy_intra; $product_static->accountancy_code_buy_export = $objp->code_buy_export; + $product_static->tva_tx = $objp->tva_tx_prod; + $product_static->tva_tx = $objp->tva_tx_prod; $facture_static->ref = $objp->ref; $facture_static->id = $objp->facid; $facture_static->type = $objp->ftype; + $facture_static->datef = $objp->datef; + + $facture_static_det->id = $objp->rowid; + $facture_static_det->total_ht = $objp->total_ht; + $facture_static_det->tva_tx = $objp->tva_tx_line; + $facture_static_det->vat_src_code = $objp->vat_src_code; + $facture_static_det->product_type = $objp->type_l; + $facture_static_det->desc = $objp->description; + + $accoutinAccountArray = array( + 'dom'=>$objp->aarowid, + 'intra'=>$objp->aarowid_intra, + 'export'=>$objp->aarowid_export, + 'thirdparty' =>$objp->aarowid_thirdparty); $code_sell_p_notset = ''; $code_sell_t_notset = ''; - $objp->aarowid_suggest = ''; // Will be set later - $isBuyerInEEC = isInEEC($objp); - - // Level 1: Search suggested default account for product/service - $suggestedaccountingaccountbydefaultfor = ''; - if ($objp->type_l == 1) { - if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) - $objp->code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : ''); - $suggestedaccountingaccountbydefaultfor = ''; - } else { - if ($isSellerInEEC && $isBuyerInEEC && $objp->tva_tx_line != 0) { // European intravat sale, but with a VAT - $objp->code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : ''); - $suggestedaccountingaccountbydefaultfor = 'eecwithvat'; - } elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number - $objp->code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : ''); - $suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber'; - } elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale - $objp->code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : ''); - $suggestedaccountingaccountbydefaultfor = 'eec'; - } else { // Foreign sale - $objp->code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : ''); - $suggestedaccountingaccountbydefaultfor = 'export'; - } - } - } elseif ($objp->type_l == 0) { - if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) - $objp->code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : ''); - $suggestedaccountingaccountbydefaultfor = ''; - } else { - if ($isSellerInEEC && $isBuyerInEEC && $objp->tva_tx_line != 0) { // European intravat sale, but with a VAT - $objp->code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : ''); - $suggestedaccountingaccountbydefaultfor = 'eecwithvat'; - } elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number - $objp->code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : ''); - $suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber'; - } elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale - $objp->code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : ''); - $suggestedaccountingaccountbydefaultfor = 'eec'; - } else { - $objp->code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : ''); - $suggestedaccountingaccountbydefaultfor = 'export'; - } - } - } - if ($objp->code_sell_l == -1) { - $objp->code_sell_l = ''; - } - - // Level 2: Search suggested account for product/service (similar code exists in page index.php to make automatic binding) - $suggestedaccountingaccountfor = ''; - if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) - $objp->code_sell_p = $objp->code_sell; - $objp->aarowid_suggest = $objp->aarowid; - $suggestedaccountingaccountfor = ''; + $return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $product_static, $facture_static, $facture_static_det, $accoutinAccountArray); + if (!is_array($return) && $return<0) { + setEventMessage($accountingAccount->error, 'errors'); } else { - if ($isSellerInEEC && $isBuyerInEEC && $objp->tva_tx_line != 0) { // European intravat sale, but with VAT - $objp->code_sell_p = $objp->code_sell; - $objp->aarowid_suggest = $objp->aarowid; - $suggestedaccountingaccountfor = 'eecwithvat'; - } elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number - $objp->code_sell_p = $objp->code_sell; - $objp->aarowid_suggest = $objp->aarowid; // There is a doubt for this case. Is it an error on vat or we just forgot to fill vat number ? - $suggestedaccountingaccountfor = 'eecwithoutvatnumber'; - } elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale - $objp->code_sell_p = $objp->code_sell_intra; - $objp->aarowid_suggest = $objp->aarowid_intra; - $suggestedaccountingaccountfor = 'eec'; - } else { // Foreign sale - $objp->code_sell_p = $objp->code_sell_export; - $objp->aarowid_suggest = $objp->aarowid_export; - $suggestedaccountingaccountfor = 'export'; - } + $suggestedid=$return['suggestedid']; + $suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor']; + $suggestedaccountingaccountbydefaultfor=$return['suggestedaccountingaccountbydefaultfor']; + $code_sell_l=$return['code_sell_l']; + $code_sell_p=$return['code_sell_p']; + $code_sell_t=$return['code_sell_t']; } - // Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding) - if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { - if (!empty($objp->company_code_sell)) { - $objp->code_sell_t = $objp->company_code_sell; - $objp->aarowid_suggest = $objp->aarowid_thirdparty; - $suggestedaccountingaccountfor = ''; - } - } - - // Manage Deposit - if ($objp->description == "(DEPOSIT)") { - $accountdeposittoventilated = new AccountingAccount($db); - $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1); - $objp->code_sell_l = $accountdeposittoventilated->ref; - $objp->aarowid_suggest = $accountdeposittoventilated->rowid; - } - - if (!empty($objp->code_sell_p)) { + if (!empty($code_sell_p)) { // Value was defined previously } else { $code_sell_p_notset = 'color:orange'; } - if (empty($objp->code_sell_l) && empty($objp->code_sell_p)) { + if (empty($code_sell_l) && empty($code_sell_p)) { $code_sell_p_notset = 'color:red'; } if ($suggestedaccountingaccountfor == 'eecwithoutvatnumber' && empty($code_sell_p_notset)) { $code_sell_p_notset = 'color:orange'; } - // $objp->code_sell_l is now default code of product/service - // $objp->code_sell_p is now code of product/service - // $objp->code_sell_t is now code of thirdparty + // $code_sell_l is now default code of product/service + // $code_sell_p is now code of product/service + // $code_sell_t is now code of thirdparty print ''; // Line id - print ''.$objp->rowid.''; + print ''.$facture_static_det->id.''; // Ref Invoice print ''.$facture_static->getNomUrl(1).''; - print ''.dol_print_date($db->jdate($objp->datef), 'day').''; + print ''.dol_print_date($db->jdate($facture_static->datef), 'day').''; // Ref Product print ''; if ($product_static->id > 0) { print $product_static->getNomUrl(1); } - if ($objp->product_label) { - print '
'.$objp->product_label.''; + if ($product_static->label) { + print '
'.$product_static->label.''; } print ''; // Description print ''; - $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description)); + $text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc)); $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; - print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description); + print $form->textwithtooltip(dol_trunc($text, $trunclength), $facture_static_det->desc); print ''; print ''; - print price($objp->total_ht); + print price($facture_static_det->total_ht); print ''; // Vat rate - if ($objp->vat_tx_l != $objp->vat_tx_p) { + $code_vat_differ=''; + if ($product_static->tva_tx !== $facture_static_det->tva_tx) { $code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red'; } print ''; - print vatrate($objp->tva_tx_line.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')); + print vatrate($facture_static_det->tva_tx.($facture_static_det->vat_src_code ? ' ('.$facture_static_det->vat_src_code.')' : '')); print ''; // Thirdparty @@ -704,27 +646,27 @@ if ($result) { // Country print ''; - $labelcountry = ($objp->country_code && ($langs->trans("Country".$objp->country_code) != "Country".$objp->country_code)) ? $langs->trans("Country".$objp->country_code) : $objp->country_label; + $labelcountry = ($thirdpartystatic->country_code && ($langs->trans("Country".$thirdpartystatic->country_code) != "Country".$thirdpartystatic->country_code)) ? $langs->trans("Country".$thirdpartystatic->country_code) : $objp->country_label; print $labelcountry; print ''; // VAT Num - print ''.$objp->tva_intra.''; + print ''.$thirdpartystatic->tva_intra.''; // Found accounts print ''; - $s = '1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; + $s = '1. '.(($facture_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; $shelp = ''; if ($suggestedaccountingaccountbydefaultfor == 'eec') { $shelp .= $langs->trans("SaleEEC"); } elseif ($suggestedaccountingaccountbydefaultfor == 'export') { $shelp .= $langs->trans("SaleExport"); } - $s .= ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : ''.$langs->trans("NotDefined").''); + $s .= ($code_sell_l > 0 ? length_accountg($code_sell_l) : ''.$langs->trans("NotDefined").''); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); - if ($objp->product_id > 0) { + if ($product_static->id > 0) { print '
'; - $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; + $s = '2. '.(($facture_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; $shelp = ''; $ttype = 'help'; if ($suggestedaccountingaccountfor == 'eec') { $shelp = $langs->trans("SaleEEC"); @@ -736,12 +678,12 @@ if ($result) { } elseif ($suggestedaccountingaccountfor == 'export') { $shelp = $langs->trans("SaleExport"); } - $s .= (empty($objp->code_sell_p) ? ''.$langs->trans("NotDefined").'' : length_accountg($objp->code_sell_p)); + $s .= (empty($code_sell_p) ? ''.$langs->trans("NotDefined").'' : length_accountg($code_sell_p)); print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1); } else { if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { print '
'; - $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; + $s = '2. '.(($facture_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; $shelp = ''; $s .= $langs->trans("NotDefined"); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); @@ -749,29 +691,16 @@ if ($result) { } if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { print '
'; - $s = '3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': '; + $s = '3. '.(($facture_static_det->product_type == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': '; $shelp = ''; - $s .= ($objp->code_sell_t > 0 ? length_accountg($objp->code_sell_t) : ''.$langs->trans("NotDefined").''); + $s .= ($code_sell_t > 0 ? length_accountg($code_sell_t) : ''.$langs->trans("NotDefined").''); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); } print ''; // Suggested accounting account print ''; - $suggestedid = $objp->aarowid_suggest; - if (empty($suggestedid) && empty($objp->code_sell_p) && !empty($objp->code_sell_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC)) { - if (empty($accountingaccount_codetotid_cache[$objp->code_sell_l])) { - $tmpaccount = new AccountingAccount($db); - $tmpaccount->fetch(0, $objp->code_sell_l, 1); - if ($tmpaccount->id > 0) { - $suggestedid = $tmpaccount->id; - } - $accountingaccount_codetotid_cache[$objp->code_sell_l] = $tmpaccount->id; - } else { - $suggestedid = $accountingaccount_codetotid_cache[$objp->code_sell_l]; - } - } - print $formaccounting->select_account($suggestedid, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'); + print $formaccounting->select_account($suggestedid, 'codeventil'.$facture_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; // Column with checkbox @@ -780,7 +709,7 @@ if ($result) { if ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') { $ischecked = 0; } - print ''; + print ''; print ''; print ''; From 729ca70bf396d05b3cf75abe5a28b2fafcf92df7 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 4 Jun 2021 12:20:52 +0200 Subject: [PATCH 002/374] NEW : rewrite bind accountancy code finding on sales invoice --- .../class/accountingaccount.class.php | 15 +-- htdocs/accountancy/customer/index.php | 101 ++++++++++++------ htdocs/accountancy/customer/list.php | 6 +- htdocs/societe/card.php | 12 ++- 4 files changed, 90 insertions(+), 44 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index c4a11fb6565..9f5c7799037 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -739,24 +739,24 @@ class AccountingAccount extends CommonObject // Level 2: Search suggested account for product/service (similar code exists in page index.php to make automatic binding) $suggestedaccountingaccountfor = ''; - if (($thirdparty->country_code == $mysoc->country_code) || empty($thirdparty->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) + if ((($thirdparty->country_code == $mysoc->country_code) || empty($thirdparty->country_code)) && !empty($product->accountancy_code_sell)) { // If buyer in same country than seller (if not defined, we assume it is same country) $code_sell_p = $product->accountancy_code_sell; $suggestedid = $accountingAccount['dom']; - $suggestedaccountingaccountfor = ''; + $suggestedaccountingaccountfor = 'prodserv'; } else { - if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) { // European intravat sale, but with VAT + if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0 && !empty($product->accountancy_code_sell)) { // European intravat sale, but with VAT $code_sell_p = $product->accountancy_code_sell; $suggestedid = $accountingAccount['dom']; $suggestedaccountingaccountfor = 'eecwithvat'; - } elseif ($isSellerInEEC && $isBuyerInEEC && empty($thirdparty->tva_intra)) { // European intravat sale, without VAT intra community number + } elseif ($isSellerInEEC && $isBuyerInEEC && empty($thirdparty->tva_intra) && !empty($product->accountancy_code_sell)) { // European intravat sale, without VAT intra community number $code_sell_p = $product->accountancy_code_sell; $suggestedid = $accountingAccount['dom']; // There is a doubt for this case. Is it an error on vat or we just forgot to fill vat number ? $suggestedaccountingaccountfor = 'eecwithoutvatnumber'; - } elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale + } elseif ($isSellerInEEC && $isBuyerInEEC && !empty($product->accountancy_code_sell_intra)) { // European intravat sale $code_sell_p = $product->accountancy_code_sell_intra; $suggestedid = $accountingAccount['intra']; $suggestedaccountingaccountfor = 'eec'; - } else { // Foreign sale + } elseif (!empty($product->accountancy_code_sell_export)) { // Foreign sale $code_sell_p = $product->accountancy_code_sell_export; $suggestedid = $accountingAccount['export']; $suggestedaccountingaccountfor = 'export'; @@ -768,7 +768,7 @@ class AccountingAccount extends CommonObject if (!empty($thirdparty->code_compta)) { $code_sell_t = $thirdparty->code_compta; $suggestedid = $accountingAccount['thirdparty']; - $suggestedaccountingaccountfor = ''; + $suggestedaccountingaccountfor = 'thridparty'; } } @@ -782,6 +782,7 @@ class AccountingAccount extends CommonObject $code_sell_l = $accountdeposittoventilated->ref; $suggestedid = $accountdeposittoventilated->rowid; + $suggestedaccountingaccountfor = 'deposit'; } if (empty($suggestedid) && empty($code_sell_p) && !empty($code_sell_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC)) { diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index d33f5e12312..2bb2903eefa 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; // Load translation files required by the page $langs->loadLangs(array("compta", "bills", "other", "main", "accountancy")); @@ -46,6 +47,7 @@ if (!$user->rights->accounting->bind->write) { accessforbidden(); } +$accountingAccount = new AccountingAccount($db); $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); if (GETPOST("year", 'int')) { @@ -166,49 +168,82 @@ if ($action == 'validatehistory') { $isSellerInEEC = isInEEC($mysoc); + $thirdpartystatic = new Societe($db); + $facture_static = new Facture($db); + $facture_static_det = new FactureLigne($db); + $product_static = new Product($db); + $i = 0; while ($i < min($num_lines, 10000)) { // No more than 10000 at once $objp = $db->fetch_object($result); - $isBuyerInEEC = isInEEC($objp); // This make a database request but there is a cache into $conf->cache['country_code_in_EEC'] + $thirdpartystatic->id = $objp->socid; + $thirdpartystatic->name = $objp->name; + $thirdpartystatic->client = $objp->client; + $thirdpartystatic->fournisseur = $objp->fournisseur; + $thirdpartystatic->code_client = $objp->code_client; + $thirdpartystatic->code_compta_client = $objp->code_compta_client; + $thirdpartystatic->code_fournisseur = $objp->code_fournisseur; + $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; + $thirdpartystatic->email = $objp->email; + $thirdpartystatic->country_code = $objp->country_code; + $thirdpartystatic->tva_intra = $objp->tva_intra; + $thirdpartystatic->code_compta = $objp->company_code_sell; - // Level 2: Search suggested account for product/service (similar code exists in page list.php to make manual binding) - $suggestedaccountingaccountfor = ''; - if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) - $objp->code_sell_p = $objp->code_sell; - $objp->aarowid_suggest = $objp->aarowid; - $suggestedaccountingaccountfor = ''; + $product_static->ref = $objp->product_ref; + $product_static->id = $objp->product_id; + $product_static->type = $objp->type; + $product_static->label = $objp->product_label; + $product_static->status = $objp->status; + $product_static->status_buy = $objp->status_buy; + $product_static->accountancy_code_sell = $objp->code_sell; + $product_static->accountancy_code_sell_intra = $objp->code_sell_intra; + $product_static->accountancy_code_sell_export = $objp->code_sell_export; + $product_static->accountancy_code_buy = $objp->code_buy; + $product_static->accountancy_code_buy_intra = $objp->code_buy_intra; + $product_static->accountancy_code_buy_export = $objp->code_buy_export; + $product_static->tva_tx = $objp->tva_tx_prod; + $product_static->tva_tx = $objp->tva_tx_prod; + + $facture_static->ref = $objp->ref; + $facture_static->id = $objp->facid; + $facture_static->type = $objp->ftype; + $facture_static->datef = $objp->datef; + + $facture_static_det->id = $objp->rowid; + $facture_static_det->total_ht = $objp->total_ht; + $facture_static_det->tva_tx = $objp->tva_tx_line; + $facture_static_det->vat_src_code = $objp->vat_src_code; + $facture_static_det->product_type = $objp->type_l; + $facture_static_det->desc = $objp->description; + + $accoutinAccountArray = array( + 'dom'=>$objp->aarowid, + 'intra'=>$objp->aarowid_intra, + 'export'=>$objp->aarowid_export, + 'thirdparty' =>$objp->aarowid_thirdparty); + + $code_sell_p_notset = ''; + $code_sell_t_notset = ''; + + $return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $product_static, $facture_static, $facture_static_det, $accoutinAccountArray); + if (!is_array($return) && $return<0) { + setEventMessage($accountingAccount->error, 'errors'); } else { - if ($isSellerInEEC && $isBuyerInEEC && $objp->tva_tx_line != 0) { // European intravat sale, but with VAT - $objp->code_sell_p = $objp->code_sell; - $objp->aarowid_suggest = $objp->aarowid; - $suggestedaccountingaccountfor = 'eecwithvat'; - } elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number - $objp->code_sell_p = $objp->code_sell; - $objp->aarowid_suggest = 0; // There is a doubt, no automatic binding - $suggestedaccountingaccountfor = 'eecwithoutvatnumber'; - } elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale - $objp->code_sell_p = $objp->code_sell_intra; - $objp->aarowid_suggest = $objp->aarowid_intra; - $suggestedaccountingaccountfor = 'eec'; - } else { // Foreign sale - $objp->code_sell_p = $objp->code_sell_export; - $objp->aarowid_suggest = $objp->aarowid_export; - $suggestedaccountingaccountfor = 'export'; + $suggestedid=$return['suggestedid']; + $suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor']; + + if (!empty($suggestedid) && $suggestedaccountingaccountfor<>'') { + $suggestedid=$return['suggestedid']; + } else { + $suggestedid=0; } } - // Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding) - if (!empty($objp->company_code_sell)) { - $objp->code_sell_t = $objp->company_code_sell; - $objp->aarowid_suggest = $objp->aarowid_thirdparty; - $suggestedaccountingaccountfor = ''; - } - - if ($objp->aarowid_suggest > 0) { + if ($suggestedid > 0) { $sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facturedet"; - $sqlupdate .= " SET fk_code_ventilation = ".((int) $objp->aarowid_suggest); - $sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".((int) $objp->rowid); + $sqlupdate .= " SET fk_code_ventilation = ".((int) $suggestedid); + $sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".((int) $facture_static_det->id); $resqlupdate = $db->query($sqlupdate); if (!$resqlupdate) { diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index e165cc3d8b1..c58df26edc2 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -584,6 +584,7 @@ if ($result) { $code_sell_p=$return['code_sell_p']; $code_sell_t=$return['code_sell_t']; } + //var_dump($return); if (!empty($code_sell_p)) { // Value was defined previously @@ -705,8 +706,9 @@ if ($result) { // Column with checkbox print ''; - $ischecked = $objp->aarowid_suggest; - if ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') { + if (!empty($suggestedid) && $suggestedaccountingaccountfor<>'') { + $ischecked=1; + } elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') { $ischecked = 0; } print ''; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index aa8205bfa99..1c7871d4b1c 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -490,10 +490,18 @@ if (empty($reshook)) { $object->webservices_key = GETPOST('webservices_key', 'san_alpha'); if (GETPOSTISSET('accountancy_code_sell')) { - $object->accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha'); + if (GETPOST('accountancy_code_sell', 'int')==-1) { + $object->accountancy_code_sell = 0; + } else { + $object->accountancy_code_sell = GETPOST('accountancy_code_sell', 'int'); + } } if (GETPOSTISSET('accountancy_code_buy')) { - $object->accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha'); + if (GETPOST('accountancy_code_buy', 'int')==-1) { + $object->accountancy_code_buy = 0; + } else { + $object->accountancy_code_buy = GETPOST('accountancy_code_buy', 'int'); + } } // Incoterms From ac6e108be6e5643dfd993a7be283b64e2f97b872 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 4 Jun 2021 12:27:49 +0200 Subject: [PATCH 003/374] fix syntax --- .../class/accountingaccount.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 9f5c7799037..1827549020f 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -800,19 +800,19 @@ class AccountingAccount extends CommonObject $suggestedid = $this->accountingaccount_codetotid_cache[$code_sell_l]; } } + return array( + 'suggestedaccountingaccountbydefaultfor' => $suggestedaccountingaccountbydefaultfor, + 'suggestedaccountingaccountfor' => $suggestedaccountingaccountfor, + 'suggestedid' => $suggestedid, + 'code_sell_l' => $code_sell_l, + 'code_sell_p' => $code_sell_p, + 'code_sell_t' => $code_sell_t, + ); } else { if (is_array($hookmanager->resArray) && !empty($hookmanager->resArray)) { return $hookmanager->resArray; } } - return array( - 'suggestedaccountingaccountbydefaultfor' => $suggestedaccountingaccountbydefaultfor, - 'suggestedaccountingaccountfor' => $suggestedaccountingaccountfor, - 'suggestedid' => $suggestedid, - 'code_sell_l' => $code_sell_l, - 'code_sell_p' => $code_sell_p, - 'code_sell_t' => $code_sell_t, - ); } /** From 97287af9879675b3b4580c4ac3cc005e020ad06f Mon Sep 17 00:00:00 2001 From: jpb Date: Mon, 19 Jul 2021 14:03:03 +0200 Subject: [PATCH 004/374] add field to object product, add sql --- .../install/mysql/migration/14.0.0-15.0.0.sql | 1 + htdocs/install/mysql/tables/llx_product.sql | 4 +++- htdocs/langs/fr_FR/products.lang | 1 + htdocs/product/card.php | 23 ++++++++++++++++++- htdocs/product/class/product.class.php | 15 ++++++++++-- 5 files changed, 40 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 95de2ab7ba6..1a38da5237f 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -36,4 +36,5 @@ -- v15 +ALTER TABLE llx_product ADD COLUMN mandatory_period tinyint NULL DEFAULT 0 AFTER fk_project; diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 4aad3393137..09b71c9c5c4 100644 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -103,5 +103,7 @@ create table llx_product desiredstock float DEFAULT 0, fk_unit integer DEFAULT NULL, price_autogen tinyint DEFAULT 0, - fk_project integer DEFAULT NULL -- Used when product was generated by a project or is specifif to a project + fk_project integer DEFAULT NULL, -- Used when product was generated by a project or is specifif to a project + mandatory_period tinyint DEFAULT 0 -- is used to signal to the user that the start and end dates are mandatory for this type of product the fk_product_type == 1 (service) (non-blocking action) + )ENGINE=innodb; diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index dc308c95af2..af80e0c67a2 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -399,3 +399,4 @@ ProductSupplierExtraFields=Attributs supplémentaires (Prix fournisseur) DeleteLinkedProduct=Supprimer le produit enfant lié à la combinaison PMPValue=Prix moyen pondéré (PMP) PMPValueShort=PMP +mandatoryperiod=Période obligatoires diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 2472c764d7e..55589a967d4 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -551,7 +551,7 @@ if (empty($reshook)) { $accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha'); $accountancy_code_buy_intra = GETPOST('accountancy_code_buy_intra', 'alpha'); $accountancy_code_buy_export = GETPOST('accountancy_code_buy_export', 'alpha'); - + $checkmandatory = GETPOST('mandatoryperiod', 'alpha'); if (empty($accountancy_code_sell) || $accountancy_code_sell == '-1') { $object->accountancy_code_sell = ''; } else { @@ -582,6 +582,11 @@ if (empty($reshook)) { } else { $object->accountancy_code_buy_export = $accountancy_code_buy_export; } + if ($object->isService()){ + $object->mandatory_period = (!empty($checkmandatory)) ? 1 : 0 ; + } + + // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object); @@ -1981,6 +1986,16 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans("ProductAccountancyBuyExportCode").''; print ''; print ''; + + if ($object->isService()) { + // Mandatory period + print ''.$langs->trans("mandatoryperiod").''; + print 'mandatory_period == 1 ? ' checked="checked"' : '').' /> '; + print ''; + } + + + } } print ''; @@ -2259,6 +2274,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')." "; print ''; + + // Mandatory period + + print ''.$langs->trans("mandatoryperiod").''; + print 'mandatory_period == 1 ? ' checked="checked"' : '').' disabled/> '; + print ''; } else { if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { // Nature diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 28bf0288c7b..5222bc1a01c 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -426,6 +426,13 @@ class Product extends CommonObject public $is_object_used; + /** + * + * + * + */ + public $mandatory_period; + /** * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" @@ -476,6 +483,8 @@ class Product extends CommonObject 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), //'tosell' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')), //'tobuy' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')), + 'mandatory_period' =>array('type'=>'integer', 'label'=>'mandatory_period', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000), + ); /** @@ -1141,7 +1150,7 @@ class Product extends CommonObject $sql .= ", price_autogen = ".(!$this->price_autogen ? 0 : 1); $sql .= ", fk_price_expression = ".($this->fk_price_expression != 0 ? (int) $this->fk_price_expression : 'NULL'); $sql .= ", fk_user_modif = ".($user->id > 0 ? $user->id : 'NULL'); - + $sql .= ", mandatory_period = ".($this->mandatory_period ); // stock field is not here because it is a denormalized value from product_stock. $sql .= " WHERE rowid = ".((int) $id); @@ -2244,7 +2253,7 @@ class Product extends CommonObject $sql .= " p.price_min, p.price_min_ttc, p.price_base_type, p.cost_price, p.default_vat_code, p.tva_tx, p.recuperableonly as tva_npr, p.localtax1_tx, p.localtax2_tx, p.localtax1_type, p.localtax2_type, p.tosell,"; $sql .= " p.tobuy, p.fk_product_type, p.duration, p.fk_default_warehouse, p.seuil_stock_alerte, p.canvas, p.net_measure, p.net_measure_units, p.weight, p.weight_units,"; $sql .= " p.length, p.length_units, p.width, p.width_units, p.height, p.height_units,"; - $sql .= " p.surface, p.surface_units, p.volume, p.volume_units, p.barcode, p.fk_barcode_type, p.finished,"; + $sql .= " p.surface, p.surface_units, p.volume, p.volume_units, p.barcode, p.fk_barcode_type, p.finished,p.mandatory_period,"; if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { $sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,"; } else { @@ -2416,6 +2425,8 @@ class Product extends CommonObject $this->price_autogen = $obj->price_autogen; $this->model_pdf = $obj->model_pdf; + $this->mandatory_period = $obj->mandatory_period; + $this->db->free($resql); // fetch optionals attributes and labels From e11afb7da05cb0ad90c9169e5c42996d61f4d2f9 Mon Sep 17 00:00:00 2001 From: jpb Date: Tue, 20 Jul 2021 11:23:35 +0200 Subject: [PATCH 005/374] add color on date dield and warning on line --- htdocs/core/tpl/objectline_create.tpl.php | 23 +++++++++++++++++++++-- htdocs/core/tpl/objectline_edit.tpl.php | 18 ++++++++++++++++++ htdocs/core/tpl/objectline_view.tpl.php | 15 +++++++++++++++ htdocs/langs/fr_FR/products.lang | 1 + htdocs/product/ajax/products.php | 3 ++- htdocs/product/class/product.class.php | 10 ++++++++++ 6 files changed, 67 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index f978a436354..2a96880e04a 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -678,10 +678,10 @@ if (!empty($usemargins) && $user->rights->margins->creer) { /* When changing predefined product, we reload list of supplier prices required for margin combo */ $("#idprod, #idprodfournprice").change(function() { - console.log("Call method change() after change on #idprod or #idprodfournprice (senderissupplier=). this.val = "+$(this).val()); + console.log("Call method change() 1 after change on #idprod or #idprodfournprice (senderissupplier=). this.val = "+$(this).val()); setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva - + setColorToDateSelector($(this).val()); jQuery('#trlinefordates').show(); rights->margins->creer) { { 'id': $(this).val(), 'socid': socid; ?> }, function(data) { console.log("Load unit price end, we got value "+data.price_ht); + + + console.log(data); + console.log(jQuery("#date_start").val()); + console.log(jQuery("#date_end").val()); + // service and we setted mandatory_period to true + if (data.mandatory_period == 1 && data.type == 1 ) { + console.log("we are good to color date input"); + jQuery("#date_start").css("background-color","#f2cf87"); + jQuery("#date_end").css("background-color","#f2cf87"); + }else{ + jQuery("#date_start").css("background-color","#FFF"); + jQuery("#date_end").css("background-color","#FFF"); + } + jQuery("#price_ht").val(data.price_ht); global->PRODUIT_AUTOFILL_DESC) && $conf->global->PRODUIT_AUTOFILL_DESC == 1) { @@ -984,6 +999,10 @@ if (!empty($usemargins) && $user->rights->margins->creer) { jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").show(); jQuery("#fournprice_predef").hide(); } + function setColorToDateSelector(val){ + console.log("from function "+val); + } + function setforpredef() { console.log("Call setforpredef. We hide some fields and show dates"); jQuery("#select_type").val(-1); diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 9094daaa2d1..ea6133f8684 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -333,9 +333,19 @@ $coldisplay++; if (isset($conf->global->MAIN_DEFAULT_DATE_START_HOUR)) { print 'jQuery("#date_starthour").val("'.$conf->global->MAIN_DEFAULT_DATE_START_HOUR.'");'; } + + if (isset($conf->global->MAIN_DEFAULT_DATE_START_MIN)) { print 'jQuery("#date_startmin").val("'.$conf->global->MAIN_DEFAULT_DATE_START_MIN.'");'; } + + $res = $line->fetch_product(); + // on doit fetch le product là !!! pour connaître le type + if ($res > 0 ){ + if ($line->product->isMandatoryPeriod() && $line->product->isService()) { + print 'jQuery("#date_start").css("background-color","#f2cf87");'; + } + } } if (!$line->date_end) { if (isset($conf->global->MAIN_DEFAULT_DATE_END_HOUR)) { @@ -344,6 +354,14 @@ $coldisplay++; if (isset($conf->global->MAIN_DEFAULT_DATE_END_MIN)) { print 'jQuery("#date_endmin").val("'.$conf->global->MAIN_DEFAULT_DATE_END_MIN.'");'; } + + $res = $line->fetch_product(); + // on doit fetch le product là !!! pour connaître le type + if ($res > 0 ){ + if ($line->product->isMandatoryperiod() && $line->product->isService()) { + print 'jQuery("#date_end").css("background-color","#f2cf87");'; + } + } } print '' ?> diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 3e8ef7ea411..50575c19dc2 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -180,7 +180,22 @@ if (($line->info_bits & 2) == 2) { } else { if ($line->date_start || $line->date_end) { print '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; + } + if ((!$line->date_start && !$line->date_end) || (!$line->date_start || !$line->date_end) ){ // pas de date + // show warning under line + // we need to fetch product associated to line for some test + $res = $line->fetch_product(); + if ($res > 0 ){ + if ($line->product->isService() && $line->product->isMandatoryPeriod()){ + print '
'.$langs->trans("mandatoryPeriodNeedTobeSet").'
'; + } + } + } + + + + //print get_date_range($line->date_start, $line->date_end, $format); } diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index af80e0c67a2..7e70e5ca186 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -400,3 +400,4 @@ DeleteLinkedProduct=Supprimer le produit enfant lié à la combinaison PMPValue=Prix moyen pondéré (PMP) PMPValueShort=PMP mandatoryperiod=Période obligatoires +mandatoryPeriodNeedTobeSet=Attention périodes non saisies et obligatoires diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 77acafbbd55..9ba8d9cec09 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -91,7 +91,7 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) { $outtype = $object->type; $outqty = 1; $outdiscount = 0; - + $mandatory_period = $object->mandatory_period; $found = false; $price_level = 1; @@ -203,6 +203,7 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) { 'tva_tx' => $outtva_tx, 'qty' => $outqty, 'discount' => $outdiscount, + 'mandatory_period' => $mandatory_period, 'array_options'=>$object->array_options); } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 5222bc1a01c..1c27671ba00 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5642,6 +5642,16 @@ class Product extends CommonObject return ($this->type == Product::TYPE_SERVICE ? true : false); } + + /** + * Return if object have a constraint on mandatory_period + * + * @return boolean True if mandatory_period setted to 1 + */ + public function isMandatoryPeriod() + { + return ($this->mandatory_period == 1 ? true : false); + } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Get a barcode from the module to generate barcode values. From 367e83923909802529e670723e343e613cb8b942 Mon Sep 17 00:00:00 2001 From: jpb Date: Tue, 20 Jul 2021 13:56:30 +0200 Subject: [PATCH 006/374] change class css and behavior js --- htdocs/core/tpl/objectline_create.tpl.php | 27 +++++++++++-------- htdocs/core/tpl/objectline_edit.tpl.php | 14 +++++++--- htdocs/core/tpl/objectline_view.tpl.php | 4 +-- .../install/mysql/migration/14.0.0-15.0.0.sql | 2 +- htdocs/langs/fr_FR/products.lang | 2 +- htdocs/theme/eldy/global.inc.php | 2 +- 6 files changed, 32 insertions(+), 19 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 2a96880e04a..ecd8a47fc86 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -674,6 +674,15 @@ if (!empty($usemargins) && $user->rights->margins->creer) { + $("#date_start, #date_end").focusout(function() + { + + if ( $(this).val() == '' && !$(this).hasClass("error") ) { + $(this).addClass('error'); + }else{ + $(this).removeClass('error'); + } + }); /* When changing predefined product, we reload list of supplier prices required for margin combo */ $("#idprod, #idprodfournprice").change(function() @@ -681,7 +690,6 @@ if (!empty($usemargins) && $user->rights->margins->creer) { console.log("Call method change() 1 after change on #idprod or #idprodfournprice (senderissupplier=). this.val = "+$(this).val()); setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva - setColorToDateSelector($(this).val()); jQuery('#trlinefordates').show(); rights->margins->creer) { console.log("Load unit price end, we got value "+data.price_ht); - console.log(data); - console.log(jQuery("#date_start").val()); - console.log(jQuery("#date_end").val()); + // service and we setted mandatory_period to true if (data.mandatory_period == 1 && data.type == 1 ) { console.log("we are good to color date input"); - jQuery("#date_start").css("background-color","#f2cf87"); - jQuery("#date_end").css("background-color","#f2cf87"); + + jQuery("#date_start").addClass("error"); + jQuery("#date_end").addClass("error"); }else{ - jQuery("#date_start").css("background-color","#FFF"); - jQuery("#date_end").css("background-color","#FFF"); + jQuery("#date_start").removeClass("error"); + jQuery("#date_end").removeClass("error"); } jQuery("#price_ht").val(data.price_ht); @@ -733,6 +740,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) { if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { ?> if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") { + var editor = CKEDITOR.instances['dp_desc']; var editor = CKEDITOR.instances['dp_desc']; if (editor) { editor.setData(proddesc); @@ -999,9 +1007,6 @@ if (!empty($usemargins) && $user->rights->margins->creer) { jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").show(); jQuery("#fournprice_predef").hide(); } - function setColorToDateSelector(val){ - console.log("from function "+val); - } function setforpredef() { console.log("Call setforpredef. We hide some fields and show dates"); diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index ea6133f8684..8ef08b60660 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -340,10 +340,9 @@ $coldisplay++; } $res = $line->fetch_product(); - // on doit fetch le product là !!! pour connaître le type if ($res > 0 ){ if ($line->product->isMandatoryPeriod() && $line->product->isService()) { - print 'jQuery("#date_start").css("background-color","#f2cf87");'; + print 'jQuery("#date_start").addClass("error");'; } } } @@ -359,7 +358,7 @@ $coldisplay++; // on doit fetch le product là !!! pour connaître le type if ($res > 0 ){ if ($line->product->isMandatoryperiod() && $line->product->isService()) { - print 'jQuery("#date_end").css("background-color","#f2cf87");'; + print 'jQuery("#date_end").addClass("error");'; } } } @@ -469,6 +468,15 @@ jQuery(document).ready(function() } }); + $("#date_start, #date_end").focusout(function() + { + + if ( $(this).val() == '' && !$(this).hasClass("error") ) { + $(this).addClass('error'); + }else{ + $(this).removeClass('error'); + } + }); margin->enabled)) { ?> diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 50575c19dc2..42453df6e31 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -182,13 +182,13 @@ if (($line->info_bits & 2) == 2) { print '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; } - if ((!$line->date_start && !$line->date_end) || (!$line->date_start || !$line->date_end) ){ // pas de date + if (!$line->date_start || !$line->date_end){ // show warning under line // we need to fetch product associated to line for some test $res = $line->fetch_product(); if ($res > 0 ){ if ($line->product->isService() && $line->product->isMandatoryPeriod()){ - print '
'.$langs->trans("mandatoryPeriodNeedTobeSet").'
'; + print '
'.$langs->trans("mandatoryPeriodNeedTobeSet").'
'; } } } diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 1a38da5237f..b2f690c1d89 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -36,5 +36,5 @@ -- v15 -ALTER TABLE llx_product ADD COLUMN mandatory_period tinyint NULL DEFAULT 0 AFTER fk_project; +ALTER TABLE llx_product ADD COLUMN mandatory_period tinyint NULL DEFAULT 0; diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 7e70e5ca186..168bdf07fcf 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -399,5 +399,5 @@ ProductSupplierExtraFields=Attributs supplémentaires (Prix fournisseur) DeleteLinkedProduct=Supprimer le produit enfant lié à la combinaison PMPValue=Prix moyen pondéré (PMP) PMPValueShort=PMP -mandatoryperiod=Période obligatoires +mandatoryperiod=Périodes obligatoires mandatoryPeriodNeedTobeSet=Attention périodes non saisies et obligatoires diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index ab9ab624801..2ab774f70eb 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -234,7 +234,7 @@ input.button.massactionconfirmed { margin: 4px; } -input:invalid, select:invalid { +input:invalid, select:invalid , input.error{ border-color: #ea1212; } From 1237c5ba5544e4f570d30fb001616a48c3d69324 Mon Sep 17 00:00:00 2001 From: jpb Date: Tue, 20 Jul 2021 14:46:56 +0200 Subject: [PATCH 007/374] add msg to formconfirm on propal invoice and commande --- htdocs/comm/propal/card.php | 16 ++++++++++++++++ htdocs/commande/card.php | 15 +++++++++++++++ htdocs/compta/facture/card.php | 15 +++++++++++++++ htdocs/langs/en_US/products.lang | 3 +++ htdocs/langs/fr_FR/products.lang | 1 + 5 files changed, 50 insertions(+) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 3c0d8dd9a28..1c83e7ed962 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1958,8 +1958,24 @@ if ($action == 'create') { $notify = new Notify($db); $text .= '
'; $text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid, $object); + } + // mandatoryPeriod + $nbMandated = 0; + foreach ($object->lines as $line){ + $res = $line->fetch_product(); + if ($res > 0 ){ + if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )){ + $nbMandated++; + break; + } + } + } + if ($nbMandated > 0 ) $text .= '
'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'
'; + + + if (!$error) { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate', '', 0, 1); } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 8420a5e7f87..f6ecf217a0d 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1910,6 +1910,21 @@ if ($action == 'create' && $usercancreate) { ); } + // mandatoryPeriod + $nbMandated = 0; + foreach ($object->lines as $line){ + $res = $line->fetch_product(); + if ($res > 0 ){ + if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )){ + $nbMandated++; + break; + } + } + } + if ($nbMandated > 0 ) $text .= '
'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'
'; + + + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220); } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 699a10d3ef5..60f025efbae 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4001,6 +4001,21 @@ if ($action == 'create') { if ($object->type != Facture::TYPE_CREDIT_NOTE && $object->total_ttc < 0) { // Can happen only if $conf->global->FACTURE_ENABLE_NEGATIVE is on $text .= '
'.img_warning().' '.$langs->trans("ErrorInvoiceOfThisTypeMustBePositive"); } + + // mandatoryPeriod + $nbMandated = 0; + foreach ($object->lines as $line){ + $res = $line->fetch_product(); + if ($res > 0 ){ + if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )){ + $nbMandated++; + break; + } + } + } + if ($nbMandated > 0 ) $text .= '
'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'
'; + + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ValidateBill'), $text, 'confirm_valid', $formquestion, (($object->type != Facture::TYPE_CREDIT_NOTE && $object->total_ttc < 0) ? "no" : "yes"), 2); } diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index bf34efe3f79..5a24c2d56f8 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -399,3 +399,6 @@ ProductSupplierExtraFields=Additional Attributes (Supplier Prices) DeleteLinkedProduct=Delete the child product linked to the combination PMPValue=Weighted average price PMPValueShort=WAP +mandatoryperiod=Mandatory periods +mandatoryPeriodNeedTobeSet=Attention periods not entered and mandatory +mandatoryPeriodNeedTobeSetMsgValidate=A service requires a start and end period diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 168bdf07fcf..aa8b5a5c462 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -401,3 +401,4 @@ PMPValue=Prix moyen pondéré (PMP) PMPValueShort=PMP mandatoryperiod=Périodes obligatoires mandatoryPeriodNeedTobeSet=Attention périodes non saisies et obligatoires +mandatoryPeriodNeedTobeSetMsgValidate=Un service nécessite une période de début et de fin From dc90a62d906dde5239f88f86eb13fff118a927d8 Mon Sep 17 00:00:00 2001 From: jpb Date: Tue, 20 Jul 2021 15:18:14 +0200 Subject: [PATCH 008/374] add tooltips helper on product card --- htdocs/langs/en_US/products.lang | 1 + htdocs/langs/fr_FR/products.lang | 1 + htdocs/product/card.php | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 5a24c2d56f8..2531dd919d9 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -402,3 +402,4 @@ PMPValueShort=WAP mandatoryperiod=Mandatory periods mandatoryPeriodNeedTobeSet=Attention periods not entered and mandatory mandatoryPeriodNeedTobeSetMsgValidate=A service requires a start and end period +mandatoryHelper=Message to the user on the need to enter a start date and an end date on a service when creating / validating an invoice, commercial proposal, sales order.
This action is not blocking in the process of confirmation diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index aa8b5a5c462..e2acf31eb4d 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -402,3 +402,4 @@ PMPValueShort=PMP mandatoryperiod=Périodes obligatoires mandatoryPeriodNeedTobeSet=Attention périodes non saisies et obligatoires mandatoryPeriodNeedTobeSetMsgValidate=Un service nécessite une période de début et de fin +mandatoryHelper=Message à l'utilisateur sur la necessité de saisir une date de début et une date de fin sur un service lors de la création/validation de facture, proposition commerciale , commande client.
Cette action n'est pas bloquante dans le processus de validation diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 55589a967d4..277fec6e78f 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2279,7 +2279,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans("mandatoryperiod").''; print 'mandatory_period == 1 ? ' checked="checked"' : '').' disabled/> '; + print ''; + + $htmltooltip = '
'.$langs->trans("mandatoryHelper"); + + + print ''; + print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + } else { if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { // Nature From 2f0ba41a531cece5b8e42b4c49d0deb91d7b25a5 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 20 Jul 2021 13:35:10 +0000 Subject: [PATCH 009/374] Fixing style errors. --- htdocs/comm/propal/card.php | 7 +++---- htdocs/commande/card.php | 6 +++--- htdocs/compta/facture/card.php | 6 +++--- htdocs/core/tpl/objectline_edit.tpl.php | 4 ++-- htdocs/core/tpl/objectline_view.tpl.php | 7 +++---- htdocs/product/card.php | 6 +----- 6 files changed, 15 insertions(+), 21 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 1c83e7ed962..5cf3c640563 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1958,15 +1958,14 @@ if ($action == 'create') { $notify = new Notify($db); $text .= '
'; $text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid, $object); - } // mandatoryPeriod $nbMandated = 0; - foreach ($object->lines as $line){ + foreach ($object->lines as $line) { $res = $line->fetch_product(); - if ($res > 0 ){ - if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )){ + if ($res > 0 ) { + if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )) { $nbMandated++; break; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index f6ecf217a0d..4a8818113d5 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1912,10 +1912,10 @@ if ($action == 'create' && $usercancreate) { // mandatoryPeriod $nbMandated = 0; - foreach ($object->lines as $line){ + foreach ($object->lines as $line) { $res = $line->fetch_product(); - if ($res > 0 ){ - if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )){ + if ($res > 0 ) { + if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )) { $nbMandated++; break; } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 60f025efbae..e4391b126b7 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4004,10 +4004,10 @@ if ($action == 'create') { // mandatoryPeriod $nbMandated = 0; - foreach ($object->lines as $line){ + foreach ($object->lines as $line) { $res = $line->fetch_product(); - if ($res > 0 ){ - if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )){ + if ($res > 0 ) { + if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )) { $nbMandated++; break; } diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 8ef08b60660..642bb90403d 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -340,7 +340,7 @@ $coldisplay++; } $res = $line->fetch_product(); - if ($res > 0 ){ + if ($res > 0 ) { if ($line->product->isMandatoryPeriod() && $line->product->isService()) { print 'jQuery("#date_start").addClass("error");'; } @@ -356,7 +356,7 @@ $coldisplay++; $res = $line->fetch_product(); // on doit fetch le product là !!! pour connaître le type - if ($res > 0 ){ + if ($res > 0 ) { if ($line->product->isMandatoryperiod() && $line->product->isService()) { print 'jQuery("#date_end").addClass("error");'; } diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 42453df6e31..7d5e02f82ea 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -180,14 +180,13 @@ if (($line->info_bits & 2) == 2) { } else { if ($line->date_start || $line->date_end) { print '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; - } - if (!$line->date_start || !$line->date_end){ + if (!$line->date_start || !$line->date_end) { // show warning under line // we need to fetch product associated to line for some test $res = $line->fetch_product(); - if ($res > 0 ){ - if ($line->product->isService() && $line->product->isMandatoryPeriod()){ + if ($res > 0 ) { + if ($line->product->isService() && $line->product->isMandatoryPeriod()) { print '
'.$langs->trans("mandatoryPeriodNeedTobeSet").'
'; } } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 277fec6e78f..45b5e87121d 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -582,7 +582,7 @@ if (empty($reshook)) { } else { $object->accountancy_code_buy_export = $accountancy_code_buy_export; } - if ($object->isService()){ + if ($object->isService()) { $object->mandatory_period = (!empty($checkmandatory)) ? 1 : 0 ; } @@ -1993,9 +1993,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print 'mandatory_period == 1 ? ' checked="checked"' : '').' /> '; print ''; } - - - } } print ''; @@ -2287,7 +2284,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; - } else { if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { // Nature From f16eba1811b8b762be109449dd1f96c17e5b1b2e Mon Sep 17 00:00:00 2001 From: jpb Date: Tue, 20 Jul 2021 16:04:12 +0200 Subject: [PATCH 010/374] quick fix create product --- htdocs/product/class/product.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 1c27671ba00..f9b046e341c 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -636,7 +636,7 @@ class Product extends CommonObject // Barcode value $this->barcode = trim($this->barcode); - + $this->mandatory_period = empty($this->mandatory_period) ? 0 : $this->mandatory_period; // Check parameters if (empty($this->label)) { $this->error = 'ErrorMandatoryParametersNotProvided'; @@ -718,6 +718,7 @@ class Product extends CommonObject $sql .= ", tobatch"; $sql .= ", batch_mask"; $sql .= ", fk_unit"; + $sql .= ", mandatory_period"; $sql .= ") VALUES ("; $sql .= "'".$this->db->idate($now)."'"; $sql .= ", ".$conf->entity; @@ -746,6 +747,7 @@ class Product extends CommonObject $sql .= ", ".((empty($this->status_batch) || $this->status_batch < 0) ? '0' : $this->status_batch); $sql .= ", '".$this->db->escape($this->batch_mask)."'"; $sql .= ", ".(!$this->fk_unit ? 'NULL' : $this->fk_unit); + $sql .= ", '".$this->mandatory_period."'"; $sql .= ")"; dol_syslog(get_class($this)."::Create", LOG_DEBUG); From 875167d5937368627c5b053a8369c9a92279c526 Mon Sep 17 00:00:00 2001 From: jpb Date: Tue, 20 Jul 2021 16:17:17 +0200 Subject: [PATCH 011/374] add escape to sql --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index f9b046e341c..18413b89c30 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -747,7 +747,7 @@ class Product extends CommonObject $sql .= ", ".((empty($this->status_batch) || $this->status_batch < 0) ? '0' : $this->status_batch); $sql .= ", '".$this->db->escape($this->batch_mask)."'"; $sql .= ", ".(!$this->fk_unit ? 'NULL' : $this->fk_unit); - $sql .= ", '".$this->mandatory_period."'"; + $sql .= ", '".$this->db->escape($this->mandatory_period)."'"; $sql .= ")"; dol_syslog(get_class($this)."::Create", LOG_DEBUG); From d61b831737b585b60d0125e68c58e0f57e21da49 Mon Sep 17 00:00:00 2001 From: jpb Date: Tue, 20 Jul 2021 22:39:30 +0200 Subject: [PATCH 012/374] add field in create product --- htdocs/core/tpl/objectline_create.tpl.php | 2 -- htdocs/core/tpl/objectline_edit.tpl.php | 2 +- htdocs/product/card.php | 12 +++++++++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index ecd8a47fc86..34b6fe9ec44 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -716,8 +716,6 @@ if (!empty($usemargins) && $user->rights->margins->creer) { // service and we setted mandatory_period to true if (data.mandatory_period == 1 && data.type == 1 ) { - console.log("we are good to color date input"); - jQuery("#date_start").addClass("error"); jQuery("#date_end").addClass("error"); }else{ diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 642bb90403d..e15c489a5b6 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -341,7 +341,7 @@ $coldisplay++; $res = $line->fetch_product(); if ($res > 0 ) { - if ($line->product->isMandatoryPeriod() && $line->product->isService()) { + if ( $line->product->isMandatoryPeriod() && $line->product->isService()) { print 'jQuery("#date_start").addClass("error");'; } } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 45b5e87121d..4b5e178733d 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -106,6 +106,7 @@ $accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha'); $accountancy_code_buy_intra = GETPOST('accountancy_code_buy_intra', 'alpha'); $accountancy_code_buy_export = GETPOST('accountancy_code_buy_export', 'alpha'); +$checkmandatory = GETPOST('accountancy_code_buy_export', 'alpha'); // by default 'alphanohtml' (better security); hidden conf MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML allows basic html $label_security_check = empty($conf->global->MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML) ? 'alphanohtml' : 'restricthtml'; @@ -264,7 +265,7 @@ if (empty($reshook)) { $object->ref = $ref; $object->label = GETPOST('label', $label_security_check); $object->price_base_type = GETPOST('price_base_type', 'aZ09'); - + $object->mandatory_period = !empty(GETPOST("mandatoryperiod",'alpha')) ? 1 : 0; if ($object->price_base_type == 'TTC') { $object->price_ttc = GETPOST('price'); } else { @@ -1401,6 +1402,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print $form->load_tva("tva_tx", $defaultva, $mysoc, $mysoc, 0, 0, '', false, 1); print ''; + if (!empty($conf->service->enabled)){ + if ($object->isService()){ + // Mandatory period + print ''.$langs->trans("mandatoryperiod").''; + print ' '; + print ''; + + } + } print ''; print '
'; From 191163c7e7ec9509c1d388afe8aae654f7932e04 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 20 Jul 2021 20:41:49 +0000 Subject: [PATCH 013/374] Fixing style errors. --- htdocs/product/card.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 4b5e178733d..0f7b061fb54 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -265,7 +265,7 @@ if (empty($reshook)) { $object->ref = $ref; $object->label = GETPOST('label', $label_security_check); $object->price_base_type = GETPOST('price_base_type', 'aZ09'); - $object->mandatory_period = !empty(GETPOST("mandatoryperiod",'alpha')) ? 1 : 0; + $object->mandatory_period = !empty(GETPOST("mandatoryperiod", 'alpha')) ? 1 : 0; if ($object->price_base_type == 'TTC') { $object->price_ttc = GETPOST('price'); } else { @@ -1402,13 +1402,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print $form->load_tva("tva_tx", $defaultva, $mysoc, $mysoc, 0, 0, '', false, 1); print ''; - if (!empty($conf->service->enabled)){ - if ($object->isService()){ + if (!empty($conf->service->enabled)) { + if ($object->isService()) { // Mandatory period print ''.$langs->trans("mandatoryperiod").''; print ' '; print ''; - } } print ''; From 32f9b1a55640449211d11bfc284ffd55429f4f00 Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 21 Jul 2021 08:26:41 +0200 Subject: [PATCH 014/374] fix cmd fourn no msg --- htdocs/core/tpl/objectline_create.tpl.php | 8 ++++---- htdocs/core/tpl/objectline_view.tpl.php | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 34b6fe9ec44..ac4bbca05a0 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -68,6 +68,7 @@ if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf- if (in_array($object->element, array('propal', 'commande', 'order', 'facture', 'facturerec', 'invoice', 'supplier_proposal', 'order_supplier', 'invoice_supplier'))) { $colspan++; // With this, there is a column move button } + //print $object->element; // Lines for extrafield $objectline = null; @@ -674,16 +675,17 @@ if (!empty($usemargins) && $user->rights->margins->creer) { + +table_element_line != 'commande_fournisseurdet' || $this->table_element_line == 'facture_fourn_det') { ?> $("#date_start, #date_end").focusout(function() { - if ( $(this).val() == '' && !$(this).hasClass("error") ) { $(this).addClass('error'); }else{ $(this).removeClass('error'); } }); - + /* When changing predefined product, we reload list of supplier prices required for margin combo */ $("#idprod, #idprodfournprice").change(function() { @@ -712,8 +714,6 @@ if (!empty($usemargins) && $user->rights->margins->creer) { function(data) { console.log("Load unit price end, we got value "+data.price_ht); - - // service and we setted mandatory_period to true if (data.mandatory_period == 1 && data.type == 1 ) { jQuery("#date_start").addClass("error"); diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 7d5e02f82ea..d4a4f6a0573 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -184,12 +184,15 @@ if (($line->info_bits & 2) == 2) { if (!$line->date_start || !$line->date_end) { // show warning under line // we need to fetch product associated to line for some test + if ($object->element != 'order_supplier'){ $res = $line->fetch_product(); if ($res > 0 ) { if ($line->product->isService() && $line->product->isMandatoryPeriod()) { print '
'.$langs->trans("mandatoryPeriodNeedTobeSet").'
'; } } + } + } From c93e2cda0dea8c175c4fe1132405012b7c4ae2cc Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 21 Jul 2021 06:31:07 +0000 Subject: [PATCH 015/374] Fixing style errors. --- htdocs/core/tpl/objectline_view.tpl.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index d4a4f6a0573..5c955c56ff3 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -184,15 +184,14 @@ if (($line->info_bits & 2) == 2) { if (!$line->date_start || !$line->date_end) { // show warning under line // we need to fetch product associated to line for some test - if ($object->element != 'order_supplier'){ - $res = $line->fetch_product(); - if ($res > 0 ) { - if ($line->product->isService() && $line->product->isMandatoryPeriod()) { - print '
'.$langs->trans("mandatoryPeriodNeedTobeSet").'
'; + if ($object->element != 'order_supplier') { + $res = $line->fetch_product(); + if ($res > 0 ) { + if ($line->product->isService() && $line->product->isMandatoryPeriod()) { + print '
'.$langs->trans("mandatoryPeriodNeedTobeSet").'
'; + } } } - } - } From 62d007e232b44fb9beb968fad698bc5fb98763b4 Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 21 Jul 2021 08:56:40 +0200 Subject: [PATCH 016/374] add focusout constraint --- htdocs/core/tpl/objectline_create.tpl.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index ac4bbca05a0..9a87d89189a 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -679,10 +679,13 @@ if (!empty($usemargins) && $user->rights->margins->creer) { table_element_line != 'commande_fournisseurdet' || $this->table_element_line == 'facture_fourn_det') { ?> $("#date_start, #date_end").focusout(function() { - if ( $(this).val() == '' && !$(this).hasClass("error") ) { - $(this).addClass('error'); - }else{ - $(this).removeClass('error'); + type = $(this).attr('type'); + if (type == 1){ + if ( $(this).val() == '' && !$(this).hasClass("error") ) { + $(this).addClass('error'); + }else{ + $(this).removeClass('error'); + } } }); @@ -714,6 +717,11 @@ if (!empty($usemargins) && $user->rights->margins->creer) { function(data) { console.log("Load unit price end, we got value "+data.price_ht); + $( '#date_start').removeAttr( "type" ); + $( '#date_end' ).removeAttr( "type" ); + $('#date_start').attr('type', data.type); + $('#date_end').attr('type', data.type); + // service and we setted mandatory_period to true if (data.mandatory_period == 1 && data.type == 1 ) { jQuery("#date_start").addClass("error"); From 0396573b91f5d340779eb89b6aab0e805cce1ddf Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 21 Jul 2021 09:46:38 +0200 Subject: [PATCH 017/374] fix focusout on mandatoryPeriod only --- htdocs/core/tpl/objectline_create.tpl.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 9a87d89189a..5d3d9de4ea4 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -679,8 +679,9 @@ if (!empty($usemargins) && $user->rights->margins->creer) { table_element_line != 'commande_fournisseurdet' || $this->table_element_line == 'facture_fourn_det') { ?> $("#date_start, #date_end").focusout(function() { - type = $(this).attr('type'); - if (type == 1){ + let type = $(this).attr('type'); + let mandatoryP = $(this).attr('mandatoryperiod'); + if (type == 1 && mandatoryP == 1 ){ if ( $(this).val() == '' && !$(this).hasClass("error") ) { $(this).addClass('error'); }else{ @@ -722,6 +723,11 @@ if (!empty($usemargins) && $user->rights->margins->creer) { $('#date_start').attr('type', data.type); $('#date_end').attr('type', data.type); + $( '#date_start').removeAttr( "mandatoryperiod" ); + $( '#date_end' ).removeAttr( "mandatoryperiod" ); + $('#date_start').attr('mandatoryperiod', data.mandatory_period); + $('#date_end').attr('mandatoryperiod', data.mandatory_period); + // service and we setted mandatory_period to true if (data.mandatory_period == 1 && data.type == 1 ) { jQuery("#date_start").addClass("error"); From 252765303eadfdc39dde40fc010ca3edc423e2f2 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 21 Jul 2021 07:48:57 +0000 Subject: [PATCH 018/374] Fixing style errors. --- htdocs/core/tpl/objectline_create.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 5d3d9de4ea4..d09a3257d87 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -679,8 +679,8 @@ if (!empty($usemargins) && $user->rights->margins->creer) { table_element_line != 'commande_fournisseurdet' || $this->table_element_line == 'facture_fourn_det') { ?> $("#date_start, #date_end").focusout(function() { - let type = $(this).attr('type'); - let mandatoryP = $(this).attr('mandatoryperiod'); + let type = $(this).attr('type'); + let mandatoryP = $(this).attr('mandatoryperiod'); if (type == 1 && mandatoryP == 1 ){ if ( $(this).val() == '' && !$(this).hasClass("error") ) { $(this).addClass('error'); From 8dc316797f5e1f6c8133f2928fe4a6db620afcb3 Mon Sep 17 00:00:00 2001 From: jpb Date: Mon, 26 Jul 2021 09:15:23 +0200 Subject: [PATCH 019/374] move info to the left --- htdocs/product/card.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 0f7b061fb54..c5507180548 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2282,16 +2282,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; // Mandatory period - - print ''.$langs->trans("mandatoryperiod").''; - print 'mandatory_period == 1 ? ' checked="checked"' : '').' disabled/> '; - print ''; - $htmltooltip = '
'.$langs->trans("mandatoryHelper"); - - - print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print ''.$langs->trans("mandatoryperiod"); + print $form->textwithpicto('', $htmltooltip, 1, 0).''; + print 'mandatory_period == 1 ? ' checked="checked"' : '').' disabled/> '; print ''; } else { if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { From 04d406bd39963ea27307bf9316c7db8734f7b189 Mon Sep 17 00:00:00 2001 From: jpb Date: Thu, 5 Aug 2021 09:09:11 +0200 Subject: [PATCH 020/374] remove useless boolean statment --- htdocs/core/tpl/objectline_create.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index d09a3257d87..1b5cfff66f2 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -676,11 +676,11 @@ if (!empty($usemargins) && $user->rights->margins->creer) { } ?> -table_element_line != 'commande_fournisseurdet' || $this->table_element_line == 'facture_fourn_det') { ?> +table_element_line != 'commande_fournisseurdet') { ?> $("#date_start, #date_end").focusout(function() { let type = $(this).attr('type'); - let mandatoryP = $(this).attr('mandatoryperiod'); + let mandatoryP = $(this).attr('mandatoryperiod'); if (type == 1 && mandatoryP == 1 ){ if ( $(this).val() == '' && !$(this).hasClass("error") ) { $(this).addClass('error'); From 399a44ea20a37f88cac5615ae336dde7c8e415d5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Aug 2021 21:40:49 +0200 Subject: [PATCH 021/374] Update objectline_create.tpl.php --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 1b5cfff66f2..2c6fb585440 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -693,7 +693,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) { /* When changing predefined product, we reload list of supplier prices required for margin combo */ $("#idprod, #idprodfournprice").change(function() { - console.log("Call method change() 1 after change on #idprod or #idprodfournprice (senderissupplier=). this.val = "+$(this).val()); + console.log("Call method change() after change on #idprod or #idprodfournprice (senderissupplier=). this.val = "+$(this).val()); setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva jQuery('#trlinefordates').show(); From d9a07acfa36d2e3953cff50baf0eb77cc02f7341 Mon Sep 17 00:00:00 2001 From: jpb Date: Fri, 20 Aug 2021 14:05:22 +0200 Subject: [PATCH 022/374] remove duplicate code --- htdocs/core/tpl/objectline_create.tpl.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 1b5cfff66f2..a28143dfc41 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -752,7 +752,6 @@ if (!empty($usemargins) && $user->rights->margins->creer) { if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { ?> if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") { - var editor = CKEDITOR.instances['dp_desc']; var editor = CKEDITOR.instances['dp_desc']; if (editor) { editor.setData(proddesc); From 709a2975637759716e745943645d408e7b3f93c7 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Mon, 30 Aug 2021 14:45:42 +0200 Subject: [PATCH 023/374] NEW : Allow drag and drop on kits --- htdocs/core/ajax/row.php | 2 + htdocs/core/class/commonobject.class.php | 11 +++-- htdocs/langs/en_US/products.lang | 3 +- htdocs/langs/fr_FR/products.lang | 1 + htdocs/product/class/product.class.php | 59 +++++++++++++++++------- htdocs/product/composition/card.php | 28 +++++++++-- 6 files changed, 79 insertions(+), 25 deletions(-) diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php index 95518cbbf66..1afd5f8b206 100644 --- a/htdocs/core/ajax/row.php +++ b/htdocs/core/ajax/row.php @@ -99,6 +99,8 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3) $perm = 1; } elseif ($table_element_line == 'ecm_files' && $fk_element == 'fk_ticket' && !empty($user->rights->ticket->write)) { $perm = 1; + } elseif ($table_element_line == 'product_association' && $fk_element == 'fk_product' && !empty($user->rights->produit->creer)) { + $perm = 1; } else { $tmparray = explode('_', $table_element_line); $tmpmodule = $tmparray[0]; $tmpobject = preg_replace('/line$/', '', $tmparray[1]); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5cdb83194f4..22aa26ceb62 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3021,7 +3021,7 @@ abstract class CommonObject * * @param int $rowid Id of line * @param int $rang Position - * @return void + * @return int */ public function updateRangOfLine($rowid, $rang) { @@ -3037,10 +3037,13 @@ abstract class CommonObject dol_syslog(get_class($this)."::updateRangOfLine", LOG_DEBUG); if (!$this->db->query($sql)) { dol_print_error($this->db); + return -1; + } else { + $parameters=array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); + $action=''; + $reshook = $hookmanager->executeHooks('afterRankOfLineUpdate', $parameters, $this, $action); + return 1; } - $parameters=array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); - $action=''; - $reshook = $hookmanager->executeHooks('afterRankOfLineUpdate', $parameters, $this, $action); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index ae199f4136b..31aa253af93 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -400,4 +400,5 @@ DeleteLinkedProduct=Delete the child product linked to the combination PMPValue=Weighted average price PMPValueShort=WAP DefaultBOM=Default BOM -DefaultBOMDesc=The default BOM recommended to use to manufacture this product. This field can be set only if nature of product is '%s'. \ No newline at end of file +DefaultBOMDesc=The default BOM recommended to use to manufacture this product. This field can be set only if nature of product is '%s'. +Rank=Rank diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 013d75d2ec0..f67cfd8423d 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -399,3 +399,4 @@ ProductSupplierExtraFields=Attributs supplémentaires (Prix fournisseur) DeleteLinkedProduct=Supprimer le produit enfant lié à la combinaison PMPValue=Prix moyen pondéré (PMP) PMPValueShort=PMP +Rank=Rang diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e51c553809d..5681cf2571a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4014,22 +4014,27 @@ class Product extends CommonObject dol_print_error($this->db); return -1; } else { - $result = $this->db->query($sql); - if ($result) { - $num = $this->db->num_rows($result); - if ($num > 0) { - $this->error = "isFatherOfThis"; + //Selection of the highest row + $sql = 'SELECT MAX(rang) as max_rank FROM '.MAIN_DB_PREFIX.'product_association'; + $sql .= ' WHERE fk_product_pere = '.$id_pere; + $resql = $this->db->query($sql); + if ($resql > 0) { + $obj = $this->db->fetch_object($resql); + $rank = $obj->max_rank + 1; + //Addition of a product with the highest rank +1 + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association(fk_product_pere,fk_product_fils,qty,incdec,rang)'; + $sql .= ' VALUES ('.$id_pere.', '.$id_fils.', '.$qty.', '.$incdec.', '.$rank.')'; + if (! $this->db->query($sql)) { + dol_print_error($this->db); return -1; - } else { - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association(fk_product_pere,fk_product_fils,qty,incdec)'; - $sql .= ' VALUES ('.((int) $id_pere).', '.((int) $id_fils).', '.((float) $qty).', '.((int) $incdec).')'; - if (!$this->db->query($sql)) { - dol_print_error($this->db); - return -1; - } else { - return 1; - } } + else + { + return 1; + } + } else { + dol_print_error($this->db); + return -1; } } } @@ -4102,6 +4107,24 @@ class Product extends CommonObject return -1; } + //Updated ranks so that none are missing + $sqlrank = 'SELECT rowid, rang FROM '.MAIN_DB_PREFIX.'product_association'; + $sqlrank.= ' WHERE fk_product_pere = '.$fk_parent; + $sqlrank.= ' ORDER BY rang'; + $resqlrank = $this->db->query($sqlrank); + if ($resqlrank) { + $cpt = 0; + while ($objrank = $this->db->fetch_object($resqlrank)){ + $cpt++; + $sql = 'UPDATE '.MAIN_DB_PREFIX.'product_association'; + $sql.= ' SET rang ='.$cpt; + $sql.= ' WHERE rowid ='.$objrank->rowid; + if (! $this->db->query($sql)) { + dol_print_error($this->db); + return -1; + } + } + } return 1; } @@ -4666,12 +4689,14 @@ class Product extends CommonObject } $sql = "SELECT p.rowid, p.ref, p.label as label, p.fk_product_type,"; - $sql .= " pa.qty as qty, pa.fk_product_fils as id, pa.incdec"; + $sql .= " pa.qty as qty, pa.fk_product_fils as id, pa.incdec,"; + $sql .= " pa.rowid as fk_association, pa.rang"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p,"; $sql .= " ".MAIN_DB_PREFIX."product_association as pa"; $sql .= " WHERE p.rowid = pa.fk_product_fils"; $sql .= " AND pa.fk_product_pere = ".((int) $id); $sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens + $sql.= " ORDER BY pa.rang"; dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level, LOG_DEBUG); @@ -4698,7 +4723,9 @@ class Product extends CommonObject 2=>$rec['fk_product_type'], 3=>$this->db->escape($rec['label']), 4=>$rec['incdec'], - 5=>$rec['ref'] + 5=>$rec['ref'], + 6=>$rec['fk_association'], + 7=>$rec['rang'] ); //$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty'],2=>$rec['fk_product_type']); //$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty']); diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 000e5da6cbc..d1e59482d44 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -132,6 +132,8 @@ if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->se setEventMessages('RecordSaved', null); } $action = ''; + header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; } @@ -268,8 +270,18 @@ if ($id > 0 || !empty($ref)) { $prodsfather = $object->getFather(); // Parent Products $object->get_sousproduits_arbo(); // Load $object->sousprods + $parent_label = $object->label; $prods_arbo = $object->get_arbo_each_prod(); + $tmpid = $id; + if (! empty($conf->use_javascript_ajax)) { + $nboflines = $prods_arbo; + $table_element_line='product_association'; + + include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; + } + $id = $tmpid; + $nbofsubsubproducts = count($prods_arbo); // This include sub sub product into nb $prodschild = $object->getChildsArbo($id, 1); $nbofsubproducts = count($prodschild); // This include only first level of childs @@ -323,9 +335,10 @@ if ($id > 0 || !empty($ref)) { print ''; print ''; - print ''; + print '
'; - print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -335,6 +348,7 @@ if ($id > 0 || !empty($ref)) { } print ''; print ''; + print ''; print ''."\n"; $totalsell = 0; @@ -343,7 +357,9 @@ if ($id > 0 || !empty($ref)) { $productstatic->fetch($value['id']); if ($value['level'] <= 1) { - print ''; + print ''; + + print ''; $notdefined = 0; $nb_of_subproduct = $value['nb']; @@ -407,6 +423,8 @@ if ($id > 0 || !empty($ref)) { print ''; } + print ''; print ''."\n"; } else { $hide = ''; @@ -414,10 +432,11 @@ if ($id > 0 || !empty($ref)) { $hide = ' hideobject'; // By default, we do not show this. It makes screen very difficult to understand } - print ''; + print ''; //$productstatic->ref=$value['label']; $productstatic->ref = $value['ref']; + print ''; print ''; print ''; + print ''; print ''."\n"; } From 73b4f0df51ee6ca9b030c8436e411e0efe41587f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 30 Aug 2021 13:38:55 +0000 Subject: [PATCH 024/374] Fixing style errors. --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 5681cf2571a..27582a533bd 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4114,7 +4114,7 @@ class Product extends CommonObject $resqlrank = $this->db->query($sqlrank); if ($resqlrank) { $cpt = 0; - while ($objrank = $this->db->fetch_object($resqlrank)){ + while ($objrank = $this->db->fetch_object($resqlrank)) { $cpt++; $sql = 'UPDATE '.MAIN_DB_PREFIX.'product_association'; $sql.= ' SET rang ='.$cpt; From 317876eb0c3b6d0ed11f78c50be12dccecabf9ae Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Mon, 30 Aug 2021 15:48:22 +0200 Subject: [PATCH 025/374] NEW : Update SQL : install and migration --- htdocs/install/mysql/migration/14.0.0-15.0.0.sql | 1 + htdocs/install/mysql/tables/llx_product_association.sql | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 1d9dd28f9d7..349b7e3a617 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -57,6 +57,7 @@ ALTER TABLE llx_categorie_ticket ADD CONSTRAINT fk_categorie_ticket_categorie_ro ALTER TABLE llx_categorie_ticket ADD CONSTRAINT fk_categorie_ticket_ticket_rowid FOREIGN KEY (fk_ticket) REFERENCES llx_ticket (rowid); ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN ref_fourn varchar(128); ALTER TABLE llx_product_customer_price MODIFY COLUMN ref_customer varchar(128); +ALTER TABLE llx_product_association ADD COLUMN rang int; -- -- add action trigger INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('ORDER_SUPPLIER_CANCEL','Supplier order request canceled','Executed when a supplier order is canceled','order_supplier',13); diff --git a/htdocs/install/mysql/tables/llx_product_association.sql b/htdocs/install/mysql/tables/llx_product_association.sql index 91cc14882f1..5447446695f 100644 --- a/htdocs/install/mysql/tables/llx_product_association.sql +++ b/htdocs/install/mysql/tables/llx_product_association.sql @@ -23,6 +23,7 @@ create table llx_product_association fk_product_pere integer NOT NULL DEFAULT 0, -- id du produit maitre fk_product_fils integer NOT NULL DEFAULT 0, -- id du sous-produit qty double NULL, - incdec integer DEFAULT 1 -- when set to 1 changing stock of product will change stock of linked product too + incdec integer DEFAULT 1, -- when set to 1 changing stock of product will change stock of linked product too + range integer, )ENGINE=innodb; From 7794a01a0b3fe65e46518276675b3d56e2b6df32 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Mon, 30 Aug 2021 15:51:59 +0200 Subject: [PATCH 026/374] FIX : Stickler-ci --- htdocs/product/class/product.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 27582a533bd..c41228bbd4a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4027,9 +4027,7 @@ class Product extends CommonObject if (! $this->db->query($sql)) { dol_print_error($this->db); return -1; - } - else - { + } else { return 1; } } else { From 08364d249247682d2c270d0dd99184e3ff315a0e Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Mon, 30 Aug 2021 16:08:07 +0200 Subject: [PATCH 027/374] FIX : Travis --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c41228bbd4a..82bf28cb7ca 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4023,7 +4023,7 @@ class Product extends CommonObject $rank = $obj->max_rank + 1; //Addition of a product with the highest rank +1 $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association(fk_product_pere,fk_product_fils,qty,incdec,rang)'; - $sql .= ' VALUES ('.$id_pere.', '.$id_fils.', '.$qty.', '.$incdec.', '.$rank.')'; + $sql .= ' VALUES ('.$id_pere.', '.$id_fils.', '.$this->db->escape($qty).', '.$incdec.', '.$rank.')'; if (! $this->db->query($sql)) { dol_print_error($this->db); return -1; From fb183f4f5d45e928ac898fa5e758f834f6fe5b34 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Mon, 30 Aug 2021 16:13:51 +0200 Subject: [PATCH 028/374] FIX : Travis --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 82bf28cb7ca..4d8990a12f1 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4023,7 +4023,7 @@ class Product extends CommonObject $rank = $obj->max_rank + 1; //Addition of a product with the highest rank +1 $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association(fk_product_pere,fk_product_fils,qty,incdec,rang)'; - $sql .= ' VALUES ('.$id_pere.', '.$id_fils.', '.$this->db->escape($qty).', '.$incdec.', '.$rank.')'; + $sql .= ' VALUES ('.$id_pere.', '.$id_fils.', '.$qty.', '.$incdec.', '.$this->db->escape($rank).')'; if (! $this->db->query($sql)) { dol_print_error($this->db); return -1; From f44ae62eb34b2fe794f901013eb20f95311f369d Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Mon, 30 Aug 2021 16:59:09 +0200 Subject: [PATCH 029/374] FIX : Travis --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 4d8990a12f1..bc348925244 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4107,7 +4107,7 @@ class Product extends CommonObject //Updated ranks so that none are missing $sqlrank = 'SELECT rowid, rang FROM '.MAIN_DB_PREFIX.'product_association'; - $sqlrank.= ' WHERE fk_product_pere = '.$fk_parent; + $sqlrank.= ' WHERE fk_product_pere = '.$this->db->escape($fk_parent); $sqlrank.= ' ORDER BY rang'; $resqlrank = $this->db->query($sqlrank); if ($resqlrank) { From 58845082b1a861e2d643350801ee8e14eb7cd5a0 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Mon, 30 Aug 2021 17:20:50 +0200 Subject: [PATCH 030/374] FIX : Travis --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index bc348925244..508059e9e34 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4116,7 +4116,7 @@ class Product extends CommonObject $cpt++; $sql = 'UPDATE '.MAIN_DB_PREFIX.'product_association'; $sql.= ' SET rang ='.$cpt; - $sql.= ' WHERE rowid ='.$objrank->rowid; + $sql.= ' WHERE rowid ='.$this->db->escape($objrank->rowid); if (! $this->db->query($sql)) { dol_print_error($this->db); return -1; From a733628e10b1259610f26312834d69022c7b71a9 Mon Sep 17 00:00:00 2001 From: Erik van Berkum Date: Tue, 31 Aug 2021 08:13:15 +0900 Subject: [PATCH 031/374] Fix: select products in BOM, when adding new item the $conf->product->limit_size blocks loading all --- htdocs/bom/tpl/objectline_create.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index 210ab695ec8..52cea154c0f 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -100,9 +100,9 @@ if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { $statustoshow = -1; if (!empty($conf->global->ENTREPOT_EXTRA_STATUS)) { // hide products in closed warehouse, but show products for internal transfer - $form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); + $form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, 0, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); } else { - $form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); + $form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, 0, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); } echo ''; From ef2bb99476090a7600d19fc2ef71c10b4d46af35 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Sep 2021 16:29:08 +0200 Subject: [PATCH 032/374] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 22aa26ceb62..70effea53b3 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3021,7 +3021,7 @@ abstract class CommonObject * * @param int $rowid Id of line * @param int $rang Position - * @return int + * @return int <0 if KO, >0 if OK */ public function updateRangOfLine($rowid, $rang) { From 3b236f677d68031c6e2e3597d512bc9b3d45fa30 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Sep 2021 16:31:16 +0200 Subject: [PATCH 033/374] Update llx_product_association.sql --- htdocs/install/mysql/tables/llx_product_association.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_product_association.sql b/htdocs/install/mysql/tables/llx_product_association.sql index 5447446695f..f97e2aa6a0b 100644 --- a/htdocs/install/mysql/tables/llx_product_association.sql +++ b/htdocs/install/mysql/tables/llx_product_association.sql @@ -24,6 +24,6 @@ create table llx_product_association fk_product_fils integer NOT NULL DEFAULT 0, -- id du sous-produit qty double NULL, incdec integer DEFAULT 1, -- when set to 1 changing stock of product will change stock of linked product too - range integer, + rang integer DEFAULT 0 )ENGINE=innodb; From 4b7b54e196f8d07246d4d73bb199129182a6dbcd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Sep 2021 16:32:25 +0200 Subject: [PATCH 034/374] Update 14.0.0-15.0.0.sql --- htdocs/install/mysql/migration/14.0.0-15.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 349b7e3a617..cd6cbeae3e6 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -57,7 +57,7 @@ ALTER TABLE llx_categorie_ticket ADD CONSTRAINT fk_categorie_ticket_categorie_ro ALTER TABLE llx_categorie_ticket ADD CONSTRAINT fk_categorie_ticket_ticket_rowid FOREIGN KEY (fk_ticket) REFERENCES llx_ticket (rowid); ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN ref_fourn varchar(128); ALTER TABLE llx_product_customer_price MODIFY COLUMN ref_customer varchar(128); -ALTER TABLE llx_product_association ADD COLUMN rang int; +ALTER TABLE llx_product_association ADD COLUMN rang integer DEFAULT 0; -- -- add action trigger INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('ORDER_SUPPLIER_CANCEL','Supplier order request canceled','Executed when a supplier order is canceled','order_supplier',13); From cda25b711542d13eeef178748b7ea1f40735f9b5 Mon Sep 17 00:00:00 2001 From: Erik van Berkum Date: Fri, 3 Sep 2021 10:41:33 +0900 Subject: [PATCH 035/374] Previous commit was not a bug --- htdocs/bom/tpl/objectline_create.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index 52cea154c0f..210ab695ec8 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -100,9 +100,9 @@ if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { $statustoshow = -1; if (!empty($conf->global->ENTREPOT_EXTRA_STATUS)) { // hide products in closed warehouse, but show products for internal transfer - $form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, 0, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); + $form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); } else { - $form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, 0, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); + $form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); } echo ''; From 9d89e48d154276396e0dcd1c217cfa59577ac7df Mon Sep 17 00:00:00 2001 From: Julien Gainza Date: Mon, 6 Sep 2021 15:55:33 +0200 Subject: [PATCH 036/374] Fix : Add extrafields on API "get events list" --- htdocs/comm/action/class/api_agendaevents.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index d9feb4472b6..bf35ed95be0 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -171,6 +171,7 @@ class AgendaEvents extends DolibarrApi $obj = $db->fetch_object($result); $actioncomm_static = new ActionComm($db); if ($actioncomm_static->fetch($obj->rowid)) { + $actioncomm_static->fetch_optionals(); $obj_ret[] = $this->_cleanObjectDatas($actioncomm_static); } $i++; From a39f469a503de75d5404d1e4faf7a9e8d0f952d9 Mon Sep 17 00:00:00 2001 From: Laurent Dinclaux Date: Tue, 7 Sep 2021 22:31:09 +1100 Subject: [PATCH 037/374] Only check takepos configuration if a terminal is choosen, to prevent error message --- htdocs/takepos/index.php | 51 +++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 1ddab39dcbe..61edb446963 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -978,36 +978,39 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { query($sql); -$paiementsModes = array(); -if ($resql) { - while ($obj = $db->fetch_object($resql)) { - $paycode = $obj->code; - if ($paycode == 'LIQ') { - $paycode = 'CASH'; - } - if ($paycode == 'CHQ') { - $paycode = 'CHEQUE'; - } + $resql = $db->query( $sql ); + $paiementsModes = array(); + if ( $resql ) { + while ( $obj = $db->fetch_object( $resql ) ) { + $paycode = $obj->code; + if ( $paycode == 'LIQ' ) { + $paycode = 'CASH'; + } + if ( $paycode == 'CHQ' ) { + $paycode = 'CHEQUE'; + } - $constantforkey = "CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION["takeposterminal"]; - //var_dump($constantforkey.' '.$conf->global->$constantforkey); - if (!empty($conf->global->$constantforkey) && $conf->global->$constantforkey > 0) { - array_push($paiementsModes, $obj); + $constantforkey = "CASHDESK_ID_BANKACCOUNT_" . $paycode . $_SESSION["takeposterminal"]; + //var_dump($constantforkey.' '.$conf->global->$constantforkey); + if ( ! empty( $conf->global->$constantforkey ) && $conf->global->$constantforkey > 0 ) { + array_push( $paiementsModes, $obj ); + } } } + + if ( empty( $paiementsModes ) ) { + $langs->load( 'errors' ); + setEventMessages( $langs->trans( "ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv( "TakePOS" ) ), null, 'errors' ); + setEventMessages( $langs->trans( "ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"] ), null, 'errors' ); + } } -if (empty($paiementsModes)) { - $langs->load('errors'); - setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("TakePOS")), null, 'errors'); - setEventMessages($langs->trans("ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"]), null, 'errors'); -} if (count($maincategories) == 0) { if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) { $tmpcategory = new Categorie($db); From 807b4bf93e8b9662a4c393ba62191895087915ea Mon Sep 17 00:00:00 2001 From: Laurent Dinclaux Date: Tue, 7 Sep 2021 22:42:17 +1100 Subject: [PATCH 038/374] Fix cash payment in some cases. Make pay requests language independant and rely on payment method code. --- htdocs/takepos/invoice.php | 6 ++---- htdocs/takepos/pay.php | 15 +++------------ 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 0c00fcdd938..4130ac5c3cb 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -188,11 +188,9 @@ if ($action == 'valid' && $user->rights->facture->creer) { if (!empty($conf->global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) { $bankaccount = GETPOST('accountid', 'int'); } else { - if ($pay == "cash") { + if ($pay == 'LIQ') { $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]}; // For backward compatibility - } elseif ($pay == "card") { - $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$_SESSION["takeposterminal"]}; // For backward compatibility - } elseif ($pay == "cheque") { + } elseif ($pay == "CHQ") { $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]}; // For backward compatibility } else { $accountname = "CASHDESK_ID_BANKACCOUNT_".$pay.$_SESSION["takeposterminal"]; diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index ba8ac8f82f7..6e22f27f7ff 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -316,23 +316,20 @@ print ''; + print ''; } else { print ''; } @@ -345,23 +342,20 @@ print ''; + print ''; } else { $button = array_pop($action_buttons); print ''; @@ -375,23 +369,20 @@ print ''; + print ''; } else { $button = array_pop($action_buttons); print ''; From c8af143468460be7a252412a89b5ac282fd1d429 Mon Sep 17 00:00:00 2001 From: Laurent Dinclaux Date: Tue, 7 Sep 2021 23:27:31 +1100 Subject: [PATCH 039/374] Fix coding standards --- htdocs/takepos/index.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 61edb446963..415281af65d 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -978,36 +978,36 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { query( $sql ); + $resql = $db->query($sql); $paiementsModes = array(); - if ( $resql ) { - while ( $obj = $db->fetch_object( $resql ) ) { + if ($resql) { + while ( $obj = $db->fetch_object($resql) ) { $paycode = $obj->code; - if ( $paycode == 'LIQ' ) { + if ($paycode == 'LIQ') { $paycode = 'CASH'; } - if ( $paycode == 'CHQ' ) { + if ($paycode == 'CHQ') { $paycode = 'CHEQUE'; } $constantforkey = "CASHDESK_ID_BANKACCOUNT_" . $paycode . $_SESSION["takeposterminal"]; //var_dump($constantforkey.' '.$conf->global->$constantforkey); - if ( ! empty( $conf->global->$constantforkey ) && $conf->global->$constantforkey > 0 ) { - array_push( $paiementsModes, $obj ); + if ( ! empty($conf->global->$constantforkey) && $conf->global->$constantforkey > 0) { + array_push($paiementsModes, $obj); } } } - if ( empty( $paiementsModes ) ) { - $langs->load( 'errors' ); - setEventMessages( $langs->trans( "ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv( "TakePOS" ) ), null, 'errors' ); - setEventMessages( $langs->trans( "ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"] ), null, 'errors' ); + if (empty($paiementsModes)) { + $langs->load('errors'); + setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("TakePOS")), null, 'errors'); + setEventMessages($langs->trans("ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"]), null, 'errors'); } } From ff74fbdf16cf0a3e37d904833f63ebbc8600c4c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Sep 2021 02:37:47 +0200 Subject: [PATCH 040/374] Update card.php --- htdocs/comm/propal/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 6fa4f60a01c..1ed4527fc1b 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1983,9 +1983,9 @@ if ($action == 'create') { } } } - if ($nbMandated > 0 ) $text .= '
'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'
'; - - + if ($nbMandated > 0) { + $text .= '
'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'
'; + } if (!$error) { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate', '', 0, 1); From 91e624fd5d6b62d868d9ec29b69cdc5c8108bad1 Mon Sep 17 00:00:00 2001 From: jpb Date: Thu, 9 Sep 2021 10:14:39 +0200 Subject: [PATCH 041/374] change test --- htdocs/core/tpl/objectline_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index e732d271a48..41c9b198c1a 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -185,7 +185,7 @@ if (($line->info_bits & 2) == 2) { if (!$line->date_start || !$line->date_end) { // show warning under line // we need to fetch product associated to line for some test - if ($object->element != 'order_supplier') { + if ($object->element == 'propal' || $object->element == 'order' || $object->element == 'propal_supplier' || $object->element == 'supplier_proposal' || $object->element == 'commande') { $res = $line->fetch_product(); if ($res > 0 ) { if ($line->product->isService() && $line->product->isMandatoryPeriod()) { From dd7f6b6a5cd6f08224ef93646632480c8890490b Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 9 Sep 2021 08:17:52 +0000 Subject: [PATCH 042/374] Fixing style errors. --- htdocs/core/tpl/objectline_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 41c9b198c1a..d9b36253d85 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -185,7 +185,7 @@ if (($line->info_bits & 2) == 2) { if (!$line->date_start || !$line->date_end) { // show warning under line // we need to fetch product associated to line for some test - if ($object->element == 'propal' || $object->element == 'order' || $object->element == 'propal_supplier' || $object->element == 'supplier_proposal' || $object->element == 'commande') { + if ($object->element == 'propal' || $object->element == 'order' || $object->element == 'propal_supplier' || $object->element == 'supplier_proposal' || $object->element == 'commande') { $res = $line->fetch_product(); if ($res > 0 ) { if ($line->product->isService() && $line->product->isMandatoryPeriod()) { From e7eb17177db432f54856897f2d1e7d97b8ebc0ea Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 10 Sep 2021 15:52:54 +0200 Subject: [PATCH 043/374] merge --- .../class/accountingaccount.class.php | 101 ------------------ 1 file changed, 101 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index ff9dcf14cdb..7ec07d1f15b 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -449,38 +449,6 @@ class AccountingAccount extends CommonObject } } - /** - * Check usage of accounting code - * - * @return int <0 if KO, >0 if OK - */ - public function checkUsage() - { - global $langs; - - $sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet"; - $sql .= " WHERE fk_code_ventilation=" . $this->id . ")"; - $sql .= "UNION"; - $sql .= " (SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facture_fourn_det"; - $sql .= " WHERE fk_code_ventilation=" . $this->id . ")"; - - dol_syslog(get_class($this) . "::checkUsage sql=" . $sql, LOG_DEBUG); - $resql = $this->db->query($sql); - - if ($resql) { - $num = $this->db->num_rows($resql); - if ($num > 0) { - $this->error = $langs->trans('ErrorAccountancyCodeIsAlreadyUse'); - return 0; - } else { - return 1; - } - } else { - $this->error = $this->db->lasterror(); - return -1; - } - } - /** * Return clicable name (with picto eventually) * @@ -915,73 +883,4 @@ class AccountingAccount extends CommonObject } } } - - /** - * Load record in memory - * - * @param int $rowid Id - * @param string $account_number Account number - * @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active char of account - * @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC' (better and faster than previous parameter if you have chart of account code). - * @return int <0 if KO, 0 if not found, Id of record if OK and found - */ - public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0, $limittoachartaccount = '') - { - global $conf; - - if ($rowid || $account_number) { - $sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.account_number, a.account_parent, a.label, a.labelshort, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active, a.reconcilable"; - $sql .= ", ca.label as category_label"; - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as a"; - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_accounting_category as ca ON a.fk_accounting_category = ca.rowid"; - $sql .= " WHERE"; - if ($rowid) { - $sql .= " a.rowid = " . (int) $rowid; - } elseif ($account_number) { - $sql .= " a.account_number = '" . $this->db->escape($account_number) . "'"; - $sql .= " AND a.entity = " . $conf->entity; - } - if (!empty($limittocurrentchart)) { - $sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $this->db->escape($conf->global->CHARTOFACCOUNTS) . ')'; - } - if (!empty($limittoachartaccount)) { - $sql .= " AND a.fk_pcg_version = '" . $this->db->escape($limittoachartaccount) . "'"; - } - - dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) { - $obj = $this->db->fetch_object($result); - - if ($obj) { - $this->id = $obj->rowid; - $this->rowid = $obj->rowid; - $this->ref = $obj->account_number; - $this->datec = $obj->datec; - $this->tms = $obj->tms; - $this->fk_pcg_version = $obj->fk_pcg_version; - $this->pcg_type = $obj->pcg_type; - $this->account_number = $obj->account_number; - $this->account_parent = $obj->account_parent; - $this->label = $obj->label; - $this->labelshort = $obj->labelshort; - $this->account_category = $obj->fk_accounting_category; - $this->account_category_label = $obj->category_label; - $this->fk_user_author = $obj->fk_user_author; - $this->fk_user_modif = $obj->fk_user_modif; - $this->active = $obj->active; - $this->status = $obj->active; - $this->reconcilable = $obj->reconcilable; - - return $this->id; - } else { - return 0; - } - } else { - $this->error = "Error " . $this->db->lasterror(); - $this->errors[] = "Error " . $this->db->lasterror(); - } - } - return -1; - } } From 324af09415a2881ccc9e73181fd31081ba840df5 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 13 Sep 2021 15:57:21 +0200 Subject: [PATCH 044/374] Close #18692 : Possibility to move directories in ecm --- htdocs/ecm/class/htmlecm.form.class.php | 20 +++++++++++------- htdocs/ecm/dir_card.php | 28 +++++++++++++++++++------ htdocs/langs/en_US/ecm.lang | 2 ++ htdocs/langs/fr_FR/ecm.lang | 2 ++ 4 files changed, 39 insertions(+), 13 deletions(-) diff --git a/htdocs/ecm/class/htmlecm.form.class.php b/htdocs/ecm/class/htmlecm.form.class.php index 4b9d0a847f2..7d695ce023d 100644 --- a/htdocs/ecm/class/htmlecm.form.class.php +++ b/htdocs/ecm/class/htmlecm.form.class.php @@ -55,9 +55,10 @@ class FormEcm * @param int $selected Id of preselected section * @param string $select_name Name of HTML select component * @param string $module Module ('ecm', 'medias', ...) + * @param array $ignore_id Arroy of id to ignore * @return string String with HTML select */ - public function selectAllSections($selected = 0, $select_name = '', $module = 'ecm') + public function selectAllSections($selected = 0, $select_name = '', $module = 'ecm', $ignore_id = array()) { global $conf, $langs; $langs->load("ecm"); @@ -65,6 +66,9 @@ class FormEcm if ($select_name == '') { $select_name = "catParent"; } + if (!is_array($ignore_id)) { + $ignore_id = array($ignore_id); + } $cate_arbo = null; if ($module == 'ecm') { @@ -83,13 +87,15 @@ class FormEcm } else { $output .= ''; foreach ($cate_arbo as $key => $value) { - $valueforoption = empty($cate_arbo[$key]['id']) ? $cate_arbo[$key]['relativename'] : $cate_arbo[$key]['id']; - if ($selected && $valueforoption == $selected) { - $add = 'selected '; - } else { - $add = ''; + if (!in_array($cate_arbo[$key]['id'], $ignore_id)) { + $valueforoption = empty($cate_arbo[$key]['id']) ? $cate_arbo[$key]['relativename'] : $cate_arbo[$key]['id']; + if ($selected && $valueforoption == $selected) { + $add = 'selected '; + } else { + $add = ''; + } + $output .= ''; } - $output .= ''; } } } diff --git a/htdocs/ecm/dir_card.php b/htdocs/ecm/dir_card.php index fec8151728e..b6aa59720ae 100644 --- a/htdocs/ecm/dir_card.php +++ b/htdocs/ecm/dir_card.php @@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/ecm/class/htmlecm.form.class.php'; // Load translation files required by page $langs->loadLangs(array('ecm', 'companies', 'other')); @@ -204,6 +205,12 @@ if ($action == 'update' && !GETPOST('cancel', 'alpha') && $permtoadd) { // Fetch was already done $ecmdir->label = dol_sanitizeFileName(GETPOST("label")); + $fk_parent = GETPOST("catParent", 'int'); + if ($fk_parent == "-1") { + $ecmdir->fk_parent = "0"; + } else { + $ecmdir->fk_parent = $fk_parent; + } $ecmdir->description = GETPOST("description"); $ret = $extrafields->setOptionalsFromPost(null, $ecmdir); if ($ret < 0) { @@ -219,8 +226,10 @@ if ($action == 'update' && !GETPOST('cancel', 'alpha') && $permtoadd) { } $result = $ecmdir->update($user); if ($result > 0) { + $newdir = $ecmdir->getRelativePath(1); + $newdir = $conf->ecm->dir_output.'/'.$newdir; // Try to rename file if changed - if ($oldlabel != $ecmdir->label && file_exists($olddir)) { + if (($oldlabel != $ecmdir->label && file_exists($olddir)) || ($olddir != $newdir && file_exists($olddir))) { $newdir = $ecmdir->getRelativePath(1); // return "xxx/zzz/" from ecm directory $newdir = $conf->ecm->dir_output.'/'.$newdir; //print $olddir.'-'.$newdir; @@ -270,6 +279,7 @@ if ($action == 'update' && !GETPOST('cancel', 'alpha') && $permtoadd) { */ $form = new Form($db); +$formecm = new FormEcm($db); $object = new EcmDirectory($db); // Need to create a new one instance $extrafields = new ExtraFields($db); @@ -317,11 +327,7 @@ if ($module == 'ecm') { $tmpecmdir->fetch($ecmdir->id); while ($tmpecmdir && $result > 0) { $tmpecmdir->ref = $tmpecmdir->label; - if ($i == 0 && $action == 'edit') { - $s = ''; - } else { - $s = $tmpecmdir->getNomUrl(1).$s; - } + $s = $tmpecmdir->getNomUrl(1).$s; if ($tmpecmdir->fk_parent) { $s = ' -> '.$s; $result = $tmpecmdir->fetch($tmpecmdir->fk_parent); @@ -371,6 +377,16 @@ print img_picto('','object_dir').' '.$l print $s; print '';*/ if ($module == 'ecm') { + if ($action == 'edit') { + print '
'; + print ''; + } + print '' . "\n"; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index d7bf9b3d565..9aef4c18ed2 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1835,7 +1835,7 @@ if ($source == 'organizedeventregistration') { print ''."\n"; From 0c0ef7b6839e62fe53412f76853f52b3c1451a02 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Sep 2021 20:56:14 +0200 Subject: [PATCH 060/374] Debug module event organization --- .../class/conferenceorbooth.class.php | 4 ++-- .../class/conferenceorboothattendee.class.php | 4 ++-- .../conferenceorboothattendee_card.php | 3 ++- .../conferenceorboothattendee_list.php | 15 ++++++++++----- htdocs/modulebuilder/template/myobject_list.php | 6 ++++-- .../eventorganization/attendee_register.php | 6 +++++- 6 files changed, 25 insertions(+), 13 deletions(-) diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index e1af900371d..8d12fcd4da5 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -106,8 +106,8 @@ class ConferenceOrBooth extends ActionComm 'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'help'=>"Help text", 'showoncombobox'=>'1',), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'maxwidth500'), - 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>'1', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), + 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>'1', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), 'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1), 'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width300'), 'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'2',), diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index f619b5459c3..4cb5cfc7cea 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -103,9 +103,9 @@ class ConferenceOrBoothAttendee extends CommonObject public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'comment'=>"Reference of object"), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'Attendee', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'maxwidth500'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'Attendee', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), 'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'), - 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project'), + 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), 'email' => array('type'=>'mail', 'label'=>'Email', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'index'=>1,), 'date_subscription' => array('type'=>'datetime', 'label'=>'DateOfRegistration', 'enabled'=>'1', 'position'=>56, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'1',), 'amount' => array('type'=>'price', 'label'=>'AmountPaid', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>1, 'default'=>'null', 'isameasure'=>'1', 'help'=>"AmountOfSubscriptionPaid",), diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 4206b802be3..bae8da29d24 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -48,7 +48,7 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); $conf_or_booth_id = GETPOST('conforboothid', 'int'); $fk_project = GETPOST('fk_project', 'int'); -$withproject = GETPOST('withproject', 'int'); +$withproject = 1; // Initialize technical objects $object = new ConferenceOrBoothAttendee($db); @@ -65,6 +65,7 @@ if ($conf_or_booth_id > 0) { } else { $object->fk_actioncomm = $confOrBooth->id; $object->fk_project = $confOrBooth->fk_project; + $fk_project = $object->fk_project; } } diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index d51a9014afb..10cbd33378b 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -646,22 +646,25 @@ if ($limit > 0 && $limit != $conf->liste_limit) { foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { foreach ($search[$key] as $skey) { - $param .= '&search_'.$key.'[]='.urlencode($skey); + if ($skey != '') { + $param .= '&search_'.$key.'[]='.urlencode($skey); + } } - } else { + } elseif ($search[$key] != '') { $param .= '&search_'.$key.'='.urlencode($search[$key]); } } if ($confOrBooth->id > 0) { - $param .= '&conforboothid='.urlencode($confOrBooth->id).$withProjectUrl; + $param .= '&conforboothid='.urlencode($confOrBooth->id); } if ($projectstatic->id > 0) { - $param .= '&fk_project='.urlencode($projectstatic->id).$withProjectUrl; + $param .= '&fk_project='.urlencode($projectstatic->id); } - +$param .= $withProjectUrl; if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } + // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Add $param from hooks @@ -694,6 +697,8 @@ print ''; print ''; print ''; print ''; +print ''; +print ''; $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.(empty($confOrBooth->id) ? '' : '&conforboothid='.$confOrBooth->id).$withProjectUrl), '', $permissiontoadd); diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 2d7b89505bf..3a0237dd144 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -414,9 +414,11 @@ if ($limit > 0 && $limit != $conf->liste_limit) { foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { foreach ($search[$key] as $skey) { - $param .= '&search_'.$key.'[]='.urlencode($skey); + if ($skey != '') { + $param .= '&search_'.$key.'[]='.urlencode($skey); + } } - } else { + } elseif ($search[$key] != '') { $param .= '&search_'.$key.'='.urlencode($search[$key]); } } diff --git a/htdocs/public/eventorganization/attendee_register.php b/htdocs/public/eventorganization/attendee_register.php index e8909d91814..2a207877c01 100644 --- a/htdocs/public/eventorganization/attendee_register.php +++ b/htdocs/public/eventorganization/attendee_register.php @@ -493,9 +493,13 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen $confattendee->error = $facture->error; $confattendee->errors = $facture->errors; $error++; - } else { + } + + /* + if (!$error) { $facture->add_object_linked($confattendee->element, $confattendee->id); } + */ } if (!$error) { From ae028baea147f81d096c0fc3ae516bc373887f5b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Sep 2021 21:12:29 +0200 Subject: [PATCH 061/374] Debug module event organization --- .../class/conferenceorboothattendee.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 4cb5cfc7cea..8f75fd63a0d 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -103,10 +103,10 @@ class ConferenceOrBoothAttendee extends CommonObject public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'comment'=>"Reference of object"), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'Attendee', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), - 'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'), - 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), - 'email' => array('type'=>'mail', 'label'=>'Email', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'index'=>1,), + 'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'), + 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), + 'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1,), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), 'date_subscription' => array('type'=>'datetime', 'label'=>'DateOfRegistration', 'enabled'=>'1', 'position'=>56, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'1',), 'amount' => array('type'=>'price', 'label'=>'AmountPaid', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>1, 'default'=>'null', 'isameasure'=>'1', 'help'=>"AmountOfSubscriptionPaid",), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,), From bf173fdbf15d1a429b71c77073d0a07591586a69 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Sep 2021 21:19:16 +0200 Subject: [PATCH 062/374] Debug module event organization --- .../conferenceorboothattendee_card.php | 40 ++++++++++++------- .../conferenceorboothattendee_list.php | 4 +- .../modulebuilder/template/myobject_list.php | 2 +- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index bae8da29d24..666a256534d 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -75,12 +75,24 @@ $extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); // Initialize array of search criterias -$search_all = GETPOST("search_all", 'alpha'); +$search_all = GETPOST('search_all', 'alphanohtml'); $search = array(); foreach ($object->fields as $key => $val) { - if (GETPOST('search_'.$key, 'alpha')) { + if (GETPOST('search_'.$key, 'alpha') !== '') { $search[$key] = GETPOST('search_'.$key, 'alpha'); } + if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { + $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int')); + $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int')); + } +} + +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array(); +foreach ($object->fields as $key => $val) { + if (!empty($val['searchall'])) { + $fieldstosearchall['t.'.$key] = $val['label']; + } } if (empty($action) && empty($id) && empty($ref)) { @@ -175,8 +187,6 @@ if (empty($reshook)) { /* * View - * - * Put here all code to build page */ $form = new Form($db); @@ -306,7 +316,7 @@ if (!empty($withproject)) { print '
'; print '
'; - print '
'.$langs->trans('Rank').''.$langs->trans('ComposedProduct').''.$langs->trans('Label').''.$langs->trans('MinSupplierPrice').''.$langs->trans('Qty').''.$langs->trans('ComposedProductIncDecStock').'
'.$object->sousprods[$parent_label][$value['id']][7].''.($value['incdec'] == 1 ? 'x' : '').''; + print '
'; for ($i = 0; $i < $value['level']; $i++) { print '     '; // Add indentation @@ -437,6 +456,7 @@ if ($id > 0 || !empty($ref)) { } print ''.$value['nb'].'  
'.$langs->trans("ECMDirName").''; + print ''; + print '
'.$langs->trans("ECMParentDirectory").''; + print $formecm->selectAllSections($ecmdir->fk_parent, '', 'ecm', array($ecmdir->id)); + print ''; + print '
'.$langs->trans("Description").''; if ($action == 'edit') { print '
'.$langs->trans("Attendee"); print ''; print $attendee->email; - print ($thirdparty->name ? ' ('.$thirdparty->name.')' : ''); + print ($thirdparty->name ? ' ('.$langs->trans("Company").' '.$thirdparty->name.')' : ''); print ''; print '
'; + print '
'; // Description print '"; } - print '"; print '"; - + print '"; - + print ''; - print ''; + print ''; + print ''; + print ''; - // Label - print ''; - print ''; + print '
'; - // Project - if (empty($withproject)) { - print '
'; + print dol_get_fiche_end(); - // Third party - print ''; + print '
'; + } + + /* + * Actions + */ + /*print '
'; + */ + + // To verify role of users + //$userAccess = $projectstatic->restrictedProjectArea($user); // We allow task affected to user even if a not allowed project + //$arrayofuseridoftask=$object->getListContactId('internal'); + + $head = task_prepare_head($object); + + if ($action == 'edit' && $user->rights->projet->creer) { + print ''; + print ''; + print ''; + print ''; + print ''; + + print dol_get_fiche_head($head, 'task_task', $langs->trans("Task"), 0, 'projecttask', 0, '', ''); + + print '
'.$langs->trans("Description").''; @@ -320,7 +330,7 @@ if (!empty($withproject)) { print "
'; + print '
'; $typeofdata = 'checkbox:'.($projectstatic->accept_conference_suggestions ? ' checked="checked"' : ''); $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); @@ -337,24 +347,24 @@ if (!empty($withproject)) { print "
'; - print $form->editfieldkey('PriceOfRegistration', 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); + print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval('PriceOfRegistration', 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); print "
'; - print $form->editfieldkey('PriceOfBooth', 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); + print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval('PriceOfBooth', 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); print "
'.$langs->trans("EventOrganizationICSLink").''; // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // Show message - $message = 'entity > 1 ? "&entity=".$conf->entity : ""); $message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...'); $message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').''; print $message; @@ -367,7 +377,7 @@ if (!empty($withproject)) { //print ''; print ''; $linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$projectstatic->id; - $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2); + $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5'); $linksuggest .= '&securekey='.urlencode($encodedsecurekey); //print ''; $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_register.php?id='.$projectstatic->id.'&type=global'; - $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2); + $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5'); $link_subscription .= '&securekey='.urlencode($encodedsecurekey); //print '
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
'.$langs->trans("Project").''; - print $projectstatic->getNomUrl(1); - print '
'.$langs->trans("ThirdParty").''; - if ($projectstatic->societe->id) { - print $projectstatic->societe->getNomUrl(1); - } else { - print ' '; - } - print '
'; + + // Ref + print ''; + print ''; + + // Label + print ''; + print ''; + + // Project + if (empty($withproject)) { + print ''; + + // Third party + print ''; + } - // Date start - print ''; + // Task parent + print ''; - // Date end - print ''; + // Date start + print ''; - // Planned workload - print ''; + // Date end + print ''; - // Progress declared - print ''; + // Planned workload + print ''; - // Description - print ''; - print ''; + // Progress declared + print ''; - // Other options - $parameters = array(); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (empty($reshook)) { - print $object->showOptionals($extrafields, 'edit'); - } + // Description + print ''; + print ''; - print '
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
'.$langs->trans("Project").''; + print $projectstatic->getNomUrl(1); + print '
'.$langs->trans("ThirdParty").''; + if ($projectstatic->societe->id) { + print $projectstatic->societe->getNomUrl(1); + } else { + print ' '; } - - // Task parent - print '
'.$langs->trans("ChildOfProjectTask").''; - print $formother->selectProjectTasks($object->fk_task_parent, $projectstatic->id, 'task_parent', ($user->admin ? 0 : 1), 0, 0, 0, $object->id); print '
'.$langs->trans("DateStart").''; - print $form->selectDate($object->date_start, 'dateo', 1, 1, 0, '', 1, 0); - print '
'.$langs->trans("ChildOfProjectTask").''; + print $formother->selectProjectTasks($object->fk_task_parent, $projectstatic->id, 'task_parent', ($user->admin ? 0 : 1), 0, 0, 0, $object->id); + print '
'.$langs->trans("Deadline").''; - print $form->selectDate($object->date_end ? $object->date_end : -1, 'datee', 1, 1, 0, '', 1, 0); - print '
'.$langs->trans("DateStart").''; + print $form->selectDate($object->date_start, 'dateo', 1, 1, 0, '', 1, 0); + print '
'.$langs->trans("PlannedWorkload").''; - print $form->select_duration('planned_workload', $object->planned_workload, 0, 'text'); - print '
'.$langs->trans("Deadline").''; + print $form->selectDate($object->date_end ? $object->date_end : -1, 'datee', 1, 1, 0, '', 1, 0); + print '
'.$langs->trans("ProgressDeclared").''; - print $formother->select_percent($object->progress, 'progress', 0, 5, 0, 100, 1); - print '
'.$langs->trans("PlannedWorkload").''; + print $form->select_duration('planned_workload', $object->planned_workload, 0, 'text'); + print '
'.$langs->trans("Description").''; - print ''; - print '
'.$langs->trans("ProgressDeclared").''; + print $formother->select_percent($object->progress, 'progress', 0, 5, 0, 100, 1); + print '
'.$langs->trans("Description").''; + print ''; + print '
'; + // Other options + $parameters = array(); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook)) { + print $object->showOptionals($extrafields, 'edit'); + } - print dol_get_fiche_end(); + print ''; - print '
'; - print '   '; - print ''; - print '
'; + print dol_get_fiche_end(); - print ''; + print '
'; + print '   '; + print ''; + print '
'; + + print ''; + } else { + /* + * Fiche tache en mode visu + */ + $param = ($withproject ? '&withproject=1' : ''); + $linkback = $withproject ? ''.$langs->trans("BackToList").'' : ''; + + print dol_get_fiche_head($head, 'task_task', $langs->trans("Task"), -1, 'projecttask', 0, '', 'reposition'); + + if ($action == 'delete') { + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".GETPOST("id", 'int').'&withproject='.$withproject, $langs->trans("DeleteATask"), $langs->trans("ConfirmDeleteATask"), "confirm_delete"); + } + + if (!GETPOST('withproject') || empty($projectstatic->id)) { + $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); + $object->next_prev_filter = " fk_projet IN (".$db->sanitize($projectsListId).")"; } else { - /* - * Fiche tache en mode visu - */ - $param = ($withproject ? '&withproject=1' : ''); - $linkback = $withproject ? ''.$langs->trans("BackToList").'' : ''; - - print dol_get_fiche_head($head, 'task_task', $langs->trans("Task"), -1, 'projecttask', 0, '', 'reposition'); - - if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".GETPOST("id", 'int').'&withproject='.$withproject, $langs->trans("DeleteATask"), $langs->trans("ConfirmDeleteATask"), "confirm_delete"); - } - - if (!GETPOST('withproject') || empty($projectstatic->id)) { - $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = " fk_projet IN (".$db->sanitize($projectsListId).")"; - } else { - $object->next_prev_filter = " fk_projet = ".((int) $projectstatic->id); - } - - $morehtmlref = ''; - - // Project - if (empty($withproject)) { - $morehtmlref .= '
'; - $morehtmlref .= $langs->trans("Project").': '; - $morehtmlref .= $projectstatic->getNomUrl(1); - $morehtmlref .= '
'; - - // Third party - $morehtmlref .= $langs->trans("ThirdParty").': '; - if (!empty($projectstatic->thirdparty)) { - $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1); - } - $morehtmlref .= '
'; - } - - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); - - print '
'; - print '
'; - - print '
'; - print ''; - - // Task parent - print ''; - - // Date start - Date end - print ''; - - // Planned workload - print ''; - - // Description - print ''; - - print '
'.$langs->trans("ChildOfTask").''; - if ($object->fk_task_parent > 0) { - $tasktmp = new Task($db); - $tasktmp->fetch($object->fk_task_parent); - print $tasktmp->getNomUrl(1); - } - print '
'.$langs->trans("DateStart").' - '.$langs->trans("Deadline").''; - $start = dol_print_date($object->date_start, 'dayhour'); - print ($start ? $start : '?'); - $end = dol_print_date($object->date_end, 'dayhour'); - print ' - '; - print ($end ? $end : '?'); - if ($object->hasDelay()) { - print img_warning("Late"); - } - print '
'.$langs->trans("PlannedWorkload").''; - if ($object->planned_workload != '') { - print convertSecondToTime($object->planned_workload, 'allhourmin'); - } - print '
'.$langs->trans("Description").''; - print nl2br($object->description); - print '
'; - print '
'; - - print '
'; - - print '
'; - print ''; - - // Progress declared - print ''; - - // Progress calculated - print ''; - - // Other attributes - $cols = 3; - $parameters = array('socid'=>$socid); - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - - print '
'.$langs->trans("ProgressDeclared").''; - if ($object->progress != '') { - print $object->progress.' %'; - } - print '
'.$langs->trans("ProgressCalculated").''; - if ($object->planned_workload != '') { - $tmparray = $object->getSummaryOfTimeSpent(); - if ($tmparray['total_duration'] > 0 && !empty($object->planned_workload)) { - print round($tmparray['total_duration'] / $object->planned_workload * 100, 2).' %'; - } else { - print '0 %'; - } - } else { - print ''.$langs->trans("WorkloadNotDefined").''; - } - print '
'; - - print '
'; - print '
'; - - print '
'; - print '
'; - - print dol_get_fiche_end(); + $object->next_prev_filter = " fk_projet = ".((int) $projectstatic->id); } + $morehtmlref = ''; - if ($action != 'edit') { - /* - * Actions - */ + // Project + if (empty($withproject)) { + $morehtmlref .= '
'; + $morehtmlref .= $langs->trans("Project").': '; + $morehtmlref .= $projectstatic->getNomUrl(1); + $morehtmlref .= '
'; - print '
'; + // Third party + $morehtmlref .= $langs->trans("ThirdParty").': '; + if (!empty($projectstatic->thirdparty)) { + $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1); + } + $morehtmlref .= '
'; + } - $parameters = array(); - $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been - // modified by hook - if (empty($reshook)) { - // Modify - if ($user->rights->projet->creer) { - print ''.$langs->trans('Modify').''; - } else { - print ''.$langs->trans('Modify').''; - } + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); - // Delete - if ($user->rights->projet->supprimer) { - if (!$object->hasChildren() && !$object->hasTimeSpent()) { - print ''.$langs->trans('Delete').''; - } else { - print ''.$langs->trans('Delete').''; - } - } else { - print ''.$langs->trans('Delete').''; - } + print '
'; + print '
'; - print '
'; + print '
'; + print ''; + + // Task parent + print ''; + + // Date start - Date end + print ''; + + // Planned workload + print ''; + + // Description + print ''; + + print '
'.$langs->trans("ChildOfTask").''; + if ($object->fk_task_parent > 0) { + $tasktmp = new Task($db); + $tasktmp->fetch($object->fk_task_parent); + print $tasktmp->getNomUrl(1); + } + print '
'.$langs->trans("DateStart").' - '.$langs->trans("Deadline").''; + $start = dol_print_date($object->date_start, 'dayhour'); + print ($start ? $start : '?'); + $end = dol_print_date($object->date_end, 'dayhour'); + print ' - '; + print ($end ? $end : '?'); + if ($object->hasDelay()) { + print img_warning("Late"); + } + print '
'.$langs->trans("PlannedWorkload").''; + if ($object->planned_workload != '') { + print convertSecondToTime($object->planned_workload, 'allhourmin'); + } + print '
'.$langs->trans("Description").''; + print nl2br($object->description); + print '
'; + print '
'; + + print '
'; + + print '
'; + print ''; + + // Progress declared + print ''; + + // Progress calculated + print ''; + + // Other attributes + $cols = 3; + $parameters = array('socid'=>$socid); + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + + print '
'.$langs->trans("ProgressDeclared").''; + if ($object->progress != '') { + print $object->progress.' %'; + } + print '
'.$langs->trans("ProgressCalculated").''; + if ($object->planned_workload != '') { + $tmparray = $object->getSummaryOfTimeSpent(); + if ($tmparray['total_duration'] > 0 && !empty($object->planned_workload)) { + print round($tmparray['total_duration'] / $object->planned_workload * 100, 2).' %'; + } else { + print '0 %'; + } + } else { + print ''.$langs->trans("WorkloadNotDefined").''; + } + print '
'; + + print '
'; + print '
'; + + print '
'; + print '
'; + + print dol_get_fiche_end(); + } + + + if ($action != 'edit') { + /* + * Actions + */ + + print '
'; + + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been + // modified by hook + if (empty($reshook)) { + // Modify + if ($user->rights->projet->creer) { + print ''.$langs->trans('Modify').''; + } else { + print ''.$langs->trans('Modify').''; } - print '
'; - print ''; // ancre + // Delete + if ($user->rights->projet->supprimer) { + if (!$object->hasChildren() && !$object->hasTimeSpent()) { + print ''.$langs->trans('Delete').''; + } else { + print ''.$langs->trans('Delete').''; + } + } else { + print ''.$langs->trans('Delete').''; + } - /* - * Generated documents - */ - $filename = dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref); - $filedir = $conf->projet->dir_output."/".dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref); - $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = ($user->rights->projet->lire); - $delallowed = ($user->rights->projet->creer); - - print $formfile->showdocuments('project_task', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf); - - print '
'; - - // List of actions on element - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; - $formactions = new FormActions($db); - $defaultthirdpartyid = $socid > 0 ? $socid : $object->project->socid; - $formactions->showactions($object, 'task', $defaultthirdpartyid, 1, '', 10, 'withproject='.$withproject); - - print '
'; + print '
'; } + + print '
'; + print ''; // ancre + + /* + * Generated documents + */ + $filename = dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref); + $filedir = $conf->projet->dir_output."/".dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref); + $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; + $genallowed = ($user->rights->projet->lire); + $delallowed = ($user->rights->projet->creer); + + print $formfile->showdocuments('project_task', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf); + + print '
'; + + // List of actions on element + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $defaultthirdpartyid = $socid > 0 ? $socid : $object->project->socid; + $formactions->showactions($object, 'task', $defaultthirdpartyid, 1, '', 10, 'withproject='.$withproject); + + print '
'; } } diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index a85fdcf2db1..8e5877c7d0d 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -107,6 +107,13 @@ $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($projectstatic->table_element); $extrafields->fetch_name_optionals_label($object->table_element); +if ($id > 0 || $ref) { + $object->fetch($id, $ref); +} + +restrictedArea($user, 'projet', $object->fk_project, 'projet&project'); + + /* * Actions From 1f76165e461707d8c23c5f0f69f558b74d3e5939 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 01:35:42 +0200 Subject: [PATCH 119/374] Fix do not show link on objects for object with existing hard link field --- htdocs/comm/action/card.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 461002029ae..bc9b77cc881 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1226,12 +1226,16 @@ if ($action == 'create') { // Object linked if (!empty($origin) && !empty($originid)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - print ''.$langs->trans("LinkedObject").''; - print ''.dolGetElementUrl($originid, $origin, 1).''; - print ''; - print ''; - print ''; - print ''; + + if (! in_array($origin, array('societe', 'project', 'task', 'user'))) { + // We do not use link for object that already contains a hard coded + print ''.$langs->trans("LinkedObject").''; + print ''.dolGetElementUrl($originid, $origin, 1).''; + print ''; + print ''; + print ''; + print ''; + } } $reg = array(); From e92a24d5f13d36e3956be7ae93f2e61db73b9073 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 13:49:21 +0200 Subject: [PATCH 120/374] Fix test --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 7918bb4a6d6..42bf537923d 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -474,7 +474,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && !empty($conf->gl if (in_array(GETPOST('action', 'aZ09'), $arrayofactiontoforcetokencheck)) { $sensitiveget = true; } - if (preg_match('/^(classify|confirm_|delete|disable|enable|remove_|setremise)/', GETPOST('action', 'aZ09'))) { + if (preg_match('/^(classify|close|confirm_|delete|disable|enable|remove_|setremise)/', GETPOST('action', 'aZ09'))) { $sensitiveget = true; } From 663fe098f966102e976c36f18ba18c9a0441674e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 13:55:22 +0200 Subject: [PATCH 121/374] Update doc --- SECURITY.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index bec9c992351..d27749eb203 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -4,11 +4,11 @@ This file contains some policies about the security reports on Dolibarr ERP CRM ## Supported Versions for security reports -| Version | Supported | -| ---------- | ------------------ | -| <= 14.0.1 | :x: | -| >= 14.0.2+ | :white_check_mark: | - +| Version | Supported | +| ---------- | ---------------------- | +| <= 14.0.1 | :x: | +| >= 14.0.2+ | :white_check_mark: except CSRF attacks| +| >= develop | :white_check_mark: | ## Reporting a Vulnerability From 5c8fb384265e2c60a1340e99a9607f01fd0b0bca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 14:41:46 +0200 Subject: [PATCH 122/374] Fix add del* action into list of sensitive actions --- htdocs/accountancy/bookkeeping/list.php | 4 ++-- htdocs/accountancy/bookkeeping/listbyaccount.php | 4 ++-- htdocs/accountancy/bookkeeping/listbysubaccount.php | 4 ++-- htdocs/adherents/admin/member.php | 6 +++--- htdocs/adherents/card.php | 4 ++-- htdocs/adherents/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/admin/agenda_extsites.php | 4 ++-- htdocs/admin/agenda_other.php | 8 ++++---- htdocs/admin/agenda_reminder.php | 8 ++++---- htdocs/admin/bank.php | 4 ++-- htdocs/admin/bom.php | 4 ++-- htdocs/admin/boxes.php | 4 ++-- htdocs/admin/commande.php | 6 +++--- htdocs/admin/contract.php | 6 +++--- htdocs/admin/delivery.php | 4 ++-- htdocs/admin/ecm.php | 4 ++-- htdocs/admin/eventorganization.php | 4 ++-- htdocs/admin/expedition.php | 6 +++--- htdocs/admin/expensereport.php | 4 ++-- htdocs/admin/facture.php | 4 ++-- htdocs/admin/fichinter.php | 4 ++-- htdocs/admin/holiday.php | 4 ++-- htdocs/admin/knowledgemanagement.php | 4 ++-- htdocs/admin/mrp.php | 6 +++--- htdocs/admin/paymentbybanktransfer.php | 4 ++-- htdocs/admin/prelevement.php | 4 ++-- htdocs/admin/propal.php | 4 ++-- htdocs/admin/reception_setup.php | 4 ++-- htdocs/admin/security_other.php | 8 ++++---- htdocs/admin/stock.php | 4 ++-- htdocs/admin/supplier_invoice.php | 4 ++-- htdocs/admin/supplier_order.php | 4 ++-- htdocs/admin/supplier_proposal.php | 8 ++++---- htdocs/admin/ticket.php | 4 ++-- htdocs/admin/user.php | 8 ++++---- htdocs/admin/usergroup.php | 4 ++-- htdocs/admin/workflow.php | 4 ++-- htdocs/admin/workstation.php | 4 ++-- htdocs/bom/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/categories/admin/categorie.php | 4 ++-- htdocs/comm/propal/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/commande/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/compta/facture/tpl/linkedobjectblock.tpl.php | 2 +- .../compta/facture/tpl/linkedobjectblockForRec.tpl.php | 2 +- htdocs/compta/payment_sc/card.php | 2 +- htdocs/compta/tva/card.php | 2 +- htdocs/contrat/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/eventorganization/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/expensereport/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/fichinter/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/main.inc.php | 6 ++---- htdocs/margin/admin/margin.php | 8 ++++---- htdocs/modulebuilder/admin/setup.php | 4 ++-- htdocs/modulebuilder/template/admin/setup.php | 4 ++-- .../core/tpl/linkedobjectblock_myobject.tpl.php | 2 +- htdocs/mrp/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/multicurrency/multicurrency_rate.php | 4 ++-- htdocs/product/admin/product.php | 4 ++-- htdocs/product/stock/massstockmove.php | 2 +- htdocs/projet/admin/project.php | 8 ++++---- htdocs/reception/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/recruitment/admin/setup.php | 4 ++-- htdocs/recruitment/admin/setup_candidatures.php | 4 ++-- htdocs/societe/admin/societe.php | 2 +- htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/ticket/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/user/group/card.php | 2 +- htdocs/user/group/perms.php | 4 ++-- htdocs/user/perms.php | 10 +++++----- htdocs/variants/combinations.php | 2 +- 72 files changed, 143 insertions(+), 145 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 73c23e4d63b..081d074eab7 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1250,7 +1250,7 @@ while ($i < min($num, $limit)) { } if (empty($line->date_validation)) { if ($user->rights->accounting->mouvements->supprimer) { - print ''.img_delete().''; + print ''.img_delete().''; } } print ''; @@ -1274,7 +1274,7 @@ print ''; // TODO Replace this with mass delete action if ($user->rights->accounting->mouvements->supprimer_tous) { print ''; } diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 27f23d36a74..22ba2d3f0b1 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -904,7 +904,7 @@ while ($i < min($num, $limit)) { } if (empty($line->date_validation)) { if ($user->rights->accounting->mouvements->supprimer) { - print ''.img_delete().''; + print ''.img_delete().''; } } print ''; @@ -957,7 +957,7 @@ print ''; // TODO Replace this with mass delete action if ($user->rights->accounting->mouvements->supprimer_tous) { print ''; } diff --git a/htdocs/accountancy/bookkeeping/listbysubaccount.php b/htdocs/accountancy/bookkeeping/listbysubaccount.php index 5e83c729fb1..101a8897bb5 100644 --- a/htdocs/accountancy/bookkeeping/listbysubaccount.php +++ b/htdocs/accountancy/bookkeeping/listbysubaccount.php @@ -915,7 +915,7 @@ while ($i < min($num, $limit)) { } if (empty($line->date_validation)) { if ($user->rights->accounting->mouvements->supprimer) { - print ''.img_delete().''; + print ''.img_delete().''; } } print ''; @@ -968,7 +968,7 @@ print ''; // TODO Replace this with mass delete action if ($user->rights->accounting->mouvements->supprimer_tous) { print ''; } diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 018498c2457..0ff0919652d 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -404,13 +404,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } @@ -419,7 +419,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->MEMBER_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 4b81e065d3f..ca1ad342d8a 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1979,10 +1979,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $isinspip = $mailmanspip->is_in_spip($object); if ($isinspip == 1) { - print ''.$langs->trans("DeleteIntoSpip").''."\n"; + print ''.$langs->trans("DeleteIntoSpip").''."\n"; } if ($isinspip == 0) { - print ''.$langs->trans("AddIntoSpip").''."\n"; + print ''.$langs->trans("AddIntoSpip").''."\n"; } } diff --git a/htdocs/adherents/tpl/linkedobjectblock.tpl.php b/htdocs/adherents/tpl/linkedobjectblock.tpl.php index 0414bf20a14..7aa2f39a3ff 100644 --- a/htdocs/adherents/tpl/linkedobjectblock.tpl.php +++ b/htdocs/adherents/tpl/linkedobjectblock.tpl.php @@ -45,7 +45,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { } echo ''; echo ''; - echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; echo ''; } diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index d689b2df8af..5567e741272 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -282,9 +282,9 @@ while ($i <= $MAXAGENDA) { print ajax_constantonoff('AGENDA_EXT_ACTIVEBYDEFAULT' . $key); } else { if (empty($conf->global->{$default})) { - print '' . img_picto($langs->trans("Enabled"), 'on') . ''; + print '' . img_picto($langs->trans("Enabled"), 'on') . ''; } else { - print '' . img_picto($langs->trans("Disabled"), 'off') . ''; + print '' . img_picto($langs->trans("Disabled"), 'off') . ''; } } print ''; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 463df5475f9..252008fb877 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -260,7 +260,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (in_array($name, $def)) { print ''."\n"; if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name") { - print 'scandir.'&label='.urlencode($module->name).'&type=action">'; + print 'scandir.'&label='.urlencode($module->name).'&type=action">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; } else { @@ -269,7 +269,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { print ""; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'&type=action">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'&type=action">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } @@ -324,9 +324,9 @@ print ' '."\n"; print ''."\n"; //print ajax_constantonoff('AGENDA_USE_EVENT_TYPE'); Do not use ajax here, we need to reload page to change other combo list if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'switch_on').''; + print ''.img_picto($langs->trans("Enabled"), 'switch_on').''; } print ''."\n"; diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index 2b2da673202..ac968778ffc 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -181,7 +181,7 @@ if (empty($conf->global->AGENDA_REMINDER_BROWSER)) { $langs->load("errors"); print img_warning($langs->trans("WarningAvailableOnlyForHTTPSServers"), '', 'valignmiddle size15x').' '; } - print ''.img_picto($langs->trans('Enabled'), 'switch_on').''; + print ''.img_picto($langs->trans('Enabled'), 'switch_on').''; print ''."\n"; print ''."\n"; @@ -190,9 +190,9 @@ if (empty($conf->global->AGENDA_REMINDER_BROWSER)) { print ''."\n"; if (empty($conf->global->AGENDA_REMINDER_BROWSER_SOUND)) { - print ''.img_picto($langs->trans('Disabled'), 'switch_off').''; + print ''.img_picto($langs->trans('Disabled'), 'switch_off').''; } else { - print ''.img_picto($langs->trans('Enabled'), 'switch_on').''; + print ''.img_picto($langs->trans('Enabled'), 'switch_on').''; } print ''."\n"; @@ -229,7 +229,7 @@ if (empty($conf->cron->enabled)) { $langs->load("cron"); print ''.$langs->trans("JobXMustBeEnabled", $langs->transnoentitiesnoconv("sendEmailsReminder")).''; } else { - print ''.img_picto($langs->trans('Enabled'), 'switch_on').''; + print ''.img_picto($langs->trans('Enabled'), 'switch_on').''; } } } diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index a9463be9937..4e79d3ee276 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -354,13 +354,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index 0aae15eef3e..35cf6b3e8a4 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -362,13 +362,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index c4e697bfe00..2e4226e89d5 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -423,8 +423,8 @@ foreach ($boxactivated as $key => $box) { $hasprevious = ($key != 0); print ''.($key + 1).''; print ''; - print ($hasnext ? ''.img_down().' ' : ''); - print ($hasprevious ? ''.img_up().'' : ''); + print ($hasnext ? ''.img_down().' ' : ''); + print ($hasprevious ? ''.img_up().'' : ''); print ''; print ''; print ''.img_delete().''; diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index d57292e3562..23d7020e370 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -424,13 +424,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } @@ -439,7 +439,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->COMMANDE_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index b5e0c3ae28b..7854924c090 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -353,13 +353,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } @@ -368,7 +368,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->CONTRACT_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/delivery.php b/htdocs/admin/delivery.php index 4fa7b2b79c7..68a18aa0f6a 100644 --- a/htdocs/admin/delivery.php +++ b/htdocs/admin/delivery.php @@ -357,13 +357,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir).'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ""; } else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/ecm.php b/htdocs/admin/ecm.php index 52badf366ca..44df7f74189 100644 --- a/htdocs/admin/ecm.php +++ b/htdocs/admin/ecm.php @@ -93,9 +93,9 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('ECM_AUTO_TREE_ENABLED'); } else { if (empty($conf->global->ECM_AUTO_TREE_ENABLED)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } elseif (!empty($conf->global->USER_MAIL_REQUIRED)) { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } print ''; diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index 9c088aec61c..36ba50818c6 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -580,13 +580,13 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 32f82f5dad5..777767a823e 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -353,13 +353,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } @@ -368,7 +368,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->EXPEDITION_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 1553f6887f8..70bbc6f2b07 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -358,13 +358,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir).'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ""; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index bf4e2ea9eb6..a9f1e97ffab 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -501,13 +501,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("SetAsDefault"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("SetAsDefault"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 4d9304472d5..cdc3d139515 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -419,13 +419,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir).'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ""; } else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index 81db1cbe58d..00d82f68035 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -359,13 +359,13 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/knowledgemanagement.php b/htdocs/admin/knowledgemanagement.php index 477f38fa663..b886e6faf39 100644 --- a/htdocs/admin/knowledgemanagement.php +++ b/htdocs/admin/knowledgemanagement.php @@ -533,13 +533,13 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/mrp.php b/htdocs/admin/mrp.php index 7cd3c095955..333fcb2bd6b 100644 --- a/htdocs/admin/mrp.php +++ b/htdocs/admin/mrp.php @@ -359,13 +359,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } @@ -374,7 +374,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->MRP_MO_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/paymentbybanktransfer.php b/htdocs/admin/paymentbybanktransfer.php index 4d170aa5fbd..04e1488fedc 100644 --- a/htdocs/admin/paymentbybanktransfer.php +++ b/htdocs/admin/paymentbybanktransfer.php @@ -298,7 +298,7 @@ foreach ($dirmodels as $reldir) if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"),'switch_on'); print ''; print ''; @@ -306,7 +306,7 @@ foreach ($dirmodels as $reldir) else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index f9c183b5c7d..2e266f833ea 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -312,7 +312,7 @@ foreach ($dirmodels as $reldir) if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"),'switch_on'); print ''; print ''; @@ -320,7 +320,7 @@ foreach ($dirmodels as $reldir) else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index dcd91df0dbc..88df6b0da05 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -402,13 +402,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/reception_setup.php b/htdocs/admin/reception_setup.php index 6367b80c150..c364911ab51 100644 --- a/htdocs/admin/reception_setup.php +++ b/htdocs/admin/reception_setup.php @@ -363,13 +363,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 5f8cc66eb1e..477691cf6ef 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -111,9 +111,9 @@ if (function_exists("imagecreatefrompng")) { print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA'); } else { if (empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } } else { @@ -130,9 +130,9 @@ if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff('MAIN_USE_ADVANCED_PERMS'); } else { if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } print ""; diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index e45a01d9ed1..d8d6a883d88 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -565,13 +565,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index a888a248d11..ec5a3e087cf 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -375,7 +375,7 @@ foreach ($dirmodels as $reldir) { //if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name") //{ // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all - print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">'; + print 'scandir).'&label='.urlencode($module->name).'&type=invoice_supplier">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; /*} @@ -386,7 +386,7 @@ foreach ($dirmodels as $reldir) { print ""; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'&type=invoice_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index cfa6c878a74..0efa365a33f 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -381,7 +381,7 @@ foreach ($dirmodels as $reldir) { if (in_array($name, $def)) { print ''."\n"; if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name") { - print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier">'; + print 'scandir).'&label='.urlencode($module->name).'&type=order_supplier">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; } else { @@ -390,7 +390,7 @@ foreach ($dirmodels as $reldir) { print ""; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'&type=order_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index 980ebe10fff..1585b66b1e1 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -380,18 +380,18 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { - print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''."\n"; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } // Defaut - print ""; + print ''; if ($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index c3778861ddf..03fd647dd29 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -400,13 +400,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index da3a1913d64..391a456439c 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -147,9 +147,9 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('USER_MAIL_REQUIRED'); } else { if (empty($conf->global->USER_MAIL_REQUIRED)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } print ''; @@ -256,13 +256,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php index b73d3ce4f22..9846389f87a 100644 --- a/htdocs/admin/usergroup.php +++ b/htdocs/admin/usergroup.php @@ -188,13 +188,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 1b6fa5bebe7..ada5a6e0b3b 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -250,11 +250,11 @@ foreach ($workflowcodes as $key => $params) { print ajax_constantonoff($key); } else { if (!empty($conf->global->$key)) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/admin/workstation.php b/htdocs/admin/workstation.php index f14393e2588..76556fb4d68 100755 --- a/htdocs/admin/workstation.php +++ b/htdocs/admin/workstation.php @@ -423,13 +423,13 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/bom/tpl/linkedobjectblock.tpl.php b/htdocs/bom/tpl/linkedobjectblock.tpl.php index fcba37105d3..946563f7b81 100644 --- a/htdocs/bom/tpl/linkedobjectblock.tpl.php +++ b/htdocs/bom/tpl/linkedobjectblock.tpl.php @@ -73,7 +73,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { echo ''; // For now, shipments must stay linked to order, so link is not deletable if ($object->element != 'shipping') { - echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; } echo ''; echo "\n"; diff --git a/htdocs/categories/admin/categorie.php b/htdocs/categories/admin/categorie.php index bddeb9a771a..02e6892b571 100644 --- a/htdocs/categories/admin/categorie.php +++ b/htdocs/categories/admin/categorie.php @@ -101,9 +101,9 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('CATEGORIE_RECURSIV_ADD'); } else { if (empty($conf->global->CATEGORIE_RECURSIV_ADD)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } print ''; diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index 23c1a459c74..829effed6a2 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -68,7 +68,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { } print ''; print ''.$objectlink->getLibStatut(3).''; - print ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + print ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; print "\n"; } if (count($linkedObjectBlock) > 1) { diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index a0641c4c493..211702059cb 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -64,7 +64,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { echo ''; // For now, shipments must stay linked to order, so link is not deletable if ($object->element != 'shipping') { - echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; } echo ''; echo "\n"; diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index 47523447205..bcfece64157 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -93,7 +93,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { print $objectlink->getLibStatut(3); } print ''; - print ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + print ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; print "\n"; } if (count($linkedObjectBlock) > 1) { diff --git a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php index 935f6b03948..7c9683c8b8c 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php @@ -57,7 +57,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { } ?> getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> global->BILL_ADD_PAYMENT_VALIDATION)) if ($action == '') { if ($user->rights->tax->charges->supprimer) { if (!$disable_delete) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } else { print ''.$langs->trans('Delete').''; } diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 9764f679959..363af314113 100755 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -767,7 +767,7 @@ if ($id) { } if (!empty($user->rights->tax->charges->supprimer) && empty($totalpaye)) { - print ''; + print ''; } else { print ''; } diff --git a/htdocs/contrat/tpl/linkedobjectblock.tpl.php b/htdocs/contrat/tpl/linkedobjectblock.tpl.php index 310e2bd00b9..8715a8ce4cc 100644 --- a/htdocs/contrat/tpl/linkedobjectblock.tpl.php +++ b/htdocs/contrat/tpl/linkedobjectblock.tpl.php @@ -62,7 +62,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { echo price($totalcontrat); } ?> getLibStatut(7); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) { } print ''; echo ''.$objectlink->getLibStatut(3).''; - echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; echo ''; } diff --git a/htdocs/expensereport/tpl/linkedobjectblock.tpl.php b/htdocs/expensereport/tpl/linkedobjectblock.tpl.php index 31c5526903b..e3fc511a024 100644 --- a/htdocs/expensereport/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expensereport/tpl/linkedobjectblock.tpl.php @@ -47,7 +47,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { echo price($objectlink->total_ht); } ?> getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) { datev, 'day'); ?> getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) { echo price($objectlink->total_ht); } ?> getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) { echo $objectlink->getLibStatut(3); } ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> gl 'activate', 'add', 'addrights', 'addtimespent', 'doprev', 'donext', 'dvprev', 'dvnext', 'install', - 'reopen', - 'setpricelevel', 'set_paid', - 'update' + 'reopen' ); $sensitiveget = false; if (in_array(GETPOST('action', 'aZ09'), $arrayofactiontoforcetokencheck)) { $sensitiveget = true; } - if (preg_match('/^(classify|close|confirm_|delete|disable|enable|remove_|setremise)/', GETPOST('action', 'aZ09'))) { + if (preg_match('/^(classify|close|confirm|del|disable|enable|remove|set|update)/', GETPOST('action', 'aZ09'))) { $sensitiveget = true; } diff --git a/htdocs/margin/admin/margin.php b/htdocs/margin/admin/margin.php index 939b084fe41..588773ef50c 100644 --- a/htdocs/margin/admin/margin.php +++ b/htdocs/margin/admin/margin.php @@ -155,9 +155,9 @@ if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff('DISPLAY_MARGIN_RATES'); } else { if (empty($conf->global->DISPLAY_MARGIN_RATES)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } print ''; @@ -172,9 +172,9 @@ if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff('DISPLAY_MARK_RATES'); } else { if (empty($conf->global->DISPLAY_MARK_RATES)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } print ''; diff --git a/htdocs/modulebuilder/admin/setup.php b/htdocs/modulebuilder/admin/setup.php index 5aaae9f93eb..e5ccb0c3966 100644 --- a/htdocs/modulebuilder/admin/setup.php +++ b/htdocs/modulebuilder/admin/setup.php @@ -125,9 +125,9 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { print ajax_constantonoff('MODULEBUILDER_USE_ABOUT'); } else { if (empty($conf->global->MODULEBUILDER_USE_ABOUT)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } print ''; diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 9007eab60cc..6d7497b7780 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -598,13 +598,13 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php b/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php index 67aac8c0e98..3c6442bd454 100644 --- a/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php +++ b/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php @@ -50,7 +50,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { date, 'day'); ?> getLibStatut(7); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) { echo ''; // For now, shipments must stay linked to order, so link is not deletable if ($object->element != 'shipping') { - echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; } echo ''; echo "\n"; diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 35b7544ccbc..d0be7666a95 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -526,8 +526,8 @@ if ($resql) { if (in_array($obj->rowid, $arrayofselected)) { $selected = 1; } - print 'rowid.'">'.img_picto('edit', 'edit').''; - print 'rowid.'">'.img_picto('delete', 'delete').''; + print 'rowid.'">'.img_picto('edit', 'edit').''; + print 'rowid.'">'.img_picto('delete', 'delete').''; print ''; } print ''; diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index fa75a20277f..199f2a04f03 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -448,13 +448,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index da8ef2e5b37..af6d6c08740 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -632,7 +632,7 @@ foreach ($listofdata as $key => $val) { print ''; } print ''.$val['qty'].''; - print ''.img_delete($langs->trans("Remove")).''; + print ''.img_delete($langs->trans("Remove")).''; print ''; } } diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php index eaea44dd22b..0ce2a38a471 100644 --- a/htdocs/projet/admin/project.php +++ b/htdocs/projet/admin/project.php @@ -564,13 +564,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir).'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ""; } else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } @@ -704,13 +704,13 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) { // Active if (in_array($name, $def)) { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir).'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ""; } else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/reception/tpl/linkedobjectblock.tpl.php b/htdocs/reception/tpl/linkedobjectblock.tpl.php index 39a5a24347d..41ebc02747f 100644 --- a/htdocs/reception/tpl/linkedobjectblock.tpl.php +++ b/htdocs/reception/tpl/linkedobjectblock.tpl.php @@ -69,7 +69,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { // For now, receptions must stay linked to order, so link is not deletable if ($object->element != 'order_supplier') { ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> diff --git a/htdocs/recruitment/admin/setup.php b/htdocs/recruitment/admin/setup.php index 6da39445f7f..6b6dd050820 100644 --- a/htdocs/recruitment/admin/setup.php +++ b/htdocs/recruitment/admin/setup.php @@ -459,13 +459,13 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/recruitment/admin/setup_candidatures.php b/htdocs/recruitment/admin/setup_candidatures.php index 2bcddf58964..b2189954bf4 100644 --- a/htdocs/recruitment/admin/setup_candidatures.php +++ b/htdocs/recruitment/admin/setup_candidatures.php @@ -457,13 +457,13 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index b9b2046fd90..8b4975a5592 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -560,7 +560,7 @@ foreach ($dirsociete as $dirroot) { print "\n"; //if ($conf->global->COMPANY_ADDON_PDF != "$name") //{ - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; //} diff --git a/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php b/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php index c33c3b2ebac..d0fce33ed22 100644 --- a/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php @@ -53,7 +53,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { echo price($objectlink->total_ht); } ?> getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) { // For now, shipments must stay linked to order, so link is not deletable if ($object->element != 'shipping') { ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 36b9ce7566c..4fb9c51644f 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -384,7 +384,7 @@ if ($action == 'create') { } if ($candisableperms) { - print ''.$langs->trans("DeleteGroup").''; + print ''.$langs->trans("DeleteGroup").''; } print "\n"; diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index e2c419b0543..46506163c1f 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -332,7 +332,7 @@ if ($object->id > 0) { if (in_array($obj->id, $permsgroupbyentity[$entity])) { // Own permission by group if ($caneditperms) { - print 'id.'&confirm=yes&token='.newToken().'">'; + print 'id.'&confirm=yes">'; //print img_edit_remove($langs->trans("Remove")); print img_picto($langs->trans("Remove"), 'switch_on'); print ''; @@ -343,7 +343,7 @@ if ($object->id > 0) { } else { // Do not own permission if ($caneditperms) { - print 'id.'&confirm=yes&token='.newToken().'">'; + print 'id.'&confirm=yes">'; //print img_edit_add($langs->trans("Add")); print img_picto($langs->trans("Add"), 'switch_off'); print ''; diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 391682b2d6d..7c7fe868b2f 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -279,9 +279,9 @@ print ''.$langs->trans("Module").''; if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->admin)) { if ($caneditperms) { print ''; - print ''.$langs->trans("All").""; + print ''.$langs->trans("All").""; print ' / '; - print ''.$langs->trans("None").""; + print ''.$langs->trans("None").""; print ''; } print ' '; @@ -359,9 +359,9 @@ if ($result) { if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->admin)) { if ($caneditperms) { print ''; - print 'module.'&confirm=yes&token='.newToken().'">'.$langs->trans("All").""; + print 'module.'&confirm=yes">'.$langs->trans("All").""; print ' / '; - print 'module.'&confirm=yes&token='.newToken().'">'.$langs->trans("None").""; + print 'module.'&confirm=yes">'.$langs->trans("None").""; print ''; } print ' '; @@ -399,7 +399,7 @@ if ($result) { print ''; } elseif (in_array($obj->id, $permsuser)) { // Permission granted by user if ($caneditperms) { - print 'id.'&confirm=yes&token='.newToken().'">'; + print 'id.'&confirm=yes">'; //print img_edit_remove($langs->trans("Remove")); print img_picto($langs->trans("Remove"), 'switch_on'); print ''; diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index c29fc519258..a3ad036ca9a 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -888,7 +888,7 @@ if (!empty($id) || !empty($ref)) { print ''.$prodstatic->getLibStatut(2, 0).''; print ''.$prodstatic->getLibStatut(2, 1).''; print ''; - print 'id.'">'.img_edit().''; + print 'id.'">'.img_edit().''; print 'id.'">'.img_delete().''; print ''; print ''; From 4d563651fab4c55ef82ef0ff3aef37999c15531d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 14:49:11 +0200 Subject: [PATCH 123/374] Add a mode MAIN_SECURITY_CSRF_WITH_TOKEN = 2 --- htdocs/main.inc.php | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index a40135adc27..433c168b7f2 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -460,22 +460,25 @@ if (!defined('NOTOKENRENEWAL') && !defined('NOSESSION')) { //dol_syslog("aaaa - ".defined('NOCSRFCHECK')." - ".$dolibarr_nocsrfcheck." - ".$conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN." - ".$_SERVER['REQUEST_METHOD']." - ".GETPOST('token', 'alpha')); // Check validity of token, only if option MAIN_SECURITY_CSRF_WITH_TOKEN enabled or if constant CSRFCHECK_WITH_TOKEN is set into page -if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && !empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)) || defined('CSRFCHECK_WITH_TOKEN')) { +if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN')) || defined('CSRFCHECK_WITH_TOKEN')) { // Array of action code where CSRFCHECK with token will be forced (so token must be provided on url request) - $arrayofactiontoforcetokencheck = array( - 'activate', 'add', 'addrights', 'addtimespent', - 'doprev', 'donext', 'dvprev', 'dvnext', - 'install', - 'reopen' - ); $sensitiveget = false; - if (in_array(GETPOST('action', 'aZ09'), $arrayofactiontoforcetokencheck)) { + if (getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') == 2) { $sensitiveget = true; + } else { + $arrayofactiontoforcetokencheck = array( + 'activate', 'add', 'addrights', 'addtimespent', + 'doprev', 'donext', 'dvprev', 'dvnext', + 'install', + 'reopen' + ); + if (in_array(GETPOST('action', 'aZ09'), $arrayofactiontoforcetokencheck)) { + $sensitiveget = true; + } + if (preg_match('/^(classify|close|confirm|del|disable|enable|remove|set|update)/', GETPOST('action', 'aZ09'))) { + $sensitiveget = true; + } } - if (preg_match('/^(classify|close|confirm|del|disable|enable|remove|set|update)/', GETPOST('action', 'aZ09'))) { - $sensitiveget = true; - } - // Check a token is provided for all cases that need a mandatory token // (all POST actions + all login, actions and mass actions on pages with CSRFCHECK_WITH_TOKEN set + all sensitive GET actions) if ( From 074e8b2031c4340ad42b871c773a82f56e5492ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 14:53:09 +0200 Subject: [PATCH 124/374] Update doc to prepare MAIN_SECURITY_CSRF_WITH_TOKEN to 2 by default --- SECURITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index d27749eb203..61f4a392db8 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -54,7 +54,7 @@ ONLY vulnerabilities discovered, when the following setup on test platform is us * $dolibarr_main_prod must be set to 1 into conf.php * $dolibarr_nocsrfcheck must be kept to the value 0 into conf.php (this is the default value) * $dolibarr_main_force_https must be set to something else than 0. -* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 1 into backoffice menu Home - Setup - Other (this protection should be set to 1 soon by default) +* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 2 into backoffice menu Home - Setup - Other (this protection should be set to 2 soon by default) * The module DebugBar and ModuleBuilder must NOT be enabled (by default, these modules are not enabled. They are developer tools) * ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities). * The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer). From bf9f007c98f4526e4b2ba070bc914d72fb98facf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 14:53:09 +0200 Subject: [PATCH 125/374] Fix MAIN_SECURITY_CSRF_WITH_TOKEN = 2 --- SECURITY.md | 2 +- htdocs/main.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index d27749eb203..61f4a392db8 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -54,7 +54,7 @@ ONLY vulnerabilities discovered, when the following setup on test platform is us * $dolibarr_main_prod must be set to 1 into conf.php * $dolibarr_nocsrfcheck must be kept to the value 0 into conf.php (this is the default value) * $dolibarr_main_force_https must be set to something else than 0. -* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 1 into backoffice menu Home - Setup - Other (this protection should be set to 1 soon by default) +* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 2 into backoffice menu Home - Setup - Other (this protection should be set to 2 soon by default) * The module DebugBar and ModuleBuilder must NOT be enabled (by default, these modules are not enabled. They are developer tools) * ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities). * The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer). diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 433c168b7f2..8070a1b3526 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -463,7 +463,7 @@ if (!defined('NOTOKENRENEWAL') && !defined('NOSESSION')) { if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN')) || defined('CSRFCHECK_WITH_TOKEN')) { // Array of action code where CSRFCHECK with token will be forced (so token must be provided on url request) $sensitiveget = false; - if (getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') == 2) { + if ((GETPOSTISSET('massaction') || GETPOST('action', 'aZ09')) && getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') == 2) { $sensitiveget = true; } else { $arrayofactiontoforcetokencheck = array( From 5631e8cc152c4849e5a3a4717be6fb3372ef27fd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 15:01:57 +0200 Subject: [PATCH 126/374] css --- htdocs/admin/translation.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 8b5c05b7bda..2327abd549e 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -463,6 +463,8 @@ if ($mode == 'searchkey') { } print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1); + $massactionbutton = ''; + print ''; print ''; @@ -499,7 +501,7 @@ if ($mode == 'searchkey') { //} print ''; // Action column - print ''; + print ''; $searchpicto = $form->showFilterAndCheckAddButtons(!empty($massactionbutton) ? 1 : 0, 'checkforselect', 1); print $searchpicto; print ''; From 1d597e8a726289c07022e26457c34862ebb2d2cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 18:03:38 +0200 Subject: [PATCH 127/374] Fix add unset* action as sensible GET actions --- htdocs/admin/agenda_other.php | 2 +- htdocs/admin/agenda_reminder.php | 4 ++-- htdocs/admin/bank.php | 8 ++++---- htdocs/admin/barcode.php | 4 ++-- htdocs/admin/bom.php | 4 ++-- htdocs/admin/commande.php | 14 ++++++------- htdocs/admin/contract.php | 2 +- htdocs/admin/defaultvalues.php | 4 ++-- htdocs/admin/delivery.php | 4 ++-- htdocs/admin/expedition.php | 2 +- htdocs/admin/expensereport.php | 4 ++-- htdocs/admin/facture.php | 2 +- htdocs/admin/fichinter.php | 4 ++-- htdocs/admin/holiday.php | 20 +++++++++---------- htdocs/admin/ldap.php | 2 +- htdocs/admin/ldap_contacts.php | 2 +- htdocs/admin/ldap_groups.php | 2 +- htdocs/admin/ldap_members.php | 2 +- htdocs/admin/ldap_members_types.php | 2 +- htdocs/admin/ldap_users.php | 2 +- htdocs/admin/modules.php | 2 +- htdocs/admin/mrp.php | 4 ++-- htdocs/admin/paymentbybanktransfer.php | 4 ++-- htdocs/admin/prelevement.php | 2 +- htdocs/admin/propal.php | 8 ++++---- htdocs/admin/reception_setup.php | 4 ++-- htdocs/admin/security.php | 2 +- htdocs/admin/spip.php | 2 +- htdocs/admin/stock.php | 2 +- htdocs/admin/supplier_invoice.php | 6 +++--- htdocs/admin/supplier_order.php | 8 ++++---- htdocs/admin/supplier_payment.php | 6 +++--- htdocs/admin/supplier_proposal.php | 8 ++++---- htdocs/admin/user.php | 6 +++--- htdocs/admin/usergroup.php | 2 +- htdocs/bom/bom_card.php | 2 +- htdocs/comm/mailing/card.php | 10 +++++----- htdocs/contact/card.php | 2 +- htdocs/contact/list.php | 2 +- .../modules/printing/printgcp.modules.php | 2 +- .../modules/printing/printipp.modules.php | 2 +- .../product_batch/mod_lot_advanced.php | 4 ++-- .../modules/product_batch/mod_sn_advanced.php | 4 ++-- htdocs/don/admin/donation.php | 6 +++--- htdocs/install/step2.php | 2 +- htdocs/main.inc.php | 4 +++- htdocs/margin/admin/margin.php | 4 ++-- htdocs/modulebuilder/template/admin/setup.php | 4 ++-- htdocs/printing/admin/printing.php | 8 ++++---- htdocs/product/admin/product.php | 8 ++++---- htdocs/product/admin/product_lot.php | 4 ++-- htdocs/projet/admin/project.php | 8 ++++---- htdocs/recruitment/admin/setup.php | 4 ++-- .../recruitment/admin/setup_candidatures.php | 4 ++-- htdocs/societe/admin/societe.php | 6 +++--- htdocs/societe/list.php | 2 +- htdocs/takepos/admin/setup.php | 2 +- 57 files changed, 126 insertions(+), 124 deletions(-) diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 252008fb877..8060398574c 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -278,7 +278,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if ($conf->global->ACTION_EVENT_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'&type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'&type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index ac968778ffc..1d8cd8f723c 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -174,7 +174,7 @@ if (empty($conf->global->AGENDA_REMINDER_BROWSER)) { $langs->load("errors"); print img_warning($langs->trans("WarningAvailableOnlyForHTTPSServers"), '', 'valignmiddle size15x').' '; } - print ''.img_picto($langs->trans('Disabled'), 'switch_off').''; + print ''.img_picto($langs->trans('Disabled'), 'switch_off').''; print ''."\n"; } else { if (!isHTTPS()) { @@ -221,7 +221,7 @@ if (empty($conf->cron->enabled)) { print ''.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("Module2300Name")).''; } else { if (empty($conf->global->AGENDA_REMINDER_EMAIL)) { - print ''.img_picto($langs->trans('Disabled'), 'switch_off').''; + print ''.img_picto($langs->trans('Disabled'), 'switch_off').''; } else { // Get the max frequency of reminder if ($job->id > 0) { diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index 4e79d3ee276..6580db4e8f3 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -258,7 +258,7 @@ while ($i < $nbofbank) { print img_picto($langs->trans("Activated"), 'on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'off'); print ''; } @@ -369,7 +369,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->BANKADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -428,13 +428,13 @@ print ""; // Active if ($conf->global->BANK_COLORIZE_MOVEMENT) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index b0eb36d81ac..de05203f5f6 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -374,11 +374,11 @@ if ($conf->product->enabled) { print ''.$modBarCode->getExample($langs)."\n"; if ($conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index 35cf6b3e8a4..a36c3698306 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -235,7 +235,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->BOM_ADDON == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -377,7 +377,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->BOM_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 23d7020e370..1e977fb48df 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -299,7 +299,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->COMMANDE_ADDON == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -655,10 +655,10 @@ print ''.$langs->trans("ShippableOrderIconInList").''; print ' '; print ''; if (!empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) { - print ''; + print ''; print img_picto($langs->trans("Activated"),'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"),'switch_off'); } print ''; @@ -676,9 +676,9 @@ if ($conf->banque->enabled) { print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_ORDER'); } else { if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER)) { - print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } else { - print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; } } print ''; @@ -696,9 +696,9 @@ if ($conf->stock->enabled) { print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER'); } else { if (empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { - print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } else { - print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; } } print ''; diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 7854924c090..1c6a0ec0458 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -230,7 +230,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->CONTRACT_ADDON == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index e74a8df069c..026a4315c83 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -206,12 +206,12 @@ $param = '&mode='.$mode; $enabledisablehtml = $langs->trans("EnableDefaultValues").' '; if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) { // Button off, click to enable - $enabledisablehtml .= ''; + $enabledisablehtml .= ''; $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off'); $enabledisablehtml .= ''; } else { // Button on, click to disable - $enabledisablehtml .= ''; + $enabledisablehtml .= ''; $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on'); $enabledisablehtml .= ''; } diff --git a/htdocs/admin/delivery.php b/htdocs/admin/delivery.php index 68a18aa0f6a..8e60b02a5bf 100644 --- a/htdocs/admin/delivery.php +++ b/htdocs/admin/delivery.php @@ -235,7 +235,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->DELIVERY_ADDON_NUMBER == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -372,7 +372,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->DELIVERY_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 777767a823e..2d4736cc49d 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -229,7 +229,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->EXPEDITION_ADDON_NUMBER == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir).'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 70bbc6f2b07..f7c9a84c5d1 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -238,7 +238,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->EXPENSEREPORT_ADDON == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -373,7 +373,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index a9f1e97ffab..ae269492ddf 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -516,7 +516,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->FACTURE_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("SetAsDefault"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("SetAsDefault"), 'off').''; } print ''; diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index cdc3d139515..4369bb9a2a7 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -294,7 +294,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->FICHEINTER_ADDON == $classname) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -434,7 +434,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->FICHEINTER_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index 00d82f68035..55d19a7ea6c 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -230,7 +230,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->HOLIDAY_ADDON == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -374,7 +374,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if ($conf->global->HOLIDAY_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -466,9 +466,9 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY', array(), null, 0); } else { if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY)) { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } else { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } } print ""; @@ -482,9 +482,9 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY', array(), null, 0); } else { if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY)) { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } else { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } } print ""; @@ -498,9 +498,9 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY', array(), null, 0, 0, 0, 2, 0, 1); } else { if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } else { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } } print ""; @@ -514,9 +514,9 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY', array(), null, 0, 0, 0, 2, 0, 1); } else { if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } else { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } } print ""; diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index 1a274f8cec1..737aa7e1940 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -131,7 +131,7 @@ if (!function_exists("ldap_connect")) { $form = new Form($db); -print '
'; +print ''; print ''; print dol_get_fiche_head($head, 'ldap', $langs->trans("LDAPSetup"), -1); diff --git a/htdocs/admin/ldap_contacts.php b/htdocs/admin/ldap_contacts.php index d68726c5125..b51843e1509 100644 --- a/htdocs/admin/ldap_contacts.php +++ b/htdocs/admin/ldap_contacts.php @@ -145,7 +145,7 @@ print dol_get_fiche_head($head, 'contacts', $langs->trans("LDAPSetup"), -1); print $langs->trans("LDAPDescContact").'
'; print '
'; -print ''; +print ''; print ''; print ''; diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index 91fba4e3519..14718303f67 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -120,7 +120,7 @@ print $langs->trans("LDAPDescGroups").'
'; print '
'; -print ''; +print ''; print ''; print '
'; diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index 3fb65f730c6..44ed5f5dc25 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -184,7 +184,7 @@ if (!function_exists("ldap_connect")) { setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); } -print ''; +print ''; print ''; print dol_get_fiche_head($head, 'members', $langs->trans("LDAPSetup"), -1); diff --git a/htdocs/admin/ldap_members_types.php b/htdocs/admin/ldap_members_types.php index 777bc80c6e1..a812f98a5e7 100644 --- a/htdocs/admin/ldap_members_types.php +++ b/htdocs/admin/ldap_members_types.php @@ -112,7 +112,7 @@ print $langs->trans("LDAPDescMembersTypes").'
'; print '
'; -print ''; +print ''; print ''; $form = new Form($db); diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index ab6c0f52121..dbdd61b9913 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -173,7 +173,7 @@ if (!function_exists("ldap_connect")) { } -print ''; +print ''; print ''; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index ccf12d5a104..253ee32e581 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -878,7 +878,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { } } $codeenabledisable .= ''."\n"; - $codeenabledisable .= 'global->MRP_MO_ADDON == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -374,7 +374,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->MRP_MO_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/paymentbybanktransfer.php b/htdocs/admin/paymentbybanktransfer.php index 04e1488fedc..ba7690bb6e3 100644 --- a/htdocs/admin/paymentbybanktransfer.php +++ b/htdocs/admin/paymentbybanktransfer.php @@ -144,7 +144,7 @@ $linkback = ''; -print ''; +print ''; print ''; print '
'; @@ -318,7 +318,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 2e266f833ea..90a75626e7c 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -332,7 +332,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 88df6b0da05..22ce045a7ab 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -278,7 +278,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->PROPALE_ADDON == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -417,7 +417,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->PROPALE_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -658,11 +658,11 @@ if ($conf->banque->enabled) { if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL)) { - print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } else { - print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; } } print ''; diff --git a/htdocs/admin/reception_setup.php b/htdocs/admin/reception_setup.php index c364911ab51..218cc1ef853 100644 --- a/htdocs/admin/reception_setup.php +++ b/htdocs/admin/reception_setup.php @@ -235,7 +235,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->RECEPTION_ADDON_NUMBER == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -378,7 +378,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->RECEPTION_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index a86ca272b85..b3204d594e0 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -260,7 +260,7 @@ foreach ($arrayhandler as $key => $module) { //print img_picto('', 'tick'); print img_picto($langs->trans("Enabled"), 'switch_on'); } else { - print ''; + print ''; //print $langs->trans("Activate"); print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; diff --git a/htdocs/admin/spip.php b/htdocs/admin/spip.php index 8f267e9eb1c..92dba301854 100644 --- a/htdocs/admin/spip.php +++ b/htdocs/admin/spip.php @@ -149,7 +149,7 @@ if (!empty($conf->global->ADHERENT_USE_SPIP)) { } else { print dol_get_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user'); - $link = ''; + $link = ''; //$link.=$langs->trans("Activate"); $link .= img_picto($langs->trans("Disabled"), 'switch_off'); $link .= ''; diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index d8d6a883d88..2f357b2d5fc 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -580,7 +580,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->STOCK_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index ec5a3e087cf..40fe58f68d6 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -256,7 +256,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->INVOICE_SUPPLIER_ADDON_NUMBER == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -395,9 +395,9 @@ foreach ($dirmodels as $reldir) { if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF == "$name") { //print img_picto($langs->trans("Default"),'on'); // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all - print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; + print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; } else { - print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 0efa365a33f..00b5fbfdb8e 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -269,7 +269,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -399,7 +399,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'&type=order_supplier" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -472,11 +472,11 @@ if ($conf->banque->enabled) { if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER)) { - print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } else { - print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; } } print ''; diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index 15210f89360..ce2c9f0f872 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -372,7 +372,7 @@ foreach ($dirmodels as $reldir) { print ""; } else { print '"; } @@ -381,9 +381,9 @@ foreach ($dirmodels as $reldir) { if ($conf->global->SUPPLIER_PAYMENT_ADDON_PDF == "$name") { //print img_picto($langs->trans("Default"),'on'); // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all - print 'scandir.'&label='.urlencode($module->name).'&type=SUPPLIER_PAYMENT"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; + print 'scandir).'&label='.urlencode($module->name).'&type=SUPPLIER_PAYMENT"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; } else { - print 'scandir.'&label='.urlencode($module->name).'&type=SUPPLIER_PAYMENT"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'&type=SUPPLIER_PAYMENT"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index 1585b66b1e1..6e3f190aeb6 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -257,7 +257,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->SUPPLIER_PROPOSAL_ADDON == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -395,7 +395,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -503,9 +503,9 @@ if ($conf->banque->enabled) { print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL'); } else { if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL)) { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'switch_on').''; + print ''.img_picto($langs->trans("Enabled"), 'switch_on').''; } } print ''; diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index 391a456439c..85ab0f0e9a8 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -165,9 +165,9 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('USER_HIDE_INACTIVE_IN_COMBOBOX'); } else { if (empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } print ''; @@ -271,7 +271,7 @@ foreach ($dirmodels as $reldir) { if (getDolGlobalString('USER_ADDON_PDF_ODT') == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php index 9846389f87a..3319ab994a6 100644 --- a/htdocs/admin/usergroup.php +++ b/htdocs/admin/usergroup.php @@ -203,7 +203,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->USERGROUP_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index f24cf3f80d3..ec7ee47c6be 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -596,7 +596,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Modify if ($object->status == $object::STATUS_DRAFT) { if ($permissiontoadd) { - print ''.$langs->trans("Modify").''."\n"; + print ''.$langs->trans("Modify").''."\n"; } else { print ''.$langs->trans('Modify').''."\n"; } diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 0a28346a130..dbfbc84b69f 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -952,18 +952,18 @@ if ($action == 'create') { print "\n\n
\n"; if (($object->statut == 1) && ($user->rights->mailing->valider || $object->fk_user_valid == $user->id)) { - print ''.$langs->trans("SetToDraft").''; + print ''.$langs->trans("SetToDraft").''; } if (($object->statut == 0 || $object->statut == 1 || $object->statut == 2) && $user->rights->mailing->creer) { if (!empty($conf->fckeditor->enabled) && !empty($conf->global->FCKEDITOR_ENABLE_MAILING)) { - print ''.$langs->trans("EditWithEditor").''; + print ''.$langs->trans("EditWithEditor").''; } else { - print ''.$langs->trans("EditWithTextEditor").''; + print ''.$langs->trans("EditWithTextEditor").''; } if (!empty($conf->use_javascript_ajax)) { - print ''.$langs->trans("EditHTMLSource").''; + print ''.$langs->trans("EditHTMLSource").''; } } @@ -972,7 +972,7 @@ if ($action == 'create') { if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send) { print ''.$langs->trans("TestMailing").''; } else { - print ''.$langs->trans("TestMailing").''; + print ''.$langs->trans("TestMailing").''; } if ($object->statut == 0) { diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 1941d7e31d6..835e7f0cafb 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1371,7 +1371,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $titlealt = $val['label']; } if ($object->stcomm_id != $val['id']) { - print ''.img_action($titlealt, $val['code'], $val['picto']).''; + print ''.img_action($titlealt, $val['code'], $val['picto']).''; } } print '
'; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 26624b1bf10..bae32e8b3b1 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -1216,7 +1216,7 @@ while ($i < min($num, $limit)) { $titlealt = $val['label']; } if ($obj->stcomm_id != $val['id']) { - print ''.img_action($titlealt, $val['code'], $val['picto']).''; + print ''.img_action($titlealt, $val['code'], $val['picto']).''; } } print ''; diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index ec53b523336..226ed6c43cd 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -237,7 +237,7 @@ class printing_printgcp extends PrintingDriver if ($conf->global->PRINTING_GCP_DEFAULT == $printer_det['id']) { $html .= img_picto($langs->trans("Default"), 'on'); } else { - $html .= ''.img_picto($langs->trans("Disabled"), 'off').''; + $html .= ''.img_picto($langs->trans("Disabled"), 'off').''; } $html .= ''; $html .= ''."\n"; diff --git a/htdocs/core/modules/printing/printipp.modules.php b/htdocs/core/modules/printing/printipp.modules.php index 0d824d2c7c0..f290b2b4e90 100644 --- a/htdocs/core/modules/printing/printipp.modules.php +++ b/htdocs/core/modules/printing/printipp.modules.php @@ -233,7 +233,7 @@ class printing_printipp extends PrintingDriver if ($conf->global->PRINTIPP_URI_DEFAULT == $value) { $html .= img_picto($langs->trans("Default"), 'on'); } else { - $html .= ''.img_picto($langs->trans("Disabled"), 'off').''; + $html .= ''.img_picto($langs->trans("Disabled"), 'off').''; } $html .= ''; $html .= ''."\n"; diff --git a/htdocs/core/modules/product_batch/mod_lot_advanced.php b/htdocs/core/modules/product_batch/mod_lot_advanced.php index 0e920483508..d44a261a16b 100644 --- a/htdocs/core/modules/product_batch/mod_lot_advanced.php +++ b/htdocs/core/modules/product_batch/mod_lot_advanced.php @@ -87,9 +87,9 @@ class mod_lot_advanced extends ModeleNumRefBatch // Option to enable custom masks per product $texte .= ''; diff --git a/htdocs/core/modules/product_batch/mod_sn_advanced.php b/htdocs/core/modules/product_batch/mod_sn_advanced.php index ca24a67c781..5e8fde199c1 100644 --- a/htdocs/core/modules/product_batch/mod_sn_advanced.php +++ b/htdocs/core/modules/product_batch/mod_sn_advanced.php @@ -87,9 +87,9 @@ class mod_sn_advanced extends ModeleNumRefBatch // Option to enable custom masks per product $texte .= ''; diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php index d8b06285be4..c56effea73a 100644 --- a/htdocs/don/admin/donation.php +++ b/htdocs/don/admin/donation.php @@ -251,12 +251,12 @@ if (is_resource($handle)) { print ''; } else { print "'; } } else { print ""; } @@ -267,7 +267,7 @@ if (is_resource($handle)) { print ''; } else { print "'; } diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index f95cb218561..1835c87f759 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -141,7 +141,7 @@ if ($action == "set") { $requestnb = 0; // To disable some code, so you can call step2 with url like - // http://localhost/dolibarrnew/install/step2.php?action=set&createtables=0&createkeys=0&createfunctions=0&createdata=llx_20_c_departements + // http://localhost/dolibarrnew/install/step2.php?action=set&token='.newToken().'&createtables=0&createkeys=0&createfunctions=0&createdata=llx_20_c_departements $createtables = isset($_GET['createtables']) ?GETPOST('createtables') : 1; $createkeys = isset($_GET['createkeys']) ?GETPOST('createkeys') : 1; $createfunctions = isset($_GET['createfunctions']) ?GETPOST('createfunction') : 1; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 8070a1b3526..bea9500bd0f 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -464,8 +464,10 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( // Array of action code where CSRFCHECK with token will be forced (so token must be provided on url request) $sensitiveget = false; if ((GETPOSTISSET('massaction') || GETPOST('action', 'aZ09')) && getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') == 2) { + // All GET actions and mass actions are processed as sensitive. $sensitiveget = true; } else { + // Only GET actions coded with a &token into url are processed as sensitive. $arrayofactiontoforcetokencheck = array( 'activate', 'add', 'addrights', 'addtimespent', 'doprev', 'donext', 'dvprev', 'dvnext', @@ -475,7 +477,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( if (in_array(GETPOST('action', 'aZ09'), $arrayofactiontoforcetokencheck)) { $sensitiveget = true; } - if (preg_match('/^(classify|close|confirm|del|disable|enable|remove|set|update)/', GETPOST('action', 'aZ09'))) { + if (preg_match('/^(classify|close|confirm|del|disable|enable|remove|set|unset|update)/', GETPOST('action', 'aZ09'))) { $sensitiveget = true; } } diff --git a/htdocs/margin/admin/margin.php b/htdocs/margin/admin/margin.php index 588773ef50c..30c85197337 100644 --- a/htdocs/margin/admin/margin.php +++ b/htdocs/margin/admin/margin.php @@ -189,9 +189,9 @@ if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff('ForceBuyingPriceIfNull'); } else { if (empty($conf->global->ForceBuyingPriceIfNull)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } print ''; diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 6d7497b7780..d0d4a404dcf 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -614,9 +614,9 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ($conf->global->$constforvar == $name) { //print img_picto($langs->trans("Default"), 'on'); // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset - print 'scandir.'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; + print 'scandir).'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; } else { - print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/printing/admin/printing.php b/htdocs/printing/admin/printing.php index 2b86efa507c..a0849f082e8 100644 --- a/htdocs/printing/admin/printing.php +++ b/htdocs/printing/admin/printing.php @@ -274,13 +274,13 @@ if ($mode == 'config' && $user->admin) { print ajax_constantonoff($printer->active); } else { if (empty($conf->global->{$printer->conf})) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } - print ''; - print ''; + print ''; + print ''; print ''."\n"; } diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 199f2a04f03..4f6094e1787 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -346,7 +346,7 @@ foreach ($dirproduct as $dirroot) { } print ''; @@ -762,10 +762,10 @@ if (!empty($conf->global->PRODUCT_CANVAS_ABILITY)) { if ($conf->global->$const) { print img_picto($langs->trans("Active"), 'tick'); print ''; diff --git a/htdocs/product/admin/product_lot.php b/htdocs/product/admin/product_lot.php index 3f4fd636de4..24f515fa0bc 100644 --- a/htdocs/product/admin/product_lot.php +++ b/htdocs/product/admin/product_lot.php @@ -161,7 +161,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL < 2) { if ($conf->global->PRODUCTBATCH_LOT_ADDON == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -253,7 +253,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL < 2) { if ($conf->global->PRODUCTBATCH_SN_ADDON == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php index 0ce2a38a471..adef0826992 100644 --- a/htdocs/projet/admin/project.php +++ b/htdocs/projet/admin/project.php @@ -347,7 +347,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->PROJECT_ADDON == 'mod_'.$classname) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -443,7 +443,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) { if ($conf->global->PROJECT_TASK_ADDON == 'mod_'.$classname) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -579,7 +579,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->PROJECT_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -719,7 +719,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) { if ($conf->global->PROJECT_TASK_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/recruitment/admin/setup.php b/htdocs/recruitment/admin/setup.php index 6b6dd050820..3f71b0397a1 100644 --- a/htdocs/recruitment/admin/setup.php +++ b/htdocs/recruitment/admin/setup.php @@ -475,9 +475,9 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ($conf->global->$constforvar == $name) { //print img_picto($langs->trans("Default"), 'on'); // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset - print 'scandir.'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; + print 'scandir).'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; } else { - print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/recruitment/admin/setup_candidatures.php b/htdocs/recruitment/admin/setup_candidatures.php index b2189954bf4..9c30f0d1ccf 100644 --- a/htdocs/recruitment/admin/setup_candidatures.php +++ b/htdocs/recruitment/admin/setup_candidatures.php @@ -473,9 +473,9 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ($conf->global->$constforvar == $name) { //print img_picto($langs->trans("Default"), 'on'); // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset - print 'scandir.'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; + print 'scandir).'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; } else { - print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 8b4975a5592..29f8d0b175d 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -391,7 +391,7 @@ foreach ($arrayofmodules as $file => $modCodeTiers) { $disabled = (!empty($conf->multicompany->enabled) && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity) ? true : false); print ''; } else { - print ''; } @@ -576,7 +576,7 @@ foreach ($dirsociete as $dirroot) { print ""; } else { print '"; } } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index ca4793c2c60..bc786a540d6 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1639,7 +1639,7 @@ while ($i < min($num, $limit)) { $titlealt = $val['label']; } if ($obj->stcomm_id != $val['id']) { - print ''.img_action($titlealt, $val['code'], $val['picto']).''; + print ''.img_action($titlealt, $val['code'], $val['picto']).''; } } print ''; diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index e75321e263b..db3b28d0948 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -196,7 +196,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->TAKEPOS_REF_ADDON == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } From a747c71cf58482e51752280611a5f0d8677364af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 19:19:28 +0200 Subject: [PATCH 128/374] css --- htdocs/core/tpl/objectline_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index b50ca83c6f6..248059ba531 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -164,7 +164,7 @@ if (($line->info_bits & 2) == 2) { // Show date range if ($line->element == 'facturedetrec') { if ($line->date_start_fill || $line->date_end_fill) { - print '

'; + print '
'; } if ($line->date_start_fill) { print ''.$langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); From 14c8bdce1a8f03419a958a8508268941df710c10 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 19:25:38 +0200 Subject: [PATCH 129/374] Better desciption of option --- htdocs/core/tpl/objectline_view.tpl.php | 4 ++-- htdocs/langs/en_US/admin.lang | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 248059ba531..ad27dae210c 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -164,7 +164,7 @@ if (($line->info_bits & 2) == 2) { // Show date range if ($line->element == 'facturedetrec') { if ($line->date_start_fill || $line->date_end_fill) { - print '
'; + print '
'; } if ($line->date_start_fill) { print ''.$langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); @@ -180,7 +180,7 @@ if (($line->info_bits & 2) == 2) { } } else { if ($line->date_start || $line->date_end) { - print '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; + print '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; } //print get_date_range($line->date_start, $line->date_end, $format); } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 26edb7f0518..a73f06e1201 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1626,8 +1626,7 @@ ProductSetup=Products module setup ServiceSetup=Services module setup ProductServiceSetup=Products and Services modules setup NumberOfProductShowInSelect=Maximum number of products to show in combo select lists (0=no limit) -ViewProductDescInFormAbility=Display product descriptions in forms (otherwise shown in a tooltip popup) -DoNotAddProductDescAtAddLines=Do not add product description (from product card) on submit add lines on forms +ViewProductDescInFormAbility=Display product descriptions in lines of items (otherwise show description in a tooltip popup) OnProductSelectAddProductDesc=How to use the description of the products when adding a product as a line of a document AutoFillFormFieldBeforeSubmit=Auto fill the description input field with the description of product DoNotAutofillButAutoConcat=Do not autofill the input field with description of product. Description of the product will be concatenated to the entered description automatically. From ee362a42bd5098a00c155521ff8a96202c1011ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 21:06:09 +0200 Subject: [PATCH 130/374] css --- htdocs/bom/class/bom.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 19938a049a9..b57aaf158fd 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -98,7 +98,7 @@ class BOM extends CommonObject 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1, 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200'), - 'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth150', 'csslist'=>'minwidth150 center'), + 'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth175', 'csslist'=>'minwidth175 center'), //'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), From 3dc32140479a74253276ecdeae3bc6361d2a2e0c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 21:13:27 +0200 Subject: [PATCH 131/374] CSS --- htdocs/expedition/list.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 50a59e0d2e4..27340df146c 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -402,16 +402,16 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } if ($sall) { - $param .= "&sall=".urlencode($sall); + $param .= "&sall=".urlencode($sall); } if ($search_ref_exp) { - $param .= "&search_ref_exp=".urlencode($search_ref_exp); + $param .= "&search_ref_exp=".urlencode($search_ref_exp); } if ($search_ref_liv) { - $param .= "&search_ref_liv=".urlencode($search_ref_liv); + $param .= "&search_ref_liv=".urlencode($search_ref_liv); } if ($search_ref_customer) { - $param .= "&search_ref_customer=".urlencode($search_ref_customer); + $param .= "&search_ref_customer=".urlencode($search_ref_customer); } if ($search_user > 0) { $param .= '&search_user='.urlencode($search_user); @@ -420,10 +420,10 @@ if ($search_sale > 0) { $param .= '&search_sale='.urlencode($search_sale); } if ($search_company) { - $param .= "&search_company=".urlencode($search_company); + $param .= "&search_company=".urlencode($search_company); } if ($search_tracking) { - $param .= "&search_tracking=".urlencode($search_tracking); + $param .= "&search_tracking=".urlencode($search_tracking); } if ($search_town) { $param .= '&search_town='.urlencode($search_town); @@ -768,7 +768,7 @@ while ($i < min($num, $limit)) { // Ref if (!empty($arrayfields['e.ref']['checked'])) { - print "
\n"; if (!$i) { @@ -788,7 +788,7 @@ while ($i < min($num, $limit)) { // Third party if (!empty($arrayfields['s.nom']['checked'])) { - print ''; if (!$i) { From 6af9f3b142247f5e1f07c7dae13aabc2039b10cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 21:18:30 +0200 Subject: [PATCH 132/374] Fix css --- htdocs/expedition/list.php | 4 ++-- htdocs/reception/list.php | 36 ++++++++++++++++++------------------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 27340df146c..3660b8a5cbe 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -806,7 +806,7 @@ while ($i < min($num, $limit)) { } // Zip if (!empty($arrayfields['s.zip']['checked'])) { - print ''; if (!$i) { @@ -815,7 +815,7 @@ while ($i < min($num, $limit)) { } // State if (!empty($arrayfields['state.nom']['checked'])) { - print "\n"; + print '\n"; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 5b4bdf6bb6f..d14d2159ea3 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -573,43 +573,43 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } if ($sall) { - $param .= "&sall=".urlencode($sall); + $param .= "&sall=".urlencode($sall); } if ($search_ref_rcp) { - $param .= "&search_ref_rcp=".urlencode($search_ref_rcp); + $param .= "&search_ref_rcp=".urlencode($search_ref_rcp); } if ($search_ref_liv) { - $param .= "&search_ref_liv=".urlencode($search_ref_liv); + $param .= "&search_ref_liv=".urlencode($search_ref_liv); } if ($search_company) { - $param .= "&search_company=".urlencode($search_company); + $param .= "&search_company=".urlencode($search_company); } if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); + $param .= '&optioncss='.urlencode($optioncss); } if ($search_billed != '' && $search_billed >= 0) { - $param .= "&search_billed=".urlencode($search_billed); + $param .= "&search_billed=".urlencode($search_billed); } if ($search_town) { - $param .= "&search_town=".urlencode($search_town); + $param .= "&search_town=".urlencode($search_town); } if ($search_zip) { - $param .= "&search_zip=".urlencode($search_zip); + $param .= "&search_zip=".urlencode($search_zip); } if ($search_state) { - $param .= "&search_state=".urlencode($search_state); + $param .= "&search_state=".urlencode($search_state); } if ($search_status != '') { - $param .= "&search_status=".urlencode($search_status); + $param .= "&search_status=".urlencode($search_status); } if ($search_country) { - $param .= "&search_country=".urlencode($search_country); + $param .= "&search_country=".urlencode($search_country); } if ($search_type_thirdparty) { - $param .= "&search_type_thirdparty=".urlencode($search_type_thirdparty); + $param .= "&search_type_thirdparty=".urlencode($search_type_thirdparty); } if ($search_ref_supplier) { - $param .= "&search_ref_supplier=".urlencode($search_ref_supplier); + $param .= "&search_ref_supplier=".urlencode($search_ref_supplier); } // Add $param from extra fields foreach ($search_array_options as $key => $val) { @@ -885,7 +885,7 @@ while ($i < min($num, $limit)) { // Ref if (!empty($arrayfields['e.ref']['checked'])) { - print "'; if (!$i) { @@ -928,7 +928,7 @@ while ($i < min($num, $limit)) { } // Zip if (!empty($arrayfields['s.zip']['checked'])) { - print ''; if (!$i) { From 25971e373ddaaff83988463da3d990c68cbbf635 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 21:20:12 +0200 Subject: [PATCH 133/374] Fix css --- htdocs/reception/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index d14d2159ea3..207e04428bc 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -900,7 +900,7 @@ while ($i < min($num, $limit)) { // Ref customer if (!empty($arrayfields['e.ref_supplier']['checked'])) { - print '\n"; if (!$i) { From b5a27b4c15eec694ab5eecdef53b2de5ebbcec19 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 21:27:01 +0200 Subject: [PATCH 134/374] css --- htdocs/reception/list.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 207e04428bc..624748ded8f 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -898,9 +898,9 @@ while ($i < min($num, $limit)) { } } - // Ref customer + // Ref supplier if (!empty($arrayfields['e.ref_supplier']['checked'])) { - print '\n"; if (!$i) { @@ -919,8 +919,8 @@ while ($i < min($num, $limit)) { } // Town if (!empty($arrayfields['s.town']['checked'])) { - print ''; if (!$i) { $totalarray['nbfield']++; @@ -929,7 +929,7 @@ while ($i < min($num, $limit)) { // Zip if (!empty($arrayfields['s.zip']['checked'])) { print ''; if (!$i) { $totalarray['nbfield']++; @@ -937,7 +937,7 @@ while ($i < min($num, $limit)) { } // State if (!empty($arrayfields['state.nom']['checked'])) { - print "\n"; + print "\n"; if (!$i) { $totalarray['nbfield']++; } @@ -946,7 +946,7 @@ while ($i < min($num, $limit)) { if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; if (!$i) { $totalarray['nbfield']++; From 77e493755f14931f1f9b5b30471414a9bf6aefd8 Mon Sep 17 00:00:00 2001 From: javieralapps4up Date: Sun, 19 Sep 2021 22:26:49 +0200 Subject: [PATCH 135/374] Fix: #18760 bad rights admin if advanced perms Insufficient rights to view a group's card for admin users if advanced permissions are used --- htdocs/main.inc.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 1d975f5ab5a..b7b1462ad36 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1039,6 +1039,16 @@ if (!defined('NOLOGIN')) { $user->rights->user->user->supprimer = 1; $user->rights->user->self->creer = 1; $user->rights->user->self->password = 1; + + //Required if advanced permissions are used with MAIN_USE_ADVANCED_PERMS + $user->rights->user->user_advance->readperms = 1; + $user->rights->user->user_advance->write = 1; + $user->rights->user->self_advance->readperms = 1; + $user->rights->user->self_advance->writeperms = 1; + $user->rights->user->group_advance->read = 1; + $user->rights->user->group_advance->readperms = 1; + $user->rights->user->group_advance->write = 1; + $user->rights->user->group_advance->delete = 1; } /* From 1ea2182bf7522238076b56c2567bba06a6d6b77b Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 19 Sep 2021 20:32:07 +0000 Subject: [PATCH 136/374] Fixing style errors. --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b7b1462ad36..1af8595b780 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1039,7 +1039,7 @@ if (!defined('NOLOGIN')) { $user->rights->user->user->supprimer = 1; $user->rights->user->self->creer = 1; $user->rights->user->self->password = 1; - + //Required if advanced permissions are used with MAIN_USE_ADVANCED_PERMS $user->rights->user->user_advance->readperms = 1; $user->rights->user->user_advance->write = 1; From ce56f52a30cab429caa4eadc63a4cfee47f9a63b Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 20 Sep 2021 03:28:30 +0200 Subject: [PATCH 137/374] FIX #18698 Supplier invoice list - "alert" checkbox not working --- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- htdocs/fourn/facture/list.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index fd393445187..4bca77809cb 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2440,7 +2440,7 @@ class FactureFournisseur extends CommonInvoice if ($facturestatic->hasDelay()) { $response->nbtodolate++; - $response->url_late = DOL_URL_ROOT.'/fourn/facture/list.php?option=late&mainmenu=billing&leftmenu=suppliers_bills'; + $response->url_late = DOL_URL_ROOT.'/fourn/facture/list.php?search_option=late&mainmenu=billing&leftmenu=suppliers_bills'; } } $this->db->free($resql); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 0d34a3790df..ac64a9af82e 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -119,7 +119,7 @@ $search_btn = GETPOST('button_search', 'alpha'); $search_remove_btn = GETPOST('button_removefilter', 'alpha'); $search_categ_sup = trim(GETPOST("search_categ_sup", 'int')); -$option = GETPOST('option'); +$option = GETPOST('search_option'); if ($option == 'late') { $search_status = '1'; } @@ -803,7 +803,7 @@ if ($resql) { $param .= '&show_files='.urlencode($show_files); } if ($option) { - $param .= "&option=".urlencode($option); + $param .= "&search_option=".urlencode($option); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); @@ -1428,9 +1428,9 @@ if ($resql) { // Date limit if (!empty($arrayfields['f.date_lim_reglement']['checked'])) { - print ''; if (!$i) { From 360e3290b56f6412066739ad27fd6f3b284088fc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Sep 2021 04:20:20 +0200 Subject: [PATCH 138/374] typo --- htdocs/core/modules/modFacture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 2fadb5d86ae..ef341c83e89 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -142,7 +142,7 @@ class modFacture extends DolibarrModules 'objectname'=>'Facture', 'method'=>'sendEmailsRemindersOnInvoiceDueDate', 'parameters'=>"10,all,EmailTemplateCode", - 'comment'=>'Send an emails when the unpaid invoices reach a due date + n days = today. First param is the offset n of days, second parameter is "all" or a payment mode code, last paramater is the code of email template to use (an email template with EmailTemplateCode must exists. the version in the language of the thirdparty will be used in priority).', + 'comment'=>'Send an emails when the unpaid invoices reach a due date + n days = today. First param is the offset n of days, second parameter is "all" or a payment mode code, last parameter is the code of email template to use (an email template with EmailTemplateCode must exists. the version in the language of the thirdparty will be used in priority).', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, From 9b4e4b0ba57e3c332b2d1f4c1911c89e2e5a269a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Sep 2021 04:20:21 +0200 Subject: [PATCH 139/374] typo From df0a26550fd49ae47f7064a4da775a9f093f5f35 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 20 Sep 2021 09:12:07 +0200 Subject: [PATCH 140/374] Update to match eldy's advices --- htdocs/ecm/class/htmlecm.form.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/ecm/class/htmlecm.form.class.php b/htdocs/ecm/class/htmlecm.form.class.php index 7d695ce023d..623d626935d 100644 --- a/htdocs/ecm/class/htmlecm.form.class.php +++ b/htdocs/ecm/class/htmlecm.form.class.php @@ -55,10 +55,10 @@ class FormEcm * @param int $selected Id of preselected section * @param string $select_name Name of HTML select component * @param string $module Module ('ecm', 'medias', ...) - * @param array $ignore_id Arroy of id to ignore + * @param array $ids_to_ignore Array of id to ignore * @return string String with HTML select */ - public function selectAllSections($selected = 0, $select_name = '', $module = 'ecm', $ignore_id = array()) + public function selectAllSections($selected = 0, $select_name = '', $module = 'ecm', $ids_to_ignore = array()) { global $conf, $langs; $langs->load("ecm"); @@ -66,8 +66,8 @@ class FormEcm if ($select_name == '') { $select_name = "catParent"; } - if (!is_array($ignore_id)) { - $ignore_id = array($ignore_id); + if (!is_array($ids_to_ignore)) { + $ids_to_ignore = array($ids_to_ignore); } $cate_arbo = null; @@ -87,7 +87,7 @@ class FormEcm } else { $output .= ''; foreach ($cate_arbo as $key => $value) { - if (!in_array($cate_arbo[$key]['id'], $ignore_id)) { + if (!in_array($cate_arbo[$key]['id'], $ids_to_ignore)) { $valueforoption = empty($cate_arbo[$key]['id']) ? $cate_arbo[$key]['relativename'] : $cate_arbo[$key]['id']; if ($selected && $valueforoption == $selected) { $add = 'selected '; From 5397e2d9c3ee220a1e7e8fe81ad1f1a589c62595 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Sep 2021 11:30:33 +0200 Subject: [PATCH 141/374] Clean sql --- htdocs/ecm/class/ecmdirectory.class.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 3c7af135922..54b1e6b6bb8 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -144,7 +144,6 @@ class EcmDirectory extends CommonObject // Clean parameters $this->label = dol_sanitizeFileName(trim($this->label)); - $this->fk_parent = trim($this->fk_parent); $this->description = trim($this->description); $this->date_c = $now; $this->fk_user_c = $user->id; @@ -155,7 +154,7 @@ class EcmDirectory extends CommonObject // Check if same directory does not exists with this name $relativepath = $this->label; - if ($this->fk_parent) { + if ($this->fk_parent > 0) { $parent = new EcmDirectory($this->db); $parent->fetch($this->fk_parent); $relativepath = $parent->getRelativePath().$relativepath; @@ -194,11 +193,11 @@ class EcmDirectory extends CommonObject $sql .= ") VALUES ("; $sql .= " '".$this->db->escape($this->label)."',"; $sql .= " '".$this->db->escape($conf->entity)."',"; - $sql .= " '".$this->db->escape($this->fk_parent)."',"; + $sql .= " ".($this->fk_parent > 0 ? ((int) $this->fk_parent) : "null").","; $sql .= " '".$this->db->escape($this->description)."',"; $sql .= " ".((int) $this->cachenbofdoc).","; $sql .= " '".$this->db->idate($this->date_c)."',"; - $sql .= " '".$this->db->escape($this->fk_user_c)."'"; + $sql .= " ".($this->fk_user_c > 0 ? ((int) $this->fk_user_c) : "null").","; $sql .= ")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); @@ -249,20 +248,19 @@ class EcmDirectory extends CommonObject // Clean parameters $this->label = trim($this->label); - $this->fk_parent = trim($this->fk_parent); $this->description = trim($this->description); - - // Check parameters - // Put here code to add control on parameters values + if ($this->fk_parent <= 0) { + $this->fk_parent = 0; + } $this->db->begin(); // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET"; - $sql .= " label='".$this->db->escape($this->label)."',"; - $sql .= " fk_parent='".$this->db->escape($this->fk_parent)."',"; - $sql .= " description='".$this->db->escape($this->description)."'"; - $sql .= " WHERE rowid=".((int) $this->id); + $sql .= " label = '".$this->db->escape($this->label)."',"; + $sql .= " fk_parent = ".($this->fk_parent > 0 ? ((int) $this->fk_parent) : "null").","; + $sql .= " description = '".$this->db->escape($this->description)."'"; + $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); From 131677a5ea06feb4c9e58aebd90256c4eec6caae Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Mon, 20 Sep 2021 11:50:10 +0200 Subject: [PATCH 142/374] FIX #18735 File preview is not working --- htdocs/expedition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 8c959116582..902914c4327 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2553,7 +2553,7 @@ if ($action == 'create') { // Presend form $modelmail = 'shipping_send'; $defaulttopic = 'SendShippingRef'; - $diroutput = $conf->expedition->dir_output.'/sending'; + $diroutput = $conf->expedition->dir_output; $trackid = 'shi'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; From 0453a27bda7740fb65a1a7cf8e93c2386b2d8f68 Mon Sep 17 00:00:00 2001 From: javieralapps4up Date: Mon, 20 Sep 2021 12:24:44 +0200 Subject: [PATCH 143/374] Update main.inc.php --- htdocs/main.inc.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 1af8595b780..9bcf6238b36 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1041,14 +1041,16 @@ if (!defined('NOLOGIN')) { $user->rights->user->self->password = 1; //Required if advanced permissions are used with MAIN_USE_ADVANCED_PERMS - $user->rights->user->user_advance->readperms = 1; - $user->rights->user->user_advance->write = 1; - $user->rights->user->self_advance->readperms = 1; - $user->rights->user->self_advance->writeperms = 1; - $user->rights->user->group_advance->read = 1; - $user->rights->user->group_advance->readperms = 1; - $user->rights->user->group_advance->write = 1; - $user->rights->user->group_advance->delete = 1; + if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { + $user->rights->user->user_advance->readperms = 1; + $user->rights->user->user_advance->write = 1; + $user->rights->user->self_advance->readperms = 1; + $user->rights->user->self_advance->writeperms = 1; + $user->rights->user->group_advance->read = 1; + $user->rights->user->group_advance->readperms = 1; + $user->rights->user->group_advance->write = 1; + $user->rights->user->group_advance->delete = 1; + } } /* From be2a95ca51f124b674104a9be8af793381d8025a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Sep 2021 13:01:53 +0200 Subject: [PATCH 144/374] Add language as_IN --- htdocs/langs/en_US/languages.lang | 1 + htdocs/societe/class/societe.class.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index e3b6bed94c8..ca962811831 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -6,6 +6,7 @@ Language_ar_MA=Arabic (Moroco) Language_ar_SA=Arabic Language_ar_TN=Arabic (Tunisia) Language_ar_IQ=Arabic (Iraq) +Language_as_IN=Assamese Language_az_AZ=Azerbaijani Language_bn_BD=Bengali Language_bn_IN=Bengali (India) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ff6e9474d34..e7597b311c2 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2581,7 +2581,7 @@ class Societe extends CommonObject $label .= ' ('.dol_escape_htmltag($this->name_alias).')'; } } - $label .= '
'.$langs->trans('Email').': '.$this->email; + $label .= '
'.img_picto('', 'email', 'class="pictofixedwidth"').$this->email; if (!empty($this->phone) || !empty($this->fax)) { $phonelist = array(); if ($this->phone) { @@ -2590,7 +2590,7 @@ class Societe extends CommonObject if ($this->fax) { $phonelist[] = dol_print_phone($this->fax, $this->country_code, $this->id, 0, '', ' ', 'fax'); } - $label .= '
'.$langs->trans('Phone').': '.implode(' ', $phonelist); + $label .= '
'.implode(' ', $phonelist); } if (!empty($this->address)) { $label .= '
'.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs); // Address + country From 0eff2fa15b64882be38019bf6c492b8b08f70a03 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Sep 2021 13:20:54 +0200 Subject: [PATCH 145/374] FIX default language defined for IN country --- htdocs/core/class/html.formadmin.class.php | 12 ++++++++++++ htdocs/core/lib/functions.lib.php | 12 +++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 8e03f158a02..13619fe5aa3 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -73,6 +73,18 @@ class FormAdmin $langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 12, 0, $mainlangonly); + // If the language to select is not inside the list of available language and empty value is not available, we must find + // an alternative as the language code to pre-select (to avoid to have first element in list pre-selected). + if ($selected && !in_array($selected, $langs_available) && empty($showempty)) { + $tmparray = explode('_', $selected); + if (!empty($tmparray[1])) { + $selected = getLanguageCodeFromCountryCode($tmparray[1]); + } + if (empty($selected)) { + $selected = $langs->defaultlang; + } + } + $out = ''; $out .= ''; +print ''; +print ''; +print ''; print load_fiche_titre($langs->trans("CommentsOfVoters"), '', ''); @@ -391,7 +396,7 @@ $comments = $object->getComments(); if ($comments) { foreach ($comments as $comment) { if ($user->rights->opensurvey->write) { - print ' '.img_picto('', 'delete.png', '', false, 0, 0, '', '', 0).' '; + print ' '.img_picto('', 'delete.png', '', false, 0, 0, '', '', 0).' '; } print dol_htmlentities($comment->usercomment).': '.dol_nl2br(dol_htmlentities($comment->comment))."
"; @@ -407,10 +412,7 @@ if ($object->allow_comments) { print $langs->trans("AddACommentForPoll").'
'; print '
'."\n"; print $langs->trans("Name").': '."\n"; - print '
'."\n"; - if (isset($erreur_commentaire_vide) && $erreur_commentaire_vide == "yes") { - print "".$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")).""; - } + print '
'."\n"; } print ''; From 82f66f8b0a4cc1939d9710e3a5e38b7dbbe1f987 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Sep 2021 19:00:28 +0200 Subject: [PATCH 151/374] Better label of field --- htdocs/langs/en_US/products.lang | 1 + htdocs/mrp/mo_production.php | 39 ++++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index ae199f4136b..b8f242652a1 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -397,6 +397,7 @@ ActionAvailableOnVariantProductOnly=Action only available on the variant of prod ProductsPricePerCustomer=Product prices per customers ProductSupplierExtraFields=Additional Attributes (Supplier Prices) DeleteLinkedProduct=Delete the child product linked to the combination +AmountUsedToUpdateWAP=Amount to use to update the Weighted Average Price PMPValue=Weighted average price PMPValueShort=WAP DefaultBOM=Default BOM diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 3dccebf9549..84dab109b91 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -38,7 +38,7 @@ dol_include_once('/bom/class/bom.class.php'); dol_include_once('/mrp/lib/mrp_mo.lib.php'); // Load translation files required by the page -$langs->loadLangs(array("mrp", "stocks", "other", "productbatch")); +$langs->loadLangs(array("mrp", "stocks", "other", "product", "productbatch")); // Get parameters $id = GETPOST('id', 'int'); @@ -691,6 +691,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $bom = new Bom($db); $res = $bom->fetch($object->fk_bom); if ($res > 0) { + $bom->calculateCosts(); $bomcost = $bom->unit_cost; } } @@ -818,6 +819,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } + $bomcost = price2num($bomcost, 'MU'); + $arrayoflines = $object->fetchLinesLinked('consumed', $line->id); $alreadyconsumed = 0; foreach ($arrayoflines as $line2) { @@ -1006,9 +1009,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; if ($permissiontoupdatecost) { if (empty($bomcost)) { - print ''; + print ''; } else { - print ''; + print ''; } } print ''; @@ -1073,10 +1076,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $tmpproduct = new Product($db); $tmpproduct->fetch($line->fk_product); - if (empty($bomcost)) { - $bomcost = $tmpproduct->pmp; - } - $arrayoflines = $object->fetchLinesLinked('produced', $line->id); $alreadyproduced = 0; foreach ($arrayoflines as $line2) { @@ -1095,8 +1094,19 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''; if ($permissiontoupdatecost) { + // Defined $manufacturingcost + $manufacturingcost = $bomcost; + if (empty($manufacturingcost)) { + $manufacturingcost = price2num($tmpproduct->cost_price, 'MU'); + } + if (empty($manufacturingcost)) { + $manufacturingcost = price2num($tmpproduct->pmp, 'MU'); + } + print ''; } print ''; if ($permissiontoupdatecost) { + // Defined $manufacturingcost + $manufacturingcost = $bomcost; + if (empty($manufacturingcost)) { + $manufacturingcost = price2num($tmpproduct->cost_price, 'MU'); + } + if (empty($manufacturingcost)) { + $manufacturingcost = price2num($tmpproduct->pmp, 'MU'); + } + if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - $preselected = (GETPOSTISSET('pricetoproduce-'.$line->id.'-'.$i) ? GETPOST('pricetoproduce-'.$line->id.'-'.$i) : price($bomcost)); + $preselected = (GETPOSTISSET('pricetoproduce-'.$line->id.'-'.$i) ? GETPOST('pricetoproduce-'.$line->id.'-'.$i) : price($manufacturingcost)); print ''; } else { - print ''; + print ''; } } print ''; From d1bfaa5256106d089c6823eea168a2a9b29d82e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Sep 2021 19:02:04 +0200 Subject: [PATCH 152/374] Trans --- htdocs/langs/en_US/products.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index b8f242652a1..294e2afbc03 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -75,6 +75,7 @@ SellingPriceTTC=Selling price (inc. tax) SellingMinPriceTTC=Minimum Selling price (inc. tax) CostPriceDescription=This price field (excl. tax) can be used to capture the average amount this product costs to your company. It may be any price you calculate yourself, for example, from the average buying price plus average production and distribution cost. CostPriceUsage=This value could be used for margin calculation. +ManufacturingPrice=Manufacturing price SoldAmount=Sold amount PurchasedAmount=Purchased amount NewPrice=New price From e3f3e01c2170bdd24f0a6a31a6dbd22074615f33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Sep 2021 19:21:39 +0200 Subject: [PATCH 153/374] Fields on surveys on 2 columns --- htdocs/opensurvey/card.php | 35 +++++++++++++++++--------- htdocs/opensurvey/results.php | 46 ++++++++++++++++++++++++++++++----- 2 files changed, 63 insertions(+), 18 deletions(-) diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index bc63b319efd..c32b49ff1a1 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -222,20 +222,21 @@ dol_banner_tab($object, 'id', $linkback, 1, 'id_sondage', 'id_sondage', $morehtm print '
'; -print '
'; +print '
'; +print '
'; print '
'."\n"; - print 'scandir.'&label='.urlencode($module->name).'&type=SUPPLIER_PAYMENT">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'&type=SUPPLIER_PAYMENT">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "
'; if ($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS) { - $texte .= ''.img_picto($langs->trans("Enabled"), 'on').''; + $texte .= ''.img_picto($langs->trans("Enabled"), 'on').''; } else { - $texte .= ''.img_picto($langs->trans("Disabled"), 'off').''; + $texte .= ''.img_picto($langs->trans("Disabled"), 'off').''; } $texte .= ' '.$langs->trans('CustomMasks')."\n"; $texte .= ''; if ($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS) { - $texte .= ''.img_picto($langs->trans("Enabled"), 'on').''; + $texte .= ''.img_picto($langs->trans("Enabled"), 'on').''; } else { - $texte .= ''.img_picto($langs->trans("Disabled"), 'off').''; + $texte .= ''.img_picto($langs->trans("Disabled"), 'off').''; } $texte .= ' '.$langs->trans('CustomMasks')."\n"; $texte .= '\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Enabled"), 'switch_on').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Enabled"), 'switch_on').''; print '\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; print ''.img_picto('', 'setup').''.img_picto('', 'setup').''.img_picto('', 'setup').''.img_picto('', 'setup').'
'; if (!$disabled) { - print ''; + print ''; } print img_picto($langs->trans("Disabled"), 'switch_off'); if (!$disabled) { @@ -463,7 +463,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->PRODUCT_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; - print ''.$langs->trans("Disable").''; + print ''.$langs->trans("Disable").''; } else { print ' '; - print ''.$langs->trans("Activate").''; + print ''.$langs->trans("Activate").''; } print '
'; if (!$disabled) { - print ''; + print ''; } print img_picto($langs->trans("Disabled"), 'switch_off'); if (!$disabled) { @@ -468,7 +468,7 @@ foreach ($arrayofmodules as $file => $modCodeCompta) { print img_picto($langs->trans("Activated"), 'switch_on'); print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; + print ''; print $shipment->getNomUrl(1); print "'; + print ''; print $companystatic->getNomUrl(1); print ''; + print ''; print $obj->zip; print '".$obj->state_name."'.$obj->state_name.""; + print ''; print $reception->getNomUrl(1); $filename = dol_sanitizeFileName($reception->ref); $filedir = $conf->reception->dir_output.'/'.dol_sanitizeFileName($reception->ref); @@ -900,8 +900,8 @@ while ($i < min($num, $limit)) { // Ref customer if (!empty($arrayfields['e.ref_supplier']['checked'])) { - print ""; - print $obj->ref_supplier; + print '\n"; if (!$i) { $totalarray['nbfield']++; @@ -910,7 +910,7 @@ while ($i < min($num, $limit)) { // Third party if (!empty($arrayfields['s.nom']['checked'])) { - print ''; + print ''; print $companystatic->getNomUrl(1); print ''; + print ''; print $obj->zip; print 'ref_supplier).'">'; print dol_escape_htmltag($obj->ref_supplier); print "'; + print ''; print dol_escape_htmltag($obj->ref_supplier); print "'; - print $obj->town; + print ''; + print dol_escape_htmltag($obj->town); print ''; - print $obj->zip; + print dol_escape_htmltag($obj->zip); print '".$obj->state_name."".dol_escape_htmltag($obj->state_name)."'; $tmparray = getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; + print dol_escape_htmltag($tmparray['label']); print ''.dol_print_date($datelimit, 'day'); + print ''.dol_print_date($datelimit, 'day'); if ($facturestatic->hasDelay()) { - print img_warning($langs->trans('Late')); + print img_warning($langs->trans('Alert').' - '.$langs->trans('Late')); } print ''.$langs->trans("Qty").''.$langs->trans("PMPValue").''.$form->textwithpicto($langs->trans("UnitCost"), $langs->trans("AmountUsedToUpdateWAP")).''.$langs->trans("UnitCost").''.$form->textwithpicto($langs->trans("ManufacturingPrice"), $langs->trans("AmountUsedToUpdateWAP")).''.$langs->trans("QtyAlreadyProduced").''.$line->qty.''; - print price($bomcost); + if ($manufacturingcost) { + print price($manufacturingcost); + } print ''; @@ -1188,11 +1198,20 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print '
'; // Type $type = ($object->format == "A") ? 'classic' : 'date'; -print ''; // Title print ''; // Description -print ''; // EMail //If linked user, then emails are going to be sent to users' email if (!$object->fk_user_creat) { - print ''; } // Receive an email with each vote -print ''; // Users can comment -print ''; // Users can see others vote -print ''; +print '
'.$langs->trans("Type").''; +print '
'.$langs->trans("Type").''; print img_picto('', dol_buildpath('/opensurvey/img/'.($type == 'classic' ? 'chart-32.png' : 'calendar-32.png'), 1), 'width="16"', 1); print ' '.$langs->trans($type == 'classic' ? "TypeClassic" : "TypeDate").'
'; $adresseadmin = $object->mail_admin; -print $langs->trans("Title").''; +print $langs->trans("Title").''; if ($action == 'edit') { print ''; } else { @@ -244,7 +245,7 @@ if ($action == 'edit') { print '
'.$langs->trans("Description").''; +print '
'.$langs->trans("Description").''; if ($action == 'edit') { $doleditor = new DolEditor('nouveauxcommentaires', $object->description, '', 120, 'dolibarr_notes', 'In', 1, 1, 1, ROWS_7, '90%'); $doleditor->Create(0, ''); @@ -256,17 +257,17 @@ print '
'.$langs->trans("EMail").''; + print '
'.$langs->trans("EMail").''; if ($action == 'edit') { print ''; } else { - print dol_print_email($object->mail_admin, 0, 0, 1); + print dol_print_email($object->mail_admin, 0, 0, 1, 0, 1, 1); } print '
'.$langs->trans('ToReceiveEMailForEachVote').''; +print '
'.$langs->trans('ToReceiveEMailForEachVote').''; if ($action == 'edit') { print 'mailsonde ? 'checked="checked"' : '').'">'; } else { @@ -282,7 +283,7 @@ if ($action == 'edit') { print '
'.$langs->trans('CanComment').''; +print '
'.$langs->trans('CanComment').''; if ($action == 'edit') { print 'allow_comments ? 'checked="checked"' : '').'">'; } else { @@ -291,7 +292,7 @@ if ($action == 'edit') { print '
'.$langs->trans('CanSeeOthersVote').''; +print '
'.$langs->trans('CanSeeOthersVote').''; if ($action == 'edit') { print 'allow_spy ? 'checked="checked"' : '').'">'; } else { @@ -299,8 +300,16 @@ if ($action == 'edit') { } print '
'; + +print ''; +print '
'; +print '
'; + +print ''; + // Expire date -print ''; // Author print ''; // Link -print ''; print '
'.$langs->trans('ExpireDate').''; +print '
'.$langs->trans('ExpireDate').''; if ($action == 'edit') { print $form->selectDate($expiredate ? $expiredate : $object->date_fin, 'expire', 0, 0, 0, '', 1, 0); } else { @@ -313,7 +322,7 @@ print '
'; -print $langs->trans("Author").''; +print $langs->trans("Author").''; if ($object->fk_user_creat) { print $userstatic->getLoginUrl(1); } else { @@ -322,7 +331,7 @@ if ($object->fk_user_creat) { print '
'.img_picto('', 'globe').' '.$langs->trans("UrlForSurvey", '').''; +print '
'.img_picto('', 'globe').' '.$langs->trans("UrlForSurvey", '').''; // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); @@ -338,8 +347,10 @@ if ($action != 'edit') { print '
'; +print '
'; print ''; +print '
'; print dol_get_fiche_end(); diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index ff5198c006a..d03cbca69c5 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -455,20 +455,21 @@ dol_banner_tab($object, 'id', $linkback, 1, 'id_sondage', 'id_sondage', $morehtm print '
'; -print '
'; +print '
'; +print '
'; print ''; // Type $type = ($object->format == "A") ? 'classic' : 'date'; -print ''; // Title print ''; +// Description +print ''; + +// EMail +//If linked user, then emails are going to be sent to users' email +if (!$object->fk_user_creat) { + print ''; +} + +print '
'.$langs->trans("Type").''; +print '
'.$langs->trans("Type").''; print img_picto('', dol_buildpath('/opensurvey/img/'.($type == 'classic' ? 'chart-32.png' : 'calendar-32.png'), 1), 'width="16"', 1); print ' '.$langs->trans($type == 'classic' ? "TypeClassic" : "TypeDate").'
'; $adresseadmin = $object->mail_admin; -print $langs->trans("Title").''; +print $langs->trans("Title").''; if ($action == 'edit') { print ''; } else { @@ -476,8 +477,39 @@ if ($action == 'edit') { } print '
'.$langs->trans("Description").''; +if ($action == 'edit') { + $doleditor = new DolEditor('nouveauxcommentaires', $object->description, '', 120, 'dolibarr_notes', 'In', 1, 1, 1, ROWS_7, '90%'); + $doleditor->Create(0, ''); +} else { + print (dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true)); +} +print '
'.$langs->trans("EMail").''; + if ($action == 'edit') { + print ''; + } else { + print dol_print_email($object->mail_admin, 0, 0, 1, 0, 1, 1); + } + print '
'; + +print '
'; +print '
'; +print '
'; + +print ''; + + // Expire date -print ''; // Author print ''; // Link -print ''; print '
'.$langs->trans('ExpireDate').''; +print '
'.$langs->trans('ExpireDate').''; if ($action == 'edit') { print $form->selectDate($expiredate ? $expiredate : $object->date_fin, 'expire', 0, 0, 0, '', 1, 0); } else { @@ -490,7 +522,7 @@ print '
'; -print $langs->trans("Author").''; +print $langs->trans("Author").''; if ($object->fk_user_creat) { print $userstatic->getLoginUrl(1); } else { @@ -499,7 +531,7 @@ if ($object->fk_user_creat) { print '
'.img_picto('', 'globe').' '.$langs->trans("UrlForSurvey", '').''; +print '
'.img_picto('', 'globe').' '.$langs->trans("UrlForSurvey", '').''; // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); @@ -521,8 +553,10 @@ if ($action != 'edit') { print '
'; +print '
'; print '
'; +print '
'; print dol_get_fiche_end(); From c40b22facd3cf4f3e69020755b7abf5cdf8b21a9 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Mon, 20 Sep 2021 19:41:13 +0200 Subject: [PATCH 154/374] Add turnover homepage box --- .../facture/class/facturestats.class.php | 28 +++ .../core/boxes/box_graph_invoices_peryear.php | 223 ++++++++++++++++++ htdocs/core/class/stats.class.php | 30 +++ 3 files changed, 281 insertions(+) create mode 100644 htdocs/core/boxes/box_graph_invoices_peryear.php diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index 96c8e88b97e..39325c2cbbd 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -266,4 +266,32 @@ class FactureStats extends Stats return $this->_getAllByProduct($sql, $limit); } + /** + * Return the invoices amount by year for a number of past years + * + * @param int $numberYears Years to scan + * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is year, 2=Label of abscissa is last number of year + * @return array Array with amount by year + */ + public function getAmountByYear($numberYears, $format = 0) + { + global $user; + + $endYear = date('Y'); + $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) + { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } + $sql .= $this->join; + $sql .= " WHERE f.datef BETWEEN '".$this->db->idate(dol_get_first_day($startYear))."' AND '".$this->db->idate(dol_get_last_day($endYear))."'"; + $sql .= " AND ".$this->where; + $sql .= " GROUP BY dm"; + $sql .= $this->db->order('dm', 'ASC'); + + $res = $this->_getAmountByYear($sql); + return $res; + } } diff --git a/htdocs/core/boxes/box_graph_invoices_peryear.php b/htdocs/core/boxes/box_graph_invoices_peryear.php new file mode 100644 index 00000000000..3b3192a98ba --- /dev/null +++ b/htdocs/core/boxes/box_graph_invoices_peryear.php @@ -0,0 +1,223 @@ + + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/boxes/box_graph_invoices_peryear.php + * \ingroup factures + * \brief Box to show graph of invoices per year + */ +include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; + + +/** + * Class to manage the box to show last invoices + */ +class box_graph_invoices_peryear extends ModeleBoxes +{ + public $boxcode = "invoicesperyear"; + public $boximg = "object_bill"; + public $boxlabel = "BoxCustomersInvoicesPerYear"; + public $depends = array("facture"); + + /** + * @var DoliDB Database handler. + */ + public $db; + + public $info_box_head = array(); + public $info_box_contents = array(); + + + /** + * Constructor + * + * @param DoliDB $db Database handler + * @param string $param More parameters + */ + public function __construct($db, $param) + { + global $user; + + $this->db = $db; + + $this->hidden = !($user->rights->facture->lire); + } + + /** + * Load data into info_box_contents array to show array later. + * + * @param int $max Maximum number of records to load + * @return void + */ + public function loadBox($max = 5) + { + global $conf, $user, $langs; + + $this->max = $max; + + $refreshaction = 'refresh_'.$this->boxcode; + + //include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + //$facturestatic=new Facture($this->db); + + $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1; + if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1; + + $text = $langs->trans("Turnover", $max); + $this->info_box_head = array( + 'text' => $text, + 'limit'=> dol_strlen($text), + 'graph'=> 1, + 'sublink'=>'', + 'subtext'=>$langs->trans("Filter"), + 'subpicto'=>'filter.png', + 'subclass'=>'linkobject boxfilter', + 'target'=>'none' // Set '' to get target="_blank" + ); + + $dir = ''; // We don't need a path because image file will not be saved into disk + $prefix = ''; + $socid = 0; + if ($user->socid) $socid = $user->socid; + if (!$user->rights->societe->client->voir || $socid) $prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user + + if ($user->rights->facture->lire) + { + $mesg = ''; + + $param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; + $param_showtot = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot'; + + include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php'; + $autosetarray = preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE')); + if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode, $autosetarray)) + { + $endyear = GETPOST($param_year, 'int'); + $showtot = GETPOST($param_showtot, 'alpha'); + } else { + $tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true); + $endyear = $tmparray['year']; + $showtot = $tmparray['showtot']; + } + if (empty($showtot)) { $showtot = 1; } + $nowarray = dol_getdate(dol_now(), true); + if (empty($endyear)) $endyear = $nowarray['year']; + $numberyears = (empty($conf->global->MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH) ? 5 : $conf->global->MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH); + $startyear = $endyear - $numberyears; + $endyear = + + $mode = 'customer'; + $WIDTH = (($showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320'; + $HEIGHT = '192'; + + $stats = new FactureStats($this->db, $socid, $mode, 0); + + // Build graphic amount of object. $data = array(array('Lib',val1,val2,val3),...) + $data2 = $stats->getAmountByYear($numberyears); + + $filenamenb = $dir."/".$prefix."invoicesamountyears-".$endyear.".png"; + // default value for customer mode + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountyears-'.$endyear.'.png'; + if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountyears-'.$endyear.'.png'; + + $px2 = new DolGraph(); + $mesg = $px2->isGraphKo(); + if (!$mesg) + { + $langs->load("bills"); + + $px2->SetData($data2); + unset($data2); + $i = $startyear; + $legend = array(); + while ($i <= $endyear) + { + if ($startmonth != 1) + { + $legend[] = sprintf("%d/%d", $i - 2001, $i - 2000); + } else { + $legend[] = $i; + } + $i++; + } + $px2->SetLegend([$langs->trans("AmountOfBillsHT")]); + $px2->SetMaxValue($px2->GetCeilMaxValue()); + $px2->SetWidth($WIDTH); + $px2->SetHeight($HEIGHT); + $px2->SetYLabel($langs->trans("AmountOfBillsHT")); + $px2->SetShading(3); + $px2->SetHorizTickIncrement(1); + $px2->SetCssPrefix("cssboxes"); + $px2->mode = 'depth'; + $px2->SetTitle($langs->trans("Turnover")); + + $px2->draw($filenamenb, $fileurlnb); + } + + if (empty($conf->use_javascript_ajax)) + { + $langs->load("errors"); + $mesg = $langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs"); + } + + if (!$mesg) + { + $stringtoshow = ''; + $stringtoshow .= ''; + $stringtoshow .= '
'; // hideobject is to start hidden + $stringtoshow .= '
'; + $stringtoshow .= ''; + $stringtoshow .= ''; + $stringtoshow .= ''; + $stringtoshow .= ''; + $stringtoshow .= $langs->trans("Year").' '; + $stringtoshow .= ''; + $stringtoshow .= '
'; + $stringtoshow .= '
'; + $stringtoshow .= $px2->show(); + $this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'class="nohover center"', 'textnoformat'=>$stringtoshow); + } else { + $this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'class="nohover left"', 'maxlength'=>500, 'text' => $mesg); + } + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'class="nohover left"', + 'text' => ''.$langs->trans("ReadPermissionNotAllowed").'' + ); + } + } + + /** + * Method to show box + * + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string + * @return string + */ + public function showBox($head = null, $contents = null, $nooutput = 0) + { + return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); + } +} diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index 4ac164b1d3a..6fd5db42253 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -617,4 +617,34 @@ abstract class Stats return $result; } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore + /** + * Returns the summed amounts per year for a given number of past years ending now + * @param string $sql SQL + * @return array + */ + function _getAmountByYear($sql) + { + $result = array(); + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $row = $this->db->fetch_row($resql); + $j = (int) $row[0]; + $result[] = [ + 0 => (int) $row[0], + 1 => (int) $row[1], + ]; + $i++; + } + $this->db->free($resql); + } + return $result; + } + } From d919ef9c4cf74b8049864034e0a2882bec041b19 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 20 Sep 2021 17:57:10 +0000 Subject: [PATCH 155/374] Fixing style errors. --- .../facture/class/facturestats.class.php | 3 +-- .../core/boxes/box_graph_invoices_peryear.php | 23 +++++++------------ htdocs/core/class/stats.class.php | 9 +++----- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index 39325c2cbbd..1e6457104ea 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -281,8 +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 (!$user->rights->societe->client->voir && !$this->socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= $this->join; diff --git a/htdocs/core/boxes/box_graph_invoices_peryear.php b/htdocs/core/boxes/box_graph_invoices_peryear.php index 3b3192a98ba..447ab9dfdfb 100644 --- a/htdocs/core/boxes/box_graph_invoices_peryear.php +++ b/htdocs/core/boxes/box_graph_invoices_peryear.php @@ -95,8 +95,7 @@ class box_graph_invoices_peryear extends ModeleBoxes if ($user->socid) $socid = $user->socid; if (!$user->rights->societe->client->voir || $socid) $prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user - if ($user->rights->facture->lire) - { + if ($user->rights->facture->lire) { $mesg = ''; $param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; @@ -105,8 +104,7 @@ class box_graph_invoices_peryear extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php'; $autosetarray = preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE')); - if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode, $autosetarray)) - { + if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode, $autosetarray)) { $endyear = GETPOST($param_year, 'int'); $showtot = GETPOST($param_showtot, 'alpha'); } else { @@ -119,7 +117,7 @@ class box_graph_invoices_peryear extends ModeleBoxes if (empty($endyear)) $endyear = $nowarray['year']; $numberyears = (empty($conf->global->MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH) ? 5 : $conf->global->MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH); $startyear = $endyear - $numberyears; - $endyear = + $endyear = $mode = 'customer'; $WIDTH = (($showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320'; @@ -137,18 +135,15 @@ class box_graph_invoices_peryear extends ModeleBoxes $px2 = new DolGraph(); $mesg = $px2->isGraphKo(); - if (!$mesg) - { + if (!$mesg) { $langs->load("bills"); $px2->SetData($data2); unset($data2); $i = $startyear; $legend = array(); - while ($i <= $endyear) - { - if ($startmonth != 1) - { + while ($i <= $endyear) { + if ($startmonth != 1) { $legend[] = sprintf("%d/%d", $i - 2001, $i - 2000); } else { $legend[] = $i; @@ -169,14 +164,12 @@ class box_graph_invoices_peryear extends ModeleBoxes $px2->draw($filenamenb, $fileurlnb); } - if (empty($conf->use_javascript_ajax)) - { + if (empty($conf->use_javascript_ajax)) { $langs->load("errors"); $mesg = $langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs"); } - if (!$mesg) - { + if (!$mesg) { $stringtoshow = ''; $stringtoshow .= ''; - $response[] = array('title'=>$obj->question,'ref'=>$obj->url,'answer'=>$obj->answer,'url'=>$urltoprint); - } + $response[] = array('title'=>$obj->question,'ref'=>$obj->ref,'answer'=>dol_escape_htmltag(preg_replace('/\\r|\\r\\n|\\n/', "", $obj->answer)),'url'=>$obj->url); $i++; } } else { diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index dd43ae0ffae..d936ceb8c22 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -258,43 +258,41 @@ class FormTicket if (idgroupticket != "") { $.ajax({ url: \''.DOL_URL_ROOT.'/core/ajax/fetchKnowledgeRecord.php\', - data: { action: \'getKnowledgeRecord\', idticketgroup: idgroupticket, token: \''.newToken().'\', lang:\''.$langs->defaultlang.'\', popupurl:false}, + data: { action: \'getKnowledgeRecord\', idticketgroup: idgroupticket, token: \''.newToken().'\', lang:\''.$langs->defaultlang.'\'}, type: \'GET\', success: function(response) { var urllist = \'\'; console.log("We received response "+response); response = JSON.parse(response) for (key in response) { - console.log(response[key]) - urllist += "
  • " + response[key].title + ": " +response[key].url+"
  • "; + answer = response[key].answer; + urllist += \'
  • \' +response[key].title+\'
  • \'; } if (urllist != "") { - console.log(urllist) - $("#KWwithajax").html(\''.$langs->trans("KMFoundForTicketGroup").'
      \'+urllist+\'
    \'); + $("#KWwithajax").html(\''.$langs->trans("KMFoundForTicketGroup").'
      \'+urllist+\'
    \'); $("#KWwithajax").show(); + $(".button_KMpopup").on("click",function(){ + console.log("Open popup with jQuery(...).dialog() with KM article") + var $dialog = $("
    ").html($(this).attr("data-html")) + .dialog({ + autoOpen: false, + modal: true, + height: (window.innerHeight - 150), + width: "80%", + title: $(this).attr("title"), + }); + $dialog.dialog("open"); + console.log($dialog); + }) } }, error : function(output) { - console.log("error"); + console.error("Error on Fetch of KM articles"); }, }); } }; - $("#selectcategory_code").bind("change",function() { groupticketchange(); }); - MutationObserver = window.MutationObserver || window.WebKitMutationObserver; - var trackChange = function(element) { - var observer = new MutationObserver(function(mutations, observer) { - if (mutations[0].attributeName == "value") { - $(element).trigger("change"); - } - }); - observer.observe(element, { - attributes: true - }); - } - - trackChange($("#selectcategory_code")[0]); - + $("#selectcategory_code").on("change",function() { groupticketchange(); }); if ($("#selectcategory_code").val() != "") { groupticketchange(); } From f2b39b3eeb82e6e182d6f3ad9a39573f1076c253 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Tue, 21 Sep 2021 11:27:41 +0200 Subject: [PATCH 166/374] FIX #18767 : Adherent delete Adherent Delete was not working due to the fact that $features = 'adherent'; $feature2 = 'cotisation'; And $user->rights->$feature->$subfeature->supprimer does not exist Also I used the double declaration of salaries. --- htdocs/core/lib/security.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 4c36244a5bf..da5d9388bd8 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -513,8 +513,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f if (!$user->rights->salaries->delete) { $deleteok = 0; } - } elseif ($feature == 'salaries') { - if (!$user->rights->salaries->delete) { + } elseif ($feature == 'adherent') { + if (!$user->rights->adherent->supprimer) { $deleteok = 0; } } elseif (!empty($feature2)) { // This is for permissions on 2 levels From 06f97f4f805c0b5c7424aadf038b485486ec14f4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Sep 2021 12:04:28 +0200 Subject: [PATCH 167/374] Look and feel v14 --- htdocs/adherents/card.php | 2 +- htdocs/adherents/subscription.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 56643d80632..4e760e055a6 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1836,7 +1836,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; } - // Login Dolibarr + // Login Dolibarr - Link to user print ''; $editenable = $user->rights->adherent->creer && $user->rights->user->user->creer; print $form->editfieldkey('LinkedToDolibarrUser', 'login', '', $object, $editenable); diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 4da534161d6..17ac089670b 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -623,7 +623,7 @@ if ($rowid > 0) { print ''; } - // Login Dolibarr + // Login Dolibarr - Link to user print ''; print ''; // PMP - print ''; + $usercaneditpmp = 0; + if (!empty($conf->global->PRODUCT_CAN_EDIT_WAP)) { + $usercaneditpmp = $usercancreate; + } + print ''; print ''; print ''; From 9ba7f019ea68b8150e6144b2a16595b01a8565b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Sep 2021 16:53:29 +0200 Subject: [PATCH 177/374] Fix css --- htdocs/contact/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index efb8f03736e..b16b1640555 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1284,7 +1284,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($objsoc->id > 0) { $morehtmlref .= $objsoc->getNomUrl(1, 'contact'); } else { - $morehtmlref .= $langs->trans("ContactNotLinkedToCompany"); + $morehtmlref .= ''.$langs->trans("ContactNotLinkedToCompany").''; } } $morehtmlref .= ''; From 97d912d5535edccfaadcfb97164b24fa48d783f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Sep 2021 17:17:38 +0200 Subject: [PATCH 178/374] Add more information about private or public poll. --- htdocs/langs/en_US/opensurvey.lang | 2 ++ htdocs/public/opensurvey/studs.php | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/opensurvey.lang b/htdocs/langs/en_US/opensurvey.lang index 7d26151fa16..9fafacaf8bf 100644 --- a/htdocs/langs/en_US/opensurvey.lang +++ b/htdocs/langs/en_US/opensurvey.lang @@ -48,6 +48,8 @@ AddEndHour=Add end hour votes=vote(s) NoCommentYet=No comments have been posted for this poll yet CanComment=Voters can comment in the poll +YourVoteIsPrivate=This poll is private, nobody can see your vote. +YourVoteIsPublic=This poll is public, anybody with the link can see your vote. CanSeeOthersVote=Voters can see other people's vote SelectDayDesc=For each selected day, you can choose, or not, meeting hours in the following format:
    - empty,
    - "8h", "8H" or "8:00" to give a meeting's start hour,
    - "8-11", "8h-11h", "8H-11H" or "8:00-11:00" to give a meeting's start and end hour,
    - "8h15-11h15", "8H15-11H15" or "8:15-11:15" for the same thing but with minutes. BackToCurrentMonth=Back to current month diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index 2a39e6e4730..7be05684fd2 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -274,7 +274,13 @@ $toutsujet = str_replace("°", "'", $toutsujet); print '
    '.$langs->trans("YouAreInivitedToVote").'
    '; -print $langs->trans("OpenSurveyHowTo").'

    '; +print $langs->trans("OpenSurveyHowTo").'
    '; +if (empty($object->allow_spy)) { + print ''.$langs->trans("YourVoteIsPrivate").'
    '; +} else { + print $form->textwithpicto(''.$langs->trans("YourVoteIsPublic").'', $langs->trans("CanSeeOthersVote")).'
    '; +} +print '
    '; print '
    '."\n"; From c89468428e5417d7ba3f15c6ed3c9aadc99761f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Tue, 21 Sep 2021 11:22:59 +0200 Subject: [PATCH 179/374] add warehouse in projects elements count --- htdocs/core/lib/project.lib.php | 5 ++++- htdocs/projet/element.php | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 722f99d3b69..4e4adaf9d3e 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -126,7 +126,7 @@ function project_prepare_head(Project $project, $moreparam = '') if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->facture->enabled) || !empty($conf->contrat->enabled) - || !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled)) { + || !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled) || !empty($conf->stock->enabled)) { $nbElements = 0; // Enable caching of thirdrparty count Contacts $cachekey = 'count_elements_project_'.$project->id; @@ -134,6 +134,9 @@ function project_prepare_head(Project $project, $moreparam = '') if (!is_null($dataretrieved)) { $nbElements = $dataretrieved; } else { + if (!empty ($conf->stock->enabled)) { + $nbElements += $project->getElementCount('stock', 'entrepot', 'fk_project'); + } if (!empty($conf->propal->enabled)) { $nbElements += $project->getElementCount('propal', 'propal'); } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 7fcfe3bc92b..9e14a53e7ea 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -36,6 +36,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +if (!empty($conf->stock->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; +} if (!empty($conf->propal->enabled)) { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; } From dcd3f85e79f0d82d261161a066aac18159626552 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Sep 2021 17:32:08 +0200 Subject: [PATCH 180/374] Fix sql error --- htdocs/accountancy/class/bookkeeping.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index d47078af06c..c80e1088e14 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -888,9 +888,11 @@ class BookKeeping extends CommonObject // Affichage par compte comptable if (!empty($option)) { $sql .= ' AND t.subledger_account IS NOT NULL'; - $sql .= ' ORDER BY t.subledger_account ASC'; + $sortfield = 't.subledger_account'.($sortfield ? ','.$sortfield : ''); + $sortorder = 'ASC'.($sortfield ? ','.$sortfield : ''); } else { - $sql .= ' ORDER BY t.numero_compte ASC'; + $sortfield = 't.numero_compte'.($sortfield ? ','.$sortfield : ''); + $sortorder = 'ASC'.($sortorder ? ','.$sortorder : ''); } $sql .= $this->db->order($sortfield, $sortorder); From e227bdb22b74eabcb8987e374c6261362c05b458 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 21 Sep 2021 17:58:00 +0200 Subject: [PATCH 181/374] FIX check if method exists instead --- htdocs/core/actions_addupdatedelete.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 71288da8335..17b75305ebc 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -236,7 +236,7 @@ if ($action == 'update' && !empty($permissiontoadd)) { if ($conf->categorie->enabled) { $categories = GETPOST('categories', 'array'); - if (!empty($categories)) { + if (method_exists($object, 'setCategories')) { $object->setCategories($categories); } } From d6632757f9f41bc925b6e9daf333e6e968f9f3d1 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 21 Sep 2021 16:06:03 +0000 Subject: [PATCH 182/374] Fixing style errors. --- htdocs/core/actions_addupdatedelete.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 17b75305ebc..2cc477520ea 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -237,7 +237,7 @@ if ($action == 'update' && !empty($permissiontoadd)) { if ($conf->categorie->enabled) { $categories = GETPOST('categories', 'array'); if (method_exists($object, 'setCategories')) { - $object->setCategories($categories); + $object->setCategories($categories); } } } From a5566473d95fb3f695a8554f967c8b7b85d0f068 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Sep 2021 18:06:48 +0200 Subject: [PATCH 183/374] Clean code --- htdocs/product/class/product.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e0a8ccb78a5..b799113af29 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5814,7 +5814,6 @@ class Product extends CommonObject */ public function setCategories($categories) { - require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; return parent::setCategoriesCommon($categories, Categorie::TYPE_PRODUCT); } From 9266b4e8fd7a7f639c3debf4f33fcd78d0a4e1d4 Mon Sep 17 00:00:00 2001 From: kamel Date: Tue, 21 Sep 2021 14:15:17 +0200 Subject: [PATCH 184/374] FIX Button text on proposal card for create a invoice --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 95a1418b644..c96f24760c0 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2583,7 +2583,7 @@ if ($action == 'create') { // Create an invoice and classify billed if ($object->statut == Propal::STATUS_SIGNED) { if (!empty($conf->facture->enabled) && $usercancreateinvoice) { - print ''.$langs->trans("AddBill").''; + print ''.$langs->trans("CreateBill").''; } $arrayofinvoiceforpropal = $object->getInvoiceArrayList(); From 5d684b1c719716d0e8d4aa4d7d6dff01bf1d2e9a Mon Sep 17 00:00:00 2001 From: Erik van Berkum Date: Wed, 22 Sep 2021 10:03:25 +0900 Subject: [PATCH 185/374] Fix: translation error: ConfirmDeleteMO is not delete this Bill Of Materials but delete this Manufacturing Order. --- htdocs/langs/am_ET/mrp.lang | 2 +- htdocs/langs/ar_IQ/mrp.lang | 2 +- htdocs/langs/ar_SA/mrp.lang | 2 +- htdocs/langs/az_AZ/mrp.lang | 2 +- htdocs/langs/bg_BG/mrp.lang | 2 +- htdocs/langs/bn_BD/mrp.lang | 2 +- htdocs/langs/bn_IN/mrp.lang | 2 +- htdocs/langs/bs_BA/mrp.lang | 2 +- htdocs/langs/cs_CZ/mrp.lang | 2 +- htdocs/langs/de_DE/mrp.lang | 2 +- htdocs/langs/el_GR/mrp.lang | 2 +- htdocs/langs/en_US/mrp.lang | 4 ++-- htdocs/langs/et_EE/mrp.lang | 2 +- htdocs/langs/eu_ES/mrp.lang | 2 +- htdocs/langs/fa_IR/mrp.lang | 2 +- htdocs/langs/fi_FI/mrp.lang | 2 +- htdocs/langs/he_IL/mrp.lang | 2 +- htdocs/langs/hi_IN/mrp.lang | 2 +- htdocs/langs/hr_HR/mrp.lang | 2 +- htdocs/langs/hu_HU/mrp.lang | 2 +- htdocs/langs/id_ID/mrp.lang | 2 +- htdocs/langs/is_IS/mrp.lang | 2 +- htdocs/langs/it_IT/mrp.lang | 2 +- htdocs/langs/ka_GE/mrp.lang | 2 +- htdocs/langs/kk_KZ/mrp.lang | 2 +- htdocs/langs/km_KH/mrp.lang | 2 +- htdocs/langs/kn_IN/mrp.lang | 2 +- htdocs/langs/ko_KR/mrp.lang | 2 +- htdocs/langs/lo_LA/mrp.lang | 2 +- htdocs/langs/lt_LT/mrp.lang | 2 +- htdocs/langs/mk_MK/mrp.lang | 2 +- htdocs/langs/mn_MN/mrp.lang | 2 +- htdocs/langs/ne_NP/mrp.lang | 2 +- htdocs/langs/nl_NL/mrp.lang | 2 +- htdocs/langs/pt_PT/mrp.lang | 2 +- htdocs/langs/sk_SK/mrp.lang | 2 +- htdocs/langs/sl_SI/mrp.lang | 2 +- htdocs/langs/sq_AL/mrp.lang | 2 +- htdocs/langs/sr_RS/mrp.lang | 2 +- htdocs/langs/sw_SW/mrp.lang | 2 +- htdocs/langs/tg_TJ/mrp.lang | 2 +- htdocs/langs/th_TH/mrp.lang | 2 +- htdocs/langs/tr_TR/mrp.lang | 2 +- htdocs/langs/uk_UA/mrp.lang | 2 +- htdocs/langs/vi_VN/mrp.lang | 2 +- htdocs/langs/zh_CN/mrp.lang | 2 +- htdocs/langs/zh_HK/mrp.lang | 2 +- 47 files changed, 48 insertions(+), 48 deletions(-) diff --git a/htdocs/langs/am_ET/mrp.lang b/htdocs/langs/am_ET/mrp.lang index 2414a92cefb..5d226c0f77b 100644 --- a/htdocs/langs/am_ET/mrp.lang +++ b/htdocs/langs/am_ET/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/ar_IQ/mrp.lang b/htdocs/langs/ar_IQ/mrp.lang index 2414a92cefb..5d226c0f77b 100644 --- a/htdocs/langs/ar_IQ/mrp.lang +++ b/htdocs/langs/ar_IQ/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/ar_SA/mrp.lang b/htdocs/langs/ar_SA/mrp.lang index 97c6e6378bb..fe2c1a87769 100644 --- a/htdocs/langs/ar_SA/mrp.lang +++ b/htdocs/langs/ar_SA/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=أوامر التصنيع NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/az_AZ/mrp.lang b/htdocs/langs/az_AZ/mrp.lang index 2414a92cefb..5d226c0f77b 100644 --- a/htdocs/langs/az_AZ/mrp.lang +++ b/htdocs/langs/az_AZ/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/bg_BG/mrp.lang b/htdocs/langs/bg_BG/mrp.lang index 0c39bca3291..933315a64d4 100644 --- a/htdocs/langs/bg_BG/mrp.lang +++ b/htdocs/langs/bg_BG/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Стойност 0,95 означава сре DeleteBillOfMaterials=Изтриване на списък с материали DeleteMo=Изтриване на поръчка за производство ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Поръчки за производство NewMO=Нова поръчка за производство QtyToProduce=Кол. за производство diff --git a/htdocs/langs/bn_BD/mrp.lang b/htdocs/langs/bn_BD/mrp.lang index 2414a92cefb..5d226c0f77b 100644 --- a/htdocs/langs/bn_BD/mrp.lang +++ b/htdocs/langs/bn_BD/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/bn_IN/mrp.lang b/htdocs/langs/bn_IN/mrp.lang index 2414a92cefb..5d226c0f77b 100644 --- a/htdocs/langs/bn_IN/mrp.lang +++ b/htdocs/langs/bn_IN/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/bs_BA/mrp.lang b/htdocs/langs/bs_BA/mrp.lang index 16ab0c8ac49..999a6ec67b8 100644 --- a/htdocs/langs/bs_BA/mrp.lang +++ b/htdocs/langs/bs_BA/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/cs_CZ/mrp.lang b/htdocs/langs/cs_CZ/mrp.lang index 948205b3887..13d519a79b7 100644 --- a/htdocs/langs/cs_CZ/mrp.lang +++ b/htdocs/langs/cs_CZ/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Hodnota 0,95 znamená průměrně ztrátu vyr DeleteBillOfMaterials=Odstranit kusovník DeleteMo=Smazat výrobní zakázku ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Výrobní zakázky NewMO=Nová výrobní objednávka QtyToProduce=Množství k výrobě diff --git a/htdocs/langs/de_DE/mrp.lang b/htdocs/langs/de_DE/mrp.lang index 0c90379fd43..323bbe74d59 100644 --- a/htdocs/langs/de_DE/mrp.lang +++ b/htdocs/langs/de_DE/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Ein Wert von 0,95 bedeutet im Durchschnitt 5% DeleteBillOfMaterials=Stückliste löschen DeleteMo=Fertigungsauftrag löschen ConfirmDeleteBillOfMaterials=Möchten Sie diese Stückliste wirklich löschen? -ConfirmDeleteMo=Möchten Sie diese Stückliste wirklich löschen? +ConfirmDeleteMo=Möchten Sie diese Fertigungsauftrag wirklich löschen? MenuMRP=Fertigungsaufträge NewMO=Neuer Fertigungsauftrag QtyToProduce=Produktionsmenge diff --git a/htdocs/langs/el_GR/mrp.lang b/htdocs/langs/el_GR/mrp.lang index 3d622d1de8b..f70ffcd3117 100644 --- a/htdocs/langs/el_GR/mrp.lang +++ b/htdocs/langs/el_GR/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Η τιμή 0,95 σημαίνει κατά μ DeleteBillOfMaterials=Διαγραφή λογαριασμού υλικών DeleteMo=Διαγραφή Παραγγελίας Παραγωγής ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Παραγγελίες Παραγωγής NewMO=Νέα Παραγγελία Παραγωγής QtyToProduce=Ποσότητα για παραγωγή diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 47d1fbe889f..10e81316ee4 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -32,7 +32,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce @@ -104,4 +104,4 @@ HumanMachine=Human / Machine WorkstationArea=Workstation area Machines=Machines THMEstimatedHelp=This rate makes it possible to define a forecast cost of the item -MOAndLines=Manufacturing Orders and lines \ No newline at end of file +MOAndLines=Manufacturing Orders and lines diff --git a/htdocs/langs/et_EE/mrp.lang b/htdocs/langs/et_EE/mrp.lang index c7146c45dfe..32e99e6e6b7 100644 --- a/htdocs/langs/et_EE/mrp.lang +++ b/htdocs/langs/et_EE/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/eu_ES/mrp.lang b/htdocs/langs/eu_ES/mrp.lang index acf5a23db9b..a6e57a1168a 100644 --- a/htdocs/langs/eu_ES/mrp.lang +++ b/htdocs/langs/eu_ES/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/fa_IR/mrp.lang b/htdocs/langs/fa_IR/mrp.lang index c00afb9dd3a..d536b6b661c 100644 --- a/htdocs/langs/fa_IR/mrp.lang +++ b/htdocs/langs/fa_IR/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/fi_FI/mrp.lang b/htdocs/langs/fi_FI/mrp.lang index 2eafe6926bb..14f2af7e1fe 100644 --- a/htdocs/langs/fi_FI/mrp.lang +++ b/htdocs/langs/fi_FI/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Valmistustilaukset NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/he_IL/mrp.lang b/htdocs/langs/he_IL/mrp.lang index 2414a92cefb..5d226c0f77b 100644 --- a/htdocs/langs/he_IL/mrp.lang +++ b/htdocs/langs/he_IL/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/hi_IN/mrp.lang b/htdocs/langs/hi_IN/mrp.lang index 2414a92cefb..5d226c0f77b 100644 --- a/htdocs/langs/hi_IN/mrp.lang +++ b/htdocs/langs/hi_IN/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/hr_HR/mrp.lang b/htdocs/langs/hr_HR/mrp.lang index dd2c40eda6c..00710061f2a 100644 --- a/htdocs/langs/hr_HR/mrp.lang +++ b/htdocs/langs/hr_HR/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Proizvodni nalozi NewMO=Novi proizvodni nalog QtyToProduce=Qty to produce diff --git a/htdocs/langs/hu_HU/mrp.lang b/htdocs/langs/hu_HU/mrp.lang index 350817adedb..0623b3a8447 100644 --- a/htdocs/langs/hu_HU/mrp.lang +++ b/htdocs/langs/hu_HU/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Gyártási rendelések NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/id_ID/mrp.lang b/htdocs/langs/id_ID/mrp.lang index 76290ed5ea9..6f0d5c87b0a 100644 --- a/htdocs/langs/id_ID/mrp.lang +++ b/htdocs/langs/id_ID/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Nilai 0,95 berarti rata-rata 5%% dari kehilan DeleteBillOfMaterials=Hapus Bill Of Material DeleteMo=Hapus Pesanan Pembuatan ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Pesanan Manufaktur NewMO=Pesanan Manufaktur Baru QtyToProduce=Jumlah yang akan diproduksi diff --git a/htdocs/langs/is_IS/mrp.lang b/htdocs/langs/is_IS/mrp.lang index 8fe3fd8f4c1..ca52ce21b60 100644 --- a/htdocs/langs/is_IS/mrp.lang +++ b/htdocs/langs/is_IS/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/it_IT/mrp.lang b/htdocs/langs/it_IT/mrp.lang index 1e6247f3799..6d54470bf3f 100644 --- a/htdocs/langs/it_IT/mrp.lang +++ b/htdocs/langs/it_IT/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Il valore di 0,95 indica una media di 5%% di DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Elimina Ordine di Produzione ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Ordini di produzione NewMO=Nuovo ordine di produzione QtyToProduce=Qtà da produrre diff --git a/htdocs/langs/ka_GE/mrp.lang b/htdocs/langs/ka_GE/mrp.lang index 2414a92cefb..5d226c0f77b 100644 --- a/htdocs/langs/ka_GE/mrp.lang +++ b/htdocs/langs/ka_GE/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/kk_KZ/mrp.lang b/htdocs/langs/kk_KZ/mrp.lang index 2414a92cefb..5d226c0f77b 100644 --- a/htdocs/langs/kk_KZ/mrp.lang +++ b/htdocs/langs/kk_KZ/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/km_KH/mrp.lang b/htdocs/langs/km_KH/mrp.lang index 2414a92cefb..5d226c0f77b 100644 --- a/htdocs/langs/km_KH/mrp.lang +++ b/htdocs/langs/km_KH/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/kn_IN/mrp.lang b/htdocs/langs/kn_IN/mrp.lang index 2414a92cefb..5d226c0f77b 100644 --- a/htdocs/langs/kn_IN/mrp.lang +++ b/htdocs/langs/kn_IN/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/ko_KR/mrp.lang b/htdocs/langs/ko_KR/mrp.lang index 131e1f376ac..9ea63ea0c0c 100644 --- a/htdocs/langs/ko_KR/mrp.lang +++ b/htdocs/langs/ko_KR/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/lo_LA/mrp.lang b/htdocs/langs/lo_LA/mrp.lang index 00db7f202ec..daffab535ba 100644 --- a/htdocs/langs/lo_LA/mrp.lang +++ b/htdocs/langs/lo_LA/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/lt_LT/mrp.lang b/htdocs/langs/lt_LT/mrp.lang index 9760b1babbe..a88ffc2687d 100644 --- a/htdocs/langs/lt_LT/mrp.lang +++ b/htdocs/langs/lt_LT/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/mk_MK/mrp.lang b/htdocs/langs/mk_MK/mrp.lang index 2414a92cefb..5d226c0f77b 100644 --- a/htdocs/langs/mk_MK/mrp.lang +++ b/htdocs/langs/mk_MK/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/mn_MN/mrp.lang b/htdocs/langs/mn_MN/mrp.lang index 2414a92cefb..5d226c0f77b 100644 --- a/htdocs/langs/mn_MN/mrp.lang +++ b/htdocs/langs/mn_MN/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/ne_NP/mrp.lang b/htdocs/langs/ne_NP/mrp.lang index 2414a92cefb..5d226c0f77b 100644 --- a/htdocs/langs/ne_NP/mrp.lang +++ b/htdocs/langs/ne_NP/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/nl_NL/mrp.lang b/htdocs/langs/nl_NL/mrp.lang index d94344175c0..143e3cb4d55 100644 --- a/htdocs/langs/nl_NL/mrp.lang +++ b/htdocs/langs/nl_NL/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Waarde van 0,95 betekent een gemiddelde van 5 DeleteBillOfMaterials=Stuklijst verwijderen DeleteMo=Productieorder verwijderen ConfirmDeleteBillOfMaterials=Weet u zeker dat u deze stuklijst wilt verwijderen? -ConfirmDeleteMo=Weet u zeker dat u deze stuklijst wilt verwijderen? +ConfirmDeleteMo=Weet u zeker dat u deze Productieorder wilt verwijderen? MenuMRP=Productieorders NewMO=Nieuwe productieorder QtyToProduce=Te produceren aantal diff --git a/htdocs/langs/pt_PT/mrp.lang b/htdocs/langs/pt_PT/mrp.lang index 025f164f94e..39982e5bd35 100644 --- a/htdocs/langs/pt_PT/mrp.lang +++ b/htdocs/langs/pt_PT/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Eliminar Faturas de Materiais DeleteMo=Eliminar Encomenda de Manufaturação ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Encomendas de Manufatura NewMO=Nova Encomenda de Manufatura QtyToProduce=Qt. a produzir diff --git a/htdocs/langs/sk_SK/mrp.lang b/htdocs/langs/sk_SK/mrp.lang index d620b7e31e3..9917552ba94 100644 --- a/htdocs/langs/sk_SK/mrp.lang +++ b/htdocs/langs/sk_SK/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/sl_SI/mrp.lang b/htdocs/langs/sl_SI/mrp.lang index 30bf0ca0238..b700927dd12 100644 --- a/htdocs/langs/sl_SI/mrp.lang +++ b/htdocs/langs/sl_SI/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/sq_AL/mrp.lang b/htdocs/langs/sq_AL/mrp.lang index 29554c164a3..20a6d7238de 100644 --- a/htdocs/langs/sq_AL/mrp.lang +++ b/htdocs/langs/sq_AL/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/sr_RS/mrp.lang b/htdocs/langs/sr_RS/mrp.lang index 16ab0c8ac49..999a6ec67b8 100644 --- a/htdocs/langs/sr_RS/mrp.lang +++ b/htdocs/langs/sr_RS/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/sw_SW/mrp.lang b/htdocs/langs/sw_SW/mrp.lang index 2414a92cefb..5d226c0f77b 100644 --- a/htdocs/langs/sw_SW/mrp.lang +++ b/htdocs/langs/sw_SW/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/tg_TJ/mrp.lang b/htdocs/langs/tg_TJ/mrp.lang index 2414a92cefb..5d226c0f77b 100644 --- a/htdocs/langs/tg_TJ/mrp.lang +++ b/htdocs/langs/tg_TJ/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/th_TH/mrp.lang b/htdocs/langs/th_TH/mrp.lang index d5d061b855b..229690f76fd 100644 --- a/htdocs/langs/th_TH/mrp.lang +++ b/htdocs/langs/th_TH/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/tr_TR/mrp.lang b/htdocs/langs/tr_TR/mrp.lang index 574ddefd491..b9c69a56364 100644 --- a/htdocs/langs/tr_TR/mrp.lang +++ b/htdocs/langs/tr_TR/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Üretim Emri Sil ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Üretim Emirleri NewMO=Yeni Üretim Emiri QtyToProduce=Qty to produce diff --git a/htdocs/langs/uk_UA/mrp.lang b/htdocs/langs/uk_UA/mrp.lang index 2414a92cefb..5d226c0f77b 100644 --- a/htdocs/langs/uk_UA/mrp.lang +++ b/htdocs/langs/uk_UA/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/vi_VN/mrp.lang b/htdocs/langs/vi_VN/mrp.lang index f708bed87af..d24ddfe3b48 100644 --- a/htdocs/langs/vi_VN/mrp.lang +++ b/htdocs/langs/vi_VN/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Xóa hóa đơn vật liệu DeleteMo=Xóa đơn hàng sản xuất ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Đơn đặt hàng sản xuất NewMO=Thêm Đơn hàng sản xuất QtyToProduce=Số lượng để sản xuất diff --git a/htdocs/langs/zh_CN/mrp.lang b/htdocs/langs/zh_CN/mrp.lang index 86170bd9d91..e9f0381124a 100644 --- a/htdocs/langs/zh_CN/mrp.lang +++ b/htdocs/langs/zh_CN/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce diff --git a/htdocs/langs/zh_HK/mrp.lang b/htdocs/langs/zh_HK/mrp.lang index 2414a92cefb..5d226c0f77b 100644 --- a/htdocs/langs/zh_HK/mrp.lang +++ b/htdocs/langs/zh_HK/mrp.lang @@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials? -ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials? +ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order? MenuMRP=Manufacturing Orders NewMO=New Manufacturing Order QtyToProduce=Qty to produce From 08b395e127c007a39a829a4258d36846a3833fbd Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Wed, 22 Sep 2021 08:43:30 +0200 Subject: [PATCH 186/374] another set of cleanup for action buttons --- htdocs/admin/debugbar.php | 2 +- htdocs/admin/expensereport_rules.php | 2 +- htdocs/bookmarks/card.php | 5 +---- htdocs/comm/mailing/card.php | 2 +- htdocs/comm/mailing/cibles.php | 2 +- htdocs/compta/prelevement/line.php | 2 +- htdocs/core/class/html.formfile.class.php | 4 ++-- htdocs/core/class/html.formmail.class.php | 5 ++--- htdocs/fichinter/card.php | 2 +- 9 files changed, 11 insertions(+), 15 deletions(-) diff --git a/htdocs/admin/debugbar.php b/htdocs/admin/debugbar.php index 19a440520b1..3e878b9398b 100644 --- a/htdocs/admin/debugbar.php +++ b/htdocs/admin/debugbar.php @@ -90,7 +90,7 @@ print ''; print '
    '; print $langs->trans("LinkedToDolibarrUser"); @@ -641,7 +641,9 @@ if ($rowid > 0) { $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', ''); } else { if ($object->user_id) { - $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none'); + $linkeduser = new User($db); + $linkeduser->fetch($object->user_id); + print $linkeduser->getNomUrl(-1); } else { print ''.$langs->trans("NoDolibarrAccess").''; } From 7a6a515386e50c339b783b5fe07484e4b6a8ae22 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Tue, 21 Sep 2021 12:18:37 +0200 Subject: [PATCH 168/374] Missing translations for Inventories --- htdocs/langs/en_US/admin.lang | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index ef1c1deb3b5..367f68e6a9b 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -896,6 +896,11 @@ Permission1002=Create/modify warehouses Permission1003=Delete warehouses Permission1004=Read stock movements Permission1005=Create/modify stock movements +Permission1011=View inventories +Permission1012=Create new inventory +Permission1014=Validate inventory +Permission1015=Allow to change PMP value for a product +Permission1016=Delete inventory Permission1101=Read delivery receipts Permission1102=Create/modify delivery receipts Permission1104=Validate delivery receipts From 86a6e8af1fe5f732bc5e1c15d17fa99c4087d8cc Mon Sep 17 00:00:00 2001 From: kamel Date: Tue, 21 Sep 2021 14:15:17 +0200 Subject: [PATCH 169/374] FIX Button text on proposal card for create a invoice --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 95a1418b644..c96f24760c0 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2583,7 +2583,7 @@ if ($action == 'create') { // Create an invoice and classify billed if ($object->statut == Propal::STATUS_SIGNED) { if (!empty($conf->facture->enabled) && $usercancreateinvoice) { - print ''.$langs->trans("AddBill").''; + print ''.$langs->trans("CreateBill").''; } $arrayofinvoiceforpropal = $object->getInvoiceArrayList(); From b7105d572ac1e46b653a38485026b2e401055be8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Sep 2021 14:20:01 +0200 Subject: [PATCH 170/374] Fix delete of invoice not complete (some fk_invoice still filled) --- htdocs/compta/facture/class/facture.class.php | 31 +++++++++++++++---- ...organization_conferenceorboothattendee.sql | 1 + 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 02889c4c4ef..08ca9b6bb53 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2267,7 +2267,6 @@ class Facture extends CommonInvoice $sql .= ' SET fk_facture = NULL, fk_facture_line = NULL'; $sql .= ' WHERE fk_facture_line IN ('.$this->db->sanitize(join(',', $list_rowid_det)).')'; - dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (!$this->db->query($sql)) { $this->error = $this->db->error()." sql=".$sql; $this->errors[] = $this->error; @@ -2276,6 +2275,30 @@ class Facture extends CommonInvoice } } + // Remove other links to the deleted invoice + + $sql = 'UPDATE '.MAIN_DB_PREFIX.'eventorganization_conferenceorboothattendee'; + $sql .= ' SET fk_facture = NULL'; + $sql .= ' WHERE fk_facture = '.((int) $rowid); + + if (!$this->db->query($sql)) { + $this->error = $this->db->error()." sql=".$sql; + $this->errors[] = $this->error; + $this->db->rollback(); + return -5; + } + + $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time'; + $sql .= ' SET invoice_id = NULL, invoice_line_id = NULL'; + $sql .= ' WHERE invoice_id = '.((int) $rowid); + + if (!$this->db->query($sql)) { + $this->error = $this->db->error()." sql=".$sql; + $this->errors[] = $this->error; + $this->db->rollback(); + return -5; + } + // If we decrease stock on invoice validation, we increase back if a warehouse id was provided if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse != -1) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; @@ -2299,17 +2322,13 @@ class Facture extends CommonInvoice // Invoice line extrafileds $main = MAIN_DB_PREFIX.'facturedet'; $ef = $main."_extrafields"; - $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture = ".((int) $rowid).")"; + $sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture = ".((int) $rowid).")"; // Delete invoice line $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facturedet WHERE fk_facture = '.((int) $rowid); - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - if ($this->db->query($sqlef) && $this->db->query($sql) && $this->delete_linked_contact()) { $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE rowid = '.((int) $rowid); - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $resql = $this->db->query($sql); if ($resql) { // Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive diff --git a/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.sql b/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.sql index 6d01cf4bba1..b505f8f6a31 100644 --- a/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.sql +++ b/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.sql @@ -21,6 +21,7 @@ CREATE TABLE llx_eventorganization_conferenceorboothattendee( fk_soc integer, fk_actioncomm integer, fk_project integer NOT NULL, + fk_invoice integer NULL, email varchar(100), date_subscription datetime, amount double DEFAULT NULL, From e2c389a4a99fa9c7431b819186bc799e9000dfda Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Sep 2021 14:23:21 +0200 Subject: [PATCH 171/374] Fix delete invoice --- htdocs/compta/facture/class/facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 08ca9b6bb53..a28838756d9 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2278,8 +2278,8 @@ class Facture extends CommonInvoice // Remove other links to the deleted invoice $sql = 'UPDATE '.MAIN_DB_PREFIX.'eventorganization_conferenceorboothattendee'; - $sql .= ' SET fk_facture = NULL'; - $sql .= ' WHERE fk_facture = '.((int) $rowid); + $sql .= ' SET fk_invoice = NULL'; + $sql .= ' WHERE fk_invoice = '.((int) $rowid); if (!$this->db->query($sql)) { $this->error = $this->db->error()." sql=".$sql; From 09fff2150e88f0e1f7f3a7dedd36e2710ba95c11 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Sep 2021 15:30:34 +0200 Subject: [PATCH 172/374] Fix: avoid to add line for event registration twice into invoice --- .../eventorganization/attendee_register.php | 114 +++++++++--------- 1 file changed, 59 insertions(+), 55 deletions(-) diff --git a/htdocs/public/eventorganization/attendee_register.php b/htdocs/public/eventorganization/attendee_register.php index db3acde4628..a454f214316 100644 --- a/htdocs/public/eventorganization/attendee_register.php +++ b/htdocs/public/eventorganization/attendee_register.php @@ -330,63 +330,63 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen $thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithNameContactUs", $mysoc->email); } } - if ($resultfetchthirdparty <= 0 && !empty($emailcompany)) { - // Try to find thirdparty from the email only - $resultfetchthirdparty = $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $emailcompany); - if ($resultfetchthirdparty > 0) { - // We found a unique result with that email only, so we set the fk_soc of attendee - $confattendee->fk_soc = $thirdparty->id; - $confattendee->update($user); - } elseif ($resultfetchthirdparty == -2) { - $thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithEmailContactUs", $mysoc->email); - } + } + if ($resultfetchthirdparty <= 0 && !empty($emailcompany)) { + // Try to find thirdparty from the email only + $resultfetchthirdparty = $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $emailcompany); + if ($resultfetchthirdparty > 0) { + // We found a unique result with that email only, so we set the fk_soc of attendee + $confattendee->fk_soc = $thirdparty->id; + $confattendee->update($user); + } elseif ($resultfetchthirdparty == -2) { + $thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithEmailContactUs", $mysoc->email); } - if ($resultfetchthirdparty <= 0 && !empty($email) && $email != $emailcompany) { - // Try to find thirdparty from the email only - $resultfetchthirdparty = $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $email); - if ($resultfetchthirdparty > 0) { - // We found a unique result with that email only, so we set the fk_soc of attendee - $confattendee->fk_soc = $thirdparty->id; - $confattendee->update($user); - } elseif ($resultfetchthirdparty == -2) { - $thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithEmailContactUs", $mysoc->email); - } + } + if ($resultfetchthirdparty <= 0 && !empty($email) && $email != $emailcompany) { + // Try to find thirdparty from the email only + $resultfetchthirdparty = $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $email); + if ($resultfetchthirdparty > 0) { + // We found a unique result with that email only, so we set the fk_soc of attendee + $confattendee->fk_soc = $thirdparty->id; + $confattendee->update($user); + } elseif ($resultfetchthirdparty == -2) { + $thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithEmailContactUs", $mysoc->email); } - if ($resultfetchthirdparty <= 0 && !empty($genericcompanyname)) { - // Try to find thirdparty from the generic mail only - $resultfetchthirdparty = $thirdparty->fetch('', $genericcompanyname, '', '', '', '', '', '', '', '', ''); - if ($resultfetchthirdparty > 0) { - // We found a unique result with that name + email, so we set the fk_soc of attendee - $confattendee->fk_soc = $thirdparty->id; - $confattendee->update($user); - } elseif ($resultfetchthirdparty == -2) { - $thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithNameContactUs", $mysoc->email); - } + } + if ($resultfetchthirdparty <= 0 && !empty($genericcompanyname)) { + // Try to find thirdparty from the generic mail only + $resultfetchthirdparty = $thirdparty->fetch('', $genericcompanyname, '', '', '', '', '', '', '', '', ''); + if ($resultfetchthirdparty > 0) { + // We found a unique result with that name + email, so we set the fk_soc of attendee + $confattendee->fk_soc = $thirdparty->id; + $confattendee->update($user); + } elseif ($resultfetchthirdparty == -2) { + $thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithNameContactUs", $mysoc->email); } + } - // TODO Add more tests on a VAT number, profid or a name ? + // TODO Add more tests on a VAT number, profid or a name ? - if ($resultfetchthirdparty <= 0 && !empty($email)) { - // Try to find the thirdparty from the contact - $resultfetchcontact = $contact->fetch('', null, '', $email); - if ($resultfetchcontact > 0 && $contact->fk_soc > 0) { - $thirdparty->fetch($contact->fk_soc); - $confattendee->fk_soc = $thirdparty->id; - $confattendee->update($user); - $resultfetchthirdparty = 1; - } + if ($resultfetchthirdparty <= 0 && !empty($email)) { + // Try to find the thirdparty from the contact + $resultfetchcontact = $contact->fetch('', null, '', $email); + if ($resultfetchcontact > 0 && $contact->fk_soc > 0) { + $thirdparty->fetch($contact->fk_soc); + $confattendee->fk_soc = $thirdparty->id; + $confattendee->update($user); + $resultfetchthirdparty = 1; } + } - if ($resultfetchthirdparty <= 0 && !empty($societe)) { - // Try to find thirdparty from the company name only - $resultfetchthirdparty = $thirdparty->fetch('', $societe, '', '', '', '', '', '', '', '', ''); - if ($resultfetchthirdparty > 0) { - // We found a unique result with that name only, so we set the fk_soc of attendee - $confattendee->fk_soc = $thirdparty->id; - $confattendee->update($user); - } elseif ($resultfetchthirdparty == -2) { - $thirdparty->error = "ErrorSeveralCompaniesWithNameContactUs"; - } + if ($resultfetchthirdparty <= 0 && !empty($societe)) { + // Try to find thirdparty from the company name only + $resultfetchthirdparty = $thirdparty->fetch('', $societe, '', '', '', '', '', '', '', '', ''); + if ($resultfetchthirdparty > 0) { + // We found a unique result with that name only, so we set the fk_soc of attendee + $confattendee->fk_soc = $thirdparty->id; + $confattendee->update($user); + } elseif ($resultfetchthirdparty == -2) { + $thirdparty->error = "ErrorSeveralCompaniesWithNameContactUs"; } } } @@ -450,6 +450,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen } if (!$error) { + // If the registration needs a payment if (!empty(floatval($project->price_registration))) { $outputlangs = $langs; @@ -515,11 +516,14 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen $date_start = $project->date_start; $date_end = $project->date_end; - $result = $facture->addline($labelforproduct, floatval($project->price_registration), 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, $date_start, $date_end, 0, 0, '', 'HT', 0, 1); - if ($result <= 0) { - $confattendee->error = $facture->error; - $confattendee->errors = $facture->errors; - $error++; + // If there is no lines yet, we add one + if (empty($facture->lines)) { + $result = $facture->addline($labelforproduct, floatval($project->price_registration), 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, $date_start, $date_end, 0, 0, '', 'HT', 0, 1); + if ($result <= 0) { + $confattendee->error = $facture->error; + $confattendee->errors = $facture->errors; + $error++; + } } } From 841c4da0f8d5da8c0655ab484834dfee17b51f0f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Sep 2021 15:39:05 +0200 Subject: [PATCH 173/374] Fix css --- htdocs/accountancy/customer/lines.php | 4 ++-- htdocs/accountancy/supplier/lines.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 55700fe8439..5f91f4f2571 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -369,9 +369,9 @@ if ($result) { print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print ''.$langs->trans("DescVentilDoneCustomer").'
    '; - print '
    '.$langs->trans("ChangeAccount").'
    '; + print '
    '.$langs->trans("ChangeAccount").' '; print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle'); - print '
    '; + print '
    '; $moreforfilter = ''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index da8bc0cd5e9..5b5887aa6c4 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -369,9 +369,9 @@ if ($result) { print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print ''.$langs->trans("DescVentilDoneSupplier").'
    '; - print '
    '.$langs->trans("ChangeAccount").'
    '; + print '
    '.$langs->trans("ChangeAccount").' '; print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle'); - print '
    '; + print '
    '; $moreforfilter = ''; From a7ccbb4d9aec015e6d1ea438ce28220ff9ef032d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Sep 2021 15:40:42 +0200 Subject: [PATCH 174/374] css --- htdocs/accountancy/customer/lines.php | 2 +- htdocs/accountancy/supplier/lines.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 5f91f4f2571..1e7c38b2607 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -369,7 +369,7 @@ if ($result) { print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print ''.$langs->trans("DescVentilDoneCustomer").'
    '; - print '
    '.$langs->trans("ChangeAccount").' '; + print '
    '.$langs->trans("ChangeAccount").' '; print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle'); print '
    '; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 5b5887aa6c4..61e17ab669c 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -369,7 +369,7 @@ if ($result) { print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print ''.$langs->trans("DescVentilDoneSupplier").'
    '; - print '
    '.$langs->trans("ChangeAccount").' '; + print '
    '.$langs->trans("ChangeAccount").' '; print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle'); print '
    '; From 48ce3ea4d3eaf5ec8df0cea0a09fee8438ff6ab9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 21 Sep 2021 16:31:07 +0200 Subject: [PATCH 175/374] FIX check if $categories is not empty --- htdocs/core/actions_addupdatedelete.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index de4b9d86da1..71288da8335 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -236,7 +236,9 @@ if ($action == 'update' && !empty($permissiontoadd)) { if ($conf->categorie->enabled) { $categories = GETPOST('categories', 'array'); - $object->setCategories($categories); + if (!empty($categories)) { + $object->setCategories($categories); + } } } From 76ee014b52f005433c37e4f6b388e0743e659df4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Sep 2021 16:32:32 +0200 Subject: [PATCH 176/374] Fix add a hidden solution to fix a corrupted value for AWP. --- htdocs/product/class/product.class.php | 1 - htdocs/product/fournisseurs.php | 42 +++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index bb80dcba862..d746bf4a812 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1008,7 +1008,6 @@ class Product extends CommonObject $this->accountancy_code_sell_export = trim($this->accountancy_code_sell_export); - $this->db->begin(); $result = 0; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 96c7cf5f8c3..9aaa0aa2c8c 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2021 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2012 Juanjo Menent @@ -54,7 +54,9 @@ $cancel = GETPOST('cancel', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'pricesuppliercard'; $socid = GETPOST('socid', 'int'); -$cost_price = GETPOST('cost_price', 'alpha'); +$cost_price = price2num(GETPOST('cost_price', 'alpha'), '', 2); +$pmp = price2num(GETPOST('pmp', 'alpha'), '', 2); + $backtopage = GETPOST('backtopage', 'alpha'); $error = 0; @@ -147,13 +149,29 @@ if (empty($reshook)) { } } } + if ($action == 'setpmp') { + if ($id) { + $result = $object->fetch($id); + $object->pmp = price2num($pmp); + $sql = "UPDATE ".MAIN_DB_PREFIX."product SET pmp = ".((float) $object->pmp)." WHERE rowid = ".((int) $id); + $resql = $db->query($sql); + //$result = $object->update($object->id, $user); + if ($resql) { + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + $action = ''; + } else { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } + } + } if ($action == 'confirm_remove_pf') { if ($rowid) { // id of product supplier price to remove $action = ''; $result = $object->remove_product_fournisseur_price($rowid); if ($result > 0) { - $db->query("DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields WHERE fk_object = $rowid"); + $db->query("DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields WHERE fk_object = ".((int) $rowid)); setEventMessages($langs->trans("PriceRemoved"), null, 'mesgs'); } else { $error++; @@ -425,11 +443,25 @@ if ($id > 0 || $ref) { print '
    '.$form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")).'
    '; + $textdesc = $langs->trans("AverageUnitPricePMPDesc"); + $text = $form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $textdesc, 1, 'help', ''); + print $form->editfieldkey($text, 'pmp', $object->pmp, $object, $usercaneditpmp, 'amount:6'); + print ''; + print $form->editfieldval($text, 'pmp', ($object->pmp > 0 ? $object->pmp : ''), $object, $usercaneditpmp, 'amount:6'); + if ($object->pmp > 0) { + print ' '.$langs->trans("HT"); + } + /* + .$form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")).''; if ($object->pmp > 0) { print price($object->pmp).' '.$langs->trans("HT"); - } + }*/ print '
    '; print ''; print ''; -print ''; +print ''; print "\n"; print ''; diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php index 0b12f8d3741..802cc939caa 100644 --- a/htdocs/admin/expensereport_rules.php +++ b/htdocs/admin/expensereport_rules.php @@ -319,7 +319,7 @@ foreach ($rules as $rule) { echo ''.img_edit().' '; echo ''.img_delete().''; } else { - echo ' '; + echo ' '; echo ''.$langs->trans("Cancel").''; } echo ''; diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index 839ce4c3f86..d725a659e08 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -186,10 +186,7 @@ if ($action == 'create') { print dol_get_fiche_end(); - print '
    '; - print '   '; - print ''; - print '
    '; + print $form->buttonsSaveCancel("CreateBookmark"); print ''; } diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index dbfbc84b69f..2ed56683c02 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -749,7 +749,7 @@ if ($action == 'create') { print dol_get_fiche_end(); - print '
    '; + print $form->buttonsSaveCancel("CreateMailing", ''); print ''; } else { diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 97c6735221f..3283957f8a2 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -424,7 +424,7 @@ if ($object->fetch($id) >= 0) { print '
    '; if ($allowaddtarget) { - print ''; + print ''; } else { print ''; //print $langs->trans("MailNoChangePossible"); diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index 5aa7344eea5..bea351ac46c 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -222,7 +222,7 @@ if ($id) { print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("DEBUGBAR_LOGS_LINES_NUMBER").'

    '; //Confirm Button - print '
    '; + print '
    '; print ''; } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 591fb5ed2d1..ca7e939fb6f 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -2033,8 +2033,8 @@ class FormFile print ''.dol_print_date(dol_now(), "dayhour", "tzuser").''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; } else { print ''; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 04d4ad34e89..823e90fcac3 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -956,15 +956,14 @@ class FormMail extends Form $out .= ''."\n"; if ($this->withform == 1 || $this->withform == -1) { - $out .= '
    '; - $out .= 'trans("SendMail").'"'; // Add a javascript test to avoid to forget to submit file before sending email if ($this->withfile == 2 && $conf->use_javascript_ajax) { $out .= ' onClick="if (document.mailform.addedfile.value != \'\') { alert(\''.dol_escape_js($langs->trans("FileWasNotUploaded")).'\'); return false; } else { return true; }"'; } $out .= ' />'; if ($this->withcancel) { - $out .= '     '; $out .= ''; } $out .= '
    '."\n"; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 9bf43a60378..31f42c9b0fa 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1146,7 +1146,7 @@ if ($action == 'create') { $morehtmlref .= ''; $morehtmlref .= ''; $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; + $morehtmlref .= ''; $morehtmlref .= ''; } else { $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); From 6c7c6c9efd6d0fa491fa814498e58a3e1e60595c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Sep 2021 12:47:06 +0200 Subject: [PATCH 187/374] FIX legal issue on expense report pdf (must also show price without tax) --- .../doc/pdf_standard.modules.php | 42 ++++++++++++------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index b1f48450d0d..f5862bfc5f2 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -175,10 +175,11 @@ class pdf_standard extends ModeleExpenseReport //$this->posxdate=88; //$this->posxtype=107; //$this->posxprojet=120; - $this->posxtva = 130; - $this->posxup = 145; - $this->posxqty = 168; - $this->postotalttc = 178; + $this->posxtva = 112; + $this->posxup = 127; + $this->posxqty = 150; + $this->postotalht = 160; + $this->postotalttc = 180; // if (empty($conf->projet->enabled)) { // $this->posxtva-=20; // $this->posxup-=20; @@ -642,11 +643,15 @@ class pdf_standard extends ModeleExpenseReport // Quantity $pdf->SetXY($this->posxqty, $curY); - $pdf->MultiCell($this->postotalttc - $this->posxqty - 0.8, 4, $object->lines[$linenumber]->qty, 0, 'R'); + $pdf->MultiCell($this->postotalht - $this->posxqty - 0.8, 4, $object->lines[$linenumber]->qty, 0, 'R'); + + // Total without taxes + $pdf->SetXY($this->postotalht, $curY); + $pdf->MultiCell($this->postotalttc - $this->postotalht - 0.8, 4, price($object->lines[$linenumber]->total_ht), 0, 'R'); // Total with all taxes $pdf->SetXY($this->postotalttc - 1, $curY); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc, 4, price($object->lines[$linenumber]->total_ttc), 0, 'R'); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc + 1, 4, price($object->lines[$linenumber]->total_ttc), 0, 'R'); // Comments $pdf->SetXY($this->posxcomment, $curY); @@ -950,14 +955,14 @@ class pdf_standard extends ModeleExpenseReport // Accountancy piece if (empty($hidetop)) { $pdf->SetXY($this->posxpiece - 1, $tab_top + 1); - $pdf->MultiCell($this->posxcomment - $this->posxpiece - 1, 1, '', '', 'R'); + $pdf->MultiCell($this->posxcomment - $this->posxpiece - 0.8, 1, '', '', 'R'); } // Comments $pdf->line($this->posxcomment - 1, $tab_top, $this->posxcomment - 1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxcomment - 1, $tab_top + 1); - $pdf->MultiCell($this->posxdate - $this->posxcomment - 1, 1, $outputlangs->transnoentities("Description"), '', 'L'); + $pdf->MultiCell($this->posxdate - $this->posxcomment - 0.8, 1, $outputlangs->transnoentities("Description"), '', 'L'); } // Date @@ -990,7 +995,7 @@ class pdf_standard extends ModeleExpenseReport if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxtva - 1, $tab_top + 1); + $pdf->SetXY($this->posxtva - 0.8, $tab_top + 1); $pdf->MultiCell($this->posxup - $this->posxtva - 1, 2, $outputlangs->transnoentities("VAT"), '', 'C'); } } @@ -998,22 +1003,29 @@ class pdf_standard extends ModeleExpenseReport // Unit price $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxup - 1, $tab_top + 1); - $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceU"), '', 'C'); + $pdf->SetXY($this->posxup - 0.8, $tab_top + 1); + $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUTTC"), '', 'C'); } // Quantity $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxqty - 1, $tab_top + 1); - $pdf->MultiCell($this->postotalttc - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); + $pdf->SetXY($this->posxqty - 0.8, $tab_top + 1); + $pdf->MultiCell($this->postotalht - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); + } + + // Total without taxes + $pdf->line($this->postotalht - 1, $tab_top, $this->postotalht - 1, $tab_top + $tab_height); + if (empty($hidetop)) { + $pdf->SetXY($this->postotalht - 0.8, $tab_top + 1); + $pdf->MultiCell($this->postotalttc - $this->postotalht + 1, 2, $outputlangs->transnoentities("TotalHT"), '', 'C'); } // Total with all taxes $pdf->line($this->postotalttc, $tab_top, $this->postotalttc, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->postotalttc - 1, $tab_top + 1); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc, 2, $outputlangs->transnoentities("TotalTTC"), '', 'R'); + $pdf->SetXY($this->postotalttc - 0.8, $tab_top + 1); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc + 1, 2, $outputlangs->transnoentities("TotalTTC"), '', 'R'); } $pdf->SetTextColor(0, 0, 0); From d91d14d10c9fd3e87185647188aee6962009baa8 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 22 Sep 2021 12:48:05 +0200 Subject: [PATCH 188/374] FIX init hookmanager after loading $conf values --- htdocs/install/upgrade2.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 83be835b64a..ea71b1947e7 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -144,11 +144,6 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port); - // Create the global $hookmanager object - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager = new HookManager($db); - $hookmanager->initHooks(array('upgrade')); - if (!$db->connected) { print ''.$langs->trans("ErrorFailedToConnectToDatabase", $conf->db->name).''.$langs->trans('Error').''; dolibarr_install_syslog('upgrade2: failed to connect to database :'.$conf->db->name.' on '.$conf->db->host.' for user '.$conf->db->user, LOG_ERR); @@ -182,6 +177,11 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1; } + // Create the global $hookmanager object + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($db); + $hookmanager->initHooks(array('upgrade')); + /*************************************************************************************** * From 736194142044e64522df1fe35386f46dabfade00 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 22 Sep 2021 14:56:44 +0200 Subject: [PATCH 189/374] Close #18770 : Can enter buying price on line --- .../fournisseur.commande.dispatch.class.php | 7 +++++-- .../install/mysql/migration/14.0.0-15.0.0.sql | 2 ++ .../llx_commande_fournisseur_dispatch.sql | 3 ++- htdocs/langs/en_US/receptions.lang | 1 + htdocs/langs/fr_FR/receptions.lang | 1 + htdocs/reception/card.php | 18 +++++++++++++++-- htdocs/reception/class/reception.class.php | 20 +++++++++++++++---- 7 files changed, 43 insertions(+), 9 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index a83795996e4..a73be8ac43b 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -103,6 +103,7 @@ class CommandeFournisseurDispatch extends CommonObjectLine public $batch; public $eatby = ''; public $sellby = ''; + public $cost_price = 0; @@ -189,7 +190,8 @@ class CommandeFournisseurDispatch extends CommonObjectLine $sql .= "batch,"; $sql .= "eatby,"; $sql .= "sellby,"; - $sql .= "fk_reception"; + $sql .= "fk_reception,"; + $sql .= "cost_price"; $sql .= ") VALUES ("; @@ -205,7 +207,8 @@ class CommandeFournisseurDispatch extends CommonObjectLine $sql .= " ".(!isset($this->batch) ? 'NULL' : "'".$this->db->escape($this->batch)."'").","; $sql .= " ".(!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : "'".$this->db->idate($this->eatby)."'").","; $sql .= " ".(!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : "'".$this->db->idate($this->sellby)."'").","; - $sql .= " ".(!isset($this->fk_reception) ? 'NULL' : "'".$this->db->escape($this->fk_reception)."'").""; + $sql .= " ".(!isset($this->fk_reception) ? 'NULL' : "'".$this->db->escape($this->fk_reception)."'").","; + $sql .= " ".(!isset($this->cost_price) ? '0' : "'".$this->db->escape($this->cost_price)."'").""; $sql .= ")"; $this->db->begin(); diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index fb0969dc7ef..51610ee8557 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -111,3 +111,5 @@ ALTER TABLE llx_product_lot ADD COLUMN barcode varchar(180) DEFAULT NULL; ALTER TABLE llx_product_lot ADD COLUMN fk_barcode_type integer DEFAULT NULL; ALTER TABLE llx_projet ADD COLUMN max_attendees integer DEFAULT 0; + +ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN cost_price double(24,8) DEFAULT 0; diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql index b5f85fea250..974e10c09ff 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql @@ -36,5 +36,6 @@ create table llx_commande_fournisseur_dispatch sellby date DEFAULT NULL, status integer, datec datetime, - tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + cost_price double(24,8) DEFAULT 0 )ENGINE=innodb; diff --git a/htdocs/langs/en_US/receptions.lang b/htdocs/langs/en_US/receptions.lang index 4ee0555c396..46b2d689609 100644 --- a/htdocs/langs/en_US/receptions.lang +++ b/htdocs/langs/en_US/receptions.lang @@ -45,3 +45,4 @@ ReceptionsNumberingModules=Numbering module for receptions ReceptionsReceiptModel=Document templates for receptions NoMorePredefinedProductToDispatch=No more predefined products to dispatch ReceptionExist=A reception exists +ByingPrice=Bying price diff --git a/htdocs/langs/fr_FR/receptions.lang b/htdocs/langs/fr_FR/receptions.lang index 2becadf52c4..5d01e6a75bd 100644 --- a/htdocs/langs/fr_FR/receptions.lang +++ b/htdocs/langs/fr_FR/receptions.lang @@ -45,3 +45,4 @@ ReceptionsNumberingModules=Module de numérotation pour les réceptions ReceptionsReceiptModel=Modèles de document pour les réceptions NoMorePredefinedProductToDispatch=Plus de produits prédéfinis à expédier ReceptionExist=Une réception existe +ByingPrice=Prix d'achat diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index fbb9d246431..520214f0d5c 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -340,6 +340,7 @@ if (empty($reshook)) { $eatby = "dlc".$i; $sellby = "dluo".$i; $batch = "batch".$i; + $cost_price = "cost_price".$i; if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && $conf->global->RECEPTION_GETS_ALL_ORDER_PRODUCTS)) { $ent = "entl".$i; @@ -364,8 +365,11 @@ if (empty($reshook)) { $sellby = GETPOST($sellby, 'alpha'); $eatbydate = str_replace('/', '-', $eatby); $sellbydate = str_replace('/', '-', $sellby); - - $ret = $object->addline($entrepot_id, GETPOST($idl, 'int'), GETPOST($qty, 'int'), $array_options[$i], GETPOST($comment, 'alpha'), strtotime($eatbydate), strtotime($sellbydate), GETPOST($batch, 'alpha')); + if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) { + $ret = $object->addline($entrepot_id, GETPOST($idl, 'int'), GETPOST($qty, 'int'), $array_options[$i], GETPOST($comment, 'alpha'), strtotime($eatbydate), strtotime($sellbydate), GETPOST($batch, 'alpha'), GETPOST($cost_price, 'double')); + } else { + $ret = $object->addline($entrepot_id, GETPOST($idl, 'int'), GETPOST($qty, 'int'), $array_options[$i], GETPOST($comment, 'alpha'), strtotime($eatbydate), strtotime($sellbydate), GETPOST($batch, 'alpha')); + } if ($ret < 0) { setEventMessages($object->error, $object->errors, 'errors'); $error++; @@ -989,6 +993,9 @@ if ($action == 'create') { print ''.$langs->trans("QtyOrdered").''; print ''.$langs->trans("QtyReceived").''; print ''.$langs->trans("QtyToReceive"); + if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION || $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) { + print ''.$langs->trans("ByingPrice").''; + } if (empty($conf->productbatch->enabled)) { print '
    ('.$langs->trans("Fill").''; print ' / '.$langs->trans("Reset").')'; @@ -1118,6 +1125,7 @@ if ($action == 'create') { $stock = + $product->stock_warehouse[$dispatchLines[$indiceAsked]['ent']]->real; // Convert to number $deliverableQty = $dispatchLines[$indiceAsked]['qty']; + $cost_price = $dispatchLines[$indiceAsked]['pu']; // Quantity to send print ''; @@ -1132,6 +1140,12 @@ if ($action == 'create') { } print ''; + if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) { + print ''; + print ''; + print ''; + } + // Stock if (!empty($conf->stock->enabled)) { print ''; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index add1be5e831..0b53c6fd17d 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -562,6 +562,9 @@ class Reception extends CommonObject $sql = "SELECT cd.fk_product, cd.subprice,"; $sql .= " ed.rowid, ed.qty, ed.fk_entrepot,"; $sql .= " ed.eatby, ed.sellby, ed.batch"; + if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION || $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) { + $sql .= ", ed.cost_price"; + } $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,"; $sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed"; $sql .= " WHERE ed.fk_reception = ".((int) $this->id); @@ -589,7 +592,11 @@ class Reception extends CommonObject // line without batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record. - $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref)); + if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION || $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) { + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionValidatedInDolibarr", $numref)); + } else { + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref)); + } if ($result < 0) { $error++; $this->errors[] = $mouvS->error; @@ -601,7 +608,11 @@ class Reception extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record. // Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version) - $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch); + if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION || $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) { + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch); + } else { + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch); + } if ($result < 0) { $error++; $this->errors[] = $mouvS->error; @@ -704,9 +715,10 @@ class Reception extends CommonObject * @param integer $eatby eat-by date * @param integer $sellby sell-by date * @param string $batch Lot number + * @param double $cost_price Line cost * @return int <0 if KO, index of line if OK */ - public function addline($entrepot_id, $id, $qty, $array_options = 0, $comment = '', $eatby = '', $sellby = '', $batch = '') + public function addline($entrepot_id, $id, $qty, $array_options = 0, $comment = '', $eatby = '', $sellby = '', $batch = '', $cost_price = 0) { global $conf, $langs, $user; @@ -746,8 +758,8 @@ class Reception extends CommonObject $line->eatby = $eatby; $line->sellby = $sellby; $line->status = 1; + $line->cost_price = $cost_price; $line->fk_reception = $this->id; - $this->lines[$num] = $line; return $num; From 144147c5d131059b96aaccc6ce44ec32d9d70b67 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 22 Sep 2021 14:58:03 +0200 Subject: [PATCH 190/374] FIX check if greater 0 --- htdocs/product/reassort.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index f8db6915409..c327b24e8f0 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -189,7 +189,7 @@ if ($fourn_id > 0) { $sql .= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".((int) $fourn_id); } // Insert categ filter -if ($search_categ) { +if ($search_categ > 0) { $sql .= " AND cp.fk_categorie = ".((int) $search_categ); } $sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,"; From 2824c8b8abbb3ce7e8d339da251142d2f2508331 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Sep 2021 15:11:18 +0200 Subject: [PATCH 191/374] FIX support of localtax on expense report --- htdocs/commande/card.php | 18 +- htdocs/core/class/commonobject.class.php | 3 +- htdocs/expensereport/card.php | 30 ++- .../class/expensereport.class.php | 247 ++++++++++-------- 4 files changed, 170 insertions(+), 128 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 224c443754a..c40a64032c0 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -278,6 +278,7 @@ if (empty($reshook)) { if (!empty($origin) && !empty($originid)) { // Parse element/subelement (ex: project_task) $element = $subelement = $origin; + $regs = array(); if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) { $element = $regs [1]; $subelement = $regs [2]; @@ -1394,6 +1395,7 @@ if (empty($reshook)) { /* * View */ + $title = $langs->trans('Order')." - ".$langs->trans('Card'); $help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge'; llxHeader('', $title, $help_url); @@ -2347,17 +2349,17 @@ if ($action == 'create' && $usercancreate) { if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT print ''.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).''; - print ''.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).''; + print ''.price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).''; print ''; // Multicurrency Amount VAT print ''.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).''; - print ''.price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).''; + print ''.price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).''; print ''; // Multicurrency Amount TTC print ''.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).''; - print ''.price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).''; + print ''.price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).''; print ''; } @@ -2367,23 +2369,23 @@ if ($action == 'create' && $usercancreate) { $alert = ' '.img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount)); } print ''.$langs->trans('AmountHT').''; - print ''.price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency).$alert.''; + print ''.price($object->total_ht, 1, '', 1, -1, -1, $conf->currency).$alert.''; // Total VAT - print ''.$langs->trans('AmountVAT').''.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency).''; + print ''.$langs->trans('AmountVAT').''.price($object->total_tva, 1, '', 1, -1, -1, $conf->currency).''; // Amount Local Taxes if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1 print ''.$langs->transcountry("AmountLT1", $mysoc->country_code).''; - print ''.price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency).''; + print ''.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).''; } if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF print ''.$langs->transcountry("AmountLT2", $mysoc->country_code).''; - print ''.price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).''; + print ''.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).''; } // Total TTC - print ''.$langs->trans('AmountTTC').''.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).''; + print ''.$langs->trans('AmountTTC').''.price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency).''; // Statut //print '' . $langs->trans('Status') . '' . $object->getLibStatut(4) . ''; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1f0edd23401..d53b8829686 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3526,7 +3526,7 @@ abstract class CommonObject $this->db->free($resql); - // Now update global field total_ht, total_ttc and tva + // Now update global field total_ht, total_ttc, total_tva, total_localtax1, total_localtax2, multicurrency_total_* $fieldht = 'total_ht'; $fieldtva = 'tva'; $fieldlocaltax1 = 'localtax1'; @@ -3569,6 +3569,7 @@ abstract class CommonObject dol_syslog(get_class($this)."::update_price", LOG_DEBUG); $resql = $this->db->query($sql); + if (!$resql) { $error++; $this->error = $this->db->lasterror(); diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index c01c720f481..138b98bd419 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -220,7 +220,7 @@ if (empty($reshook)) { $object->fk_user_author = $user->id; } - // Check that expense report is for a user inside the hierarchy or advanced permission for all is set + // Check that expense report is for a user inside the hierarchy, or that advanced permission for all is set if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer) && empty($user->rights->expensereport->writeall_advance))) { $error++; @@ -1095,7 +1095,7 @@ if (empty($reshook)) { $action = ''; } - if ((int) $tmpvat < 0 || $tmpvat == '') { + if ((float) $tmpvat < 0 || $tmpvat === '') { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("VAT")), null, 'errors'); $action = ''; @@ -1190,7 +1190,6 @@ if (empty($reshook)) { } } - $object->update_totaux_del($object_ligne->total_ht, $object_ligne->total_tva); header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int')); exit; } else { @@ -1240,7 +1239,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); $action = ''; } - if ((int) $tmpvat < 0 || $tmpvat == '') { + if ((float) $tmpvat < 0 || $tmpvat == '') { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Vat")), null, 'errors'); $action = ''; @@ -1277,8 +1276,6 @@ if (empty($reshook)) { } } - $result = $object->recalculer($id); - //header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); //exit; } else { @@ -1441,8 +1438,6 @@ if ($action == 'create') { } elseif ($id > 0 || $ref) { $result = $object->fetch($id, $ref); - $res = $object->fetch_optionals(); - if ($result > 0) { if (!in_array($object->fk_user_author, $user->getAllChildIds(1))) { if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous) @@ -1843,12 +1838,22 @@ if ($action == 'create') { print ''; print ''.$langs->trans("AmountVAT").''; - print ''.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency).''; + print ''.price($object->total_tva, 1, '', 1, -1, -1, $conf->currency).''; print ''; + // Amount Local Taxes + if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1 + print ''.$langs->transcountry("AmountLT1", $mysoc->country_code).''; + print ''.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).''; + } + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF + print ''.$langs->transcountry("AmountLT2", $mysoc->country_code).''; + print ''.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).''; + } + print ''; print ''.$langs->trans("AmountTTC").''; - print ''.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).''; + print ''.price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency).''; print ''; // List of payments already done @@ -2053,7 +2058,7 @@ if ($action == 'create') { // Comment print ''.dol_nl2br($line->comments).''; // VAT rate - print ''.vatrate($line->vatrate, true).''; + print ''.vatrate($line->vatrate.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), true).''; // Unit price HT print ''; if (!empty($line->value_unit_ht)) { @@ -2260,8 +2265,9 @@ if ($action == 'create') { print ''; // VAT + $selectedvat = price2num($line->vatrate).($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''); print ''; - print $form->load_tva('vatrate', (GETPOSTISSET("vatrate") ? GETPOST("vatrate") : $line->vatrate), $mysoc, '', 0, 0, '', false, 1); + print $form->load_tva('vatrate', (GETPOSTISSET("vatrate") ? GETPOST("vatrate") : $selectedvat), $mysoc, '', 0, 0, '', false, 1); print ''; // Unit price diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index d9e97baa81c..86852640596 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -80,8 +80,6 @@ class ExpenseReport extends CommonObject */ public $fk_statut; - public $vat_src_code; - public $fk_c_paiement; public $paid; @@ -124,6 +122,9 @@ class ExpenseReport extends CommonObject // Paiement public $user_paid_infos; + public $localtax1; // for backward compatibility (real field should be total_localtax1 defined into CommonObject) + public $localtax2; // for backward compatibility (real field should be total_localtax2 defined into CommonObject) + /** * Draft status @@ -213,6 +214,10 @@ class ExpenseReport extends CommonObject $this->total_ht = 0; $this->total_ttc = 0; $this->total_tva = 0; + $this->total_localtax1 = 0; + $this->total_localtax2 = 0; + $this->localtax1 = 0; // For backward compatibility + $this->localtax2 = 0; // For backward compatibility $this->modepaymentid = 0; // List of language codes for status @@ -314,12 +319,18 @@ class ExpenseReport extends CommonObject $newndfline->fk_project = $line->fk_project; $newndfline->vatrate = $line->vatrate; $newndfline->vat_src_code = $line->vat_src_code; + $newndfline->localtax1_tx = $line->localtax1_tx; + $newndfline->localtax2_tx = $line->localtax2_tx; + $newndfline->localtax1_type = $line->localtax1_type; + $newndfline->localtax2_type = $line->localtax2_type; $newndfline->comments = $line->comments; $newndfline->qty = $line->qty; $newndfline->value_unit = $line->value_unit; $newndfline->total_ht = $line->total_ht; $newndfline->total_ttc = $line->total_ttc; $newndfline->total_tva = $line->total_tva; + $newndfline->total_localtax1 = $line->total_localtax1; + $newndfline->total_localtax2 = $line->total_localtax2; $newndfline->date = $line->date; $newndfline->rule_warning_message = $line->rule_warning_message; $newndfline->fk_c_exp_tax_cat = $line->fk_c_exp_tax_cat; @@ -539,7 +550,8 @@ class ExpenseReport extends CommonObject $sql = "SELECT d.rowid, d.entity, d.ref, d.note_public, d.note_private,"; // DEFAULT $sql .= " d.detail_refuse, d.detail_cancel, d.fk_user_refuse, d.fk_user_cancel,"; // ACTIONS $sql .= " d.date_refuse, d.date_cancel,"; // ACTIONS - $sql .= " d.total_ht, d.total_ttc, d.total_tva,"; // TOTAUX (int) + $sql .= " d.total_ht, d.total_ttc, d.total_tva,"; + $sql .= " d.localtax1 as total_localtax1, d.localtax2 as total_localtax2,"; $sql .= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve,"; // DATES (datetime) $sql .= " d.fk_user_creat, d.fk_user_author, d.fk_user_modif, d.fk_user_validator,"; $sql .= " d.fk_user_valid, d.fk_user_approve,"; @@ -565,6 +577,11 @@ class ExpenseReport extends CommonObject $this->total_ht = $obj->total_ht; $this->total_tva = $obj->total_tva; $this->total_ttc = $obj->total_ttc; + $this->localtax1 = $obj->total_localtax1; // For backward compatibility + $this->localtax2 = $obj->total_localtax2; // For backward compatibility + $this->total_localtax1 = $obj->total_localtax1; + $this->total_localtax2 = $obj->total_localtax2; + $this->note_public = $obj->note_public; $this->note_private = $obj->note_private; $this->detail_refuse = $obj->detail_refuse; @@ -962,54 +979,6 @@ class ExpenseReport extends CommonObject } } - /** - * recalculer - * TODO Replace this with call to update_price if not already done - * - * @param int $id Id of expense report - * @return int <0 if KO, >0 if OK - */ - public function recalculer($id) - { - $sql = 'SELECT tt.total_ht, tt.total_ttc, tt.total_tva'; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as tt'; - $sql .= ' WHERE tt.'.$this->fk_element.' = '.((int) $id); - - $total_ht = 0; $total_tva = 0; $total_ttc = 0; - - $result = $this->db->query($sql); - if ($result) { - $num = $this->db->num_rows($result); - $i = 0; - while ($i < $num) { - $objp = $this->db->fetch_object($result); - $total_ht += $objp->total_ht; - $total_tva += $objp->total_tva; - $i++; - } - - $total_ttc = $total_ht + $total_tva; - $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; - $sql .= " total_ht = ".price2num($total_ht, 'MT'); - $sql .= " , total_ttc = ".price2num($total_ttc, 'MT'); - $sql .= " , total_tva = ".price2num($total_tva, 'MT'); - $sql .= " WHERE rowid = ".((int) $id); - $result = $this->db->query($sql); - if ($result) { - $this->db->free($result); - return 1; - } else { - $this->error = $this->db->lasterror(); - dol_syslog(get_class($this)."::recalculer: Error ".$this->error, LOG_ERR); - return -3; - } - } else { - $this->error = $this->db->lasterror(); - dol_syslog(get_class($this)."::recalculer: Error ".$this->error, LOG_ERR); - return -3; - } - } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * fetch_lines @@ -1024,14 +993,18 @@ class ExpenseReport extends CommonObject $this->lines = array(); $sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date, de.rang,'; - $sql .= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_c_exp_tax_cat, de.fk_projet as fk_project, de.tva_tx, de.fk_ecm_files,'; + $sql .= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_c_exp_tax_cat, de.fk_projet as fk_project,'; + $sql .= ' de.tva_tx, de.vat_src_code,'; + $sql .= ' de.localtax1_tx, de.localtax2_tx, de.localtax1_type, de.localtax2_type,'; + $sql .= ' de.fk_ecm_files,'; $sql .= ' de.total_ht, de.total_tva, de.total_ttc,'; + $sql .= ' de.total_localtax1, de.total_localtax2,'; $sql .= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,'; $sql .= ' p.ref as ref_projet, p.title as title_projet'; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as de'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_fees as ctf ON de.fk_c_type_fees = ctf.id'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as p ON de.fk_projet = p.rowid'; - $sql .= ' WHERE de.'.$this->fk_element.' = '.$this->id; + $sql .= ' WHERE de.'.$this->fk_element.' = '.((int) $this->id); if (!empty($conf->global->EXPENSEREPORT_LINES_SORTED_BY_ROWID)) { $sql .= ' ORDER BY de.rang ASC, de.rowid ASC'; } else { @@ -1065,11 +1038,20 @@ class ExpenseReport extends CommonObject $deplig->total_ht = $objp->total_ht; $deplig->total_tva = $objp->total_tva; $deplig->total_ttc = $objp->total_ttc; + $deplig->total_localtax1 = $objp->total_localtax1; + $deplig->total_localtax2 = $objp->total_totaltax2; $deplig->type_fees_code = empty($objp->code_type_fees) ? 'TF_OTHER' : $objp->code_type_fees; $deplig->type_fees_libelle = $objp->libelle_type_fees; - $deplig->tva_tx = $objp->tva_tx; + + $deplig->tva_tx = $objp->tva_tx; $deplig->vatrate = $objp->tva_tx; + $deplig->vat_src_code = $objp->vat_src_code; + $deplig->localtax1_tx = $objp->localtax1_tx; + $deplig->localtax2_tx = $objp->localtax2_tx; + $deplig->localtax1_type = $objp->localtax1_type; + $deplig->localtax2_type = $objp->localtax2_type; + $deplig->projet_ref = $objp->ref_projet; $deplig->projet_title = $objp->title_projet; @@ -1757,41 +1739,12 @@ class ExpenseReport extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Update total of an expense report when you delete a line. - * - * @param string $ligne_total_ht Amount without taxes - * @param string $ligne_total_tva Amount of all taxes - * @return void - */ - public function update_totaux_del($ligne_total_ht, $ligne_total_tva) - { - // phpcs:enable - $this->total_ht = $this->total_ht - $ligne_total_ht; - $this->total_tva = $this->total_tva - $ligne_total_tva; - $this->total_ttc = $this->total_ht + $this->total_tva; - - $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; - $sql .= " total_ht = ".$this->total_ht; - $sql .= " , total_ttc = ".$this->total_ttc; - $sql .= " , total_tva = ".$this->total_tva; - $sql .= " WHERE rowid = ".$this->id; - - $result = $this->db->query($sql); - if ($result) { - return 1; - } else { - $this->error = $this->db->error(); - return -1; - } - } /** * addline * * @param float $qty Qty - * @param double $up Value init + * @param double $up Unit price (price with tax) * @param int $fk_c_type_fees Type payment * @param string $vatrate Vat rate (Can be '10' or '10 (ABC)') * @param string $date Date @@ -1838,7 +1791,14 @@ class ExpenseReport extends CommonObject $this->line = new ExpenseReportLine($this->db); - $localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $mysoc, $this->thirdparty); + // We don't know seller and buyer for expense reports + $seller = $mysoc; // We use same than current company (expense report are often done in same country) + $seller->tva_assuj = 1; // Most seller uses vat + $seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company + $seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company + $buyer = new Societe($this->db); + + $localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $buyer, $seller); $vat_src_code = ''; $reg = array(); @@ -1848,16 +1808,22 @@ class ExpenseReport extends CommonObject } $vatrate = preg_replace('/\*/', '', $vatrate); - $seller = ''; // seller is unknown - - $tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type); + $tmp = calcul_price_total($qty, $up, 0, $vatrate, -1, -1, 0, 'TTC', 0, $type, $seller, $localtaxes_type); $this->line->value_unit = $up; + $this->line->vat_src_code = $vat_src_code; $this->line->vatrate = price2num($vatrate); + $this->line->localtax1_tx = $localtaxes_type[1]; + $this->line->localtax2_tx = $localtaxes_type[3]; + $this->line->localtax1_type = $localtaxes_type[0]; + $this->line->localtax2_type = $localtaxes_type[2]; + $this->line->total_ttc = $tmp[2]; $this->line->total_ht = $tmp[0]; $this->line->total_tva = $tmp[1]; + $this->line->total_localtax1 = $tmp[9]; + $this->line->total_localtax2 = $tmp[10]; $this->line->fk_expensereport = $this->id; $this->line->qty = $qty; @@ -1899,13 +1865,13 @@ class ExpenseReport extends CommonObject /** * Check constraint of rules and update price if needed * - * @param int $type type of line - * @param string $seller seller, but actually he is unknown - * @return true or false + * @param int $type Type of line + * @param string $seller Seller, but actually he is unknown + * @return true or false */ public function checkRules($type = 0, $seller = '') { - global $user, $conf, $db, $langs; + global $user, $conf, $db, $langs, $mysoc; $langs->load('trips'); @@ -1913,6 +1879,15 @@ class ExpenseReport extends CommonObject return true; // if don't use rules } + // We don't know seller and buyer for expense reports + if (!is_object($seller)) { + $seller = $mysoc; // We use same than current company (expense report are often done in same country) + $seller->tva_assuj = 1; // Most seller uses vat + $seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company + $seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company + } + //$buyer = new Societe($this->db); + $rulestocheck = ExpenseReportRule::getAllRule($this->line->fk_c_type_fees, $this->line->date, $this->fk_user_author); $violation = 0; @@ -1960,6 +1935,8 @@ class ExpenseReport extends CommonObject $this->line->total_ttc = $tmp[2]; $this->line->total_ht = $tmp[0]; $this->line->total_tva = $tmp[1]; + $this->line->total_localtax1 = $tmp[9]; + $this->line->total_localtax2 = $tmp[10]; return false; } else { @@ -1970,11 +1947,13 @@ class ExpenseReport extends CommonObject /** * Method to apply the offset if needed * - * @return boolean true=applied, false=not applied + * @param int $type Type of line + * @param string $seller Seller, but actually he is unknown + * @return boolean True=applied, False=not applied */ - public function applyOffset() + public function applyOffset($type = 0, $seller = '') { - global $conf; + global $conf, $mysoc; if (empty($conf->global->MAIN_USE_EXPENSE_IK)) { return false; @@ -1987,6 +1966,15 @@ class ExpenseReport extends CommonObject return false; } + // We don't know seller and buyer for expense reports + if (!is_object($seller)) { + $seller = $mysoc; // We use same than current company (expense report are often done in same country) + $seller->tva_assuj = 1; // Most seller uses vat + $seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company + $seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company + } + //$buyer = new Societe($this->db); + $range = ExpenseReportIk::getRangeByUser($userauthor, $this->line->fk_c_exp_tax_cat); if (empty($range)) { @@ -2010,6 +1998,8 @@ class ExpenseReport extends CommonObject $this->line->total_ttc = $tmp[2]; $this->line->total_ht = $tmp[0]; $this->line->total_tva = $tmp[1]; + $this->line->total_localtax1 = $tmp[9]; + $this->line->total_localtax2 = $tmp[10]; return true; } @@ -2033,7 +2023,7 @@ class ExpenseReport extends CommonObject $sql .= ' AND d.rowid <> '.$this->line->id; } - dol_syslog(get_class($this)."::offsetAlreadyGiven sql=".$sql); + dol_syslog(get_class($this)."::offsetAlreadyGiven"); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -2056,7 +2046,7 @@ class ExpenseReport extends CommonObject * @param double $vatrate Vat rate. Can be '8.5' or '8.5* (8.5NPROM...)' * @param string $comments Description * @param float $qty Qty - * @param double $value_unit Value init + * @param double $value_unit Unit price (with taxes) * @param int $date Date * @param int $expensereport_id Expense report id * @param int $fk_c_exp_tax_cat Id of category of car @@ -2073,7 +2063,10 @@ class ExpenseReport extends CommonObject $type = 0; // TODO What if type is service ? // We don't know seller and buyer for expense reports - $seller = $mysoc; + $seller = $mysoc; // We use same than current company (expense report are often done in same country) + $seller->tva_assuj = 1; // Most seller uses vat + $seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company + $seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company $buyer = new Societe($this->db); $localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $buyer, $seller); @@ -2087,8 +2080,8 @@ class ExpenseReport extends CommonObject } $vatrate = preg_replace('/\*/', '', $vatrate); - $tmp = calcul_price_total($qty, $value_unit, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type); - + $tmp = calcul_price_total($qty, $value_unit, 0, $vatrate, -1, -1, 0, 'TTC', 0, $type, $seller, $localtaxes_type); + //var_dump($vatrate);var_dump($localtaxes_type);var_dump($tmp);exit; // calcul total of line //$total_ttc = price2num($qty*$value_unit, 'MT'); @@ -2109,14 +2102,17 @@ class ExpenseReport extends CommonObject $this->line->vat_src_code = $vat_src_code; $this->line->vatrate = price2num($vatrate); - $this->line->total_ttc = $tmp[2]; - $this->line->total_ht = $tmp[0]; - $this->line->total_tva = $tmp[1]; $this->line->localtax1_tx = $localtaxes_type[1]; $this->line->localtax2_tx = $localtaxes_type[3]; $this->line->localtax1_type = $localtaxes_type[0]; $this->line->localtax2_type = $localtaxes_type[2]; + $this->line->total_ttc = $tmp[2]; + $this->line->total_ht = $tmp[0]; + $this->line->total_tva = $tmp[1]; + $this->line->total_localtax1 = $tmp[9]; + $this->line->total_localtax2 = $tmp[10]; + $this->line->fk_ecm_files = $fk_ecm_files; $this->line->id = ((int) $rowid); @@ -2184,6 +2180,8 @@ class ExpenseReport extends CommonObject return -1; } + $this->update_price(); + $this->db->commit(); return 1; @@ -2593,9 +2591,17 @@ class ExpenseReportLine public $projet_title; public $vatrate; + public $vat_src_code; + public $localtax1_tx; + public $localtax2_tx; + public $localtax1_type; + public $localtax2_type; + public $total_ht; public $total_tva; public $total_ttc; + public $total_localtax1; + public $total_localtax2; /** * @var int ID into llx_ecm_files table to link line to attached file @@ -2623,6 +2629,7 @@ class ExpenseReportLine { $sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_c_exp_tax_cat, fde.fk_projet as fk_project, fde.date,'; $sql .= ' fde.tva_tx as vatrate, fde.vat_src_code, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc, fde.fk_ecm_files,'; + $sql .= ' fde.localtax1_tx, fde.localtax2_tx, fde.localtax1_type, fde.localtax2_type, fde.total_localtax1, fde.total_localtax2,'; $sql .= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,'; $sql .= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref'; $sql .= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde'; @@ -2652,11 +2659,20 @@ class ExpenseReportLine $this->type_fees_libelle = $objp->type_fees_libelle; $this->projet_ref = $objp->projet_ref; $this->projet_title = $objp->projet_title; + $this->vatrate = $objp->vatrate; $this->vat_src_code = $objp->vat_src_code; + $this->localtax1_tx = $objp->localtax1_tx; + $this->localtax2_tx = $objp->localtax2_tx; + $this->localtax1_type = $objp->localtax1_type; + $this->localtax2_type = $objp->localtax2_type; + $this->total_ht = $objp->total_ht; $this->total_tva = $objp->total_tva; $this->total_ttc = $objp->total_ttc; + $this->total_localtax1 = $objp->total_localtax1; + $this->total_localtax2 = $objp->total_localtax2; + $this->fk_ecm_files = $objp->fk_ecm_files; $this->db->free($result); @@ -2695,18 +2711,29 @@ class ExpenseReportLine $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'expensereport_det'; $sql .= ' (fk_expensereport, fk_c_type_fees, fk_projet,'; - $sql .= ' tva_tx, vat_src_code, comments, qty, value_unit, total_ht, total_tva, total_ttc, date, rule_warning_message, fk_c_exp_tax_cat, fk_ecm_files)'; + $sql .= ' tva_tx, vat_src_code,'; + $sql .= ' localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,'; + $sql .= ' comments, qty, value_unit,'; + $sql .= ' total_ht, total_tva, total_ttc,'; + $sql .= ' total_localtax1, total_localtax2,'; + $sql .= ' date, rule_warning_message, fk_c_exp_tax_cat, fk_ecm_files)'; $sql .= " VALUES (".$this->db->escape($this->fk_expensereport).","; $sql .= " ".((int) $this->fk_c_type_fees).","; $sql .= " ".((int) (!empty($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : ((!empty($this->fk_projet) && $this->fk_projet > 0) ? $this->fk_projet : 'null')).","; $sql .= " ".((float) $this->vatrate).","; $sql .= " '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."',"; + $sql .= " ".((float) price2num($this->localtax1_tx)).","; + $sql .= " ".((float) price2num($this->localtax2_tx)).","; + $sql .= " '".$this->db->escape($this->localtax1_type)."',"; + $sql .= " '".$this->db->escape($this->localtax2_type)."',"; $sql .= " '".$this->db->escape($this->comments)."',"; $sql .= " ".((float) $this->qty).","; $sql .= " ".((float) $this->value_unit).","; $sql .= " ".((float) price2num($this->total_ht)).","; $sql .= " ".((float) price2num($this->total_tva)).","; $sql .= " ".((float) price2num($this->total_ttc)).","; + $sql .= " ".((float) price2num($this->total_localtax1)).","; + $sql .= " ".((float) price2num($this->total_localtax2)).","; $sql .= " '".$this->db->idate($this->date)."',"; $sql .= " ".(empty($this->rule_warning_message) ? 'null' : "'".$this->db->escape($this->rule_warning_message)."'").","; $sql .= " ".((int) $this->fk_c_exp_tax_cat).","; @@ -2814,11 +2841,17 @@ class ExpenseReportLine $sql .= ", value_unit = ".((float) $this->value_unit); $sql .= ", qty=".((float) $this->qty); $sql .= ", date='".$this->db->idate($this->date)."'"; - $sql .= ", total_ht=".((float) price2num($this->total_ht, 'MT')).""; - $sql .= ", total_tva=".((float) price2num($this->total_tva, 'MT')).""; - $sql .= ", total_ttc=".((float) price2num($this->total_ttc, 'MT')).""; + $sql .= ", total_ht=".((float) price2num($this->total_ht, 'MT')); + $sql .= ", total_tva=".((float) price2num($this->total_tva, 'MT')); + $sql .= ", total_ttc=".((float) price2num($this->total_ttc, 'MT')); + $sql .= ", total_localtax1=".((float) price2num($this->total_localtax1, 'MT')); + $sql .= ", total_localtax2=".((float) price2num($this->total_localtax2, 'MT')); $sql .= ", tva_tx=".((float) $this->vatrate); $sql .= ", vat_src_code='".$this->db->escape($this->vat_src_code)."'"; + $sql .= ", localtax1_tx=".((float) $this->localtax1_tx); + $sql .= ", localtax2_tx=".((float) $this->localtax2_tx); + $sql .= ", localtax1_type='".$this->db->escape($this->localtax1_type)."'"; + $sql .= ", localtax2_type='".$this->db->escape($this->localtax2_type)."'"; $sql .= ", rule_warning_message='".$this->db->escape($this->rule_warning_message)."'"; $sql .= ", fk_c_exp_tax_cat=".$this->db->escape($this->fk_c_exp_tax_cat); $sql .= ", fk_ecm_files=".($this->fk_ecm_files > 0 ? ((int) $this->fk_ecm_files) : 'null'); From 066013c31f90d4d134057e2bc8ec68796962186b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Wed, 22 Sep 2021 15:15:39 +0200 Subject: [PATCH 192/374] typo stickler --- htdocs/core/lib/project.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 4e4adaf9d3e..2467baa034a 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -134,7 +134,7 @@ function project_prepare_head(Project $project, $moreparam = '') if (!is_null($dataretrieved)) { $nbElements = $dataretrieved; } else { - if (!empty ($conf->stock->enabled)) { + if (!empty($conf->stock->enabled)) { $nbElements += $project->getElementCount('stock', 'entrepot', 'fk_project'); } if (!empty($conf->propal->enabled)) { From 2bd0fdd364b35d60625d81aaac23c669b9ac9d67 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 22 Sep 2021 14:09:29 +0000 Subject: [PATCH 193/374] Fixing style errors. --- htdocs/expensereport/card.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 138b98bd419..81995792dbb 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1842,14 +1842,14 @@ if ($action == 'create') { print ''; // Amount Local Taxes - if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1 - print ''.$langs->transcountry("AmountLT1", $mysoc->country_code).''; - print ''.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).''; - } - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF - print ''.$langs->transcountry("AmountLT2", $mysoc->country_code).''; - print ''.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).''; - } + if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1 + print ''.$langs->transcountry("AmountLT1", $mysoc->country_code).''; + print ''.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).''; + } + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF + print ''.$langs->transcountry("AmountLT2", $mysoc->country_code).''; + print ''.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).''; + } print ''; print ''.$langs->trans("AmountTTC").''; From 70e66627fed60b611adda6d1fab22f4647580914 Mon Sep 17 00:00:00 2001 From: Laurent De Coninck Date: Wed, 22 Sep 2021 20:14:47 +0200 Subject: [PATCH 194/374] restrict the html --- htdocs/takepos/admin/receipt.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 61fd71bdf29..3350da50104 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -42,8 +42,8 @@ if (GETPOST('action', 'alpha') == 'set') { $db->begin(); - $res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'none'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'none'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'restricthtml'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'restricthtml'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_RECEIPT_NAME", GETPOST('TAKEPOS_RECEIPT_NAME', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_SHOW_CUSTOMER", GETPOST('TAKEPOS_SHOW_CUSTOMER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_AUTO_PRINT_TICKETS", GETPOST('TAKEPOS_AUTO_PRINT_TICKETS', 'int'), 'int', 0, '', $conf->entity); From 1e0a7e43424f541538ef253f97e62671801ef833 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Sep 2021 02:10:39 +0200 Subject: [PATCH 195/374] FIX Test when date of invoie is in future (pb with TZ and offset) --- htdocs/compta/facture/card.php | 51 +++++++++++++++---------------- htdocs/core/lib/functions.lib.php | 2 +- htdocs/fourn/facture/card.php | 22 +++++++------ 3 files changed, 39 insertions(+), 36 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 105c94d6a73..d4cf0a68441 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -408,13 +408,21 @@ if (empty($reshook)) { } elseif ($action == 'setinvoicedate' && $usercancreate) { $object->fetch($id); $old_date_lim_reglement = $object->date_lim_reglement; - $date = dol_mktime(12, 0, 0, GETPOST('invoicedatemonth', 'int'), GETPOST('invoicedateday', 'int'), GETPOST('invoicedateyear', 'int')); - if (empty($date)) { + $newdate = dol_mktime(0, 0, 0, GETPOST('invoicedatemonth', 'int'), GETPOST('invoicedateday', 'int'), GETPOST('invoicedateyear', 'int'), 'tzserver'); + if (empty($newdate)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); - header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate'); + header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate&token='.newToken()); exit; } - $object->date = $date; + if ($newdate > (dol_now('tzuserrel') + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + if (empty($conf->global->INVOICE_MAX_FUTURE_DELAY)) { + setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings'); + } else { + setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings'); + } + } + + $object->date = $newdate; $new_date_lim_reglement = $object->calculate_date_lim_reglement(); if ($new_date_lim_reglement > $old_date_lim_reglement) { $object->date_lim_reglement = $new_date_lim_reglement; @@ -428,7 +436,9 @@ if (empty($reshook)) { } } elseif ($action == 'setdate_pointoftax' && $usercancreate) { $object->fetch($id); - $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); + + $date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver'); + $object->date_pointoftax = $date_pointoftax; $result = $object->update($user); if ($result < 0) { @@ -1001,14 +1011,16 @@ if (empty($reshook)) { $error++; } + $dateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server + $date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver'); + // Replacement invoice if (GETPOST('type') == Facture::TYPE_REPLACEMENT) { - $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($dateinvoice)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = 'create'; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; @@ -1020,8 +1032,6 @@ if (empty($reshook)) { $action = 'create'; } - $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int')); - if (!$error) { // This is a replacement invoice $result = $object->fetch(GETPOST('fac_replacement', 'int')); @@ -1064,19 +1074,16 @@ if (empty($reshook)) { $action = 'create'; } - $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($dateinvoice)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = 'create'; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; } - $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int')); - if (!$error) { if (!empty($originentity)) { $object->entity = $originentity; @@ -1280,19 +1287,16 @@ if (empty($reshook)) { // Standard invoice or Deposit invoice, created from a Predefined template invoice if ((GETPOST('type') == Facture::TYPE_STANDARD || GETPOST('type') == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0) { - $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($dateinvoice)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = 'create'; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; } - $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); - if (!$error) { $object->socid = GETPOST('socid', 'int'); $object->type = GETPOST('type'); @@ -1327,8 +1331,6 @@ if (empty($reshook)) { $typeamount = GETPOST('typedeposit', 'aZ09'); $valuestandardinvoice = price2num(str_replace('%', '', GETPOST('valuestandardinvoice', 'alpha')), 'MU'); $valuedeposit = price2num(str_replace('%', '', GETPOST('valuedeposit', 'alpha')), 'MU'); - $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); - $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int')); if (GETPOST('socid', 'int') < 1) { $error++; @@ -1340,7 +1342,7 @@ if (empty($reshook)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = 'create'; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; @@ -1822,19 +1824,16 @@ if (empty($reshook)) { // Situation invoices if (GETPOST('type') == Facture::TYPE_SITUATION && GETPOST('situations')) { - $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($dateinvoice)) { $error++; $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")); setEventMessages($mesg, null, 'errors'); - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; } - $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int')); - if (!(GETPOST('situations', 'int') > 0)) { $error++; $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation")); @@ -3529,7 +3528,8 @@ if ($action == 'create') { print ''; } - $newdateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); + $newdateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); + $date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver'); // Date invoice print ''.$langs->trans('DateInvoice').''; @@ -3539,7 +3539,6 @@ if ($action == 'create') { // Date point of tax if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) { print ''.$langs->trans('DatePointOfTax').''; - $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int')); print $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', '', '', '', "add", 1, 1); print ''; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 357fcc9972f..698bf4410da 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2508,7 +2508,7 @@ function dol_getdate($timestamp, $fast = false, $forcetimezone = '') * False or 0 or 'tzserver' = local to server TZ * 'auto' * 'tzuser' = local to user TZ taking dst into account at the current date. Not yet implemented. - * 'tzuserrel' = local to user TZ taking dst into account at the given date. Use this one to convert date input from user. + * 'tzuserrel' = local to user TZ taking dst into account at the given date. Use this one to convert date input from user into a GMT date. * 'tz,TimeZone' = use specified timezone * @param int $check 0=No check on parameters (Can use day 32, etc...) * @return int|string Date as a timestamp, '' or false if error diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 88c37aaaf22..9b1da2aa530 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -423,9 +423,9 @@ if (empty($reshook)) { dol_print_error($db); } } elseif ($action == 'setdatef' && $usercancreate) { - $newdate = dol_mktime(0, 0, 0, $_POST['datefmonth'], $_POST['datefday'], $_POST['datefyear']); - if ($newdate > (dol_now() + (empty($conf->global->INVOICE_MAX_OFFSET_IN_FUTURE) ? 0 : $conf->global->INVOICE_MAX_OFFSET_IN_FUTURE))) { - if (empty($conf->global->INVOICE_MAX_OFFSET_IN_FUTURE)) { + $newdate = dol_mktime(0, 0, 0, GETPOST('datefmonth', 'int'), GETPOST('datefday', 'int'), GETPOST('datefyear', 'int'), 'tzserver'); + if ($newdate > (dol_now('tzuserrel') + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + if (empty($conf->global->INVOICE_MAX_FUTURE_DELAY)) { setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings'); } else { setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings'); @@ -449,7 +449,7 @@ if (empty($reshook)) { } } elseif ($action == 'setdate_lim_reglement' && $usercancreate) { $object->fetch($id); - $object->date_echeance = dol_mktime(12, 0, 0, $_POST['date_lim_reglementmonth'], $_POST['date_lim_reglementday'], $_POST['date_lim_reglementyear']); + $object->date_echeance = dol_mktime(12, 0, 0, GETPOST('date_lim_reglementmonth', 'int'), GETPOST('date_lim_reglementday', 'int'), GETPOST('date_lim_reglementyear', 'int')); if (!empty($object->date_echeance) && $object->date_echeance < $object->date) { $object->date_echeance = $object->date; setEventMessages($langs->trans("DatePaymentTermCantBeLowerThanObjectDate"), null, 'warnings'); @@ -706,8 +706,12 @@ if (empty($reshook)) { $error++; } - $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); - $datedue = dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int')); + $dateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server + $datedue = dol_mktime(0, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int'), 'tzserver'); + /*var_dump($dateinvoice.' '.dol_print_date($dateinvoice, 'dayhour')); + var_dump(dol_now('tzuserrel').' '.dol_get_last_hour(dol_now('tzuserrel')).' '.dol_print_date(dol_now('tzuserrel'),'dayhour').' '.dol_print_date(dol_get_last_hour(dol_now('tzuserrel')), 'dayhour')); + var_dump($db->idate($dateinvoice)); + exit;*/ // Replacement invoice if (GETPOST('type') == FactureFournisseur::TYPE_REPLACEMENT) { @@ -716,7 +720,7 @@ if (empty($reshook)) { $action = 'create'; $_GET['socid'] = $_POST['socid']; $error++; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; @@ -780,7 +784,7 @@ if (empty($reshook)) { $action = 'create'; $_GET['socid'] = $_POST['socid']; $error++; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; @@ -889,7 +893,7 @@ if (empty($reshook)) { $action = 'create'; $_GET['socid'] = $_POST['socid']; $error++; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; From 51b6318f880fb3e3bb2fcc705894abd081a45f6f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Sep 2021 02:10:39 +0200 Subject: [PATCH 196/374] FIX Test when date of invoie is in future (pb with TZ and offset) --- htdocs/compta/facture/card.php | 51 +++++++++++++++---------------- htdocs/core/lib/functions.lib.php | 2 +- htdocs/fourn/facture/card.php | 22 +++++++------ 3 files changed, 39 insertions(+), 36 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d019b2dcf9a..6ea03d8bd23 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -393,13 +393,21 @@ if (empty($reshook)) { } elseif ($action == 'setinvoicedate' && $usercancreate) { $object->fetch($id); $old_date_lim_reglement = $object->date_lim_reglement; - $date = dol_mktime(12, 0, 0, GETPOST('invoicedatemonth', 'int'), GETPOST('invoicedateday', 'int'), GETPOST('invoicedateyear', 'int')); - if (empty($date)) { + $newdate = dol_mktime(0, 0, 0, GETPOST('invoicedatemonth', 'int'), GETPOST('invoicedateday', 'int'), GETPOST('invoicedateyear', 'int'), 'tzserver'); + if (empty($newdate)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); - header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate'); + header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate&token='.newToken()); exit; } - $object->date = $date; + if ($newdate > (dol_now('tzuserrel') + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + if (empty($conf->global->INVOICE_MAX_FUTURE_DELAY)) { + setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings'); + } else { + setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings'); + } + } + + $object->date = $newdate; $new_date_lim_reglement = $object->calculate_date_lim_reglement(); if ($new_date_lim_reglement > $old_date_lim_reglement) { $object->date_lim_reglement = $new_date_lim_reglement; @@ -413,7 +421,9 @@ if (empty($reshook)) { } } elseif ($action == 'setdate_pointoftax' && $usercancreate) { $object->fetch($id); - $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); + + $date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver'); + $object->date_pointoftax = $date_pointoftax; $result = $object->update($user); if ($result < 0) { @@ -986,14 +996,16 @@ if (empty($reshook)) { $error++; } + $dateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server + $date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver'); + // Replacement invoice if (GETPOST('type') == Facture::TYPE_REPLACEMENT) { - $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($dateinvoice)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = 'create'; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; @@ -1005,8 +1017,6 @@ if (empty($reshook)) { $action = 'create'; } - $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int')); - if (!$error) { // This is a replacement invoice $result = $object->fetch(GETPOST('fac_replacement', 'int')); @@ -1049,19 +1059,16 @@ if (empty($reshook)) { $action = 'create'; } - $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($dateinvoice)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = 'create'; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; } - $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int')); - if (!$error) { if (!empty($originentity)) { $object->entity = $originentity; @@ -1265,19 +1272,16 @@ if (empty($reshook)) { // Standard invoice or Deposit invoice, created from a Predefined template invoice if ((GETPOST('type') == Facture::TYPE_STANDARD || GETPOST('type') == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0) { - $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($dateinvoice)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = 'create'; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; } - $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); - if (!$error) { $object->socid = GETPOST('socid', 'int'); $object->type = GETPOST('type'); @@ -1312,8 +1316,6 @@ if (empty($reshook)) { $typeamount = GETPOST('typedeposit', 'aZ09'); $valuestandardinvoice = price2num(str_replace('%', '', GETPOST('valuestandardinvoice', 'alpha')), 'MU'); $valuedeposit = price2num(str_replace('%', '', GETPOST('valuedeposit', 'alpha')), 'MU'); - $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); - $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int')); if (GETPOST('socid', 'int') < 1) { $error++; @@ -1325,7 +1327,7 @@ if (empty($reshook)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = 'create'; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; @@ -1807,19 +1809,16 @@ if (empty($reshook)) { // Situation invoices if (GETPOST('type') == Facture::TYPE_SITUATION && GETPOST('situations')) { - $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($dateinvoice)) { $error++; $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")); setEventMessages($mesg, null, 'errors'); - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; } - $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int')); - if (!(GETPOST('situations', 'int') > 0)) { $error++; $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation")); @@ -3514,7 +3513,8 @@ if ($action == 'create') { print ''; } - $newdateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); + $newdateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); + $date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver'); // Date invoice print ''.$langs->trans('DateInvoice').''; @@ -3524,7 +3524,6 @@ if ($action == 'create') { // Date point of tax if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) { print ''.$langs->trans('DatePointOfTax').''; - $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int')); print $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', '', '', '', "add", 1, 1); print ''; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3ae97098a79..370b10da626 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2487,7 +2487,7 @@ function dol_getdate($timestamp, $fast = false, $forcetimezone = '') * False or 0 or 'tzserver' = local to server TZ * 'auto' * 'tzuser' = local to user TZ taking dst into account at the current date. Not yet implemented. - * 'tzuserrel' = local to user TZ taking dst into account at the given date. Use this one to convert date input from user. + * 'tzuserrel' = local to user TZ taking dst into account at the given date. Use this one to convert date input from user into a GMT date. * 'tz,TimeZone' = use specified timezone * @param int $check 0=No check on parameters (Can use day 32, etc...) * @return int|string Date as a timestamp, '' or false if error diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index db1497f5166..86ddda9769a 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -408,9 +408,9 @@ if (empty($reshook)) { dol_print_error($db); } } elseif ($action == 'setdatef' && $usercancreate) { - $newdate = dol_mktime(0, 0, 0, $_POST['datefmonth'], $_POST['datefday'], $_POST['datefyear']); - if ($newdate > (dol_now() + (empty($conf->global->INVOICE_MAX_OFFSET_IN_FUTURE) ? 0 : $conf->global->INVOICE_MAX_OFFSET_IN_FUTURE))) { - if (empty($conf->global->INVOICE_MAX_OFFSET_IN_FUTURE)) { + $newdate = dol_mktime(0, 0, 0, GETPOST('datefmonth', 'int'), GETPOST('datefday', 'int'), GETPOST('datefyear', 'int'), 'tzserver'); + if ($newdate > (dol_now('tzuserrel') + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + if (empty($conf->global->INVOICE_MAX_FUTURE_DELAY)) { setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings'); } else { setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings'); @@ -434,7 +434,7 @@ if (empty($reshook)) { } } elseif ($action == 'setdate_lim_reglement' && $usercancreate) { $object->fetch($id); - $object->date_echeance = dol_mktime(12, 0, 0, $_POST['date_lim_reglementmonth'], $_POST['date_lim_reglementday'], $_POST['date_lim_reglementyear']); + $object->date_echeance = dol_mktime(12, 0, 0, GETPOST('date_lim_reglementmonth', 'int'), GETPOST('date_lim_reglementday', 'int'), GETPOST('date_lim_reglementyear', 'int')); if (!empty($object->date_echeance) && $object->date_echeance < $object->date) { $object->date_echeance = $object->date; setEventMessages($langs->trans("DatePaymentTermCantBeLowerThanObjectDate"), null, 'warnings'); @@ -692,8 +692,12 @@ if (empty($reshook)) { $error++; } - $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); - $datedue = dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int')); + $dateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server + $datedue = dol_mktime(0, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int'), 'tzserver'); + /*var_dump($dateinvoice.' '.dol_print_date($dateinvoice, 'dayhour')); + var_dump(dol_now('tzuserrel').' '.dol_get_last_hour(dol_now('tzuserrel')).' '.dol_print_date(dol_now('tzuserrel'),'dayhour').' '.dol_print_date(dol_get_last_hour(dol_now('tzuserrel')), 'dayhour')); + var_dump($db->idate($dateinvoice)); + exit;*/ // Replacement invoice if (GETPOST('type') == FactureFournisseur::TYPE_REPLACEMENT) { @@ -702,7 +706,7 @@ if (empty($reshook)) { $action = 'create'; $_GET['socid'] = $_POST['socid']; $error++; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; @@ -766,7 +770,7 @@ if (empty($reshook)) { $action = 'create'; $_GET['socid'] = $_POST['socid']; $error++; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; @@ -875,7 +879,7 @@ if (empty($reshook)) { $action = 'create'; $_GET['socid'] = $_POST['socid']; $error++; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; From 128f6d9a5cb4a7ce34bbf296861809ae0c244231 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Sep 2021 02:38:53 +0200 Subject: [PATCH 197/374] Fix combo box for thirdparties in invoice stats used bad component --- htdocs/compta/facture/stats/index.php | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index ca4d3d6ccaf..5fe028e1268 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -42,7 +42,7 @@ $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height'); // Load translation files required by the page $langs->loadLangs(array('bills', 'companies', 'other')); -$mode = GETPOST("mode") ?GETPOST("mode") : 'customer'; +$mode = GETPOST("mode") ? GETPOST("mode") : 'customer'; if ($mode == 'customer' && !$user->rights->facture->lire) { accessforbidden(); } @@ -244,7 +244,7 @@ if (!count($arrayyears)) { $h = 0; $head = array(); -$head[$h][0] = DOL_URL_ROOT.'/compta/facture/stats/index.php?mode='.$mode; +$head[$h][0] = DOL_URL_ROOT.'/compta/facture/stats/index.php?mode='.urlencode($mode); $head[$h][1] = $langs->trans("ByMonthYear"); $head[$h][2] = 'byyear'; $h++; @@ -261,12 +261,12 @@ complete_head_from_modules($conf, $langs, null, $head, $h, $type); print dol_get_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1); // We use select_thirdparty_list instead of select_company so we can use $filter and share same code for customer and supplier. -$tmp_companies = $form->select_thirdparty_list($socid, 'socid', $filter, 1, 0, 0, array(), '', 1); -//Array passed as an argument to Form::selectarray to build a proper select input -$companies = array(); - -foreach ($tmp_companies as $value) { - $companies[$value['key']] = $value['label']; +$filter = ''; +if ($mode == 'customer') { + $filter = 's.client in (1,2,3)'; +} +if ($mode == 'supplier') { + $filter = 's.fournisseur = 1'; } print '
    '; @@ -281,14 +281,8 @@ print ''; print ''; // Company print ''; // ThirdParty Type From 31d9eb192fa1ab455b138c14ce06b54c91b51498 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Sep 2021 02:51:36 +0200 Subject: [PATCH 198/374] Clean code --- .../eventorganization/conferenceorboothattendee_card.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 0517210333f..84f99182192 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -205,13 +205,12 @@ if (!empty($projectstatic->socid)) { $projectstatic->fetch_thirdparty(); } -$withProjectUrl=''; + $object->project = clone $projectstatic; if (!empty($withproject)) { // Tabs for project $tab = 'eventorganisation'; - $withProjectUrl = "&withproject=1"; $head = project_prepare_head($projectstatic); print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', ''); @@ -421,8 +420,10 @@ if (!empty($withproject)) { if ($action == 'create') { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("ConferenceOrBoothAttendee")), '', 'object_'.$object->picto); - print '
    '; + + print ''; print ''; + print ''; if ($confOrBooth->id > 0) { print ''; @@ -432,8 +433,6 @@ if ($action == 'create') { print ''; } - - print ''; if ($backtopage) { print ''; } From 3467faab6bea5a336f97a1efa047e3d0a2900652 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Sep 2021 03:20:15 +0200 Subject: [PATCH 199/374] Fix property --- htdocs/expensereport/class/expensereport.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 86852640596..9eaa2f96cb5 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1039,7 +1039,7 @@ class ExpenseReport extends CommonObject $deplig->total_tva = $objp->total_tva; $deplig->total_ttc = $objp->total_ttc; $deplig->total_localtax1 = $objp->total_localtax1; - $deplig->total_localtax2 = $objp->total_totaltax2; + $deplig->total_localtax2 = $objp->total_localtax2; $deplig->type_fees_code = empty($objp->code_type_fees) ? 'TF_OTHER' : $objp->code_type_fees; $deplig->type_fees_libelle = $objp->libelle_type_fees; From a48a8231a165953f558f4e5ca8f703ab5f33c87d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Sep 2021 11:33:58 +0200 Subject: [PATCH 200/374] Fix scrutinizer --- htdocs/core/class/html.formcompany.class.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index ac6bad50e41..d1fc8f65edb 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -761,20 +761,21 @@ class FormCompany extends Form /** * Return a select list with types of contacts * - * @param object $object Object to use to find type of contact - * @param string $selected Default selected value - * @param string $htmlname HTML select name - * @param string $source Source ('internal' or 'external') - * @param string $sortorder Sort criteria ('position', 'code', ...) - * @param int $showempty 1=Add en empty line - * @param string $morecss Add more css to select component - * @param int $output 0=return HTML, 1= direct print + * @param object $object Object to use to find type of contact + * @param string $selected Default selected value + * @param string $htmlname HTML select name + * @param string $source Source ('internal' or 'external') + * @param string $sortorder Sort criteria ('position', 'code', ...) + * @param int $showempty 1=Add en empty line + * @param string $morecss Add more css to select component + * @param int $output 0=return HTML, 1= direct print * @param int $forcehidetooltip Force hide tooltip for admin - * @return void + * @return string|void Depending on $output param, return the HTML select list (recommended method) or nothing */ public function selectTypeContact($object, $selected, $htmlname = 'type', $source = 'internal', $sortorder = 'position', $showempty = 0, $morecss = '', $output = 1, $forcehidetooltip = 0) { global $user, $langs; + $out = ''; if (is_object($object) && method_exists($object, 'liste_type_contact')) { $lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1); From 977db0a2ba6b233475e3fe234aa8e3f54a805ff7 Mon Sep 17 00:00:00 2001 From: Ilias Patsiaouras Date: Thu, 23 Sep 2021 11:38:50 +0200 Subject: [PATCH 201/374] add MO to the list of possible object to link --- htdocs/core/class/html.form.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9bcbf08f71a..bc025cfcef0 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7846,6 +7846,11 @@ class Form if (empty($conf->expedition->enabled)) { continue; // Do not show if module disabled } + } elseif ($objecttype == 'mo') { + $tplpath = 'mrp/mo'; + if (empty($conf->mrp->enabled)) { + continue; // Do not show if module disabled + } } elseif ($objecttype == 'invoice_supplier') { $tplpath = 'fourn/facture'; } elseif ($objecttype == 'order_supplier') { @@ -7949,6 +7954,7 @@ class Form 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'), 'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'), 'invoice_supplier'=>array('enabled'=>$conf->supplier_invoice->enabled, 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'), + 'mo'=>array('enabled'=>$conf->mrp->enabled, 'perms'=>1, 'label'=>'LinkToMo', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."mrp_mo as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')'), 'ticket'=>array('enabled'=>$conf->ticket->enabled, 'perms'=>1, 'label'=>'LinkToTicket', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')') ); } From 2538ebec03b335bec33e06593fc63500f615b4e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Sep 2021 11:40:29 +0200 Subject: [PATCH 202/374] Better test --- htdocs/core/class/html.formticket.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index dd43ae0ffae..c455b01e932 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -21,7 +21,7 @@ /** * \file htdocs/core/class/html.formticket.class.php * \ingroup ticket - * \brief Fichier de la classe permettant la generation du formulaire html d'envoi de mail unitaire + * \brief File of class to generate the form for creating a new ticket. */ require_once DOL_DOCUMENT_ROOT."/core/class/html.form.class.php"; require_once DOL_DOCUMENT_ROOT."/core/class/html.formmail.class.php"; @@ -32,12 +32,12 @@ if (!class_exists('FormCompany')) { } /** - * Classe permettant la generation du formulaire d'un nouveau ticket. + * Class to generate the form for creating a new ticket. + * Usage: $formticket = new FormTicket($db) + * $formticket->proprietes=1 ou chaine ou tableau de valeurs + * $formticket->show_form() affiche le formulaire * * @package Ticket - * \remarks Utilisation: $formticket = new FormTicket($db) - * \remarks $formticket->proprietes=1 ou chaine ou tableau de valeurs - * \remarks $formticket->show_form() affiche le formulaire */ class FormTicket { @@ -666,7 +666,7 @@ class FormTicket dol_syslog(get_class($this)."::selectCategoryTickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); - if (empty($outputlangs)) { + if (is_null($outputlangs) || !is_object($outputlangs)) { $outputlangs = $langs; } $outputlangs->load("ticket"); From 0a28bf4d30409b5d77fdcaa71b1961d4f7fd54e4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Sep 2021 11:44:16 +0200 Subject: [PATCH 203/374] Trans --- htdocs/langs/en_US/accountancy.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index fc4b86a2cdb..a2660c2c592 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -329,8 +329,8 @@ ACCOUNTING_DISABLE_BINDING_ON_PURCHASES=Disable binding & transfer in accountanc ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS=Disable binding & transfer in accountancy on expense reports (expense reports will not be taken into account in accounting) ## Export -NotifiedExportDate=Notified export date (modification of the entries will not be possible) -NotifiedValidationDate=Validation of the entries (modification or deletion of the entries will not be possible) +NotifiedExportDate=Flag exported lines as exported (modification of the lines will not be possible) +NotifiedValidationDate=Validate the exported entries (modification or deletion of the lines will not be possible) ConfirmExportFile=Confirmation of the generation of the accounting export file ? ExportDraftJournal=Export draft journal Modelcsv=Model of export From 4a43ed2852004cbca617e2cb00f0f99b8fe641a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Sep 2021 12:05:55 +0200 Subject: [PATCH 204/374] Fix scrutinizer --- htdocs/core/class/html.formactions.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 4b12b4513e5..0048031d0e7 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -221,13 +221,14 @@ class FormActions if ($typeelement == 'project') { $projectid = $object->id; } + $taskid = 0; if ($typeelement == 'task') { $taskid = $object->id; } $newcardbutton = ''; if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create)) { - $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog', 'tzuser')).'&origin='.urlencode($typeelement).'&originid='.$object->id.((!empty($object->socid) && $object->socid > 0) ? '&socid='.$object->socid : ((!empty($socid) && $socid > 0) ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').($taskid > 0 ? '&taskid='.$taskid : '').'&backtopage='.urlencode($urlbacktopage); + $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&token='.newToken().'&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog', 'tzuser')).'&origin='.urlencode($typeelement).'&originid='.((int) $object->id).((!empty($object->socid) && $object->socid > 0) ? '&socid='.((int) $object->socid) : ((!empty($socid) && $socid > 0) ? '&socid='.((int) $socid) : '')).($projectid > 0 ? '&projectid='.((int) $projectid) : '').($taskid > 0 ? '&taskid='.((int) $taskid) : '').'&backtopage='.urlencode($urlbacktopage); $newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', $url); } From d39ab4c2887669ef706464a2ef4f6f4595688af5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Sep 2021 12:14:32 +0200 Subject: [PATCH 205/374] Clean code --- htdocs/core/boxes/box_graph_invoices_permonth.php | 4 ++-- htdocs/core/boxes/box_graph_invoices_peryear.php | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index e4418020bfc..fe01eae730b 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -145,9 +145,9 @@ class box_graph_invoices_permonth extends ModeleBoxes $filenamenb = $dir."/".$prefix."invoicesnbinyear-".$endyear.".png"; // default value for customer mode - $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$endyear.'.png'; + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$endyear.'.png'; if ($mode == 'supplier') { - $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$endyear.'.png'; + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$endyear.'.png'; } $px1 = new DolGraph(); diff --git a/htdocs/core/boxes/box_graph_invoices_peryear.php b/htdocs/core/boxes/box_graph_invoices_peryear.php index 14a431bcb84..22d9ad956e7 100644 --- a/htdocs/core/boxes/box_graph_invoices_peryear.php +++ b/htdocs/core/boxes/box_graph_invoices_peryear.php @@ -129,8 +129,10 @@ class box_graph_invoices_peryear extends ModeleBoxes $filenamenb = $dir."/".$prefix."invoicesamountyears-".$endyear.".png"; // default value for customer mode - $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountyears-'.$endyear.'.png'; - if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountyears-'.$endyear.'.png'; + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountyears-'.$endyear.'.png'; + if ($mode == 'supplier') { + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountyears-'.$endyear.'.png'; + } $px2 = new DolGraph(); $mesg = $px2->isGraphKo(); From c39c823b668e8c66ce05da47acbdd113d1a97d21 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Sep 2021 13:01:04 +0200 Subject: [PATCH 206/374] Debug Date of line of services mandatory --- htdocs/core/tpl/objectline_create.tpl.php | 49 +++++++++---------- htdocs/core/tpl/objectline_edit.tpl.php | 17 ++++--- htdocs/product/card.php | 59 +++++++++++++---------- 3 files changed, 67 insertions(+), 58 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index d9ca8291066..aeac5d038f3 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -674,22 +674,21 @@ if (!empty($usemargins) && $user->rights->margins->creer) { $("#prod_entry_mode_predef").click(); -table_element_line != 'commande_fournisseurdet') { ?> - $("#date_start, #date_end").focusout(function() - { - let type = $(this).attr('type'); - let mandatoryP = $(this).attr('mandatoryperiod'); - if (type == 1 && mandatoryP == 1 ){ - if ( $(this).val() == '' && !$(this).hasClass("error") ) { - $(this).addClass('error'); + if (in_array($this->table_element_line, array('propaldet', 'commandedet', 'facturedet'))) { ?> + $("#date_start, #date_end").focusout(function() { + let type = $(this).attr('type'); + let mandatoryP = $(this).attr('mandatoryperiod'); + if (type == 1 && mandatoryP == 1) { + if ($(this).val() == '' && !$(this).hasClass('inputmandatory')) { + $(this).addClass('inputmandatory'); }else{ - $(this).removeClass('error'); + $(this).removeClass('inputmandatory'); } } }); - + /* When changing predefined product, we reload list of supplier prices required for margin combo */ $("#idprod, #idprodfournprice").change(function() { @@ -718,23 +717,23 @@ if (!empty($usemargins) && $user->rights->margins->creer) { function(data) { console.log("Load unit price end, we got value "+data.price_ht); - $( '#date_start').removeAttr( "type" ); - $( '#date_end' ).removeAttr( "type" ); - $('#date_start').attr('type', data.type); - $('#date_end').attr('type', data.type); + $('#date_start').removeAttr('type'); + $('#date_end').removeAttr('type'); + $('#date_start').attr('type', data.type); + $('#date_end').attr('type', data.type); - $( '#date_start').removeAttr( "mandatoryperiod" ); - $( '#date_end' ).removeAttr( "mandatoryperiod" ); - $('#date_start').attr('mandatoryperiod', data.mandatory_period); - $('#date_end').attr('mandatoryperiod', data.mandatory_period); + $('#date_start').removeAttr('mandatoryperiod'); + $('#date_end').removeAttr('mandatoryperiod'); + $('#date_start').attr('mandatoryperiod', data.mandatory_period); + $('#date_end').attr('mandatoryperiod', data.mandatory_period); - // service and we setted mandatory_period to true - if (data.mandatory_period == 1 && data.type == 1 ) { - jQuery("#date_start").addClass("error"); - jQuery("#date_end").addClass("error"); + // service and we setted mandatory_period to true + if (data.mandatory_period == 1 && data.type == 1) { + jQuery('#date_start').addClass('inputmandatory'); + jQuery('#date_end').addClass('inputmandatory'); }else{ - jQuery("#date_start").removeClass("error"); - jQuery("#date_end").removeClass("error"); + jQuery('#date_start').removeClass('inputmandatory'); + jQuery('#date_end').removeClass('inputmandatory'); } jQuery("#price_ht").val(data.price_ht); diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index e15c489a5b6..611d6a9cce5 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -468,16 +468,17 @@ jQuery(document).ready(function() } }); - $("#date_start, #date_end").focusout(function() - { - - if ( $(this).val() == '' && !$(this).hasClass("error") ) { - $(this).addClass('error'); - }else{ - $(this).removeClass('error'); + table_element_line, array('propaldet', 'commandedet', 'facturedet'))) { ?> + $("#date_start, #date_end").focusout(function() { + if ( $(this).val() == '' && !$(this).hasClass('inputmandatory') ) { + $(this).addClass('inputmandatory'); + } else { + $(this).removeClass('inputmandatory'); } }); - margin->enabled)) { ?> /* Add rule to clear margin when we change some data, so when we change sell or buy price, margin will be recalculated after submitting form */ diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 9e7a9b6d52d..fd9b129e30d 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -132,7 +132,9 @@ $extrafields->fetch_name_optionals_label($object->table_element); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref); - + if ($result < 0) { + dol_print_error($db, $object->error, $object->errors); + } if (!empty($conf->product->enabled)) { $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref); } elseif (!empty($conf->service->enabled)) { @@ -1290,6 +1292,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
    '; } @@ -1429,6 +1440,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $defaultva = get_default_tva($mysoc, $mysoc); print $form->load_tva("tva_tx", $defaultva, $mysoc, $mysoc, 0, 0, '', false, 1); print ''; + print '
    '.$langs->trans("Filter").'
    '.$langs->trans("ThirdParty").''; -if ($mode == 'customer') { - $filter = 's.client in (1,2,3)'; -} -if ($mode == 'supplier') { - $filter = 's.fournisseur = 1'; -} print img_picto('', 'company', 'class="pictofixedwidth"'); -print $form->selectarray('socid', $companies, $socid, 1, 0, 0, '', 0, 0, 0, '', 'widthcentpercentminusx maxwidth300', 1); +print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth300'); print '
    '.$langs->trans("Duration").''; print ''; print $formproduct->selectMeasuringUnits("duration_unit", "time", (GETPOSTISSET('duration_value') ? GETPOSTISSET('duration_value', 'alpha') : 'h'), 0, 1); + + // Mandatory period + print '       '; + print 'mandatory_period == 1 ? ' checked="checked"' : '').'>'; + print ''; + print '
    '; print '
    '; @@ -1452,14 +1464,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print $form->load_tva("tva_tx", $defaultva, $mysoc, $mysoc, 0, 0, '', false, 1); print ''; - if (!empty($conf->service->enabled)) { - if ($object->isService()) { - // Mandatory period - print ''.$langs->trans("mandatoryperiod").''; - print ' '; - print ''; - } - } print ''; print '
    '; @@ -1834,6 +1838,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans("Duration").''; print ' '; print $formproduct->selectMeasuringUnits("duration_unit", "time", $object->duration_unit, 0, 1); + + // Mandatory period + print '       '; + print 'mandatory_period == 1 ? ' checked="checked"' : '').'>'; + print ''; + print ''; } else { if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { @@ -2050,13 +2063,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans("ProductAccountancyBuyExportCode").''; print ''; print ''; - - if ($object->isService()) { - // Mandatory period - print ''.$langs->trans("mandatoryperiod").''; - print 'mandatory_period == 1 ? ' checked="checked"' : '').' /> '; - print ''; - } } } print ''; @@ -2322,21 +2328,23 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($object->isService()) { // Duration - print ''.$langs->trans("Duration").''.$object->duration_value.' '; + print ''.$langs->trans("Duration").''; + print $object->duration_value; if ($object->duration_value > 1) { $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); } elseif ($object->duration_value > 0) { $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); } - print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')." "; - - print ''; + print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? " ".$langs->trans($dur[$object->duration_unit])." " : ''); // Mandatory period - $htmltooltip = '
    '.$langs->trans("mandatoryHelper"); - print ''.$langs->trans("mandatoryperiod"); - print $form->textwithpicto('', $htmltooltip, 1, 0).''; - print 'mandatory_period == 1 ? ' checked="checked"' : '').' disabled/> '; + if ($object->duration_value > 0) { + print '       '; + } + $htmltooltip = $langs->trans("mandatoryHelper"); + print 'mandatory_period == 1 ? ' checked="checked"' : '').' disabled>'; + print $form->textwithpicto($langs->trans("mandatoryperiod"), $htmltooltip, 1, 0); + print ''; } else { if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { @@ -2566,8 +2574,9 @@ if ($action != 'create' && $action != 'edit') { print "\n
    \n"; } + /* - * All the "Add to" areas + * All the "Add to" areas if PRODUCT_ADD_FORM_ADD_TO is set */ if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action == '' || $action == 'view') && $object->status) { From b08b7d2f6895e50c5378fb27d2cd989e2c1a1032 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Sep 2021 13:20:42 +0200 Subject: [PATCH 207/374] NEW Can show progression of task into combo list of tasks --- htdocs/core/class/html.formprojet.class.php | 17 +++++++++++++---- htdocs/projet/tasks/time.php | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 9696dca7183..18b42c597bf 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -39,6 +39,8 @@ class FormProjets */ public $error = ''; + public $nboftasks; + /** * Constructor @@ -307,11 +309,11 @@ class FormProjets * @param int $disabled Disabled * @param string $morecss More css added to the select component * @param string $projectsListId ''=Automatic filter on project allowed. List of id=Filter on project ids. - * @param string $showproject 'all' = Show project info, ''=Hide project info + * @param string $showmore 'all' = Show project info, 'progress' = Show task progression, ''=Show nothing more * @param User $usertofilter User object to use for filtering * @return int Nbr of tasks if OK, <0 if KO */ - public function selectTasks($socid = -1, $selected = '', $htmlname = 'taskid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null) + public function selectTasks($socid = -1, $selected = '', $htmlname = 'taskid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showmore = 'all', $usertofilter = null) { global $user, $conf, $langs; @@ -336,7 +338,8 @@ class FormProjets } // Search all projects - $sql = 'SELECT t.rowid, t.ref as tref, t.label as tlabel, p.rowid as pid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public,'; + $sql = 'SELECT t.rowid, t.ref as tref, t.label as tlabel, t.progress,'; + $sql .= ' p.rowid as pid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, p.usage_task,'; $sql .= ' s.nom as name'; $sql .= ' FROM '.MAIN_DB_PREFIX.'projet as p'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,'; @@ -407,7 +410,7 @@ class FormProjets $disabled = 1; } - if ($showproject == 'all') { + if (preg_match('/all/', $showmore)) { $labeltoshow .= dol_trunc($obj->ref, 18); // Project ref //if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')'; //else $labeltoshow.=' ('.$langs->trans("Private").')'; @@ -442,6 +445,10 @@ class FormProjets // Label for task $labeltoshow .= $obj->tref.' '.dol_trunc($obj->tlabel, $maxlength); $titletoshow .= $obj->tref.' '.dol_trunc($obj->tlabel, $maxlength); + if ($obj->usage_task && preg_match('/progress/', $showmore)) { + $labeltoshow .= ' ('.$obj->progress.'%)'; + $titletoshow .= ' ('.$obj->progress.'%)'; + } if (!empty($selected) && $selected == $obj->rowid) { $out .= '
    '; print ''; } diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index de160a1c946..1c38ec8e6d7 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -784,7 +784,7 @@ if ($action == 'edit') { // Actions button print '
    '; - print ''.$langs->trans("Modify").''; + print ''.$langs->trans("Modify").''; if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) { if ($conf->global->MAIN_MAIL_SENDMODE != 'mail' || !$linuxlike) { diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index 436ffa3d003..360ea07defd 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -515,7 +515,7 @@ if ($action == 'edit') { print '
    '; - print ''.$langs->trans("Modify").''; + print ''.$langs->trans("Modify").''; if (!empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default') { if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'mail' || !$linuxlike) { diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index baa8c3688d8..9cabe4a8e98 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -632,7 +632,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { if ($sortorder) { $url .= '&page='.urlencode($sortorder); } - print ''.img_edit().''; + print ''.img_edit().''; //print '   '; print ''.img_delete().'   '; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined diff --git a/htdocs/admin/mails_ticket.php b/htdocs/admin/mails_ticket.php index 667f58807dc..ce4bc76c20d 100644 --- a/htdocs/admin/mails_ticket.php +++ b/htdocs/admin/mails_ticket.php @@ -479,7 +479,7 @@ if ($action == 'edit') { print '
    '; - print ''.$langs->trans("Modify").''; + print ''.$langs->trans("Modify").''; if (!empty($conf->global->MAIN_MAIL_SENDMODE_TICKET) && $conf->global->MAIN_MAIL_SENDMODE_TICKET != 'default') { if ($conf->global->MAIN_MAIL_SENDMODE_TICKET != 'mail' || !$linuxlike) { diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index d15c128d549..4dd5ceab503 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -358,7 +358,7 @@ if ($mode == 'overwrite') { print '   '; print ''; } else { - print ''.img_edit().''; + print ''.img_edit().''; print '   '; print ''.img_delete().''; } @@ -545,9 +545,9 @@ if ($mode == 'searchkey') { if ($result) { $obj = $db->fetch_object($result); } - print ''.img_edit().''; + print ''.img_edit().''; print ' '; - print ''.img_delete().''; + print ''.img_delete().''; print '  '; $htmltext = $langs->trans("OriginalValueWas", ''.$newlangfileonly->tab_translate[$key].''); print $form->textwithpicto('', $htmltext, 1, 'info'); @@ -574,9 +574,9 @@ if ($mode == 'searchkey') { if ($result) { $obj = $db->fetch_object($result); } - print ''.img_edit().''; + print ''.img_edit().''; print ' '; - print ''.img_delete().''; + print ''.img_delete().''; print '  '; $htmltext = $langs->trans("TransKeyWithoutOriginalValue", $key); diff --git a/htdocs/admin/website_options.php b/htdocs/admin/website_options.php index f72235eb8b0..f6c92888384 100644 --- a/htdocs/admin/website_options.php +++ b/htdocs/admin/website_options.php @@ -136,7 +136,7 @@ if ($action == 'edit') { print ''; print ''; } diff --git a/htdocs/admin/workstation.php b/htdocs/admin/workstation.php index 76556fb4d68..83241f2a9e2 100755 --- a/htdocs/admin/workstation.php +++ b/htdocs/admin/workstation.php @@ -214,7 +214,7 @@ if ($action == 'edit') { print ''; print ''; }/* else { print '
    '.$langs->trans("NothingToSetup"); diff --git a/htdocs/asset/admin/setup.php b/htdocs/asset/admin/setup.php index 07da0541619..a90c2b479c4 100644 --- a/htdocs/asset/admin/setup.php +++ b/htdocs/asset/admin/setup.php @@ -98,7 +98,7 @@ if ($action == 'edit') { print ''; print ''; } diff --git a/htdocs/asset/type.php b/htdocs/asset/type.php index 65175a86c5e..46f455f86d4 100644 --- a/htdocs/asset/type.php +++ b/htdocs/asset/type.php @@ -298,7 +298,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''; if ($user->rights->asset->write) { - print 'rowid.'">'.img_edit().''; + print 'rowid.'">'.img_edit().''; } else { print ' '; } @@ -503,7 +503,7 @@ if ($rowid > 0) { // Edit if ($user->rights->asset->write) { - print ''; + print ''; } // Delete diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 2c3896a6282..9ef77fb0d98 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -121,7 +121,7 @@ if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') { $coldisplay++; if (($line->info_bits & 2) == 2 || !empty($disableedit)) { } else { - print 'id.'">'.img_edit().''; + print 'id.'">'.img_edit().''; } print ''; diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 80f64210bf5..2bbb4b5f0a8 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -231,9 +231,9 @@ print "\n
    \n"; if ($action == '') { if ($user->rights->produit->creer || $user->rights->service->creer) { - print ''.$langs->trans('Add').''; + print ''.$langs->trans('Add').''; if ($cnt_trans > 0) { - print ''.$langs->trans('Update').''; + print ''.$langs->trans('Update').''; } } } diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 8a10b39826f..e56a2e89fcf 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1688,7 +1688,7 @@ if ($id > 0) { print img_picto('', 'project', 'class="paddingrightonly"'); $numprojet = $formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $object->fk_project, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth500'); if ($numprojet == 0) { - print '   '; + print '   '; } print ''; } @@ -2168,7 +2168,7 @@ if ($id > 0) { if ($action != 'edit') { if ($user->rights->agenda->allactions->create || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { - print ''; + print ''; } else { print ''; } diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index f891bf722cc..c9f422d78c8 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -406,7 +406,7 @@ if ($object->id > 0) { print $langs->trans('PaymentConditions'); print ''; if (($action != 'editconditions') && $user->rights->societe->creer) { - print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).''; } print ''; print ''; @@ -424,7 +424,7 @@ if ($object->id > 0) { print $langs->trans('PaymentMode'); print ''; if (($action != 'editmode') && $user->rights->societe->creer) { - print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; } print ''; print ''; @@ -443,7 +443,7 @@ if ($object->id > 0) { print $langs->trans('PaymentBankAccount'); print ''; if (($action != 'editbankaccount') && $user->rights->societe->creer) { - print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; } print ''; print ''; @@ -569,7 +569,7 @@ if ($object->id > 0) { print $langs->trans('SendingMethod'); print ''; if (($action != 'editshipping') && $user->rights->societe->creer) { - print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; } print ''; print ''; @@ -589,7 +589,7 @@ if ($object->id > 0) { print $langs->trans('IntracommReportTransportMode'); print ''; if (($action != 'edittransportmode') && $user->rights->societe->creer) { - print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; } print ''; print ''; @@ -652,7 +652,7 @@ if ($object->id > 0) { print $langs->trans('ProspectLevel'); print ''; if ($action != 'editlevel' && $user->rights->societe->creer) { - print 'id.'">'.img_edit($langs->trans('Modify'), 1).''; + print 'id.'">'.img_edit($langs->trans('Modify'), 1).''; } print ''; print ''; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index b5f05e72795..cff5c5d0e35 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2093,7 +2093,7 @@ if ($action == 'create') { print $langs->trans('DatePropal'); print ''; if ($action != 'editdate' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { - print 'id.'">'.img_edit($langs->trans('SetDate'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetDate'), 1).''; } print ''; print ''; @@ -2120,7 +2120,7 @@ if ($action == 'create') { print $langs->trans('DateEndPropal'); print ''; if ($action != 'editecheance' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { - print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).''; } print ''; print ''; @@ -2150,7 +2150,7 @@ if ($action == 'create') { print $langs->trans('PaymentConditionsShort'); print ''; if ($action != 'editconditions' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).''; + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).''; } print ''; print ''; @@ -2169,7 +2169,7 @@ if ($action == 'create') { print $langs->trans('PaymentMode'); print ''; if ($action != 'editmode' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).''; + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).''; } print ''; print ''; @@ -2198,7 +2198,7 @@ if ($action == 'create') { } print ''; if ($action != 'editavailability' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1).''; + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1).''; } print ''; print ''; @@ -2218,7 +2218,7 @@ if ($action == 'create') { print $langs->trans('SendingMethod'); print ''; if ($action != 'editshippingmethod' && $usercancreate) { - print 'id.'">'.img_edit($langs->trans('SetShippingMode'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetShippingMode'), 1).''; } print ''; print ''; @@ -2255,7 +2255,7 @@ if ($action == 'create') { print $langs->trans('Source'); print ''; if ($action != 'editdemandreason' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1).''; + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1).''; } print ''; print ''; @@ -2276,7 +2276,7 @@ if ($action == 'create') { print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print ''; if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_DRAFT && $usercancreate) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; } print ''; print ''; @@ -2296,7 +2296,7 @@ if ($action == 'create') { print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print ''; if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $usercancreate) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; } print ''; print ''; @@ -2337,7 +2337,7 @@ if ($action == 'create') { print $langs->trans('BankAccount'); print ''; if ($action != 'editbankaccount' && $usercancreate) { - print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; } print ''; print ''; @@ -2373,7 +2373,7 @@ if ($action == 'create') { print $langs->trans('IncotermLabel'); print ''; if ($usercancreate) { - print ''.img_edit().''; + print ''.img_edit().''; } else { print ' '; } diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 97184c1b8eb..af0b388cb7a 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -364,7 +364,7 @@ if (empty($numref)) { print ''; if ($user->rights->banque->consolidate && $action != 'editbankreceipt') { - print 'numr.'">'.img_edit().''; + print 'numr).'">'.img_edit().''; } print ''; diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index 77db777c077..33b453cd0b4 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -469,7 +469,7 @@ if ($action == 'create') { if ($object->statut < Deplacement::STATUS_REFUNDED) { // if not refunded if ($user->rights->deplacement->creer) { - print ''.$langs->trans('Modify').''; + print ''.$langs->trans('Modify').''; } else { print ''.$langs->trans('Modify').''; } diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 153bd58114d..28143d0340a 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -1269,7 +1269,7 @@ if ($action == 'create') { print $langs->trans('PaymentConditionsShort'); print ''; if ($action != 'editconditions' && $user->rights->facture->creer) { - print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).''; } print ''; print ''; @@ -1290,7 +1290,7 @@ if ($action == 'create') { print $langs->trans('PaymentMode'); print ''; if ($action != 'editmode' && $user->rights->facture->creer) { - print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; } print ''; print ''; @@ -1310,7 +1310,7 @@ if ($action == 'create') { print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print ''; if ($usercancreate && $action != 'editmulticurrencycode' && !empty($object->brouillon)) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; } print ''; print ''; @@ -1326,7 +1326,7 @@ if ($action == 'create') { print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print ''; if ($usercancreate && $action != 'editmulticurrencyrate' && !empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; } print ''; print ''; @@ -1398,7 +1398,7 @@ if ($action == 'create') { print $langs->trans('BankAccount'); print ''; if (($action != 'editbankaccount') && $user->rights->facture->creer && $object->statut == FactureRec::STATUS_DRAFT) { - print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; } print ''; print ''; @@ -1416,7 +1416,7 @@ if ($action == 'create') { print $langs->trans('Model'); print ''; if (($action != 'editmodelpdf') && $user->rights->facture->creer && $object->statut == FactureRec::STATUS_DRAFT) { - print 'id.'">'.img_edit($langs->trans('SetModel'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetModel'), 1).''; } print ''; print ''; @@ -1463,7 +1463,7 @@ if ($action == 'create') { print $langs->trans('Frequency'); print ''; if ($action != 'editfrequency' && $user->rights->facture->creer) { - print 'id.'">'.img_edit($langs->trans('Edit'), 1).''; + print 'id.'">'.img_edit($langs->trans('Edit'), 1).''; } print ''; print ''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 7ddb90cd4da..764af7a232a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4336,7 +4336,7 @@ if ($action == 'create') { print $langs->trans('DateInvoice'); print ''; if ($action != 'editinvoicedate' && !empty($object->brouillon) && $usercancreate && empty($conf->global->FAC_FORCE_DATE_VALIDATION)) { - print 'id.'">'.img_edit($langs->trans('SetDate'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetDate'), 1).''; } print ''; print ''; @@ -4356,7 +4356,7 @@ if ($action == 'create') { print ''; - print ''; + print ''; print '
    '; print $langs->trans('DatePointOfTax'); print 'id.'">'.img_edit($langs->trans('SetDate'), 1).'id.'">'.img_edit($langs->trans('SetDate'), 1).'
    '; print ''; if ($action == 'editdate_pointoftax') { @@ -4373,7 +4373,7 @@ if ($action == 'create') { print $langs->trans('PaymentConditionsShort'); print ''; if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && $usercancreate) { - print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).''; } print ''; print ''; @@ -4394,7 +4394,7 @@ if ($action == 'create') { print $langs->trans('DateMaxPayment'); print ''; if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && $usercancreate) { - print 'id.'">'.img_edit($langs->trans('SetDate'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetDate'), 1).''; } print ''; print ''; @@ -4418,7 +4418,7 @@ if ($action == 'create') { print $langs->trans('PaymentMode'); print ''; if ($action != 'editmode' && $usercancreate) { - print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; } print ''; print ''; @@ -4438,7 +4438,7 @@ if ($action == 'create') { print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print ''; if ($usercancreate && $action != 'editmulticurrencycode' && !empty($object->brouillon)) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; } print ''; print ''; @@ -4454,7 +4454,7 @@ if ($action == 'create') { print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print ''; if ($usercancreate && $action != 'editmulticurrencyrate' && !empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; } print ''; print ''; @@ -4482,7 +4482,7 @@ if ($action == 'create') { print $langs->trans('BankAccount'); print ''; if (($action != 'editbankaccount') && $usercancreate) { - print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; } print ''; print ''; @@ -4502,7 +4502,7 @@ if ($action == 'create') { print $langs->trans('IncotermLabel'); print ''; if ($usercancreate) { - print ''.img_edit().''; + print ''.img_edit().''; } else { print ' '; } @@ -4532,7 +4532,7 @@ if ($action == 'create') { print $langs->trans('RetainedWarranty'); print ''; if ($action != 'editretainedwarranty' && $user->rights->facture->creer) { - print 'id.'">'.img_edit($langs->trans('setretainedwarranty'), 1).''; + print 'id.'">'.img_edit($langs->trans('setretainedwarranty'), 1).''; } print ''; @@ -4555,7 +4555,7 @@ if ($action == 'create') { print $langs->trans('PaymentConditionsShortRetainedWarranty'); print ''; if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer) { - print 'id.'">'.img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1).''; + print 'id.'">'.img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1).''; } print ''; @@ -4590,7 +4590,7 @@ if ($action == 'create') { print $langs->trans('RetainedWarrantyDateLimit'); print ''; if ($action != 'editretainedwarrantydatelimit' && $user->rights->facture->creer) { - print 'id.'">'.img_edit($langs->trans('setretainedwarrantyDateLimit'), 1).''; + print 'id.'">'.img_edit($langs->trans('setretainedwarrantyDateLimit'), 1).''; } print ''; @@ -4676,7 +4676,7 @@ if ($action == 'create') { print $langs->trans('RevenueStamp'); print ''; if ($action != 'editrevenuestamp' && !empty($object->brouillon) && $usercancreate) { - print 'id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).''; } print ''; print ''; diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index e94fd6f5e1b..7e5a7047060 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -363,7 +363,7 @@ if ($object->id > 0) { print $langs->trans('DateInvoice'); print ''; if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->rights->facture->creer) { - print 'id.'">'.img_edit($langs->trans('SetDate'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetDate'), 1).''; } print ''; print ''; @@ -386,7 +386,7 @@ if ($object->id > 0) { print $langs->trans('PaymentConditionsShort'); print ''; if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) { - print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).''; } print ''; print ''; @@ -407,7 +407,7 @@ if ($object->id > 0) { print $langs->trans('DateMaxPayment'); print ''; if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) { - print 'id.'">'.img_edit($langs->trans('SetDate'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetDate'), 1).''; } print ''; print ''; @@ -436,7 +436,7 @@ if ($object->id > 0) { print $langs->trans('PaymentMode'); print ''; if ($action != 'editmode' && !empty($object->brouillon) && $user->rights->facture->creer) { - print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; } print ''; print ''; @@ -453,7 +453,7 @@ if ($object->id > 0) { print $langs->trans('BankAccount'); print ''; if (($action != 'editbankaccount') && $user->rights->commande->creer && !empty($object->brouillon)) { - print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; } print ''; print ''; @@ -537,7 +537,7 @@ if ($object->id > 0) { print $langs->trans('RevenueStamp'); print ''; if ($action != 'editrevenuestamp' && !empty($object->brouillon) && $user->rights->facture->creer) { - print 'id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).''; } print ''; print ''; diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 61d295a29b0..9b235926421 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -529,7 +529,7 @@ if ($action == 'new') { print $langs->trans('Date'); print ''; if ($action != 'editdate') { - print 'id.'">'.img_edit($langs->trans('SetDate'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetDate'), 1).''; } print ''; print ''; @@ -554,7 +554,7 @@ if ($action == 'new') { print ''; - if ($action != 'editrefext') print ''; + if ($action != 'editrefext') print ''; print '
    '; print $langs->trans('RefExt'); print 'id.'">'.img_edit($langs->trans('SetRefExt'),1).'id.'">'.img_edit($langs->trans('SetRefExt'),1).'
    '; print ''; if ($action == 'editrefext') diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index f436c47b10e..1223ad3ec36 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -577,7 +577,7 @@ if ($id > 0) { print $langs->trans('DefaultPaymentMode'); print ''; if ($action != 'editmode') { - print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; } print ''; print ''; @@ -595,7 +595,7 @@ if ($id > 0) { print $langs->trans('DefaultBankAccount'); print ''; if ($action != 'editbankaccount' && $user->rights->tax->charges->creer) { - print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; } print ''; print ''; diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 363af314113..83740385f2b 100755 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -573,7 +573,7 @@ if ($id) { print $langs->trans('PaymentMode'); print ''; if ($action != 'editmode') { - print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; } print ''; print ''; @@ -591,7 +591,7 @@ if ($id) { print $langs->trans('BankAccount'); print ''; if ($action != 'editbankaccount' && $user->rights->tax->charges->creer) { - print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; } print ''; print ''; diff --git a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php index e458cdf3016..adf5bb722d3 100644 --- a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php +++ b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php @@ -139,11 +139,11 @@ if (!empty($this->control->tpl['action_delete'])) { if (empty($user->socid)) { print '
    '; if ($user->rights->societe->contact->creer) { - print ''.$langs->trans('Modify').''; + print ''.$langs->trans('Modify').''; } if (!$this->control->tpl['user_id'] && $user->rights->user->user->creer) { - print ''.$langs->trans("CreateDolibarrLogin").''; + print ''.$langs->trans("CreateDolibarrLogin").''; } if ($user->rights->societe->contact->supprimer) { diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 44ace66f05b..8ae2deae1cf 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1348,7 +1348,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print $langs->trans('ProspectLevel'); print ''; if ($action != 'editlevel' && $user->rights->societe->contact->creer) { - print 'id.'">'.img_edit($langs->trans('Modify'), 1).''; + print 'id.'">'.img_edit($langs->trans('Modify'), 1).''; } print ''; print ''; @@ -1486,11 +1486,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } if ($user->rights->societe->contact->creer) { - print ''.$langs->trans('Modify').''; + print ''.$langs->trans('Modify').''; } if (!$object->user_id && $user->rights->user->user->creer) { - print ''.$langs->trans("CreateDolibarrLogin").''; + print ''.$langs->trans("CreateDolibarrLogin").''; } // Activer diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index a5b64e37998..285f71cae48 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -311,7 +311,7 @@ if ($action != 'edit') { print '
    '; if ($user->rights->societe->contact->creer) { - print ''.$langs->trans('Modify').''; + print ''.$langs->trans('Modify').''; } print "
    "; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index bf9208ccb2b..9d8cdb78912 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1541,12 +1541,12 @@ if ($action == 'create') { print ''; if ($user->rights->contrat->creer && count($arrayothercontracts) && ($object->statut >= 0)) { print ''; - print ''; + print ''; print img_picto($langs->trans("MoveToAnotherContract"), 'uparrow'); print ''; } if ($user->rights->contrat->creer && ($object->statut >= 0)) { - print ''; + print ''; print img_edit(); print ''; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 01bd1a13141..8deda2ecd09 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -165,7 +165,7 @@ class Form $ret .= ''; } if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { - $ret .= 'id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).''; + $ret .= 'id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).''; } if (!empty($notabletag) && $notabletag == 1) { $ret .= ' : '; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index ca7e939fb6f..975738b3809 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1454,7 +1454,7 @@ class FormFile if ($permtoeditline) { $paramsectiondir = (in_array($modulepart, array('medias', 'ecm')) ? '§ion_dir='.urlencode($relativepath) : ''); - print ''.img_edit('default', 0, 'class="paddingrightonly"').''; + print ''.img_edit('default', 0, 'class="paddingrightonly"').''; } } if ($permonobject) { diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 1d8024cf40e..0adcb967991 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1295,7 +1295,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') // Edit if ($user->rights->societe->contact->creer) { - print ''; + print ''; print img_edit(); print ''; } @@ -2003,7 +2003,7 @@ function show_subsidiaries($conf, $langs, $db, $object) print ''.$obj->code_client.''; print ''; - print ''; + print ''; print img_edit(); print ''; diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index ba18e415539..e2067240c45 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -699,7 +699,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no if ($user->rights->agenda->allactions->create || (($actionstatic->authorid == $user->id || $actionstatic->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { - $out .= ''; + $out .= ''; } $out .= ''; diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index fda21e28a21..05e6d51a78d 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -190,7 +190,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset print "\n".'
  • '; if ($showfk) { print ''; + print ''; } print '
    '; - print '   '; + print '   '; print $tab[$x]['title']; print ''; print '  (mainmenu='.$tab[$x]['mainmenu'].' leftmenu='.$tab[$x]['leftmenu'].' - fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].')'; diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 29f208e5254..7a9bb12172b 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -400,7 +400,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if (!file_exists($file)) { $url = DOL_URL_ROOT.'/public/theme/common/nophoto.png'; } - print ''; + print ''; if ($subdir == $conf->global->MAIN_THEME) { $title = $langs->trans("ThemeCurrentlyActive"); } else { diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index f50276821b1..cd58ae554f2 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -208,7 +208,7 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l $fieldid = 'socid'; } - print ''.img_edit().''.img_edit().'
    '; print ''; diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 8ebb767a4d8..6a7d48add5e 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -384,7 +384,7 @@ if ($this->statut == 0 && !empty($object_rights->creer) && $action != 'selectlin $coldisplay++; if (($line->info_bits & 2) == 2 || !empty($disableedit)) { } else { ?> - id.'#line_'.$line->id; ?>"> + id.'#line_'.$line->id; ?>"> '; } print ''; @@ -392,7 +392,7 @@ if ($this->statut == 0 && !empty($object_rights->creer) && $action != 'selectlin print ''; $coldisplay++; if (!$situationinvoicelinewithparent && empty($disableremove)) { // For situation invoice, deletion is not possible if there is a parent company. - print 'id.'">'; + print 'id.'">'; print img_delete(); print ''; } @@ -402,12 +402,12 @@ if ($this->statut == 0 && !empty($object_rights->creer) && $action != 'selectlin print ''; $coldisplay++; if ($i > 0) { ?> - id; ?>"> + id; ?>"> - id; ?>"> + id; ?>"> rights->cron->create) { print ''.$langs->trans("Edit").''; } else { - print ''.$langs->trans("Edit").''; + print ''.$langs->trans("Edit").''; } if ((empty($user->rights->cron->execute))) { @@ -753,7 +753,7 @@ if (($action == "create") || ($action == "edit")) { } elseif (empty($object->status)) { print ''.$langs->trans("CronExecute").''; } else { - print ''.$langs->trans("CronExecute").''; + print ''.$langs->trans("CronExecute").''; } if (!$user->rights->cron->create) { diff --git a/htdocs/datapolicy/admin/setup.php b/htdocs/datapolicy/admin/setup.php index dde8644571e..8f25461eb64 100644 --- a/htdocs/datapolicy/admin/setup.php +++ b/htdocs/datapolicy/admin/setup.php @@ -175,7 +175,7 @@ if ($action == 'edit') { print ''; print ''; } diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index c72718ffce2..cca399f43af 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -427,7 +427,7 @@ if ($action == 'create') { // Create. Seems to no be used print ''; if ($action != 'editdate_delivery') { - print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).''; } print ''; print ''; @@ -451,7 +451,7 @@ if ($action == 'create') { // Create. Seems to no be used print $langs->trans('IncotermLabel'); print ''; if ($user->rights->expedition->delivery->creer) { - print ''.img_edit().''; + print ''.img_edit().''; } else { print ' '; } diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 528a640b391..8ff0fa62e6c 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -855,7 +855,7 @@ if (!empty($id) && $action != 'edit') { print ''.$langs->trans("ReOpen").''; } - print ''; + print ''; if ($object->statut == $object::STATUS_DRAFT) { print ''; @@ -870,7 +870,7 @@ if (!empty($id) && $action != 'edit') { if ($remaintopay == 0) { print '
    '.$langs->trans('DoPayment').'
    '; } else { - print ''; + print ''; } } diff --git a/htdocs/ecm/dir_card.php b/htdocs/ecm/dir_card.php index b6aa59720ae..0b42fc17a02 100644 --- a/htdocs/ecm/dir_card.php +++ b/htdocs/ecm/dir_card.php @@ -454,11 +454,11 @@ if ($action != 'edit' && $action != 'delete') { print '
    '; if ($permtoadd) { - print ''.$langs->trans('Edit').''; + print ''.$langs->trans('Edit').''; } if ($permtoadd) { - print ''.$langs->trans('ECMAddSection').''; + print ''.$langs->trans('ECMAddSection').''; } else { print ''.$langs->trans('ECMAddSection').''; } diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 1ec8d21447e..03e309aa41d 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -651,9 +651,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=presend&mode=init#formmailbeforetitle'); + print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); } - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=edit', '', $permissiontoadd); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=edit&token='.newToken().'', '', $permissiontoadd); // Clone print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken().'&object=scrumsprint', '', $permissiontoadd); diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index c36442915e6..7b609391ee2 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1760,7 +1760,7 @@ if ($action == 'create') { print ''; if ($action != 'editdate_livraison') { - print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).''; } print ''; print ''; @@ -1892,7 +1892,7 @@ if ($action == 'create') { print ''; if ($action != 'editshipping_method_id') { - print 'id.'">'.img_edit($langs->trans('SetSendingMethod'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetSendingMethod'), 1).''; } print ''; print ''; @@ -1929,7 +1929,7 @@ if ($action == 'create') { print $langs->trans('IncotermLabel'); print ''; if ($user->rights->expedition->creer) { - print ''.img_edit().''; + print ''.img_edit().''; } else { print ' '; } diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index f543b8baee4..a6ab016ef7b 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -370,7 +370,7 @@ if ($id > 0 || !empty($ref)) { print ''; if ($action != 'editdate_livraison') { - print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).''; } print ''; print ''; @@ -400,7 +400,7 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('SendingMethod'); print ''; if ($action != 'editshippingmethod' && $user->rights->expedition->creer) { - print 'id.'">'.img_edit($langs->trans('SetShippingMode'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetShippingMode'), 1).''; } print ''; print ''; @@ -421,7 +421,7 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Warehouse'); print ''; if ($action != 'editwarehouse' && $user->rights->commande->creer) { - print 'id.'">'.img_edit($langs->trans('SetWarehouse'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetWarehouse'), 1).''; } print ''; print ''; @@ -441,7 +441,7 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('PaymentConditionsShort'); print ''; - if ($action != 'editconditions' && $object->statut == Expedition::STATUS_VALIDATED) print 'id.'">'.img_edit($langs->trans('SetConditions'),1).''; + if ($action != 'editconditions' && $object->statut == Expedition::STATUS_VALIDATED) print 'id.'">'.img_edit($langs->trans('SetConditions'),1).''; print ''; print ''; if ($action == 'editconditions') @@ -459,7 +459,7 @@ if ($id > 0 || !empty($ref)) { print ''; - if ($action != 'editmode' && $object->statut == Expedition::STATUS_VALIDATED) print ''; + if ($action != 'editmode' && $object->statut == Expedition::STATUS_VALIDATED) print ''; print '
    '; print $langs->trans('PaymentMode'); print 'id.'">'.img_edit($langs->trans('SetMode'),1).'id.'">'.img_edit($langs->trans('SetMode'),1).'
    '; print ''; if ($action == 'editmode') @@ -478,7 +478,7 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('AvailabilityPeriod'); print ''; if ($action != 'editavailability') { - print 'id.'">'.img_edit($langs->trans('SetAvailability'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetAvailability'), 1).''; } print ''; print ''; @@ -495,7 +495,7 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Source'); print ''; if ($action != 'editdemandreason') { - print 'id.'">'.img_edit($langs->trans('SetDemandReason'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetDemandReason'), 1).''; } print ''; print ''; @@ -528,7 +528,7 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('IncotermLabel'); print ''; if ($user->rights->commande->creer) { - print ''.img_edit().''; + print ''.img_edit().''; } else { print ' '; } diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 7aa08d30c39..f982b046793 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2554,11 +2554,11 @@ if ($action != 'create' && $action != 'edit') { if ($user->rights->expensereport->creer && $object->status == ExpenseReport::STATUS_DRAFT) { if (in_array($object->fk_user_author, $user->getAllChildIds(1)) || !empty($user->rights->expensereport->writeall_advance)) { // Modify - print ''; + print ''; // Validate if (count($object->lines) > 0) { - print ''; + print ''; } } } @@ -2571,12 +2571,12 @@ if ($action != 'create' && $action != 'edit') { if ($user->rights->expensereport->creer && $object->status == ExpenseReport::STATUS_REFUSED) { if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) { // Modify - print ''; + print ''; // setdraft (le statut refusée est identique à brouillon) //print ''.$langs->trans('ReOpen').''; // Enregistrer depuis le statut "Refusée" - print ''; + print ''; } } diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index 44eb3734378..d74e0a5c5e8 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -587,7 +587,7 @@ if ($action == 'create') { print $langs->trans('Frequency'); print ''; if ($action != 'editfrequency' && $user->rights->ficheinter->creer) { - print ''; + print ''; print img_edit($langs->trans('Edit'), 1).''; } print ''; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 31f42c9b0fa..6613ea0ed9d 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1350,21 +1350,21 @@ if ($action == 'create') { // Icon to edit and delete if ($object->statut == 0 && $user->rights->ficheinter->creer) { print ''; - print 'rowid.'#'.$objp->rowid.'">'; + print 'rowid.'#'.$objp->rowid.'">'; print img_edit(); print ''; - print 'rowid.'">'; + print 'rowid.'">'; print img_delete(); print ''; print ''; if ($num > 1) { if ($i > 0) { - print 'rowid.'">'; + print 'rowid.'">'; print img_up(); print ''; } if ($i < $num - 1) { - print 'rowid.'">'; + print 'rowid.'">'; print img_down(); print ''; } diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 12b7b09cf53..9cfb2fe475f 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -261,7 +261,7 @@ if ($object->id > 0) { print $langs->trans('PaymentConditions'); print ''; if (($action != 'editconditions') && $user->rights->societe->creer) { - print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).''; } print ''; print ''; @@ -279,7 +279,7 @@ if ($object->id > 0) { print $langs->trans('PaymentMode'); print ''; if (($action != 'editmode') && $user->rights->societe->creer) { - print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; } print ''; print ''; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index e579c07ac14..ae6c271fec8 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1975,7 +1975,7 @@ if ($action == 'create') { } if (empty($conf->global->MAIN_CAN_EDIT_SUPPLIER_ON_SUPPLIER_ORDER) || $action != 'edit_thirdparty') { if (!empty($conf->global->MAIN_CAN_EDIT_SUPPLIER_ON_SUPPLIER_ORDER) && $object->statut == CommandeFournisseur::STATUS_DRAFT) { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty')).''; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty')).''; } $morehtmlref .= ' : '.$object->thirdparty->getNomUrl(1, 'supplier'); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { @@ -2075,7 +2075,7 @@ if ($action == 'create') { print $langs->trans('PaymentConditions'); print ''; if ($action != 'editconditions') { - print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).''; } print ''; print ''; @@ -2094,7 +2094,7 @@ if ($action == 'create') { print $langs->trans('PaymentMode'); print ''; if ($action != 'editmode') { - print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; } print ''; print ''; @@ -2114,7 +2114,7 @@ if ($action == 'create') { print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print ''; if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_DRAFT) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; } print ''; print ''; @@ -2134,7 +2134,7 @@ if ($action == 'create') { print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print ''; if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; } print ''; print ''; @@ -2162,7 +2162,7 @@ if ($action == 'create') { print $langs->trans('BankAccount'); print ''; if ($action != 'editbankaccount' && $usercancreate) { - print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; } print ''; print ''; @@ -2187,7 +2187,7 @@ if ($action == 'create') { print $langs->trans('DateDeliveryPlanned'); print ''; if ($action != 'editdate_livraison') { - print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).''; } print ''; print ''; @@ -2221,7 +2221,7 @@ if ($action == 'create') { print $langs->trans('IncotermLabel'); print ''; if ($usercancreate) { - print ''.img_edit().''; + print ''.img_edit().''; } else { print ' '; } diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index afd99951aa4..16d4b1f25f3 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -1294,13 +1294,13 @@ if ($id > 0 || !empty($ref)) { if ($action != 'editline' || $lineid != $objp->dispatchlineid) { if (empty($reception->id) || ($reception->statut == Reception::STATUS_DRAFT)) { // only allow edit on draft reception print ''; - print 'dispatchlineid.'#line_'.$objp->dispatchlineid.'">'; + print 'dispatchlineid.'#line_'.$objp->dispatchlineid.'">'; print img_edit(); print ''; print ''; print ''; - print 'dispatchlineid.'#dispatch_received_products">'; + print 'dispatchlineid.'#dispatch_received_products">'; print img_delete(); print ''; print ''; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 762436a3a0e..21d6e73eb39 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2779,7 +2779,7 @@ if ($action == 'create') { print $langs->trans('PaymentConditions'); print ''; if ($action != 'editconditions' && $form_permission) { - print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).''; } print ''; print ''; @@ -2808,7 +2808,7 @@ if ($action == 'create') { print $langs->trans('PaymentMode'); print ''; if ($action != 'editmode' && $form_permission2) { - print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; } print ''; print ''; @@ -2828,7 +2828,7 @@ if ($action == 'create') { print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print ''; if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_DRAFT) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; } print ''; print ''; @@ -2847,7 +2847,7 @@ if ($action == 'create') { print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print ''; if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; } print ''; print ''; @@ -2875,7 +2875,7 @@ if ($action == 'create') { print $langs->trans('BankAccount'); print ''; if ($action != 'editbankaccount' && $usercancreate) { - print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; } print ''; print ''; @@ -2895,7 +2895,7 @@ if ($action == 'create') { print $langs->trans('IncotermLabel'); print ''; if ($usercancreate) { - print ''.img_edit().''; + print ''.img_edit().''; } else { print ' '; } @@ -2918,7 +2918,7 @@ if ($action == 'create') { print $langs->trans('IntracommReportTransportMode'); print ''; if ($action != 'editmode' && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) { - print 'id.'">'.img_edit().''; + print 'id.'">'.img_edit().''; } print ''; print ''; @@ -3406,7 +3406,7 @@ if ($action == 'create') { $ventilExportCompta = $object->getVentilExportCompta(); // Should be 0 since the sum of payments are zero. But we keep the protection. if ($ventilExportCompta == 0) { - print ''.$langs->trans('Modify').''; + print ''.$langs->trans('Modify').''; } else { print ''.$langs->trans('Modify').''; } diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 65c3521bf20..9948b64e460 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -338,25 +338,25 @@ if (empty($reshook)) { // If no start date if (empty($_POST['date_debut_'])) { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=nodatedebut'); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'&error=nodatedebut'); exit; } // If no end date if (empty($_POST['date_fin_'])) { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=nodatefin'); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'&error=nodatefin'); exit; } // If start date after end date if ($date_debut > $date_fin) { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=datefin'); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'&error=datefin'); exit; } // If no validator designated if ($approverid < 1) { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=Valideur'); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'&error=Valideur'); exit; } @@ -1339,7 +1339,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { } $include_users = $object->fetch_users_approver_holiday(); if (is_array($include_users) && in_array($user->id, $include_users) && $object->statut == Holiday::STATUS_VALIDATED) { - print ''.img_edit($langs->trans("Edit")).''; + print ''.img_edit($langs->trans("Edit")).''; } print ''; print ''; @@ -1451,11 +1451,11 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { print '
    '; if ($cancreate && $object->statut == Holiday::STATUS_DRAFT) { - print ''.$langs->trans("EditCP").''; + print ''.$langs->trans("EditCP").''; } if ($cancreate && $object->statut == Holiday::STATUS_DRAFT) { // If draft - print ''.$langs->trans("Validate").''; + print ''.$langs->trans("Validate").''; } if ($object->statut == Holiday::STATUS_VALIDATED) { // If validated diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php index 9daf1d768b8..0ce7d793003 100644 --- a/htdocs/hrm/establishment/card.php +++ b/htdocs/hrm/establishment/card.php @@ -419,7 +419,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea * Action bar */ print ''; } diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 68bcd78636b..ec7ba9b74e3 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -96,7 +96,7 @@ print load_fiche_titre($langs->trans("HRMArea"), '', 'hrm'); if (!empty($setupcompanynotcomplete)) { $langs->load("errors"); $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete")); - print '
    '; + print '
    '; llxFooter(); exit; diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index 99aaabe7744..8af0431f361 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -404,12 +404,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes', '', $permissiontoadd); } if (($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) && $permissiontovalidate) { - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit', '', $permissiontoadd); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); } // Validate if ($object->status == $object::STATUS_DRAFT) { if ((empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) && $permissiontovalidate) { - print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', $permissiontoadd); + print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&token='.newToken().'&confirm=yes', '', $permissiontoadd); } else { $langs->load("errors"); //print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', 0); @@ -418,7 +418,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // Clone - print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=scrumsprint', '', $permissiontoadd); + print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken().'&object=scrumsprint', '', $permissiontoadd); /* if ($permissiontoadd) { diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index df24e022d90..a15f6c926a6 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -717,12 +717,12 @@ if ($id > 0) { // Edit if (($object->paid == 0 || $object->paid == 2) && $user->rights->loan->write) { - print ''; + print ''; } // Emit payment if (($object->paid == 0 || $object->paid == 2) && ((price2num($object->capital) > 0 && round($staytopay) < 0) || (price2num($object->capital) > 0 && round($staytopay) > 0)) && $user->rights->loan->write) { - print ''; + print ''; } // Classify 'paid' diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index db8bc85816e..4a3f9fd6e25 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1999,15 +1999,15 @@ if ($module == 'initmodule') { print ''; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; print ''; print ' '.$langs->trans("ReadmeFile").' : '.$pathtofilereadme.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; print ''; print ' '.$langs->trans("ChangeLog").' : '.$pathtochangelog.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; print ''; print ''; @@ -2177,8 +2177,8 @@ if ($module == 'initmodule') { $pathtofile = 'langs/'.$langfile['relativename']; } print ' '.$langs->trans("LanguageFile").' '.basename(dirname($pathtofile)).' : '.$pathtofile.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; print ''; } print ''; @@ -2226,7 +2226,7 @@ if ($module == 'initmodule') { print '
    '; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; if (is_array($dicts) && !empty($dicts)) { print ' '.$langs->trans("LanguageFile").' : '; @@ -2502,13 +2502,13 @@ if ($module == 'initmodule') { print '
    '; print ' '.$langs->trans("ClassFile").' : '.($realpathtoclass ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoclass).($realpathtoclass ? '' : '').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print ' '.$langs->trans("ApiClassFile").' : '.($realpathtoapi ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoapi).($realpathtoapi ? '' : '').''; if (dol_is_file($realpathtoapi)) { - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print ' '; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; print '   '; if (empty($conf->global->$const_name)) { // If module is not activated print ''.$langs->trans("GoToApiExplorer").''; @@ -2517,99 +2517,99 @@ if ($module == 'initmodule') { } } else { //print ''.$langs->trans("FileNotYetGenerated").' '; - print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; + print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; } // PHPUnit print '
    '; print ' '.$langs->trans("TestClassFile").' : '.($realpathtophpunit ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtophpunit).($realpathtophpunit ? '' : '').''; if (dol_is_file($realpathtophpunit)) { - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print ' '; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; } else { //print ''.$langs->trans("FileNotYetGenerated").' '; - print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; + print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; } print '
    '; print '
    '; print ' '.$langs->trans("PageForLib").' : '.($realpathtolib ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtolib).($realpathtolib ? '' : '').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print ' '.$langs->trans("PageForObjLib").' : '.($realpathtoobjlib ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoobjlib).($realpathtoobjlib ? '' : '').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print ' '.$langs->trans("Image").' : '.($realpathtopicto ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtopicto).($realpathtopicto ? '' : '').''; - //print ' '.img_picto($langs->trans("Edit"), 'edit').''; + //print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print '
    '; print ' '.$langs->trans("SqlFile").' : '.($realpathtosql ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosql).($realpathtosql ? '' : '').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '   '.$langs->trans("DropTableIfEmpty").''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '   '.$langs->trans("DropTableIfEmpty").''; //print '   '.$langs->trans("RunSql").''; print '
    '; print ' '.$langs->trans("SqlFileKey").' : '.($realpathtosqlkey ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlkey).($realpathtosqlkey ? '' : '').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; //print '   '.$langs->trans("RunSql").''; print '
    '; print ' '.$langs->trans("SqlFileExtraFields").' : '.($realpathtosqlextra ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlextra).($realpathtosqlextra ? '' : '').''; if (dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey)) { - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print ' '; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; print '   '; - print ''.$langs->trans("DropTableIfEmpty").''; + print ''.$langs->trans("DropTableIfEmpty").''; } else { - print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; + print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; } //print '   '.$langs->trans("RunSql").''; print '
    '; print ' '.$langs->trans("SqlFileKeyExtraFields").' : '.($realpathtosqlextrakey ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlextrakey).($realpathtosqlextrakey ? '' : '').''; if (dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey)) { - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print ' '; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; } else { - print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; + print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; } print '
    '; print '
    '; print '
    '; print ' '.$langs->trans("PageForList").' : '.($realpathtolist ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtolist).($realpathtolist ? '' : '').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print ' '.$langs->trans("PageForCreateEditView").' : '.($realpathtocard ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtocard).($realpathtocard ? '' : '').'?action=create'; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print ' '.$langs->trans("PageForContactTab").' : '.($realpathtocontact ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtocontact).($realpathtocontact ? '' : '').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; if (dol_is_file($realpathtocontact)) { print ' '; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; } print '
    '; print ' '.$langs->trans("PageForDocumentTab").' : '.($realpathtodocument ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtodocument).($realpathtodocument ? '' : '').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; if (dol_is_file($realpathtodocument)) { print ' '; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; } print '
    '; print ' '.$langs->trans("PageForNoteTab").' : '.($realpathtonote ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtonote).($realpathtonote ? '' : '').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; if (dol_is_file($realpathtonote)) { print ' '; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; } print '
    '; print ' '.$langs->trans("PageForAgendaTab").' : '.($realpathtoagenda ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoagenda).($realpathtoagenda ? '' : '').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; if (dol_is_file($realpathtoagenda)) { print ' '; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; } print '
    '; print '
    '; @@ -2928,7 +2928,7 @@ if ($module == 'initmodule') { $format = 'markdown'; } print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; } } else { @@ -3020,7 +3020,7 @@ if ($module == 'initmodule') { print '
    '; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print '
    '; @@ -3153,7 +3153,7 @@ if ($module == 'initmodule') { print '
    '; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print '
    '; @@ -3243,7 +3243,7 @@ if ($module == 'initmodule') { print ''; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; print ''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; print ''; print ''; @@ -3252,7 +3252,7 @@ if ($module == 'initmodule') { if (dol_is_file($dirins.'/'.$pathtohook)) { print ''.$pathtohook.''; print ''; - print ''.img_picto($langs->trans("Edit"), 'edit').' '; + print ''.img_picto($langs->trans("Edit"), 'edit').' '; print ''.img_picto($langs->trans("Delete"), 'delete').''; } else { print ''.$langs->trans("FileNotYetGenerated").''; @@ -3302,7 +3302,7 @@ if ($module == 'initmodule') { print ''; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; print ''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; print ''; if (!empty($triggers)) { @@ -3311,7 +3311,7 @@ if ($module == 'initmodule') { print ''; print ' '.$langs->trans("TriggersFile").' : '.$pathtofile.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; print ''.img_picto($langs->trans("Delete"), 'delete').''; print ''; } @@ -3407,11 +3407,11 @@ if ($module == 'initmodule') { print ' '.$langs->trans("JSFile").' : '; if (dol_is_file($dirins.'/'.$pathtohook)) { print ''.$pathtohook.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; } else { print ''.$langs->trans("FileNotYetGenerated").''; - print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; + print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; } print ''; } else { @@ -3455,13 +3455,13 @@ if ($module == 'initmodule') { $pathtofile = $widget['relpath']; print ' '.$langs->trans("WidgetFile").' : '.$pathtofile.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; print ''; } } else { print ' '.$langs->trans("WidgetFile").' : '.$langs->trans("NoWidget").''; - print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; + print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; print ''; } print ''; @@ -3502,7 +3502,7 @@ if ($module == 'initmodule') { print '
    '; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; } else { $fullpathoffile = dol_buildpath($file, 0); @@ -3572,13 +3572,13 @@ if ($module == 'initmodule') { $pathtofile = $clifile['relpath']; print ' '.$langs->trans("CLIFile").' : '.$pathtofile.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; print ''; } } else { print ' '.$langs->trans("CLIFile").' : '.$langs->trans("FileNotYetGenerated");''; - print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; + print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; print ''; } print ''; @@ -3618,7 +3618,7 @@ if ($module == 'initmodule') { print '
    '; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print '
    '; @@ -3746,14 +3746,14 @@ if ($module == 'initmodule') { } print ''; print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; print ''; } } else { print ''; print ' '.$langs->trans("SpecificationFile").' : '.$langs->trans("FileNotYetGenerated").''; - print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; + print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; print ''; } print ''; diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index d0d4a404dcf..7c6c6b2c04e 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -389,7 +389,7 @@ if ($action == 'edit') { print ''; print ''; } else { print '
    '.$langs->trans("NothingToSetup"); diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 51f35bbc33d..136952662cc 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -609,7 +609,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Modify if ($object->status == $object::STATUS_DRAFT) { if ($permissiontoadd) { - print ''.$langs->trans("Modify").''."\n"; + print ''.$langs->trans("Modify").''."\n"; } else { print ''.$langs->trans('Modify').''."\n"; } diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index db637136cad..2a281931046 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -556,7 +556,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle'); + print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); } if ($object->status == $object::STATUS_DRAFT) { diff --git a/htdocs/product/card.php b/htdocs/product/card.php index fd9b129e30d..80378bd1b2a 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1262,7 +1262,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans("DefaultWarehouse").''; print img_picto($langs->trans("DefaultWarehouse"), 'stock', 'class="pictofixedwidth"'); print $formproduct->selectWarehouses(GETPOST('fk_default_warehouse', 'int'), 'fk_default_warehouse', 'warehouseopen', 1, 0, 0, '', 0, 0, array(), 'minwidth300 widthcentpercentminusxx maxwidth500'); - print ' '; + print ' '; print ''; print ''; print ''; @@ -2543,14 +2543,14 @@ if ($action != 'create' && $action != 'edit') { if (empty($reshook)) { if ($usercancreate) { if (!isset($object->no_button_edit) || $object->no_button_edit <> 1) { - print 'id.'">'.$langs->trans("Modify").''; + print 'id.'">'.$langs->trans("Modify").''; } if (!isset($object->no_button_copy) || $object->no_button_copy <> 1) { if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) { print ''.$langs->trans('ToClone').''."\n"; } else { - print 'id.'">'.$langs->trans("ToClone").''; + print 'id.'">'.$langs->trans("ToClone").''; } } } diff --git a/htdocs/product/dynamic_price/editor.php b/htdocs/product/dynamic_price/editor.php index 784be41dfe9..893cc654f89 100644 --- a/htdocs/product/dynamic_price/editor.php +++ b/htdocs/product/dynamic_price/editor.php @@ -204,7 +204,7 @@ print '