From 2fdc6d9461bbc8b6943ac8e6ecad5e65ba86cda5 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 4 Jun 2021 11:35:12 +0200 Subject: [PATCH 001/243] 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/243] 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/243] 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 2c7a78867847d532c5c5ad0c701f872389e5ad69 Mon Sep 17 00:00:00 2001 From: henrynopo Date: Fri, 27 Aug 2021 11:09:10 +0800 Subject: [PATCH 004/243] Update shipment.php --- htdocs/expedition/shipment.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 42b8630bd3c..f9714039016 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -617,15 +617,17 @@ if ($id > 0 || !empty($ref)) { $sql = "SELECT cd.rowid, cd.fk_product, cd.product_type as type, cd.label, cd.description,"; $sql .= " cd.price, cd.tva_tx, cd.subprice,"; - $sql .= " cd.qty,"; + $sql .= " cd.qty, cd.fk_unit,"; $sql .= ' cd.date_start,'; $sql .= ' cd.date_end,'; $sql .= ' cd.special_code,'; $sql .= ' p.rowid as prodid, p.label as product_label, p.entity, p.ref, p.fk_product_type as product_type, p.description as product_desc,'; $sql .= ' p.weight, p.weight_units, 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'; + $sql .= ', u.short_label as unit_order'; $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_units as u ON cd.fk_unit = u.rowid"; $sql .= " WHERE cd.fk_commande = ".((int) $object->id); $sql .= " ORDER BY cd.rang, cd.rowid"; @@ -761,7 +763,7 @@ if ($id > 0 || !empty($ref)) { } // Qty ordered - print ''.$objp->qty.''; + print ''.$objp->qty.' '.$objp->unit_order.''; // Qty already shipped $qtyProdCom = $objp->qty; @@ -769,7 +771,7 @@ if ($id > 0 || !empty($ref)) { // Nb of sending products for this line of order $qtyAlreadyShipped = (!empty($object->expeditions[$objp->rowid]) ? $object->expeditions[$objp->rowid] : 0); print $qtyAlreadyShipped; - print ''; + print ' '.$objp->unit_order.''; // Qty remains to ship print ''; @@ -780,7 +782,7 @@ if ($id > 0 || !empty($ref)) { } else { print '0 ('.$langs->trans("Service").')'; } - print ''; + print ' '.$objp->unit_order.''; if ($objp->fk_product > 0) { $product = new Product($db); From 9914ebe90bcf37731cb96e94eca07558d84c914c Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Fri, 27 Aug 2021 10:21:02 +0200 Subject: [PATCH 005/243] add missing actions to admin page --- htdocs/admin/supplier_order.php | 5 ++++- htdocs/admin/supplier_payment.php | 2 ++ htdocs/fourn/commande/card.php | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 7cf64e4800d..98fe1c391ce 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -132,6 +132,8 @@ if ($action == 'updateMask') { if ($ret > 0) { $ret = addDocumentModel($value, $type, $label, $scandir); } +} elseif ($action == 'unsetdoc') { + dolibarr_del_const($db, "COMMANDE_SUPPLIER_ADDON_PDF", $conf->entity); } elseif ($action == 'setmod') { // TODO Verifier si module numerotation choisi peut etre active // par appel methode canBeActivated @@ -397,7 +399,8 @@ foreach ($dirmodels as $reldir) { // Default print ''; if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name") { - print img_picto($langs->trans("Default"), 'on'); +// print img_picto($langs->trans("Default"), 'on'); + print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; } else { print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index 3f79b52eff3..4482373a2bd 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -89,6 +89,8 @@ if ($action == 'updateMask') { if ($ret > 0) { $ret = addDocumentModel($value, $type, $label, $scandir); } +} elseif ($action == 'unsetdoc') { + dolibarr_del_const($db, "SUPPLIER_PAYMENT_ADDON_PDF", $conf->entity); } elseif ($action == 'specimen') { $modele = GETPOST('module', 'alpha'); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 6ea356e189e..8afb77a3437 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2614,8 +2614,9 @@ if ($action == 'create') { $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = $usercanread; $delallowed = $usercancreate; + $modelpdf = (!empty($object->model_pdf) ? $object->model_pdf : (empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF) ? '' : $conf->global->COMMANDE_SUPPLIER_ADDON_PDF)); - print $formfile->showdocuments('commande_fournisseur', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 0, 0, '', '', '', $object->thirdparty->default_lang); + print $formfile->showdocuments('commande_fournisseur', $objref, $filedir, $urlsource, $genallowed, $delallowed, $modelpdf, 1, 0, 0, 0, 0, '', '', '', $object->thirdparty->default_lang); $somethingshown = $formfile->numoffiles; // Show links to link elements From b48566eed853ab7a573d929c89edcea0184ec4ff Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 27 Aug 2021 08:27:04 +0000 Subject: [PATCH 006/243] Fixing style errors. --- htdocs/admin/supplier_order.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 98fe1c391ce..26f0212f412 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -399,7 +399,7 @@ foreach ($dirmodels as $reldir) { // Default print ''; if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name") { -// print img_picto($langs->trans("Default"), 'on'); + // print img_picto($langs->trans("Default"), 'on'); print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; } else { print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; From c219b8f576bd69db74be6020afa58c0a859adc20 Mon Sep 17 00:00:00 2001 From: henrynopo Date: Sat, 28 Aug 2021 15:19:45 +0800 Subject: [PATCH 007/243] Update card.php --- htdocs/expedition/card.php | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 676a5cae22c..6c3e3748892 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1133,11 +1133,17 @@ if ($action == 'create') { print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end)); print "\n"; } + + // unit of order + $unit_order = '' + if ($conf->global->PRODUCT_USE_UNITS) { + $unit_order = measuringUnitString($line->fk_unit); + } // Qty print ''.$line->qty; print ''; - print ''; + print ''.$unit_order.''; $qtyProdCom = $line->qty; // Qty already shipped @@ -1145,7 +1151,7 @@ if ($action == 'create') { $quantityDelivered = $object->expeditions[$line->id]; print $quantityDelivered; print ''; - print ''; + print ''.$unit_order.''; // Qty to ship $quantityAsked = $line->qty; @@ -2030,7 +2036,7 @@ if ($action == 'create') { // Get list of products already sent for same source object into $alreadysent $alreadysent = array(); if ($origin && $origin_id > 0) { - $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end"; + $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.fk_unit, obj.date_start, obj.date_end"; $sql .= ", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot"; $sql .= ", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition"; //if ($conf->delivery_note->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; @@ -2149,9 +2155,14 @@ if ($action == 'create') { print_date_range($lines[$i]->date_start, $lines[$i]->date_end); print "\n"; } + + $unit_order = '' + if ($conf->global->PRODUCT_USE_UNITS) { + $unit_order = measuringUnitString($lines[$i]->fk_unit); + } // Qty ordered - print ''.$lines[$i]->qty_asked.''; + print ''.$lines[$i]->qty_asked.' '.$unit_order.''; // Qty in other shipments (with shipment and warehouse used) if ($origin && $origin_id > 0) { @@ -2215,7 +2226,7 @@ if ($action == 'create') { print ''; print ''; // Qty to ship or shipped - print ''; + print ''.$unit_order.''; // Warehouse source print ''.$formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).''; // Batch number managment @@ -2226,7 +2237,7 @@ if ($action == 'create') { foreach ($lines[$i]->details_entrepot as $detail_entrepot) { print ''; // Qty to ship or shipped - print ''; + print ''.$unit_order.''; // Warehouse source print ''.$formproduct->selectWarehouses($detail_entrepot->entrepot_id, 'entl'.$detail_entrepot->line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).''; // Batch number managment @@ -2241,7 +2252,7 @@ if ($action == 'create') { print ''; print ''; // Qty to ship or shipped - print ''; + print ''.$unit_order.''; // Warehouse source print ''; // Batch number managment @@ -2253,7 +2264,7 @@ if ($action == 'create') { print ''; } else { // Qty to ship or shipped - print ''.$lines[$i]->qty_shipped.''; + print ''.$lines[$i]->qty_shipped.' '.$unit_order.''; // Warehouse source if (!empty($conf->stock->enabled)) { From 74ed754fcc3a08cba815470ba01f9d33655c0019 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 28 Aug 2021 07:22:25 +0000 Subject: [PATCH 008/243] Fixing style errors. --- htdocs/expedition/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 6c3e3748892..7c30789ecb0 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1133,7 +1133,7 @@ if ($action == 'create') { print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end)); print "\n"; } - + // unit of order $unit_order = '' if ($conf->global->PRODUCT_USE_UNITS) { @@ -2155,7 +2155,7 @@ if ($action == 'create') { print_date_range($lines[$i]->date_start, $lines[$i]->date_end); print "\n"; } - + $unit_order = '' if ($conf->global->PRODUCT_USE_UNITS) { $unit_order = measuringUnitString($lines[$i]->fk_unit); From 4ae29c53aa7678f031863828c35a8d4ba7ee69e5 Mon Sep 17 00:00:00 2001 From: henrynopo Date: Sat, 28 Aug 2021 15:30:05 +0800 Subject: [PATCH 009/243] Update pdf_espadon.modules.php --- .../expedition/doc/pdf_espadon.modules.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 28d797acffc..1d449dcccbd 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -650,6 +650,11 @@ class pdf_espadon extends ModelePdfExpedition $this->printStdColumnContent($pdf, $curY, 'qty_asked', $object->lines[$i]->qty_asked); $nexY = max($pdf->GetY(), $nexY); } + + if ($this->getColumnStatus('unit_order')) { + $this->printStdColumnContent($pdf, $curY, 'unit_order', measuringUnitString($object->lines[$i]->fk_unit)); + $nexY = max($pdf->GetY(), $nexY); + } if ($this->getColumnStatus('qty_shipped')) { $this->printStdColumnContent($pdf, $curY, 'qty_shipped', $object->lines[$i]->qty_shipped); @@ -1311,6 +1316,20 @@ class pdf_espadon extends ModelePdfExpedition 'align' => 'C', ), ); + + $rank = $rank + 10; + $this->cols['unit_order'] = array( + 'rank' => $rank, + 'width' => 15, // in mm + 'status' => empty($conf->global->PRODUCT_USE_UNITS) ? 0 : 1, + 'title' => array( + 'textkey' => 'Unit' + ), + 'border-left' => true, // add left line separator + 'content' => array( + 'align' => 'C', + ), + ); $rank = $rank + 10; $this->cols['qty_shipped'] = array( From 3598e0a2464666d78fcb5497d17dbc8e8681ef38 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 28 Aug 2021 07:32:07 +0000 Subject: [PATCH 010/243] Fixing style errors. --- .../modules/expedition/doc/pdf_espadon.modules.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 1d449dcccbd..55180a33eb4 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -650,11 +650,11 @@ class pdf_espadon extends ModelePdfExpedition $this->printStdColumnContent($pdf, $curY, 'qty_asked', $object->lines[$i]->qty_asked); $nexY = max($pdf->GetY(), $nexY); } - + if ($this->getColumnStatus('unit_order')) { - $this->printStdColumnContent($pdf, $curY, 'unit_order', measuringUnitString($object->lines[$i]->fk_unit)); - $nexY = max($pdf->GetY(), $nexY); - } + $this->printStdColumnContent($pdf, $curY, 'unit_order', measuringUnitString($object->lines[$i]->fk_unit)); + $nexY = max($pdf->GetY(), $nexY); + } if ($this->getColumnStatus('qty_shipped')) { $this->printStdColumnContent($pdf, $curY, 'qty_shipped', $object->lines[$i]->qty_shipped); @@ -1316,7 +1316,7 @@ class pdf_espadon extends ModelePdfExpedition 'align' => 'C', ), ); - + $rank = $rank + 10; $this->cols['unit_order'] = array( 'rank' => $rank, From 709a2975637759716e745943645d408e7b3f93c7 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Mon, 30 Aug 2021 14:45:42 +0200 Subject: [PATCH 011/243] 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 012/243] 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 013/243] 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 014/243] 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 015/243] 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 016/243] 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 017/243] 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 018/243] 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 ef2bb99476090a7600d19fc2ef71c10b4d46af35 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Sep 2021 16:29:08 +0200 Subject: [PATCH 019/243] 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 020/243] 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 021/243] 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 e7eb17177db432f54856897f2d1e7d97b8ebc0ea Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 10 Sep 2021 15:52:54 +0200 Subject: [PATCH 022/243] 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 5035ad9be190a002069c0c74b2aff58db0aeea6a Mon Sep 17 00:00:00 2001 From: Benjamin Chantalat <74144396+PyroShape@users.noreply.github.com> Date: Wed, 15 Sep 2021 12:32:18 +0200 Subject: [PATCH 023/243] Explicit date_creation instead of date --- htdocs/fourn/class/fournisseur.commande.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 09a43fb95ab..2a8051e818c 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -111,7 +111,7 @@ class CommandeFournisseur extends CommonOrder public $socid; public $fourn_id; - public $date; + public $date_creation; public $date_valid; public $date_approve; public $date_approve2; // Used when SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set @@ -375,7 +375,7 @@ class CommandeFournisseur extends CommonOrder $this->total_localtax1 = $obj->localtax1; $this->total_localtax2 = $obj->localtax2; $this->total_ttc = $obj->total_ttc; - $this->date = $this->db->jdate($obj->date_creation); + $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_valid = $this->db->jdate($obj->date_valid); $this->date_approve = $this->db->jdate($obj->date_approve); $this->date_approve2 = $this->db->jdate($obj->date_approve2); @@ -1282,7 +1282,7 @@ class CommandeFournisseur extends CommonOrder $now = dol_now(); // set tmp vars - $date = ($this->date_commande ? $this->date_commande : $this->date); // in case of date is set + $date = ($this->date_commande ? $this->date_commande : $this->date_creation); // in case of date is set if (empty($date)) { $date = $now; } @@ -2847,9 +2847,9 @@ class CommandeFournisseur extends CommonOrder $this->ref = 'SPECIMEN'; $this->specimen = 1; $this->socid = 1; - $this->date = $now; + $this->date_creation = $now; $this->date_commande = $now; - $this->date_lim_reglement = $this->date + 3600 * 24 * 30; + $this->date_lim_reglement = $this->date_creation + 3600 * 24 * 30; $this->cond_reglement_code = 'RECEP'; $this->mode_reglement_code = 'CHQ'; From 5e2d8eac2b13bbce11fbf4a9d4094cec5a369b87 Mon Sep 17 00:00:00 2001 From: Laurent De Coninck Date: Mon, 20 Sep 2021 22:51:43 +0200 Subject: [PATCH 024/243] Allow to edit the header of receipt by using HTML In the current version the WYSIWYG oesn't allow any HTML by thus fix you can use any button from the wysiwyg and it displays on the receipe. [see: X] --- htdocs/takepos/admin/receipt.php | 4 ++-- htdocs/takepos/receipt.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 01873d317c4..61fd71bdf29 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', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'alpha'), 'chaine', 0, '', $conf->entity); + $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_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); diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 6a305362839..a37c4a6c880 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -109,7 +109,7 @@ if (!empty($conf->global->TAKEPOS_HEADER) || !empty($conf->global->{$constFreeTe $substitutionarray = getCommonSubstitutionArray($langs); if (!empty($conf->global->TAKEPOS_HEADER)) $newfreetext .= make_substitutions($conf->global->TAKEPOS_HEADER, $substitutionarray); if (!empty($conf->global->{$constFreeText})) $newfreetext .= make_substitutions($conf->global->{$constFreeText}, $substitutionarray); - print $newfreetext; + print nl2br($newfreetext); } ?>

From c4dd6be9f8685107242f10dfe11c5039980aec66 Mon Sep 17 00:00:00 2001 From: fr69400 <82267780+fr69400@users.noreply.github.com> Date: Tue, 21 Sep 2021 18:47:34 +0200 Subject: [PATCH 025/243] Add showdocument hook --- htdocs/core/class/html.formfile.class.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 591fb5ed2d1..a21ef8e3305 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -391,6 +391,20 @@ class FormFile global $langs, $conf, $user, $hookmanager; global $form; + $reshook = 0; + if (is_object($hookmanager)){ + $parameters = array(); ++ $reshook = $hookmanager->executeHooks('showdocuments', $parameters, $object); + // May report error + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } + } + // Remode default action if $reskook > 0 + if ($reshook > 0) { + return ''; + } + if (!is_object($form)) { $form = new Form($this->db); } From 12be914d049f6f59c2735796305178f4056765cb Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 21 Sep 2021 16:49:00 +0000 Subject: [PATCH 026/243] Fixing style errors. --- htdocs/core/class/html.formfile.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index a21ef8e3305..d0d3717a1f1 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -392,13 +392,13 @@ class FormFile global $form; $reshook = 0; - if (is_object($hookmanager)){ + if (is_object($hookmanager)) { $parameters = array(); -+ $reshook = $hookmanager->executeHooks('showdocuments', $parameters, $object); + + $reshook = $hookmanager->executeHooks('showdocuments', $parameters, $object); // May report error if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - } + } } // Remode default action if $reskook > 0 if ($reshook > 0) { From fd911ff36fc1c76468e152aab95d943881f67a59 Mon Sep 17 00:00:00 2001 From: fr69400 <82267780+fr69400@users.noreply.github.com> Date: Tue, 21 Sep 2021 19:15:54 +0200 Subject: [PATCH 027/243] Update html.formfile.class.php --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d0d3717a1f1..f6f977d3058 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -394,7 +394,7 @@ class FormFile $reshook = 0; if (is_object($hookmanager)) { $parameters = array(); - + $reshook = $hookmanager->executeHooks('showdocuments', $parameters, $object); + $reshook = $hookmanager->executeHooks('showdocuments', $parameters, $object); // May report error if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); From 73b0d8079cae433cd04db9a7c41bb088fbad77c2 Mon Sep 17 00:00:00 2001 From: fr69400 <82267780+fr69400@users.noreply.github.com> Date: Tue, 21 Sep 2021 22:23:14 +0200 Subject: [PATCH 028/243] Update html.formfile.class.php --- htdocs/core/class/html.formfile.class.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d0d3717a1f1..8b954cc3d3a 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -393,8 +393,26 @@ class FormFile $reshook = 0; if (is_object($hookmanager)) { - $parameters = array(); - + $reshook = $hookmanager->executeHooks('showdocuments', $parameters, $object); + $parameters = array( + 'modulepart'=>&$modulepart, + 'modulesubdir'=>&$modulesubdir, + 'filedir'=>&$filedir, + 'urlsource'=>&$urlsource, + 'genallowed'=>&$genallowed, + 'delallowed'=>&$delallowed, + 'modelselected'=>&$modelselected, + 'allowgenifempty'=>&$allowgenifempty, + 'forcenomultilang'=>&$forcenomultilang, + 'noform'=>&$noform, + 'param'=>&$param, + 'title'=>&$title, + 'buttonlabel'=>&$buttonlabel, + 'codelang'=>&$codelang, + 'morepicto'=>&$morepicto, + 'hideifempty'=>&$hideifempty, + 'removeaction'=>&$removeaction + ); + $reshook = $hookmanager->executeHooks('showdocuments', $parameters, $object); // Note that parameters may have been updated by hook // May report error if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); From 49fd1b761cff315d592efd04ed7f2c3b8be29928 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 21 Sep 2021 20:27:33 +0000 Subject: [PATCH 029/243] Fixing style errors. --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 8b954cc3d3a..2e58c845e6b 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -394,7 +394,7 @@ class FormFile $reshook = 0; if (is_object($hookmanager)) { $parameters = array( - 'modulepart'=>&$modulepart, + 'modulepart'=>&$modulepart, 'modulesubdir'=>&$modulesubdir, 'filedir'=>&$filedir, 'urlsource'=>&$urlsource, From 736194142044e64522df1fe35386f46dabfade00 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 22 Sep 2021 14:56:44 +0200 Subject: [PATCH 030/243] 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 '
'; print ''; print ''; + } 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 ''; + if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) { + print ''; + } + // Stock if (!empty($conf->stock->enabled)) { print ''; print '\n"; - if ($conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") { + if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM) &&$conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") { print ''; From dbe459bc3ffb4602b7aad7bb80b07974ebc40fc8 Mon Sep 17 00:00:00 2001 From: Philippe Grand Date: Sat, 25 Sep 2021 18:59:39 +0200 Subject: [PATCH 053/243] Update box_members_subscriptions_by_year.php --- htdocs/core/boxes/box_members_subscriptions_by_year.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_members_subscriptions_by_year.php b/htdocs/core/boxes/box_members_subscriptions_by_year.php index dcd9da40ac7..fe64f37c805 100644 --- a/htdocs/core/boxes/box_members_subscriptions_by_year.php +++ b/htdocs/core/boxes/box_members_subscriptions_by_year.php @@ -67,7 +67,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes $this->enabled = 0; // disabled for external users } - $this->hidden = !(!empty($conf->adherent->enabled) &&$user->rights->adherent->lire); + $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire); } /** From a29ed0229bf31d2a9f812024f31acac81ea14a0f Mon Sep 17 00:00:00 2001 From: Philippe Grand Date: Sat, 25 Sep 2021 19:00:47 +0200 Subject: [PATCH 054/243] Update barcode.php --- htdocs/admin/barcode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 0c168ad27d2..5b48301c30d 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -373,7 +373,7 @@ if ($conf->product->enabled) { print ''; print '\n"; - if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM) &&$conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") { + if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM) && $conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") { print ''; From 694754267cd2449359595ffc1eba249bbdecc5da Mon Sep 17 00:00:00 2001 From: Philippe Grand Date: Sat, 25 Sep 2021 19:01:54 +0200 Subject: [PATCH 055/243] Update box_members_by_type.php --- htdocs/core/boxes/box_members_by_type.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_members_by_type.php b/htdocs/core/boxes/box_members_by_type.php index 1b8c09acc3f..0a5e4548e3f 100644 --- a/htdocs/core/boxes/box_members_by_type.php +++ b/htdocs/core/boxes/box_members_by_type.php @@ -68,7 +68,7 @@ class box_members_by_type extends ModeleBoxes $this->enabled = 0; // disabled for external users } - $this->hidden = !(!empty($conf->adherent->enabled) &&$user->rights->adherent->lire); + $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire); } /** From 2edad621b8a1e50648d57a541a7e79262e8d2ad7 Mon Sep 17 00:00:00 2001 From: Philippe Grand Date: Sat, 25 Sep 2021 19:02:28 +0200 Subject: [PATCH 056/243] Update box_members_last_modified.php --- htdocs/core/boxes/box_members_last_modified.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_members_last_modified.php b/htdocs/core/boxes/box_members_last_modified.php index 3f53d679adc..cf70bcafcb1 100644 --- a/htdocs/core/boxes/box_members_last_modified.php +++ b/htdocs/core/boxes/box_members_last_modified.php @@ -67,7 +67,7 @@ class box_members_last_modified extends ModeleBoxes $this->enabled = 0; // disabled for external users } - $this->hidden = !(!empty($conf->adherent->enabled) &&$user->rights->adherent->lire); + $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire); } /** From f7041ef1fcb5dc9ff61cc82e57dc3884c389f347 Mon Sep 17 00:00:00 2001 From: Philippe Grand Date: Sat, 25 Sep 2021 19:03:08 +0200 Subject: [PATCH 057/243] Update box_members_last_subscriptions.php --- htdocs/core/boxes/box_members_last_subscriptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_members_last_subscriptions.php b/htdocs/core/boxes/box_members_last_subscriptions.php index 5472bbbbcc7..949edd567f3 100644 --- a/htdocs/core/boxes/box_members_last_subscriptions.php +++ b/htdocs/core/boxes/box_members_last_subscriptions.php @@ -67,7 +67,7 @@ class box_members_last_subscriptions extends ModeleBoxes $this->enabled = 0; // disabled for external users } - $this->hidden = !(!empty($conf->adherent->enabled) &&$user->rights->adherent->lire); + $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire); } /** From 567334318aca2d7c5659aafdb23a6f1fcc1a07f1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Sep 2021 21:13:55 +0200 Subject: [PATCH 058/243] Fix sql eventorganization --- htdocs/core/actions_addupdatedelete.inc.php | 1 + .../class/conferenceorboothattendee.class.php | 11 +++++++---- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 11 +++++++++-- ...ventorganization_conferenceorboothattendee.key.sql | 6 +----- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index f871ed73de8..44a0f159143 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -117,6 +117,7 @@ if ($action == 'add' && !empty($permissiontoadd)) { if (!$error) { $result = $object->create($user); + var_dump($object);exit; if ($result > 0) { // Creation OK $urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist; diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 572d6f13856..4d44bc13287 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -248,9 +248,9 @@ class ConferenceOrBoothAttendee extends CommonObject } $result = $this->createCommon($user, $notrigger); - if ($result>0) { - $result =$this->fetch($result); - if ($result>0) { + if ($result > 0) { + $result = $this->fetch($result); + if ($result > 0) { $this->ref = $this->id; $result = $this->update($user); } @@ -293,7 +293,7 @@ class ConferenceOrBoothAttendee extends CommonObject // Clear fields if (property_exists($object, 'ref')) { - $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default']; + $object->ref = empty($this->fields['ref']['default']) ? "(PROV)" : $this->fields['ref']['default']; } if (property_exists($object, 'label')) { $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default']; @@ -327,6 +327,9 @@ class ConferenceOrBoothAttendee extends CommonObject $error++; $this->error = $object->error; $this->errors = $object->errors; + } else { + $object->ref = $object->id; + $result = $object->update($user); } if (!$error) { diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 63f20198658..ac9da2b1092 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -425,14 +425,21 @@ CREATE TABLE llx_eventorganization_conferenceorboothattendee( ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_project integer NOT NULL; ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_invoice integer NULL; +ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_soc; +ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_actioncomm; +ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_project; + ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_rowid (rowid); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_ref (ref); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_soc (fk_soc); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_actioncomm (fk_actioncomm); -ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm(id); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_email (email); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_status (status); -ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_soc, fk_actioncomm, email); + +-- VMYSQL4.1 DROP INDEX uk_eventorganization_conferenceorboothattendee on llx_eventorganization_conferenceorboothattendee; +-- VPGSQL8.2 DROP INDEX uk_eventorganization_conferenceorboothattendee; + +ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_project, email, fk_actioncomm); create table llx_eventorganization_conferenceorboothattendee_extrafields ( diff --git a/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.key.sql b/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.key.sql index 0633e3cc2a2..9e1bbcde191 100644 --- a/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.key.sql +++ b/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.key.sql @@ -18,15 +18,11 @@ ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_rowid (rowid); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_ref (ref); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_soc (fk_soc); -ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_actioncomm (fk_actioncomm); -ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm(id); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_project (fk_project); -ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_project FOREIGN KEY (fk_project) REFERENCES llx_projet(rowid); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_email (email); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_status (status); -- END MODULEBUILDER INDEXES -ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_soc, fk_project, fk_actioncomm, email); - +ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_project, email, fk_actioncomm); From a47cd224500a7ef53259385f34a8f7be9dea2191 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Sep 2021 21:15:53 +0200 Subject: [PATCH 059/243] Fix sql --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index ac9da2b1092..e6578a1bc66 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -425,9 +425,9 @@ CREATE TABLE llx_eventorganization_conferenceorboothattendee( ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_project integer NOT NULL; ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_invoice integer NULL; -ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_soc; -ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_actioncomm; -ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_project; +ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_soc; +ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_actioncomm; +ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_project; ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_rowid (rowid); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_ref (ref); From b7c577b762ebd5e7939d5f98454f1b290ff91615 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 26 Sep 2021 05:17:03 +0200 Subject: [PATCH 060/243] NEW #18814 Add legal form for Sweden --- htdocs/install/mysql/data/llx_c_forme_juridique.sql | 13 +++++++++++++ htdocs/install/mysql/migration/14.0.0-15.0.0.sql | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/htdocs/install/mysql/data/llx_c_forme_juridique.sql b/htdocs/install/mysql/data/llx_c_forme_juridique.sql index 07a09724ed2..7af5d28df8c 100644 --- a/htdocs/install/mysql/data/llx_c_forme_juridique.sql +++ b/htdocs/install/mysql/data/llx_c_forme_juridique.sql @@ -356,3 +356,16 @@ insert into llx_c_forme_juridique (fk_pays, code, libelle) values (13, '1306','S insert into llx_c_forme_juridique (fk_pays, code, libelle) values (13, '1307','Société en participation'); insert into llx_c_forme_juridique (fk_pays, code, libelle) values (13, '1308','Groupe de sociétés'); +-- Sweden (id country=20) +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2001', 'Aktiebolag'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2002', 'Publikt aktiebolag (AB publ)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2003', 'Ekonomisk förening (ek. för.)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2004', 'Bostadsrättsförening (BRF)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2005', 'Hyresrättsförening (HRF)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2006', 'Kooperativ'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2007', 'Enskild firma (EF)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2008', 'Handelsbolag (HB)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2009', 'Kommanditbolag (KB)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2010', 'Enkelt bolag'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2011', 'Ideell förening'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2012', 'Stiftelse'); 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 9555bcd15da..56655d05301 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 @@ -128,3 +128,16 @@ 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; + +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2001', 'Aktiebolag'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2002', 'Publikt aktiebolag (AB publ)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2003', 'Ekonomisk förening (ek. för.)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2004', 'Bostadsrättsförening (BRF)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2005', 'Hyresrättsförening (HRF)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2006', 'Kooperativ'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2007', 'Enskild firma (EF)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2008', 'Handelsbolag (HB)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2009', 'Kommanditbolag (KB)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2010', 'Enkelt bolag'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2011', 'Ideell förening'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2012', 'Stiftelse'); From c02b5b08eaebe788deb10c98762153928d4d71f1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Sep 2021 12:58:34 +0200 Subject: [PATCH 061/243] Fix trans --- htdocs/eventorganization/conferenceorbooth_list.php | 2 +- htdocs/eventorganization/conferenceorboothattendee_card.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 5f6e2820591..9c086528120 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -41,7 +41,7 @@ global $dolibarr_main_url_root; //dol_include_once('/othermodule/class/otherobject.class.php'); // Load translation files required by the page -$langs->loadLangs(array("eventorganization", "other", "projects")); +$langs->loadLangs(array("eventorganization", "other", "projects", "companies")); $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 84f99182192..09cc8a12b57 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Load translation files required by the page -$langs->loadLangs(array("eventorganization", "other")); +$langs->loadLangs(array("eventorganization", "other", "projects", "companies")); // Get parameters $id = GETPOST('id', 'int'); @@ -110,6 +110,7 @@ $permissionnote = $user->rights->eventorganization->write; // Used by the includ $permissiondellink = $user->rights->eventorganization->write; // Used by the include of actions_dellink.inc.php $upload_dir = $conf->eventorganization->multidir_output[isset($object->entity) ? $object->entity : 1]; + /* * Actions */ From cb964a3ab3fe62fa3050896822abf9f62d89f982 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Sep 2021 13:55:19 +0200 Subject: [PATCH 062/243] Fix cancel button --- htdocs/eventorganization/conferenceorboothattendee_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 09cc8a12b57..e6c03b0a74a 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -135,7 +135,7 @@ if (empty($reshook)) { if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { $backtopage = $backurlforlist; } else { - $backtopage = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?id='.($id > 0 ? $id : '__ID__'); + $backtopage = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?fk_project='.((int) $fk_project).'&id='.($id > 0 ? $id : '__ID__'); } } } From d5d4b8d8e09994a3f31e97870d6b61e409211eff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Sep 2021 14:21:23 +0200 Subject: [PATCH 063/243] Fix escape the undescore on search in website module --- htdocs/core/db/Database.interface.php | 8 ++++++++ htdocs/core/db/mysqli.class.php | 11 +++++++++++ htdocs/core/db/pgsql.class.php | 11 +++++++++++ htdocs/core/db/sqlite3.class.php | 11 +++++++++++ htdocs/core/lib/website.lib.php | 7 ++++--- htdocs/debugbar/class/TraceableDB.php | 11 +++++++++++ 6 files changed, 56 insertions(+), 3 deletions(-) diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php index 898421978db..f3e5d45afef 100644 --- a/htdocs/core/db/Database.interface.php +++ b/htdocs/core/db/Database.interface.php @@ -177,6 +177,14 @@ interface Database */ public function escape($stringtoencode); + /** + * Escape a string to insert data + * + * @param string $stringtoencode String to escape + * @return string String escaped + */ + public function escapeunderscore($stringtoencode); + /** * Sanitize a string for SQL forging * diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 343f4c8cc3e..3a8aabd3bf9 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -430,6 +430,17 @@ class DoliDBMysqli extends DoliDB return $this->db->real_escape_string($stringtoencode); } + /** + * Escape a string to insert data + * + * @param string $stringtoencode String to escape + * @return string String escaped + */ + public function escapeunderscore($stringtoencode) + { + return str_replace('_', '\_', $stringtoencode); + } + /** * Return generic error code of last operation. * diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 5a9d47dc40c..543e24a1b12 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -700,6 +700,17 @@ class DoliDBPgsql extends DoliDB return pg_escape_string($stringtoencode); } + /** + * Escape a string to insert data + * + * @param string $stringtoencode String to escape + * @return string String escaped + */ + public function escapeunderscore($stringtoencode) + { + return str_replace('_', '\_', $stringtoencode); + } + /** * Format a SQL IF * diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 563ccb19aac..008c7311ac8 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -635,6 +635,17 @@ class DoliDBSqlite3 extends DoliDB return Sqlite3::escapeString($stringtoencode); } + /** + * Escape a string to insert data + * + * @param string $stringtoencode String to escape + * @return string String escaped + */ + public function escapeunderscore($stringtoencode) + { + return str_replace('_', '\_', $stringtoencode); + } + /** * Renvoie le code erreur generique de l'operation precedente. * diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 89fd777cd20..20380e02aab 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -866,11 +866,11 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so $sql .= " AND ("; $searchalgo = ''; if (preg_match('/meta/', $algo)) { - $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.title LIKE '%".$db->escape($searchstring)."%' OR wp.description LIKE '%".$db->escape($searchstring)."%'"; - $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.keywords LIKE '".$db->escape($searchstring).",%' OR wp.keywords LIKE '% ".$db->escape($searchstring)."%'"; // TODO Use a better way to scan keywords + $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.title LIKE '%".$db->escapeunderscore($db->escape($searchstring))."%' OR wp.description LIKE '%".$db->escapeunderscore($db->escape($searchstring))."%'"; + $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.keywords LIKE '".$db->escapeunderscore($db->escape($searchstring)).",%' OR wp.keywords LIKE '% ".$db->escapeunderscore($db->escape($searchstring))."%'"; // TODO Use a better way to scan keywords } if (preg_match('/content/', $algo)) { - $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.content LIKE '%".$db->escape($searchstring)."%'"; + $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.content LIKE '%".$db->escapeunderscore($db->escape($searchstring))."%'"; } $sql .= $searchalgo; if (is_array($otherfilters) && !empty($otherfilters['category'])) { @@ -879,6 +879,7 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so $sql .= ")"; $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($max); + //print $sql; $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index af11f4c1d67..093e9b36280 100644 --- a/htdocs/debugbar/class/TraceableDB.php +++ b/htdocs/debugbar/class/TraceableDB.php @@ -250,6 +250,17 @@ class TraceableDB extends DoliDB return $this->db->escape($stringtoencode); } + /** + * Escape a string to insert data + * + * @param string $stringtoencode String to escape + * @return string String escaped + */ + public function escapeunderscore($stringtoencode) + { + return $this->db->escapeunderscore($stringtoencode); + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Get last ID after an insert INSERT From 5623e5f98afe77d1fffbc71b43278bccca3d11c9 Mon Sep 17 00:00:00 2001 From: Benjamin Chantalat <74144396+PyroShape@users.noreply.github.com> Date: Sun, 26 Sep 2021 19:09:09 +0200 Subject: [PATCH 064/243] Correct isset --- htdocs/fourn/class/fournisseur.commande.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 90c9d88a533..99ef4e54e87 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -381,10 +381,10 @@ class CommandeFournisseur extends CommonOrder $this->date_approve = $this->db->jdate($obj->date_approve); $this->date_approve2 = $this->db->jdate($obj->date_approve2); $this->date_commande = $this->db->jdate($obj->date_commande); // date we make the order to supplier - if (isset($this->date_commande)) { - $this->date = $this->db->jdate($obj->date_commande); + if (isset($obj->date_commande)) { + $this->date = $this->date_commande; } else { - $this->date = $this->db->jdate($obj->date_creation); + $this->date = $this->date_creation; } $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated $this->delivery_date = $this->db->jdate($obj->delivery_date); From c7ff60866a871af82322722b8d163a94be0f218d Mon Sep 17 00:00:00 2001 From: Stephan Steininger Date: Mon, 27 Sep 2021 10:04:59 +0200 Subject: [PATCH 065/243] load existing batch numbers for item within mrp consumtion --- htdocs/mrp/mo_production.php | 10 ++++++++-- htdocs/product/class/html.formproduct.class.php | 9 +++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 84dab109b91..9bde31e2a53 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -945,7 +945,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($action == 'consumeorproduce' && !GETPOSTISSET('qty-'.$line->id.'-'.$i)) { $preselected = 0; } - print ''; + + $disable = 'disabled'; + if ( ($line->qty - $alreadyconsumed) > 0 ) + $disable = ''; + + print ''; if ($permissiontoupdatecost && !empty($conf->global->MRP_SHOW_COST_FOR_CONSUMPTION)) { print ''; } @@ -967,7 +972,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; + //print ''; } print ''; } diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 64517c25443..75e731873d1 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -536,10 +536,11 @@ class FormProduct * @param int $forcecombo 1=Force combo iso ajax select2 * @param array $events Events to add to select2 * @param string $morecss Add more css classes to HTML select + * @param int $use_baseval 1=uses batch as value within select * * @return string HTML select */ - public function selectLotStock($selected = '', $htmlname = 'batch_id', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array(), $empty_label = '', $forcecombo = 0, $events = array(), $morecss = 'minwidth200') + public function selectLotStock($selected = '', $htmlname = 'batch_id', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array(), $empty_label = '', $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $use_baseval = 0) { global $conf, $langs; @@ -590,7 +591,11 @@ class FormProduct $label .= ' ('.$langs->trans("Stock").' '.$arraytypes['qty'].')'; } - $out .= ''; + print ''; //print ''; } print ''; diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 75e731873d1..b352264d8cb 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -593,9 +593,8 @@ class FormProduct if ( $use_baseval = 1 ) $out .= '
'.$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("QtyOrdered").''.$langs->trans("QtyReceived").''.$langs->trans("QtyToReceive"); + if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION || $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) { + print ''.$langs->trans("ByingPrice").''; @@ -1132,6 +1140,12 @@ if ($action == 'create') { } print ''; + print ''; + 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 031/243] 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 70e66627fed60b611adda6d1fab22f4647580914 Mon Sep 17 00:00:00 2001 From: Laurent De Coninck Date: Wed, 22 Sep 2021 20:14:47 +0200 Subject: [PATCH 032/243] 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 c1e1a535039eb0e5626801371f578cc8c880823b Mon Sep 17 00:00:00 2001 From: Benjamin Chantalat <74144396+PyroShape@users.noreply.github.com> Date: Thu, 23 Sep 2021 13:23:16 +0200 Subject: [PATCH 033/243] Update Explicit date_creation instead of date --- htdocs/fourn/class/fournisseur.commande.class.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 2a8051e818c..1f2f10d9991 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -111,6 +111,7 @@ class CommandeFournisseur extends CommonOrder public $socid; public $fourn_id; + public $date; public $date_creation; public $date_valid; public $date_approve; @@ -380,6 +381,11 @@ class CommandeFournisseur extends CommonOrder $this->date_approve = $this->db->jdate($obj->date_approve); $this->date_approve2 = $this->db->jdate($obj->date_approve2); $this->date_commande = $this->db->jdate($obj->date_commande); // date we make the order to supplier + if (isset($this->date_commande)) { + $this->date = $this->date_commande; + } else { + $this->date = $this->date_creation; + } $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->remise_percent = $obj->remise_percent; @@ -1282,7 +1288,7 @@ class CommandeFournisseur extends CommonOrder $now = dol_now(); // set tmp vars - $date = ($this->date_commande ? $this->date_commande : $this->date_creation); // in case of date is set + $date = ($this->date_commande ? $this->date_commande : $this->date); // in case of date is set if (empty($date)) { $date = $now; } @@ -2847,9 +2853,9 @@ class CommandeFournisseur extends CommonOrder $this->ref = 'SPECIMEN'; $this->specimen = 1; $this->socid = 1; - $this->date_creation = $now; + $this->date = $now; $this->date_commande = $now; - $this->date_lim_reglement = $this->date_creation + 3600 * 24 * 30; + $this->date_lim_reglement = $this->date + 3600 * 24 * 30; $this->cond_reglement_code = 'RECEP'; $this->mode_reglement_code = 'CHQ'; @@ -3295,7 +3301,6 @@ class CommandeFournisseur extends CommonOrder $keysinwishednotindelivered = array_diff(array_keys($qtywished), array_keys($qtydelivered)); // To check we also have same number of keys $keysindeliverednotinwished = array_diff(array_keys($qtydelivered), array_keys($qtywished)); // To check we also have same number of keys /*var_dump(array_keys($qtydelivered)); - var_dump(array_keys($qtywished)); var_dump($diff_array); var_dump($keysinwishednotindelivered); From 15313b8d374392641c957d4b7b2e9386728592b8 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 24 Sep 2021 06:03:01 +0200 Subject: [PATCH 034/243] FIX Accountancy - Missing specific filename for export on format FEC2 --- htdocs/accountancy/tpl/export_journal.tpl.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index ecb0f7a6b09..93215b9b8db 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -38,7 +38,9 @@ header('Content-Type: text/csv'); include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php'; $accountancyexport = new AccountancyExport($db); -if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$EXPORT_TYPE_FEC && $type_export == "general_ledger") { // Specific filename for FEC model export into the general ledger +// Specific filename for FEC model export into the general ledger +if ($accountancyexport->getFormatCode($formatexportset) == ($accountancyexport::$EXPORT_TYPE_FEC || $accountancyexport::$EXPORT_TYPE_FEC2) + && $type_export == "general_ledger") { // FEC format is defined here: https://www.legifrance.gouv.fr/affichCodeArticle.do?idArticle=LEGIARTI000027804775&cidTexte=LEGITEXT000006069583&dateTexte=20130802&oldAction=rechCodeArticle if (empty($search_date_end)) { // TODO Get the max date into bookeeping table From 3e485dcb4142a87db4eb3b2a8937edb08194f5a5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 24 Sep 2021 06:38:43 +0200 Subject: [PATCH 035/243] FIX Accountancy - Option of export popup are inverted --- htdocs/accountancy/bookkeeping/list.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index bc260c77ed3..ec01d9c697c 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -591,7 +591,7 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex if (!empty($accountancyexport->errors)) { setEventMessages('', $accountancyexport->errors, 'errors'); - } elseif (!$notifiedexportdate || !$notifiedvalidationdate) { + } elseif (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) { // Specify as export : update field date_export or date_validated $error = 0; $db->begin(); @@ -602,17 +602,17 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex $sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping"; $sql .= " SET"; - if (!$notifiedexportdate && !$notifiedvalidationdate) { + if (!empty($notifiedexportdate) && !empty($notifiedvalidationdate)) { $sql .= " date_export = '".$db->idate($now)."'"; $sql .= ", date_validated = '".$db->idate($now)."'"; - } elseif (!$notifiedexportdate) { + } elseif (!empty($notifiedexportdate)) { $sql .= " date_export = '".$db->idate($now)."'"; - } elseif (!$notifiedvalidationdate) { + } elseif (!empty($notifiedvalidationdate)) { $sql .= " date_validated = '".$db->idate($now)."'"; } $sql .= " WHERE rowid = ".((int) $movement->id); - dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG); + dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG); $result = $db->query($sql); if (!$result) { $error++; From f88d12f55d79900b739b5c69f976738834f564af Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 24 Sep 2021 11:16:34 +0200 Subject: [PATCH 036/243] Fix #18809 : error on client tooltip --- htdocs/comm/propal/list.php | 6 +++--- htdocs/commande/list.php | 6 +++--- htdocs/compta/facture/list.php | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 75b5f5eb633..dcba8a63ed8 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -471,7 +471,7 @@ $sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date $sql .= ' p.note_public, p.note_private,'; $sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,'; $sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,"; -$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity as user_entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender'; +$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity as user_entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender'; if (!$user->rights->societe->client->voir && !$socid) { $sql .= ", sc.fk_soc, sc.fk_user"; } @@ -1708,8 +1708,8 @@ if ($resql) { $userstatic->login = $obj->login; $userstatic->lastname = $obj->lastname; $userstatic->firstname = $obj->firstname; - $userstatic->email = $obj->email; - $userstatic->statut = $obj->statut; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_statut; $userstatic->entity = $obj->user_entity; $userstatic->photo = $obj->photo; $userstatic->office_phone = $obj->office_phone; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index e0208d3cdcc..b3a0ec37167 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -426,7 +426,7 @@ $sql .= ' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multic $sql .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,'; $sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,'; $sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,'; -$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,'; +$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,'; $sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method,'; $sql .= ' c.fk_input_reason'; if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { @@ -1682,8 +1682,8 @@ if ($resql) { $userstatic->login = $obj->login; $userstatic->lastname = $obj->lastname; $userstatic->firstname = $obj->firstname; - $userstatic->email = $obj->email; - $userstatic->statut = $obj->statut; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_statut; $userstatic->entity = $obj->entity; $userstatic->photo = $obj->photo; $userstatic->office_phone = $obj->office_phone; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 117db3f0485..0cdd2140b5d 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -497,7 +497,7 @@ $sql .= ' typent.code as typent_code,'; $sql .= ' state.code_departement as state_code, state.nom as state_name,'; $sql .= ' country.code as country_code,'; $sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,'; -$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender'; +$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender'; // We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0) // TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field. if (!$sall) { @@ -1915,8 +1915,8 @@ if ($resql) { $userstatic->login = $obj->login; $userstatic->lastname = $obj->lastname; $userstatic->firstname = $obj->firstname; - $userstatic->email = $obj->email; - $userstatic->statut = $obj->statut; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_statut; $userstatic->entity = $obj->entity; $userstatic->photo = $obj->photo; $userstatic->office_phone = $obj->office_phone; From dbf7a9a0d063b86db324fe115be58ebeb5f02ae9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Sep 2021 11:48:43 +0200 Subject: [PATCH 037/243] FIX payment using wrong type in takepos when too many payment mode --- htdocs/takepos/pay.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 6e22f27f7ff..60a4840471e 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -329,7 +329,7 @@ print ''; + print ''; } else { print ''; } @@ -355,7 +355,7 @@ print ''; + print ''; } else { $button = array_pop($action_buttons); print ''; @@ -382,7 +382,7 @@ print ''; + print ''; } else { $button = array_pop($action_buttons); print ''; @@ -394,7 +394,23 @@ print ''; + $paycode = $arrayOfValidPaymentModes[$i]->code; + $payIcon = ''; + if ($paycode == 'LIQ') { + if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) { + $payIcon = 'coins'; + } + } elseif ($paycode == 'CB') { + if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) { + $payIcon = 'credit-card'; + } + } elseif ($paycode == 'CHQ') { + if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) { + $payIcon = 'money-check'; + } + } + + print ''; $i = $i + 1; } From 128bba1d9b798c67b5a0ef477893f8efce39a4b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Sep 2021 13:29:03 +0200 Subject: [PATCH 038/243] Fix GETPOST --- htdocs/reception/card.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 57ef8981393..40b605bbe17 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -914,7 +914,7 @@ if ($action == 'create') { $ent = "entrepot_".$reg[1].'_'.$reg[2]; $pu = "pu_".$reg[1].'_'.$reg[2]; // This is unit price including discount $fk_commandefourndet = "fk_commandefourndet_".$reg[1].'_'.$reg[2]; - $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int')); + $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' => GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' => GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int')); } // with batch module enabled @@ -929,13 +929,13 @@ if ($action == 'create') { $ent = 'entrepot_'.$reg[1].'_'.$reg[2]; $pu = 'pu_'.$reg[1].'_'.$reg[2]; $lot = 'lot_number_'.$reg[1].'_'.$reg[2]; - $dDLUO = dol_mktime(12, 0, 0, $_POST['dluo_'.$reg[1].'_'.$reg[2].'month'], $_POST['dluo_'.$reg[1].'_'.$reg[2].'day'], $_POST['dluo_'.$reg[1].'_'.$reg[2].'year']); - $dDLC = dol_mktime(12, 0, 0, $_POST['dlc_'.$reg[1].'_'.$reg[2].'month'], $_POST['dlc_'.$reg[1].'_'.$reg[2].'day'], $_POST['dlc_'.$reg[1].'_'.$reg[2].'year']); + $dDLUO = dol_mktime(12, 0, 0, GETPOST('dluo_'.$reg[1].'_'.$reg[2].'month', 'int'), GETPOST('dluo_'.$reg[1].'_'.$reg[2].'day', 'int'), GETPOST('dluo_'.$reg[1].'_'.$reg[2].'year', 'int')); + $dDLC = dol_mktime(12, 0, 0, GETPOST('dlc_'.$reg[1].'_'.$reg[2].'month', 'int'), GETPOST('dlc_'.$reg[1].'_'.$reg[2].'day', 'int'), GETPOST('dlc_'.$reg[1].'_'.$reg[2].'year', 'int')); $fk_commandefourndet = 'fk_commandefourndet_'.$reg[1].'_'.$reg[2]; - $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); + $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' =>GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' =>GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); } - // If create form is coming from same page post was sent but an error occured + // If create form is coming from same page, it means that post was sent but an error occured if (preg_match('/^productid([0-9]+)$/i', $key, $reg)) { $numAsked++; @@ -951,7 +951,7 @@ if ($action == 'create') { $dDLUO = dol_mktime(12, 0, 0, GETPOST('dluo'.$reg[1].'month', 'int'), GETPOST('dluo'.$reg[1].'day', 'int'), GETPOST('dluo'.$reg[1].'year', 'int')); $dDLC = dol_mktime(12, 0, 0, GETPOST('dlc'.$reg[1].'month', 'int'), GETPOST('dlc'.$reg[1].'day', 'int'), GETPOST('dlc'.$reg[1].'year', 'int')); $fk_commandefourndet = 'fk_commandefournisseurdet'.$reg[1]; - $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST($comment), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); + $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' =>GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' =>GETPOST($comment), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); } } From 5cf90d0247448a93fe5bb2955827735426d0ba1f Mon Sep 17 00:00:00 2001 From: Benjamin Chantalat <74144396+PyroShape@users.noreply.github.com> Date: Fri, 24 Sep 2021 14:10:19 +0200 Subject: [PATCH 039/243] Correct date format --- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 1f2f10d9991..90c9d88a533 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -382,9 +382,9 @@ class CommandeFournisseur extends CommonOrder $this->date_approve2 = $this->db->jdate($obj->date_approve2); $this->date_commande = $this->db->jdate($obj->date_commande); // date we make the order to supplier if (isset($this->date_commande)) { - $this->date = $this->date_commande; + $this->date = $this->db->jdate($obj->date_commande); } else { - $this->date = $this->date_creation; + $this->date = $this->db->jdate($obj->date_creation); } $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated $this->delivery_date = $this->db->jdate($obj->delivery_date); From 14bcb124fe09d81d953b52950549afccae6d3777 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 24 Sep 2021 14:46:52 +0200 Subject: [PATCH 040/243] update reception class and card --- htdocs/reception/card.php | 2 +- htdocs/reception/class/reception.class.php | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 520214f0d5c..aa7a85c2464 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -366,7 +366,7 @@ if (empty($reshook)) { $eatbydate = str_replace('/', '-', $eatby); $sellbydate = str_replace('/', '-', $sellby); 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')); + $ret = $object->addline($entrepot_id, GETPOST($idl, 'int'), GETPOST($qty, 'int'), $array_options[$i], GETPOST($comment, 'alpha'), strtotime($eatbydate), strtotime($sellbydate), GETPOST($batch, 'alpha'), price2num(GETPOST($cost_price, 'double'), 'MU')); } 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')); } diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 0b53c6fd17d..d8ca28bd456 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -562,9 +562,7 @@ 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 .= ", 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); From 8f5f657e4dcda80443599ed7c233a64a48a58e0f Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 25 Sep 2021 07:12:33 +0200 Subject: [PATCH 041/243] FIX Accountancy - Missing specific filename for export on format FEC2, Ciel & repare it --- htdocs/accountancy/tpl/export_journal.tpl.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index 93215b9b8db..b595402228e 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -39,11 +39,11 @@ include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php'; $accountancyexport = new AccountancyExport($db); // Specific filename for FEC model export into the general ledger -if ($accountancyexport->getFormatCode($formatexportset) == ($accountancyexport::$EXPORT_TYPE_FEC || $accountancyexport::$EXPORT_TYPE_FEC2) +if (($accountancyexport->getFormatCode($formatexportset) == 'fec' || $accountancyexport->getFormatCode($formatexportset) == 'fec2') && $type_export == "general_ledger") { // FEC format is defined here: https://www.legifrance.gouv.fr/affichCodeArticle.do?idArticle=LEGIARTI000027804775&cidTexte=LEGITEXT000006069583&dateTexte=20130802&oldAction=rechCodeArticle if (empty($search_date_end)) { - // TODO Get the max date into bookeeping table + // TODO Get the max date into bookkeeping table $search_date_end = dol_now(); } $datetouseforfilename = $search_date_end; @@ -60,7 +60,7 @@ if ($accountancyexport->getFormatCode($formatexportset) == ($accountancyexport:: $endaccountingperiod = dol_print_date(dol_get_last_day($tmparray['year'], $tmparray['mon']), 'dayxcard'); $completefilename = $siren."FEC".$endaccountingperiod.".txt"; -} elseif ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$EXPORT_TYPE_CIEL && $type_export == "general_ledger" && !empty($conf->global->ACCOUNTING_EXPORT_XIMPORT_FORCE_FILENAME)) { +} elseif ($accountancyexport->getFormatCode($formatexportset) == 'ciel' && $type_export == "general_ledger" && !empty($conf->global->ACCOUNTING_EXPORT_XIMPORT_FORCE_FILENAME)) { $completefilename = "XIMPORT.TXT"; } else { $completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format; From 372ba6cf0b4d74dc603a6882250a96dbfe23f380 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 25 Sep 2021 07:49:08 +0200 Subject: [PATCH 042/243] NEW #18820 Accountancy - Add product account in import/export of thirdparty (level 3) --- htdocs/core/modules/modSociete.class.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index eed6871c465..c3eba65673b 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -281,6 +281,9 @@ class modSociete extends DolibarrModules if (!empty($conf->global->PRODUIT_MULTIPRICES)) { $this->export_fields_array[$r]['s.price_level'] = 'PriceLevel'; } + if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { + $this->export_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode'); + } // Add multicompany field if (!empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) { $nbofallowedentities = count(explode(',', getEntity('societe'))); // If project are shared, nb will be > 1 @@ -317,7 +320,8 @@ class modSociete extends DolibarrModules 'payterm.libelle'=>'Text', 'paymode.libelle'=>'Text', 's.outstanding_limit'=>'Numeric', 'pbacc.ref'=>'Text', 'incoterm.code'=>'Text', 'u.login'=>'Text', 'u.firstname'=>'Text', 'u.lastname'=>'Text', - 's.entity'=>'Numeric', 's.price_level'=>'Numeric' + 's.entity'=>'Numeric', 's.price_level'=>'Numeric', + 's.accountancy_code_sell'=>'Text', 's.accountancy_code_buy'=>'Text' ); $this->export_entities_array[$r] = array('u.login'=>'user', 'u.firstname'=>'user', 'u.lastname'=>'user'); // We define here only fields that use another picto @@ -488,6 +492,9 @@ class modSociete extends DolibarrModules if (!empty($conf->global->PRODUIT_MULTIPRICES)) { $this->import_fields_array[$r]['s.price_level'] = 'PriceLevel'; } + if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { + $this->import_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode'); + } // Add extra fields $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); @@ -621,7 +628,9 @@ class modSociete extends DolibarrModules 's.canvas' => "empty / a custom canvas form layout url e.g. mycanvas@mymodule", 's.datec' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'), 's.fk_multicurrency' => '0 (use system default currency) / 1 (use local currency)', - 's.multicurrency_code' => 'GBP/USD etc... matches field "code_iso" in table "'.MAIN_DB_PREFIX.'c_currencies"' + 's.multicurrency_code' => 'GBP/USD etc... matches field "code_iso" in table "'.MAIN_DB_PREFIX.'c_currencies"', + 's.accountancy_code_sell' => '707', + 's.accountancy_code_buy' => '607', ); $this->import_updatekeys_array[$r] = array( 's.nom' => 'Name', From 77d64e4fe2d2eea9be6f5a305c28bd4251d4be87 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 25 Sep 2021 12:13:06 +0200 Subject: [PATCH 043/243] NEW API list of staff units --- htdocs/api/class/api_setup.class.php | 59 ++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index f5f301e9c16..faccf512ed8 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1278,6 +1278,65 @@ class Setup extends DolibarrApi return $list; } + + /** + * Get the list of staff. + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Number of items per page + * @param int $page Page number (starting from zero) + * @param int $active Staff is active or not {@min 0} {@max 1} + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" + * @return array List of staff + * + * @url GET dictionary/staff + * + * @throws RestException + */ + public function getListOfStaff($sortfield = "id", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') + { + $list = array(); + + //TODO link with multicurrency module + $sql = "SELECT t.id, t.code, t.libelle, t.active, t.module"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_effectif as t"; + $sql .= " WHERE t.active = ".((int) $active); + // Add sql filters + if ($sqlfilters) { + if (!DolibarrApi::_checkFilters($sqlfilters)) { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; + $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + + $sql .= $this->db->order($sortfield, $sortorder); + + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; + + $sql .= $this->db->plimit($limit, $offset); + } + + $result = $this->db->query($sql); + + if ($result) { + $num = $this->db->num_rows($result); + $min = min($num, ($limit <= 0 ? $num : $limit)); + for ($i = 0; $i < $min; $i++) { + $list[] = $this->db->fetch_object($result); + } + } else { + throw new RestException(503, 'Error when retrieving list of staff: '.$this->db->lasterror()); + } + + return $list; + } /** * Get the list of social networks. From 6b820ae4c5461044cad4bfc2e04d29c75ccbfd22 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 25 Sep 2021 10:16:29 +0000 Subject: [PATCH 044/243] Fixing style errors. --- htdocs/api/class/api_setup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index faccf512ed8..b957feda82c 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1278,7 +1278,7 @@ class Setup extends DolibarrApi return $list; } - + /** * Get the list of staff. * From 1cdba9fb807fcfa58e124509218b2b8987363e58 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 25 Sep 2021 12:46:27 +0200 Subject: [PATCH 045/243] NEW API get list of legal form of business --- htdocs/api/class/api_setup.class.php | 63 ++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index f5f301e9c16..61c3f9b5c58 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1278,6 +1278,69 @@ class Setup extends DolibarrApi return $list; } + + /** + * Get the list of legal form of business. + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Number of items per page + * @param int $page Page number (starting from zero) + * @param string $country To filter on country + * @param int $active Lega form is active or not {@min 0} {@max 1} + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" + * @return array List of legal form + * + * @url GET dictionary/legal_form + * + * @throws RestException + */ + public function getListOfLegalForm($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $country = '', $active = 1, $sqlfilters = '') + { + $list = array(); + + //TODO link with multicurrency module + $sql = "SELECT t.rowid, t.code, t.fk_pays, t.libelle, t.isvatexempted, t.active, t.module, t.position"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_forme_juridique as t"; + $sql .= " WHERE t.active = ".((int) $active); + if ($country) { + $sql .= " AND t.fk_pays = '".$this->db->escape($country)."'"; + } + // Add sql filters + if ($sqlfilters) { + if (!DolibarrApi::_checkFilters($sqlfilters)) { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; + $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + + $sql .= $this->db->order($sortfield, $sortorder); + + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; + + $sql .= $this->db->plimit($limit, $offset); + } + + $result = $this->db->query($sql); + + if ($result) { + $num = $this->db->num_rows($result); + $min = min($num, ($limit <= 0 ? $num : $limit)); + for ($i = 0; $i < $min; $i++) { + $list[] = $this->db->fetch_object($result); + } + } else { + throw new RestException(503, 'Error when retrieving list of legal form: '.$this->db->lasterror()); + } + + return $list; + } /** * Get the list of social networks. From 509e1f5636133f83925acd0a350553a904cbeb8f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 25 Sep 2021 10:48:39 +0000 Subject: [PATCH 046/243] Fixing style errors. --- htdocs/api/class/api_setup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 61c3f9b5c58..8075861a15c 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1278,7 +1278,7 @@ class Setup extends DolibarrApi return $list; } - + /** * Get the list of legal form of business. * From f8609a4619851ac12c4c96eb18498d3765291003 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 25 Sep 2021 16:09:34 +0200 Subject: [PATCH 047/243] fix : warning: Undefined property: stdClass:: in C:\wamp64\www\dolibarr-dev\htdocs\core\boxes\box_members_last_modified.php on line 70 --- htdocs/core/boxes/box_members_last_modified.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_members_last_modified.php b/htdocs/core/boxes/box_members_last_modified.php index 9de6a3af12f..3f53d679adc 100644 --- a/htdocs/core/boxes/box_members_last_modified.php +++ b/htdocs/core/boxes/box_members_last_modified.php @@ -67,7 +67,7 @@ class box_members_last_modified extends ModeleBoxes $this->enabled = 0; // disabled for external users } - $this->hidden = !($user->rights->adherent->lire); + $this->hidden = !(!empty($conf->adherent->enabled) &&$user->rights->adherent->lire); } /** From d9110a81145477abe46985aeaa0104ea53ea78ae Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 25 Sep 2021 16:13:35 +0200 Subject: [PATCH 048/243] fix : warning: Undefined property: stdClass:: in C:\wamp64\www\dolibarr-dev\htdocs\core\boxes\box_members_last_subscriptions.php on line 70 --- htdocs/core/boxes/box_members_last_subscriptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_members_last_subscriptions.php b/htdocs/core/boxes/box_members_last_subscriptions.php index 3cea44c2dc3..5472bbbbcc7 100644 --- a/htdocs/core/boxes/box_members_last_subscriptions.php +++ b/htdocs/core/boxes/box_members_last_subscriptions.php @@ -67,7 +67,7 @@ class box_members_last_subscriptions extends ModeleBoxes $this->enabled = 0; // disabled for external users } - $this->hidden = !($user->rights->adherent->lire); + $this->hidden = !(!empty($conf->adherent->enabled) &&$user->rights->adherent->lire); } /** From 6b3cf5d482a072196b5b10d47d07f3d4773c0e65 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 25 Sep 2021 16:15:31 +0200 Subject: [PATCH 049/243] fix : warning: Undefined property: stdClass:: in C:\wamp64\www\dolibarr-dev\htdocs\core\boxes\box_members_last_subscriptions_by_year.php on line 70 --- htdocs/core/boxes/box_members_subscriptions_by_year.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_members_subscriptions_by_year.php b/htdocs/core/boxes/box_members_subscriptions_by_year.php index be835511c6b..dcd9da40ac7 100644 --- a/htdocs/core/boxes/box_members_subscriptions_by_year.php +++ b/htdocs/core/boxes/box_members_subscriptions_by_year.php @@ -67,7 +67,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes $this->enabled = 0; // disabled for external users } - $this->hidden = !($user->rights->adherent->lire); + $this->hidden = !(!empty($conf->adherent->enabled) &&$user->rights->adherent->lire); } /** From 1feb6e676cdd4aaafc63ff5f7d765d7408b1704f Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 25 Sep 2021 16:17:24 +0200 Subject: [PATCH 050/243] fix : warning: Undefined property: stdClass:: in C:\wamp64\www\dolibarr-dev\htdocs\core\boxes\box_members_by_type.php on line 70 --- htdocs/core/boxes/box_members_by_type.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_members_by_type.php b/htdocs/core/boxes/box_members_by_type.php index 5b95b58d29d..1b8c09acc3f 100644 --- a/htdocs/core/boxes/box_members_by_type.php +++ b/htdocs/core/boxes/box_members_by_type.php @@ -68,7 +68,7 @@ class box_members_by_type extends ModeleBoxes $this->enabled = 0; // disabled for external users } - $this->hidden = !($user->rights->adherent->lire); + $this->hidden = !(!empty($conf->adherent->enabled) &&$user->rights->adherent->lire); } /** From 67cc5155b1ffaee23f0070ea6011892b2c555e4d Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 25 Sep 2021 18:15:44 +0200 Subject: [PATCH 051/243] fix :Warning: Undefined property: stdClass:: in C:\wamp64\www\dolibarr-dev\htdocs\core\lib\barcode.lib.php on line 62 --- htdocs/core/lib/barcode.lib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/barcode.lib.php b/htdocs/core/lib/barcode.lib.php index 12022ed178c..f0604400525 100644 --- a/htdocs/core/lib/barcode.lib.php +++ b/htdocs/core/lib/barcode.lib.php @@ -59,7 +59,9 @@ if (empty($font_loc)) { if (defined('PHP-BARCODE_PATH_COMMAND')) { $genbarcode_loc = constant('PHP-BARCODE_PATH_COMMAND'); } else { - $genbarcode_loc = $conf->global->GENBARCODE_LOCATION; + if (!empty($conf->global->GENBARCODE_LOCATION)) { + $genbarcode_loc = $conf->global->GENBARCODE_LOCATION; + } } From 661f13adb371a2131beb41ad8409d28c9eebab41 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 25 Sep 2021 18:58:06 +0200 Subject: [PATCH 052/243] fix :Warning: Undefined property: stdClass:: in C:\wamp64\www\dolibarr-dev\htdocs\admin\barcode.php on line 376 --- htdocs/admin/barcode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index de05203f5f6..0c168ad27d2 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -373,7 +373,7 @@ if ($conf->product->enabled) { print ''.$modBarCode->getExample($langs)."'; print img_picto($langs->trans("Activated"), 'switch_on'); print ''.$modBarCode->getExample($langs)."'; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; if ($tmpproduct->status_batch) { $preselected = (GETPOSTISSET('batch-'.$line->id.'-'.$i) ? GETPOST('batch-'.$line->id.'-'.$i) : ''); - print ''; + print ''.$formproduct->selectLotStock('', 'batch-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product,'','','','','','',1).''; if ($tmpproduct->status_batch) { $preselected = (GETPOSTISSET('batch-'.$line->id.'-'.$i) ? GETPOST('batch-'.$line->id.'-'.$i) : ''); - print ''.$formproduct->selectLotStock('', 'batch-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product,'','','','','','',1).''.$formproduct->selectLotStock('', 'batch-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product, '', '', '', '', '', '', 1).'
'; - print ''; - print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder); - print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder); - print_liste_field_titre("CurrentTranslationString", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder); - //if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder); - print ''; - print "\n"; - // Line to search new record - print "\n"; - - print ''."\n"; @@ -495,6 +486,15 @@ if ($mode == 'searchkey') { print ''; print ''; + print ''; + print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder); + print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder); + print_liste_field_titre("CurrentTranslationString", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder); + //if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder); + print ''; + print "\n"; + + if ($sortfield == 'transkey' && strtolower($sortorder) == 'asc') { ksort($recordtoshow); } From c9ae46db50f4aee2775ca0839f86b9ad08b00a44 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Sep 2021 20:56:17 +0200 Subject: [PATCH 070/243] FIX Filter on categories --- htdocs/comm/propal/list.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index dcba8a63ed8..a0877a50028 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -475,7 +475,7 @@ $sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as u if (!$user->rights->societe->client->voir && !$socid) { $sql .= ", sc.fk_soc, sc.fk_user"; } -if ($search_categ_cus) { +if (!empty($search_categ_cus) && $search_categ_cus != '-1') { $sql .= ", cc.fk_categorie, cc.fk_soc"; } // Add fields from extrafields @@ -493,7 +493,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; -if (!empty($search_categ_cus)) { +if (!empty($search_categ_cus) && $search_categ_cus != '-1') { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ } $sql .= ', '.MAIN_DB_PREFIX.'propal as p'; @@ -592,6 +592,7 @@ if ($search_multicurrency_montant_ttc != '') { if ($sall) { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } + if ($search_categ_cus > 0) { $sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus); } From 9b825df158852f81e9c03486d8b377c3f2b65644 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Sep 2021 11:36:40 +0200 Subject: [PATCH 071/243] Clean code --- htdocs/compta/facture/list.php | 2 +- htdocs/societe/list.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 0cdd2140b5d..5023d818f78 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -520,7 +520,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; -if (!empty($search_categ_cus) && $search_categ_cus!=-1) { +if (!empty($search_categ_cus) && $search_categ_cus != '-1') { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 15c5e47cc99..988b2aad33e 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -89,9 +89,9 @@ $search_idprof4 = trim(GETPOST('search_idprof4', 'alpha')); $search_idprof5 = trim(GETPOST('search_idprof5', 'alpha')); $search_idprof6 = trim(GETPOST('search_idprof6', 'alpha')); $search_vat = trim(GETPOST('search_vat', 'alpha')); -$search_sale = trim(GETPOST("search_sale", 'int')); -$search_categ_cus = trim(GETPOST("search_categ_cus", 'int')); -$search_categ_sup = trim(GETPOST("search_categ_sup", 'int')); +$search_sale = GETPOST("search_sale", 'int'); +$search_categ_cus = GETPOST("search_categ_cus", 'int'); +$search_categ_sup = GETPOST("search_categ_sup", 'int'); $search_country = GETPOST("search_country", 'intcomma'); $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); $search_price_level = GETPOST('search_price_level', 'int'); @@ -100,8 +100,8 @@ $search_status = GETPOST("search_status", 'int'); $search_type = GETPOST('search_type', 'alpha'); $search_level = GETPOST("search_level", "array"); $search_stcomm = GETPOST('search_stcomm', 'int'); -$search_import_key = GETPOST("search_import_key", "alpha"); -$search_parent_name = GETPOST('search_parent_name', 'alpha'); +$search_import_key = trim(GETPOST("search_import_key", "alpha")); +$search_parent_name = trim(GETPOST('search_parent_name', 'alpha')); $type = GETPOST('type', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); @@ -494,7 +494,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_effectif as staff on (staff.id = s.fk_ef $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region = state.fk_region)"; // We'll need this table joined to the select in order to filter by categ -if (!empty($search_categ_cus) && $search_categ_cus!=-1) { +if (!empty($search_categ_cus) && $search_categ_cus != '-1') { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ } if (!empty($search_categ_sup) && $search_categ_sup!=-1) { From b77cadf39ac87aef4124327b6e792f9cde661c4e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Sep 2021 11:38:34 +0200 Subject: [PATCH 072/243] Fix filter --- htdocs/contact/list.php | 6 +++--- htdocs/fourn/facture/list.php | 2 +- htdocs/societe/list.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index a63a1bf7e49..27c6208ad0d 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -570,13 +570,13 @@ if ($limit > 0 && $limit != $conf->liste_limit) { } $param .= '&begin='.urlencode($begin).'&userid='.urlencode($userid).'&contactname='.urlencode($sall); $param .= '&type='.urlencode($type).'&view='.urlencode($view); -if (!empty($search_categ)) { +if (!empty($search_categ) && $search_categ != '-1') { $param .= '&search_categ='.urlencode($search_categ); } -if (!empty($search_categ_thirdparty)) { +if (!empty($search_categ_thirdparty) && $search_categ_thirdparty != '-1') { $param .= '&search_categ_thirdparty='.urlencode($search_categ_thirdparty); } -if (!empty($search_categ_supplier)) { +if (!empty($search_categ_supplier) && $search_categ_supplier != '-1') { $param .= '&search_categ_supplier='.urlencode($search_categ_supplier); } if ($sall != '') { diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index ac64a9af82e..6c81904b794 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -441,7 +441,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; -if (!empty($search_categ_sup)) { +if (!empty($search_categ_sup) && $search_categ_supplier != '-1') { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 988b2aad33e..8b2236cd484 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -497,7 +497,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_regio if (!empty($search_categ_cus) && $search_categ_cus != '-1') { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ } -if (!empty($search_categ_sup) && $search_categ_sup!=-1) { +if (!empty($search_categ_sup) && $search_categ_sup != '-1') { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ } $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id"; From 37603b451a3cbd4701d5b5407de49d40d41e2c92 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Sep 2021 12:24:01 +0200 Subject: [PATCH 073/243] Fix token in url --- htdocs/accountancy/admin/categories_list.php | 2 +- htdocs/accountancy/admin/subaccount.php | 6 +- htdocs/accountancy/bookkeeping/card.php | 6 +- htdocs/adherents/card.php | 2 +- htdocs/adherents/subscription.php | 4 +- htdocs/adherents/type.php | 8 +- htdocs/adherents/type_translation.php | 4 +- htdocs/admin/dav.php | 2 +- htdocs/admin/delais.php | 2 +- htdocs/admin/emailcollector_card.php | 8 +- htdocs/admin/eventorganization.php | 2 +- htdocs/admin/index.php | 2 +- htdocs/admin/knowledgemanagement.php | 2 +- htdocs/admin/limits.php | 2 +- htdocs/admin/mails.php | 2 +- htdocs/admin/mails_emailing.php | 2 +- htdocs/admin/mails_senderprofile_list.php | 2 +- htdocs/admin/mails_ticket.php | 2 +- htdocs/admin/translation.php | 10 +- htdocs/admin/website_options.php | 2 +- htdocs/admin/workstation.php | 2 +- htdocs/asset/admin/setup.php | 2 +- htdocs/asset/type.php | 4 +- htdocs/bom/tpl/objectline_view.tpl.php | 2 +- htdocs/categories/traduction.php | 4 +- htdocs/comm/action/card.php | 4 +- htdocs/comm/card.php | 12 +- htdocs/comm/propal/card.php | 22 ++-- htdocs/compta/bank/releve.php | 2 +- htdocs/compta/deplacement/card.php | 2 +- htdocs/compta/facture/card-rec.php | 14 +-- htdocs/compta/facture/card.php | 26 ++-- htdocs/compta/facture/prelevement.php | 12 +- htdocs/compta/paiement/cheque/card.php | 4 +- htdocs/compta/sociales/card.php | 4 +- htdocs/compta/tva/card.php | 4 +- .../default/tpl/contactcard_view.tpl.php | 4 +- htdocs/contact/card.php | 6 +- htdocs/contact/perso.php | 2 +- htdocs/contrat/card.php | 4 +- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/core/lib/company.lib.php | 4 +- htdocs/core/lib/ticket.lib.php | 2 +- htdocs/core/lib/treeview.lib.php | 2 +- htdocs/core/lib/usergroups.lib.php | 2 +- htdocs/core/tpl/extrafields_view.tpl.php | 2 +- htdocs/core/tpl/objectline_view.tpl.php | 8 +- htdocs/cron/card.php | 4 +- htdocs/datapolicy/admin/setup.php | 2 +- htdocs/delivery/card.php | 4 +- htdocs/don/card.php | 4 +- htdocs/ecm/dir_card.php | 4 +- .../conferenceorboothattendee_card.php | 4 +- htdocs/expedition/card.php | 6 +- htdocs/expedition/shipment.php | 16 +-- htdocs/expensereport/card.php | 8 +- htdocs/fichinter/card-rec.php | 2 +- htdocs/fichinter/card.php | 8 +- htdocs/fourn/card.php | 4 +- htdocs/fourn/commande/card.php | 16 +-- htdocs/fourn/commande/dispatch.php | 4 +- htdocs/fourn/facture/card.php | 16 +-- htdocs/holiday/card.php | 14 +-- htdocs/hrm/establishment/card.php | 2 +- htdocs/hrm/index.php | 2 +- .../knowledgerecord_card.php | 6 +- htdocs/loan/card.php | 4 +- htdocs/modulebuilder/index.php | 114 +++++++++--------- htdocs/modulebuilder/template/admin/setup.php | 2 +- htdocs/mrp/mo_card.php | 2 +- htdocs/partnership/partnership_card.php | 2 +- htdocs/product/card.php | 6 +- htdocs/product/dynamic_price/editor.php | 2 +- htdocs/product/price.php | 22 ++-- htdocs/product/stock/product.php | 4 +- htdocs/projet/card.php | 4 +- htdocs/projet/tasks/time.php | 4 +- htdocs/reception/card.php | 6 +- htdocs/recruitment/admin/setup.php | 2 +- .../recruitment/admin/setup_candidatures.php | 2 +- .../recruitmentcandidature_card.php | 2 +- .../recruitmentjobposition_card.php | 2 +- htdocs/resource/card.php | 2 +- htdocs/salaries/card.php | 4 +- .../canvas/company/tpl/card_view.tpl.php | 4 +- .../canvas/individual/tpl/card_view.tpl.php | 4 +- htdocs/societe/card.php | 16 +-- htdocs/societe/price.php | 4 +- .../tpl/linesalesrepresentative.tpl.php | 2 +- htdocs/supplier_proposal/card.php | 12 +- htdocs/takepos/invoice.php | 2 +- htdocs/ticket/agenda.php | 2 +- htdocs/ticket/card.php | 2 +- htdocs/ticket/class/actions_ticket.class.php | 2 +- htdocs/ticket/contact.php | 2 +- htdocs/ticket/document.php | 2 +- htdocs/ticket/messaging.php | 2 +- htdocs/user/bank.php | 2 +- htdocs/user/card.php | 6 +- htdocs/user/clicktodial.php | 2 +- htdocs/user/note.php | 2 +- htdocs/user/param_ihm.php | 6 +- htdocs/variants/list.php | 2 +- htdocs/website/index.php | 12 +- htdocs/website/websiteaccount_card.php | 2 +- htdocs/workstation/workstation_card.php | 2 +- htdocs/zapier/admin/setup.php | 2 +- 108 files changed, 319 insertions(+), 319 deletions(-) diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index cb931f550d8..2e369e19de1 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -811,7 +811,7 @@ if ($resql) { // Modify link if ($canbemodified) { - print ''; + print ''; } else { print ''; } diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index ad1804048c3..c3308393c27 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -439,13 +439,13 @@ if ($resql) { $e = ''; // Customer if ($obj->type == 1) { - $e .= ''.img_edit().''; + $e .= ''.img_edit().''; } elseif ($obj->type == 2) { // Supplier - $e .= ''.img_edit().''; + $e .= ''.img_edit().''; } elseif ($obj->type == 3) { // User - $e .= ''.img_edit().''; + $e .= ''.img_edit().''; } print $e; print ''."\n"; diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 1fab2cbf894..c71958691bd 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -433,7 +433,7 @@ if ($action == 'create') { print $langs->trans('Docdate'); print ''; if ($action != 'editdate') { - print ''; + print ''; } print '
'; + print '
'; //print $formadmin->select_language($langcode,'langcode',0,null,$langs->trans("All"),0,0,'',1); print $formadmin->select_language($langcode, 'langcode', 0, null, 0, 0, 0, 'maxwidth250', 1); print '
'.img_edit().''.img_edit().' piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'
'; print ''; @@ -460,7 +460,7 @@ if ($action == 'create') { print $langs->trans('Codejournal'); print ''; if ($action != 'editjournal') { - print 'piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; } print ''; print ''; @@ -487,7 +487,7 @@ if ($action == 'create') { print $langs->trans('Piece'); print ''; if ($action != 'editdocref') { - print 'piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; } print ''; print ''; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index dfc035bf1aa..dd96ff7dbbd 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1907,7 +1907,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Modify if (!empty($user->rights->adherent->creer)) { - print ''.$langs->trans("Modify").''."\n"; + print ''.$langs->trans("Modify").''."\n"; } else { print ''.$langs->trans("Modify").''."\n"; } diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index fcf65a5b668..26a45271801 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -587,7 +587,7 @@ if ($rowid > 0) { print $langs->trans("LinkedToDolibarrThirdParty"); print ''; if ($action != 'editthirdparty' && $user->rights->adherent->creer) { - print 'id.'">'.img_edit($langs->trans('SetLinkToThirdParty'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetLinkToThirdParty'), 1).''; } print ''; print ''; @@ -631,7 +631,7 @@ if ($rowid > 0) { if ($action != 'editlogin' && $user->rights->adherent->creer) { print ''; if ($user->rights->user->user->creer) { - print 'id.'">'.img_edit($langs->trans('SetLinkToUser'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetLinkToUser'), 1).''; } print ''; } diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 839e0c8ba47..6a294b0256a 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -481,12 +481,12 @@ if ($rowid > 0) { // Edit if ($user->rights->adherent->configurer) { - print ''; + print ''; } // Add if ($user->rights->adherent->configurer && !empty($object->status)) { - print ''; + print ''; } else { print ''; } @@ -728,10 +728,10 @@ if ($rowid > 0) { // Actions print ''; if ($user->rights->adherent->creer) { - print ''.img_edit().''; + print ''.img_edit().''; } if ($user->rights->adherent->supprimer) { - print ''.img_picto($langs->trans("Resiliate"), 'disable.png').''; + print ''.img_picto($langs->trans("Resiliate"), 'disable.png').''; } print ""; diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php index 63ff01584b0..88f45c9c20e 100644 --- a/htdocs/adherents/type_translation.php +++ b/htdocs/adherents/type_translation.php @@ -185,9 +185,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/admin/dav.php b/htdocs/admin/dav.php index df14ef4c1b0..fab1787f5b9 100644 --- a/htdocs/admin/dav.php +++ b/htdocs/admin/dav.php @@ -145,7 +145,7 @@ if ($action == 'edit') { print ''; print ''; } diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 2c6f9dc17c9..229fb3e2291 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -452,7 +452,7 @@ if ($action == 'edit') { print ''; } else { print '
'; + print ''.$langs->trans("Modify").'
'; } // End of page diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 9b45716d152..be3ab2d63c1 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -656,7 +656,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Delete print ''; - print ''.img_edit().''; + print ''.img_edit().''; print ' '.img_delete().''; print ''; print ''; @@ -693,14 +693,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Edit - print ''; + print ''; // Clone - print ''; + print ''; // Collect now if (count($object->actions) > 0) { - print ''; + print ''; } else { print ''; } diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index 36ba50818c6..06309a2706e 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -376,7 +376,7 @@ if ($action == 'edit') { print ''; print ''; } else { print '
'.$langs->trans("NothingToSetup"); diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index c02ee501d94..7dcc5a356b5 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -82,7 +82,7 @@ print '

'; if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) { $setupcompanynotcomplete = 1; } -print img_picto('', 'company', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit'), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup")); +print img_picto('', 'company', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit&token='.newToken()), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup")); print '

'.$langs->trans("SetupDescription3b"); if (!empty($setupcompanynotcomplete)) { $langs->load("errors"); diff --git a/htdocs/admin/knowledgemanagement.php b/htdocs/admin/knowledgemanagement.php index b886e6faf39..10f308b2b2c 100644 --- a/htdocs/admin/knowledgemanagement.php +++ b/htdocs/admin/knowledgemanagement.php @@ -324,7 +324,7 @@ if ($action == 'edit') { print ''; print ''; } else { //print '
'.$langs->trans("NothingToSetup"); diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index ef0c996569f..6246f9c09c3 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -190,7 +190,7 @@ if ($action == 'edit') { print ''; 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 ''; @@ -77,10 +94,6 @@ if ($object->element == 'product') { $ident = $conf->global->MAIN_DEFAULT_WAREHOUSE; } print img_picto('', 'stock').$formproduct->selectWarehouses($ident, 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100'); - print '   '; print ''; } if ($object->element == 'stock') { @@ -88,14 +101,19 @@ if ($object->element == 'stock') { print ''; print img_picto('', 'product'); $form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES) ? '0' : ''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500'); - print '   '; print ''; } print ''.$langs->trans("NumberOfUnit").''; -print ''; +print ''; +if ($object->element == 'product' || $object->element == 'stock') { + print ''; + print ajax_combobox("mouvement"); +} +print ''; +print ''; print ''; // If product is a Kit, we ask if we must disable stock change of subproducts diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index 27c9b2acb21..3e2adf8a169 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -89,7 +89,7 @@ if ($object->element == 'stock') { print ''.$langs->trans("WarehouseTarget").''; print img_picto('', 'stock').$formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1); print ''; -print ''.$langs->trans("NumberOfUnit").''; +print ''.$langs->trans("NumberOfUnit").''; print ''; // Serial / Eat-by date From 9d1915f9c289d9734347ab6dca50744666315ba7 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 6 Oct 2021 09:56:10 +0200 Subject: [PATCH 234/243] fix php warning --- htdocs/product/class/api_products.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 2e0d21b0456..7b19739d10e 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -462,7 +462,7 @@ class Products extends DolibarrApi $childsArbo = $this->product->getChildsArbo($id, 1); - $keys = ['rowid', 'qty', 'fk_product_type', 'label', 'incdec']; + $keys = ['rowid','qty', 'fk_product_type', 'label', 'incdec','ref']; $childs = []; foreach ($childsArbo as $values) { $childs[] = array_combine($keys, $values); From 8f9a7f4e35bb328ccf4bbcffc73c9e6f2c76a427 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Oct 2021 13:26:42 +0200 Subject: [PATCH 235/243] Update 13.0.0-14.0.0.sql --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index a879d647c19..db0e40790dc 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -626,5 +626,3 @@ CREATE TABLE llx_onlinesignature ALTER TABLE llx_facture_fourn CHANGE COLUMN fk_mode_transport fk_transport_mode integer; -ALTER TABLE llx_c_holiday_types CHANGE COLUMN newByMonth newbymonth double(8,5) DEFAULT 0 NOT NULL; - From 89b2ecf50488443a1e54185b9aa32049a606b1c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Oct 2021 13:28:05 +0200 Subject: [PATCH 236/243] Add missing migration sql --- htdocs/install/mysql/migration/14.0.0-15.0.0.sql | 3 +++ 1 file changed, 3 insertions(+) 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 7bf238da6b9..82a6bdec3dc 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 @@ -78,6 +78,9 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, -- v15 + +ALTER TABLE llx_c_holiday_types CHANGE COLUMN newByMonth newbymonth double(8,5) DEFAULT 0 NOT NULL; + ALTER TABLE llx_product ADD COLUMN mandatory_period tinyint NULL DEFAULT 0; ALTER TABLE llx_holiday ADD COLUMN date_approve DATETIME DEFAULT NULL; From 5d9c87a9ea87e522d1010f63fc4a9f6ed4c4694c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Oct 2021 13:42:13 +0200 Subject: [PATCH 237/243] Update api_products.class.php --- htdocs/product/class/api_products.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 7b19739d10e..a964b63799b 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -462,8 +462,8 @@ class Products extends DolibarrApi $childsArbo = $this->product->getChildsArbo($id, 1); - $keys = ['rowid','qty', 'fk_product_type', 'label', 'incdec','ref']; - $childs = []; + $keys = array('rowid','qty', 'fk_product_type', 'label', 'incdec','ref'); + $childs = array(); foreach ($childsArbo as $values) { $childs[] = array_combine($keys, $values); } From 7b1b7c0ad65731a1b1c4fa94e3d4f896d26924f2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Oct 2021 13:42:49 +0200 Subject: [PATCH 238/243] Update api_products.class.php --- htdocs/product/class/api_products.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index a964b63799b..8f8f280b64b 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -462,7 +462,7 @@ class Products extends DolibarrApi $childsArbo = $this->product->getChildsArbo($id, 1); - $keys = array('rowid','qty', 'fk_product_type', 'label', 'incdec','ref'); + $keys = array('rowid', 'qty', 'fk_product_type', 'label', 'incdec', 'ref'); $childs = array(); foreach ($childsArbo as $values) { $childs[] = array_combine($keys, $values); From ba1590758267c010f0dcc10275af39f7a3e5b698 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Oct 2021 13:48:42 +0200 Subject: [PATCH 239/243] Update inventory.php --- htdocs/product/inventory/inventory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index f9fd832b138..c0b607cde45 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -801,7 +801,7 @@ if ($object->id > 0) { print '
    '; // Call method to disable the button if no qty entered yet for inventory - if (!$hasinput) { + if ($object->status != $object::STATUS_VALIDATED || !$hasinput) { print '