diff --git a/ChangeLog b/ChangeLog index 2e8bfc968c7..de1482ea183 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,21 @@ English Dolibarr ChangeLog -------------------------------------------------------------- + +***** ChangeLog for 15.0.0 compared to 14.0.0 ***** + +For developers: +--------------- + +WARNING: + +Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: +* Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook. +* Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale. +* The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param). + + + ***** ChangeLog for 14.0.2 compared to 14.0.1 ***** FIX: #18353 Invoice list translation issue @@ -86,19 +101,6 @@ FIX: using Tulip, deposit mask was not saved FIX: #yogosha6907 -***** ChangeLog for 15.0.0 compared to 14.0.0 ***** - -For developers: ---------------- - -WARNING: - -Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: -* Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook. -* Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale. - - - ***** ChangeLog for 14.0.0 compared to 13.0.0 ***** For users: diff --git a/README.md b/README.md index 2cfe4138d62..54fdf1e958b 100644 --- a/README.md +++ b/README.md @@ -154,18 +154,18 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) ### Other application/modules -- Electronic Document Management (EDM) +- Electronic Document Management (EDM) - Bookmarks management - Reporting - Data export/import -- Barcodes +- Barcodes - Margin calculations - LDAP connectivity - ClickToDial integration - Mass emailing - RSS integration - Skype integration -- Social platforms linking +- Social platforms linking - Payment platforms integration (PayPal, Stripe, Paybox...) - Email-Collector @@ -179,14 +179,11 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Multi-Users and groups with finely grained rights - Multi-Currency - Multi-Company (by adding of an external module) - - Very user friendly and easy to use - customizable Dashboard - Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one) - - APIs (REST, SOAP) - Code that is easy to understand, maintain and develop (PHP with no heavy framework; trigger and hook architecture) - - Support a lot of country specific features: - Spanish Tax RE and ISPF - French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM) @@ -197,7 +194,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Compatible with European GDPR rules - ... - Flexible PDF & ODT generation for invoices, proposals, orders... -- … +- ... ### System Environment / Requirements diff --git a/SECURITY.md b/SECURITY.md index 61f4a392db8..427b1cc7ae2 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -54,12 +54,12 @@ ONLY vulnerabilities discovered, when the following setup on test platform is us * $dolibarr_main_prod must be set to 1 into conf.php * $dolibarr_nocsrfcheck must be kept to the value 0 into conf.php (this is the default value) * $dolibarr_main_force_https must be set to something else than 0. -* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 2 into backoffice menu Home - Setup - Other (this protection should be set to 2 soon by default) +* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 3 into backoffice menu Home - Setup - Other (this protection should be set to 3 soon by default) * The module DebugBar and ModuleBuilder must NOT be enabled (by default, these modules are not enabled. They are developer tools) * ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities). * The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer). * The web server setup must be done so only the documents directory is in write mode. The root directory called htdocs must be readonly. -* CSRF attacks are accepted when using a POST URL, but when using GET URL, they are validated only for creating, updating or deleting data resctricted from pages restricted to admin users. +* CSRF attacks are accepted but double check that you have set MAIN_SECURITY_CSRF_WITH_TOKEN to value 3. * Ability for a high level user to edit web site pages into the CMS by including HTML or Javascript is an expected feature. Vulnerabilities into the website module are validated only if HTML or Javascript injection can be done by a non allowed user. Scope is the web application (back office) and the APIs. diff --git a/dev/initdemo/initdemopassword.sh b/dev/initdemo/initdemopassword.sh index 933c3b1afa2..37264fb8e4d 100755 --- a/dev/initdemo/initdemopassword.sh +++ b/dev/initdemo/initdemopassword.sh @@ -171,7 +171,10 @@ if [ $res -ne 0 ]; then fi if [ -s "$mydir/initdemopostsql.sql" ]; then + echo A file initdemopostsql.sql was found, we execute it. mysql -P$port $base < "$mydir/initdemopostsql.sql" +else + echo No file initdemopostsql.sql found, we extra sql action done. fi diff --git a/dev/initdemo/mysqldump_dolibarr_14.0.0.sql b/dev/initdemo/mysqldump_dolibarr_14.0.0.sql index 4061fb9f4cf..e619c2c8fda 100644 --- a/dev/initdemo/mysqldump_dolibarr_14.0.0.sql +++ b/dev/initdemo/mysqldump_dolibarr_14.0.0.sql @@ -2056,7 +2056,7 @@ CREATE TABLE `llx_c_holiday_types` ( `label` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `affect` int(11) NOT NULL, `delay` int(11) NOT NULL, - `newByMonth` double(8,5) NOT NULL DEFAULT 0.00000, + `newbymonth` double(8,5) NOT NULL DEFAULT 0.00000, `fk_country` int(11) DEFAULT NULL, `active` int(11) DEFAULT 1, PRIMARY KEY (`rowid`), diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 930e76c7690..c9849f9f54f 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/admin/card.php b/htdocs/accountancy/admin/card.php index cd48526e62b..4d69eae7db8 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -75,7 +75,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors'); $action = 'create'; } else { - $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid='.((int) $conf->global->CHARTOFACCOUNTS); + $sql = "SELECT pcg_version FROM " . MAIN_DB_PREFIX . "accounting_system WHERE rowid = ".((int) $conf->global->CHARTOFACCOUNTS); dol_syslog('accountancy/admin/card.php:: $sql=' . $sql); $result = $db->query($sql); @@ -138,7 +138,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) { } else { $result = $object->fetch($id); - $sql = 'SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.((int) $conf->global->CHARTOFACCOUNTS); + $sql = "SELECT pcg_version FROM ".MAIN_DB_PREFIX."accounting_system WHERE rowid=".((int) $conf->global->CHARTOFACCOUNTS); dol_syslog('accountancy/admin/card.php:: $sql=' . $sql); $result2 = $db->query($sql); @@ -260,7 +260,7 @@ if ($action == 'create') { print ''; // autosuggest from existing account types if found print ''; - $sql = 'SELECT DISTINCT pcg_type FROM ' . MAIN_DB_PREFIX . 'accounting_account'; + $sql = "SELECT DISTINCT pcg_type FROM " . MAIN_DB_PREFIX . "accounting_account"; $sql .= " WHERE fk_pcg_version = '" . $db->escape($accountsystem->ref) . "'"; $sql .= ' AND entity in ('.getEntity('accounting_account', 0).')'; // Always limit to current entity. No sharing in accountancy. $sql .= ' LIMIT 50000'; // just as a sanity check 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 ''.img_edit().''; + print ''.img_edit().''; } else { print ' '; } diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 9596cd96af8..a842c294937 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -186,12 +186,28 @@ if ($action == 'update') { $msg .= '
'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'
'.$sql.'
'; $ko++; } else { - $db->begin(); - + $sql = ''; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_perentity (fk_product, entity, '".$db->escape($accountancy_field_name)."')"; - $sql .= " VALUES (".((int) $productid).", ".((int) $conf->entity).", '".$db->escape($accounting->account_number)."')"; - $sql .= " ON DUPLICATE KEY UPDATE ".$accountancy_field_name." = '".$db->escape($accounting->account_number)."'"; + $sql_exists = "SELECT rowid FROM " . MAIN_DB_PREFIX . "product_perentity"; + $sql_exists .= " WHERE fk_product = " . ((int) $productid) . " AND entity = " . ((int) $conf->entity); + $resql_exists = $db->query($sql_exists); + if (!$resql_exists) { + $msg .= '
'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'
'.$resql_exists.'
'; + $ko++; + } else { + $nb_exists = $db->num_rows($resql_exists); + if ($nb_exists <= 0) { + // insert + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_perentity (fk_product, entity, '" . $db->escape($accountancy_field_name) . "')"; + $sql .= " VALUES (" . ((int) $productid) . ", " . ((int) $conf->entity) . ", '" . $db->escape($accounting->account_number) . "')"; + } else { + $obj_exists = $db->fetch_object($resql_exists); + // update + $sql = "UPDATE " . MAIN_DB_PREFIX . "product_perentity"; + $sql .= " SET " . $accountancy_field_name . " = '" . $db->escape($accounting->account_number) . "'"; + $sql .= " WHERE rowid = " . ((int) $obj_exists->rowid); + } + } } else { $sql = " UPDATE ".MAIN_DB_PREFIX."product"; $sql .= " SET ".$accountancy_field_name." = '".$db->escape($accounting->account_number)."'"; @@ -199,6 +215,9 @@ if ($action == 'update') { } dol_syslog("/accountancy/admin/productaccount.php", LOG_DEBUG); + + $db->begin(); + if ($db->query($sql)) { $ok++; $db->commit(); 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 'piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).''; + print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).''; } print ''; 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/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 081d074eab7..1b2f376c33f 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,18 @@ 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", LOG_DEBUG); + dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG); + $result = $db->query($sql); if (!$result) { $error++; diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index fc6acffb46f..ed3c69c18bc 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 * @@ -225,8 +233,8 @@ class AccountingAccount extends CommonObject /** * 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 +267,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"; @@ -293,11 +301,11 @@ class AccountingAccount extends CommonObject $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 +321,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 +335,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,18 +347,18 @@ 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", LOG_DEBUG); $result = $this->db->query($sql); @@ -413,22 +421,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; @@ -444,20 +452,20 @@ class AccountingAccount extends CommonObject /** * 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 +473,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 +504,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 +537,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 +561,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 +593,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) @@ -620,15 +629,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(); @@ -654,12 +663,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 +678,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 +702,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,15 +714,173 @@ 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 $buyer Societe Object Buyers + * @param $seller Company Object seller + * @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 $buyer, $seller, Product $product, Facture $facture, FactureLigne $factureDet, $accountingAccount = array()) + { + global $conf; + global $hookmanager; + + // Instantiate hooks for external modules + $hookmanager->initHooks(array('accoutancyBindingCalculation')); + + // Execute hook accoutancyBindingCalculation + $parameters = array('buyer' => $buyer, 'seller' => $seller, '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($buyer); + $isSellerInEEC = isInEEC($seller); + $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 ($buyer->country_code == $seller->country_code || empty($buyer->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($buyer->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 ($buyer->country_code == $seller->country_code || empty($buyer->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($buyer->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 ((($buyer->country_code == $seller->country_code) || empty($buyer->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 = 'prodserv'; + } else { + 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($buyer->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 && !empty($product->accountancy_code_sell_intra)) { // European intravat sale + $code_sell_p = $product->accountancy_code_sell_intra; + $suggestedid = $accountingAccount['intra']; + $suggestedaccountingaccountfor = 'eec'; + } elseif (!empty($product->accountancy_code_sell_export)) { // 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($buyer->code_compta)) { + $code_sell_t = $buyer->code_compta; + $suggestedid = $accountingAccount['thirdparty']; + $suggestedaccountingaccountfor = 'thridparty'; + } + } + + // 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; + $suggestedaccountingaccountfor = 'deposit'; + } + + 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]; + } + } + 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; } } } diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 89c206df380..7c3cc2cf0e2 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", "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')) { @@ -172,35 +174,75 @@ 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, $mysoc, $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; } } @@ -215,8 +257,8 @@ if ($action == 'validatehistory') { if ($objp->aarowid_suggest > 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 35e02d5b007..a730a8a9af6 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,146 +549,84 @@ 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, $mysoc, $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']; } + //var_dump($return); - // 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 ''; @@ -692,11 +634,12 @@ if ($result) { 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 @@ -713,18 +656,18 @@ if ($result) { // 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,7 +679,7 @@ 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 { print '
'; @@ -747,38 +690,26 @@ 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 print ''; - $ischecked = $objp->aarowid_suggest; - if ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') { + if (!empty($suggestedid) && $suggestedaccountingaccountfor<>'') { + $ischecked=1; + } elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') { $ischecked = 0; } - print ''; + print ''; print ''; print ''; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index d05135e7a67..4367241dbd7 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -362,7 +362,7 @@ if ($result) { // Retrieve the accounting code of the social contribution of the payment from link of payment. // Note: We have the social contribution id, it can be faster to get accounting code from social contribution id. - $sqlmid = 'SELECT cchgsoc.accountancy_code'; + $sqlmid = "SELECT cchgsoc.accountancy_code"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."c_chargesociales cchgsoc"; $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."chargesociales as chgsoc ON chgsoc.fk_type = cchgsoc.id"; $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."paiementcharge as paycharg ON paycharg.fk_charge = chgsoc.rowid"; @@ -1019,7 +1019,7 @@ if (empty($action) || $action == 'view') { // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) - $sql = 'SELECT COUNT(rowid) as nb FROM '.MAIN_DB_PREFIX.'bank_account WHERE entity = '.$conf->entity.' AND fk_accountancy_journal IS NULL AND clos=0'; + $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."bank_account WHERE entity = ".((int) $conf->entity)." AND fk_accountancy_journal IS NULL AND clos=0"; $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index ecb0f7a6b09..b595402228e 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -38,10 +38,12 @@ 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) == '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; @@ -58,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; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index dfc035bf1aa..0cdecb3645f 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1012,7 +1012,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (count($listetype)) { print $form->selectarray("typeid", $listetype, (GETPOST('typeid', 'int') ? GETPOST('typeid', 'int') : $typeid), (count($listetype) > 1 ? 1 : 0), 0, 0, '', 0, 0, 0, '', '', 1); } else { - print ''.$langs->trans("NoTypeDefinedGoToSetup").''; + print ''.$langs->trans("NoTypeDefinedGoToSetup").''; } print "\n"; @@ -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"; } @@ -1997,7 +1997,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; if ($isinspip == -1) { - print '

'.$langs->trans('SPIPConnectionFailed').': '.$mailmanspip->error.''; + print '

'.$langs->trans('SPIPConnectionFailed').': '.$mailmanspip->error.''; } diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index d714e3d9a32..983e6d9aada 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -190,7 +190,7 @@ if ($result > 0) { if (empty($dn)) { $langs->load("errors"); - print ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Member")).''; + print ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Member")).''; } else { $records = $ldap->getAttribute($dn, $search); @@ -199,7 +199,7 @@ if ($result > 0) { // Show tree if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) { if (!is_array($records)) { - print ''.$langs->trans("ErrorFailedToReadLDAP").''; + print ''.$langs->trans("ErrorFailedToReadLDAP").''; } else { $result = show_ldap_content($records, 0, $records['count'], true); } diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index fcf65a5b668..c51fa86cec6 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 ''; } @@ -670,7 +670,7 @@ if ($rowid > 0) { print '
'; if ($object->statut > 0) { - print '"; + print '"; } else { print ''; } diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 839e0c8ba47..97307ffe23f 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -318,6 +318,19 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ""; $i++; } + + // If no record found + if ($num == 0) { + /*$colspan = 1; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + $colspan++; + } + }*/ + $colspan = 8; + print ''.$langs->trans("NoRecordFound").''; + } + print ""; print '
'; @@ -481,12 +494,12 @@ if ($rowid > 0) { // Edit if ($user->rights->adherent->configurer) { - print '
'.$langs->trans("Modify").'
'; + print '
'.$langs->trans("Modify").'
'; } // Add if ($user->rights->adherent->configurer && !empty($object->status)) { - print '
'.$langs->trans("AddMember").'
'; + print '
'.$langs->trans("AddMember").'
'; } else { print '
'.$langs->trans("AddMember").'
'; } @@ -728,10 +741,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_ldap.php b/htdocs/adherents/type_ldap.php index a695f84bb81..f932b65e98c 100644 --- a/htdocs/adherents/type_ldap.php +++ b/htdocs/adherents/type_ldap.php @@ -161,7 +161,7 @@ if ($result > 0) { // Show tree if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) { if (!is_array($records)) { - print ''.$langs->trans("ErrorFailedToReadLDAP").''; + print ''.$langs->trans("ErrorFailedToReadLDAP").''; } else { $result = show_ldap_content($records, 0, $records['count'], true); } 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/accountant.php b/htdocs/admin/accountant.php index c7bd40efa37..5be2b3d6eea 100644 --- a/htdocs/admin/accountant.php +++ b/htdocs/admin/accountant.php @@ -91,7 +91,7 @@ $form = new Form($db); $formother = new FormOther($db); $formcompany = new FormCompany($db); -$countrynotdefined = ''.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; +$countrynotdefined = ''.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; print ''.$langs->trans("AccountantDesc")."
\n"; print "
\n"; diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index de05203f5f6..c370c07b73b 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -302,7 +302,7 @@ if (!isset($_SERVER['WINDIR'])) { print ''; if (!empty($conf->global->GENBARCODE_LOCATION) && !@file_exists($conf->global->GENBARCODE_LOCATION)) { $langs->load("errors"); - print '
'.$langs->trans("ErrorFileNotFound", $conf->global->GENBARCODE_LOCATION).''; + print '
'.$langs->trans("ErrorFileNotFound", $conf->global->GENBARCODE_LOCATION).''; } print ''; } @@ -373,7 +373,7 @@ if ($conf->product->enabled) { print ''; print ''.$modBarCode->getExample($langs)."\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 ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 2e4226e89d5..afcba2ef23d 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -360,7 +360,7 @@ foreach ($boxtoadd as $box) { print ''."\n"; } if (!count($boxtoadd) && count($boxactivated)) { - print ''.$langs->trans("AllWidgetsWereEnabled").''; + print ''.$langs->trans("AllWidgetsWereEnabled").''; } print ''."\n"; print '
'; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 5e0ab61c3ee..5cffc0257e1 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -369,7 +369,7 @@ $form = new Form($db); $formother = new FormOther($db); $formcompany = new FormCompany($db); -$countrynotdefined = ''.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; +$countrynotdefined = ''.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; print load_fiche_titre($langs->trans("CompanyFoundation"), '', 'title_setup'); 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 '
'; - print ''.$langs->trans("Modify").''; + print ''.$langs->trans("Modify").''; 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").'
'; + print ''.$langs->trans("Modify").''; } // End of page diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 9073c9e238c..d0a699ef979 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -223,7 +223,7 @@ $tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFI $tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity('c_type_container').")"; //$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units"; $tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm"; -$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newByMonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid"; +$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid"; $tabsql[29] = "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status"; $tabsql[30] = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards"; //$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s"; @@ -315,7 +315,7 @@ $tabfield[24] = "code,label"; $tabfield[25] = "code,label"; //$tabfield[26]= "code,label,short_label"; $tabfield[27] = "code,libelle,picto"; -$tabfield[28] = "code,label,affect,delay,newByMonth,country_id,country"; +$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country"; $tabfield[29] = "code,label,percent,position"; $tabfield[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; //$tabfield[31]= "pcg_version,label"; @@ -361,7 +361,7 @@ $tabfieldvalue[24] = "code,label"; $tabfieldvalue[25] = "code,label"; //$tabfieldvalue[26]= "code,label,short_label"; $tabfieldvalue[27] = "code,libelle,picto"; -$tabfieldvalue[28] = "code,label,affect,delay,newByMonth,country"; +$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country"; $tabfieldvalue[29] = "code,label,percent,position"; $tabfieldvalue[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; //$tabfieldvalue[31]= "pcg_version,label"; @@ -407,7 +407,7 @@ $tabfieldinsert[24] = "code,label"; $tabfieldinsert[25] = "code,label"; //$tabfieldinsert[26]= "code,label,short_label"; $tabfieldinsert[27] = "code,libelle,picto"; -$tabfieldinsert[28] = "code,label,affect,delay,newByMonth,fk_country"; +$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country"; $tabfieldinsert[29] = "code,label,percent,position"; $tabfieldinsert[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; //$tabfieldinsert[31]= "pcg_version,label"; @@ -548,7 +548,7 @@ $tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[25] = array('code'=>$langs->trans('EnterAnyCode')); //$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"), 'picto'=>$langs->trans("PictoHelp")); -$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"), 'delay'=>$langs->trans("MinimumNoticePeriod"), 'newByMonth'=>$langs->trans("NbAddedAutomatically")); +$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"), 'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically")); $tabhelp[29] = array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList")); $tabhelp[30] = array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->trans("LabelName"), 'paper_size'=>$langs->trans("LabelPaperSize")); //$tabhelp[31] = array('pcg_version'=>$langs->trans("EnterAnyCode")); @@ -1175,6 +1175,8 @@ if ($id) { $sql .= natural_search("r.code_region", $search_code); } elseif ($search_code != '' && $id == 7) { $sql .= natural_search("a.code", $search_code); + } elseif ($search_code != '' && $id == 10) { + $sql .= natural_search("t.code", $search_code); } elseif ($search_code != '' && $id != 9) { $sql .= natural_search("code", $search_code); } @@ -1392,7 +1394,7 @@ if ($id) { if ($value == 'delay') { $valuetoshow = $langs->trans("NoticePeriod"); } - if ($value == 'newByMonth') { + if ($value == 'newbymonth') { $valuetoshow = $langs->trans("NewByMonth"); } if ($value == 'fk_tva') { @@ -1737,7 +1739,7 @@ if ($id) { if ($value == 'delay') { $valuetoshow = $langs->trans("NoticePeriod"); } - if ($value == 'newByMonth') { + if ($value == 'newbymonth') { $valuetoshow = $langs->trans("NewByMonth"); } if ($value == 'fk_tva') { diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index adaf82d6964..5a23133923e 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -232,7 +232,7 @@ class PrestaShopWebservice if ($response != '') { libxml_clear_errors(); libxml_use_internal_errors(true); - $xml = simplexml_load_string($response, 'SimpleXMLElement', LIBXML_NOCDATA); + $xml = simplexml_load_string($response, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET); if (libxml_get_errors()) { $msg = var_export(libxml_get_errors(), true); libxml_clear_errors(); 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 '
'.$langs->trans("Edit").'
'; + print '
'.$langs->trans("Edit").'
'; // Clone - print '
'.$langs->trans("ToClone").'
'; + print '
'.$langs->trans("ToClone").'
'; // Collect now if (count($object->actions) > 0) { - print '
'.$langs->trans("CollectNow").'
'; + print '
'.$langs->trans("CollectNow").'
'; } else { print '
'.$langs->trans("CollectNow").'
'; } 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 '
'; - print ''.$langs->trans("Modify").''; + print ''.$langs->trans("Modify").''; print '
'; } else { print '
'.$langs->trans("NothingToSetup"); diff --git a/htdocs/admin/eventorganization_confbooth_extrafields.php b/htdocs/admin/eventorganization_confbooth_extrafields.php index 6e19bde8268..991ed3f824a 100644 --- a/htdocs/admin/eventorganization_confbooth_extrafields.php +++ b/htdocs/admin/eventorganization_confbooth_extrafields.php @@ -16,7 +16,7 @@ */ /** - * \file htdocs/admin/eventorganization_extrafields.php + * \file htdocs/admin/eventorganization_confbooth_extrafields.php * \ingroup bom * \brief Page to setup extra fields of EventOrganization */ diff --git a/htdocs/admin/eventorganization_confboothattendee_extrafields.php b/htdocs/admin/eventorganization_confboothattendee_extrafields.php index 6b201e6b923..0b50c483d69 100644 --- a/htdocs/admin/eventorganization_confboothattendee_extrafields.php +++ b/htdocs/admin/eventorganization_confboothattendee_extrafields.php @@ -21,7 +21,7 @@ */ /** - * \file admin/conferenceorboothattendee_extrafields.php + * \file htdocs/admin/eventorganization_confboothattendee_extrafields.php * \ingroup eventorganization * \brief Page to setup extra fields of conferenceorboothattendee */ diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index f7c9a84c5d1..e33c811c161 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -145,7 +145,18 @@ if ($action == 'updateMask') { $draft = GETPOST('EXPENSEREPORT_DRAFT_WATERMARK', 'alpha'); $res2 = dolibarr_set_const($db, "EXPENSEREPORT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); - if (!$res1 > 0 || !$res2 > 0) { + $res3 = 0; + if (!empty($conf->projet->enabled) && GETPOSTISSET('EXPENSEREPORT_PROJECT_IS_REQUIRED')) { // Option may not be provided + $res3 = dolibarr_set_const($db, 'EXPENSEREPORT_PROJECT_IS_REQUIRED', GETPOST('EXPENSEREPORT_PROJECT_IS_REQUIRED', 'int'), 'chaine', 0, '', $conf->entity); + } + + $dates = GETPOST('EXPENSEREPORT_PREFILL_DATES_WITH_CURRENT_MONTH', 'int'); + $res4 = dolibarr_set_const($db, 'EXPENSEREPORT_PREFILL_DATES_WITH_CURRENT_MONTH', intval($dates), 'chaine', 0, '', $conf->entity); + + $amounts = GETPOST('EXPENSEREPORT_FORCE_LINE_AMOUNTS_INCLUDING_TAXES_ONLY', 'int'); + $res5 = dolibarr_set_const($db, 'EXPENSEREPORT_FORCE_LINE_AMOUNTS_INCLUDING_TAXES_ONLY', intval($amounts), 'chaine', 0, '', $conf->entity); + + if (!($res1 > 0) || !($res2 > 0) || !($res3 > 0) || !($res4 >0) || !($res5 >0)) { $error++; } @@ -458,6 +469,26 @@ print $form->textwithpicto($langs->trans("WatermarkOnDraftExpenseReports"), $htm print ''; print ''."\n"; +if (!empty($conf->projet->enabled)) { + print ''; + print $langs->trans('ProjectIsRequiredOnExpenseReports'); + print ''; + print $form->selectyesno('EXPENSEREPORT_PROJECT_IS_REQUIRED', empty($conf->global->EXPENSEREPORT_PROJECT_IS_REQUIRED) ? 0 : 1, 1); + print ''; +} + +print ''; +print $langs->trans('PrefillExpenseReportDatesWithCurrentMonth'); +print ''; +print $form->selectyesno('EXPENSEREPORT_PREFILL_DATES_WITH_CURRENT_MONTH', empty($conf->global->EXPENSEREPORT_PREFILL_DATES_WITH_CURRENT_MONTH) ? 0 : 1, 1); +print ''; + +print ''; +print $langs->trans('ForceExpenseReportsLineAmountsIncludingTaxesOnly'); +print ''; +print $form->selectyesno('EXPENSEREPORT_FORCE_LINE_AMOUNTS_INCLUDING_TAXES_ONLY', empty($conf->global->EXPENSEREPORT_FORCE_LINE_AMOUNTS_INCLUDING_TAXES_ONLY) ? 0 : 1, 1); +print ''; + print ''; print $form->buttonsSaveCancel("Save", ''); diff --git a/htdocs/admin/expensereport_ik.php b/htdocs/admin/expensereport_ik.php index bdaaa5845f3..d32ef64aebc 100644 --- a/htdocs/admin/expensereport_ik.php +++ b/htdocs/admin/expensereport_ik.php @@ -33,10 +33,6 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_ik.class.php' // Load translation files required by the page $langs->loadLangs(array("admin", "trips", "errors", "other", "dict")); -if (!$user->admin) { - accessforbidden(); -} - $error = 0; $action = GETPOST('action', 'aZ09'); @@ -45,10 +41,20 @@ $ikoffset = GETPOST('ikoffset', 'int'); $coef = GETPOST('coef', 'int'); $fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat'); -$fk_range = GETPOST('fk_range'); +$fk_range = GETPOST('fk_range', 'int'); + +$expIk = new ExpenseReportIk($db); + +if (!$user->admin) { + accessforbidden(); +} + + +/* + * Actions + */ if ($action == 'updateik') { - $expIk = new ExpenseReportIk($db); if ($id > 0) { $result = $expIk->fetch($id); if ($result < 0) { @@ -61,13 +67,13 @@ if ($action == 'updateik') { if ($result > 0) { setEventMessages('SetupSaved', null, 'mesgs'); + header('Location: '.$_SERVER['PHP_SELF']); exit; } else { setEventMessages($expIk->error, $expIk->errors, 'errors'); } } elseif ($action == 'delete') { // TODO add confirm - $expIk = new ExpenseReportIk($db); if ($id > 0) { $result = $expIk->fetch($id); if ($result < 0) { @@ -77,12 +83,11 @@ if ($action == 'updateik') { $expIk->delete($user); } - header('Location: '.$_SERVER['PHP_SELF']); exit; } -$rangesbycateg = ExpenseReportIk::getAllRanges(); +$rangesbycateg = $expIk->getAllRanges(); /* @@ -102,7 +107,8 @@ print dol_get_fiche_head($head, 'expenseik', $langs->trans("ExpenseReportsIk"), echo ''.$langs->trans('ExpenseReportIkDesc').''; print '

'; -echo '
'; +echo ''; +echo ''; if ($action == 'edit') { echo ''; @@ -111,8 +117,6 @@ if ($action == 'edit') { echo ''; } -echo ''; - echo ''; foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab) { diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php index 802cc939caa..67627a94af8 100644 --- a/htdocs/admin/expensereport_rules.php +++ b/htdocs/admin/expensereport_rules.php @@ -54,7 +54,6 @@ $code_expense_rules_type = GETPOST('code_expense_rules_type'); $dates = dol_mktime(12, 0, 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear')); $datee = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); $amount = GETPOST('amount'); -$restrictive = GETPOST('restrictive'); $object = new ExpenseReportRule($db); if (!empty($id)) { @@ -138,7 +137,7 @@ if ($action == 'save') { exit; } -$rules = ExpenseReportRule::getAllRule(); +$rules = $object->getAllRule(); $tab_apply = array( 'A' => $langs->trans('All'), diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index 85cd419d9ee..d0f08783e22 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -275,9 +275,9 @@ if ($resql) { print ""; print "
".$langs->trans("Status").""; if ($result > 0 && empty($rss->error)) { - print ''.$langs->trans("Online").''; + print ''.$langs->trans("Online").''; } else { - print ''.$langs->trans("Offline"); + print ''.$langs->trans("Offline"); $langs->load("errors"); if ($rssparser->error) { print ' - '.$langs->trans($rssparser->error); diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index c02ee501d94..affedf1f43c 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"); @@ -112,8 +112,8 @@ $reshook = $hookmanager->executeHooks('addHomeSetup', $parameters, $object, $act print $hookmanager->resPrint; if (empty($reshook)) { // Show into other - print ''.$langs->trans("SetupDescription5")."
"; - print "
"; + print ''.$langs->trans("SetupDescription5")."
"; + print '
'; // Show logo print '
'; diff --git a/htdocs/admin/knowledgemanagement.php b/htdocs/admin/knowledgemanagement.php index b886e6faf39..8d93c16741a 100644 --- a/htdocs/admin/knowledgemanagement.php +++ b/htdocs/admin/knowledgemanagement.php @@ -17,7 +17,7 @@ */ /** - * \file knowledgemanagement/admin/setup.php + * \file htdocs/admin/knowledgemanagement.php * \ingroup knowledgemanagement * \brief KnowledgeManagement setup page. */ @@ -65,9 +65,7 @@ if (!$user->admin) { * Actions */ -if ((float) DOL_VERSION >= 6) { - include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; -} +include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { $maskconstorder = GETPOST('maskconstorder', 'alpha'); @@ -324,7 +322,7 @@ if ($action == 'edit') { print '
'; print ''; } else { //print '
'.$langs->trans("NothingToSetup"); diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index 2317d63ab7f..4010d724c1a 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -1,10 +1,10 @@ - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2005-2017 Regis Houssin - * Copyright (C) 2006-2020 Laurent Destailleur - * Copyright (C) 2011-2013 Juanjo Menent +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2005-2017 Regis Houssin + * Copyright (C) 2006-2020 Laurent Destailleur + * Copyright (C) 2011-2013 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -153,7 +153,7 @@ $arraylist['dolibarr2ldap'] = $langs->trans("DolibarrToLDAP"); print $form->selectarray('activesynchro', $arraylist, $conf->global->LDAP_SYNCHRO_ACTIVE); print ''.$langs->trans("LDAPDnSynchroActiveExample").''; if ($conf->global->LDAP_SYNCHRO_ACTIVE && !$conf->global->LDAP_USER_DN) { - print '
'.$langs->trans("LDAPSetupNotComplete").''; + print '
'.$langs->trans("LDAPSetupNotComplete").''; } print ''; @@ -297,24 +297,24 @@ if (function_exists("ldap_connect")) { if ($result > 0) { // Test ldap connect and bind print img_picto('', 'info').' '; - print ''.$langs->trans("LDAPTCPConnectOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).''; + print ''.$langs->trans("LDAPTCPConnectOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).''; print '
'; if ($conf->global->LDAP_ADMIN_DN && !empty($conf->global->LDAP_ADMIN_PASS)) { if ($result == 2) { print img_picto('', 'info').' '; - print ''.$langs->trans("LDAPBindOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).''; + print ''.$langs->trans("LDAPBindOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).''; print '
'; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPBindKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).''; + print ''.$langs->trans("LDAPBindKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).''; print '
'; print $langs->trans("Error").' '.$ldap->error; print '
'; } } else { print img_picto('', 'warning').' '; - print ''.$langs->trans("LDAPNoUserOrPasswordProvidedAccessIsReadOnly").''; + print ''.$langs->trans("LDAPNoUserOrPasswordProvidedAccessIsReadOnly").''; print '
'; } @@ -322,18 +322,18 @@ if (function_exists("ldap_connect")) { // Test ldap_getversion if (($ldap->getVersion() == 3)) { print img_picto('', 'info').' '; - print ''.$langs->trans("LDAPSetupForVersion3").''; + print ''.$langs->trans("LDAPSetupForVersion3").''; print '
'; } else { print img_picto('', 'info').' '; - print ''.$langs->trans("LDAPSetupForVersion2").''; + print ''.$langs->trans("LDAPSetupForVersion2").''; print '
'; } $unbind = $ldap->unbind(); } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPTCPConnectKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).''; + print ''.$langs->trans("LDAPTCPConnectKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).''; print '
'; print $langs->trans("Error").' '.$ldap->error; print '
'; diff --git a/htdocs/admin/ldap_contacts.php b/htdocs/admin/ldap_contacts.php index 3be7d63759b..fef3882d2ff 100644 --- a/htdocs/admin/ldap_contacts.php +++ b/htdocs/admin/ldap_contacts.php @@ -321,12 +321,12 @@ if (function_exists("ldap_connect")) { if ($result2 > 0) { print img_picto('', 'info').' '; - print ''.$langs->trans("LDAPSynchroOK").'
'; + print ''.$langs->trans("LDAPSynchroOK").'
'; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); + print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); print ': '.$ldap->error; - print '
'; + print '
'; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
'; } @@ -336,9 +336,9 @@ if (function_exists("ldap_connect")) { print "\n
"; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKO"); + print ''.$langs->trans("LDAPSynchroKO"); print ': '.$ldap->error; - print '
'; + print '
'; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
'; } } diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index 7ba47fb8e3d..82ee85b9a20 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -260,12 +260,12 @@ if (function_exists("ldap_connect")) { if ($result2 > 0) { print img_picto('', 'info').' '; - print ''.$langs->trans("LDAPSynchroOK").'
'; + print ''.$langs->trans("LDAPSynchroOK").'
'; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); + print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); print ': '.$ldap->error; - print '
'; + print '
'; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
'; } @@ -275,9 +275,9 @@ if (function_exists("ldap_connect")) { print "\n
"; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKO"); + print ''.$langs->trans("LDAPSynchroKO"); print ': '.$ldap->error; - print '
'; + print '
'; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
'; } } @@ -331,9 +331,9 @@ if (function_exists("ldap_connect")) { print "\n
"; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKO"); + print ''.$langs->trans("LDAPSynchroKO"); print ': '.$ldap->error; - print '
'; + print '
'; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
'; } } diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index cda1700299c..876c31d79b1 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -472,12 +472,12 @@ if (function_exists("ldap_connect")) { if ($result2 > 0) { print img_picto('', 'info').' '; - print ''.$langs->trans("LDAPSynchroOK").'
'; + print ''.$langs->trans("LDAPSynchroOK").'
'; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); + print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); print ': '.$ldap->error; - print '
'; + print '
'; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
'; } @@ -487,9 +487,9 @@ if (function_exists("ldap_connect")) { print "\n
"; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKO"); + print ''.$langs->trans("LDAPSynchroKO"); print ': '.$ldap->error; - print '
'; + print '
'; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
'; } } diff --git a/htdocs/admin/ldap_members_types.php b/htdocs/admin/ldap_members_types.php index 1fde587f21e..05572dc8bbf 100644 --- a/htdocs/admin/ldap_members_types.php +++ b/htdocs/admin/ldap_members_types.php @@ -223,12 +223,12 @@ if (function_exists("ldap_connect")) { if ($result2 > 0) { print img_picto('', 'info').' '; - print ''.$langs->trans("LDAPSynchroOK").'
'; + print ''.$langs->trans("LDAPSynchroOK").'
'; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); + print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); print ': '.$ldap->error; - print '
'; + print '
'; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
'; } @@ -238,9 +238,9 @@ if (function_exists("ldap_connect")) { print "\n
"; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKO"); + print ''.$langs->trans("LDAPSynchroKO"); print ': '.$ldap->error; - print '
'; + print '
'; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
'; } } diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index ffb1e2ca90b..e6041650d63 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -444,12 +444,12 @@ if (function_exists("ldap_connect")) { if ($result2 > 0) { print img_picto('', 'info').' '; - print ''.$langs->trans("LDAPSynchroOK").'
'; + print ''.$langs->trans("LDAPSynchroOK").'
'; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); + print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); print ': '.$ldap->error; - print '
'; + print '
'; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
'; } @@ -459,9 +459,9 @@ if (function_exists("ldap_connect")) { print "\n
"; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKO"); + print ''.$langs->trans("LDAPSynchroKO"); print ': '.$ldap->error; - print '
'; + print '
'; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
'; } } @@ -530,9 +530,9 @@ if (function_exists("ldap_connect")) { print "\n
"; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKO"); + print ''.$langs->trans("LDAPSynchroKO"); print ': '.$ldap->error; - print '
'; + print '
'; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
'; } } 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_templates.php b/htdocs/admin/mails_templates.php index bacc8ef3166..2c35faea3b1 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -160,6 +160,7 @@ if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $tabhelp = array(); $tabhelp[25] = array( + 'label'=>$langs->trans('EnterAnyCode'), 'topic'=>''.$helpsubstit.'', 'joinfiles'=>$langs->trans('AttachMainDocByDefault'), 'content'=>''.$helpsubstit.'', @@ -683,8 +684,8 @@ if ($action == 'view') { $tmpaction = 'create'; $parameters = array( - 'fieldlist' => $fieldlist, - 'tabname' => $tabname[$id] + 'fieldlist' => $fieldlist, + 'tabname' => $tabname[$id] ); $reshook = $hookmanager->executeHooks('createEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error = $hookmanager->error; @@ -822,7 +823,7 @@ if ($resql) { print ''; } elseif ($value == 'fk_user') { print ''; - print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 1, '', 0, '', 'maxwidth150'); + print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'maxwidth150'); print ''; } elseif ($value == 'topic') { print ''; @@ -1187,7 +1188,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') if ($value == 'fk_user') { print ''; if ($user->admin) { - print $form->select_dolusers(empty($obj->{$value}) ? '' : $obj->{$value}, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 1, '', 0, '', 'maxwidth200'); + print $form->select_dolusers(empty($obj->{$value}) ? '' : $obj->{$value}, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'minwidth150 maxwidth300'); } else { if ($context == 'add') { // I am not admin and we show the add form print $user->getNomUrl(1); // Me 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/menus/edit.php b/htdocs/admin/menus/edit.php index aaadde965a2..65906b83f3c 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -281,7 +281,7 @@ if ($action == 'create') { print load_fiche_titre($langs->trans("NewMenu"), '', 'title_setup'); - print ''; + print ''; print ''; print dol_get_fiche_head(); diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 1f31dc639c3..9c2b91ec586 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -133,7 +133,7 @@ if ($action == 'install') { // $original_file should match format module_modulename-x.y[.z].zip $original_file = basename($_FILES["fileinstall"]["name"]); - $original_file = preg_replace('/\(\d+\)\.zip$/i', '.zip', $original_file); + $original_file = preg_replace('/\s*\(\d+\)\.zip$/i', '.zip', $original_file); $newfile = $conf->admin->dir_temp.'/'.$original_file.'/'.$original_file; if (!$original_file) { diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index 95b418a75f0..e8619219471 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -138,7 +138,7 @@ if ($action == 'add_currency') { $TCurrency = array(); -$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE entity = '.$conf->entity; +$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."multicurrency WHERE entity = ".((int) $conf->entity); $resql = $db->query($sql); if ($resql) { while ($obj = $db->fetch_object($resql)) { diff --git a/htdocs/admin/paymentbybanktransfer.php b/htdocs/admin/paymentbybanktransfer.php index ba7690bb6e3..997c71bb335 100644 --- a/htdocs/admin/paymentbybanktransfer.php +++ b/htdocs/admin/paymentbybanktransfer.php @@ -20,7 +20,7 @@ */ /** - * \file htdocs/admin/credtitransfer.php + * \file htdocs/admin/paymentbybanktransfer.php * \ingroup paymentbybanktransfer * \brief Page to setup payments by credit transfer */ @@ -429,7 +429,7 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION)) } - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index c11d5023e27..be45a2101f5 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -307,7 +307,7 @@ for ($i = 1; $i <= 6; $i++) { $pid = false; } } else { - $pid = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; + $pid = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; } if ($pid) { print ''; } else { print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid.''; diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index 8f4c0c6f763..d2f0d79e4f3 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -236,7 +236,7 @@ if ($result) { print ''; - print ''; + print ''; //print img_edit_add(); print img_picto('', 'switch_off'); print ''; diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 90a75626e7c..e09dd13b045 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -443,7 +443,7 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION)) } - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index d6b6d6e428a..05abf8c3995 100644 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -183,7 +183,7 @@ if ($action == 'edit') { if (count($listofmethods)) { print $form->selectarray('MAIN_SMS_SENDMODE', $listofmethods, $conf->global->MAIN_SMS_SENDMODE, 1); } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print ''; diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 00b5fbfdb8e..808528cdc0a 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 ce2c9f0f872..b31e4c9a433 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/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 16e5da99f60..cfc12375050 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -51,7 +51,7 @@ if ($action == 'getlastversion') { $result = getURLContent('https://sourceforge.net/projects/dolibarr/rss'); //var_dump($result['content']); if (function_exists('simplexml_load_string')) { - $sfurl = simplexml_load_string($result['content']); + $sfurl = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET); } else { setEventMessages($langs->trans("ErrorPHPDoesNotSupport", "xml"), null, 'errors'); } diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 272ac8d8f19..5ca87663c7a 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -171,7 +171,7 @@ if (GETPOST('target') == 'remote') { if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') { $xmlfile = $xmlarray['content']; //print "xmlfilestart".$xmlfile."xmlfileend"; - $xml = simplexml_load_string($xmlfile); + $xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET); } else { $errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].(($xmlarray['http_code'] == 400 && $xmlarray['content']) ? ' '.$xmlarray['content'] : '').' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg']; setEventMessages($errormsg, null, 'errors'); diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 150ca10a359..a56ed8c1da3 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -91,6 +91,7 @@ $modules_files = array(); $modules_fullpath = array(); $modulesdir = dolGetModulesDirs(); $rights_ids = array(); +$arrayofpermissions = array(); foreach ($modulesdir as $dir) { $handle = @opendir(dol_osencode($dir)); @@ -155,7 +156,7 @@ foreach ($modules as $key => $module) { if (empty($rights[0])) { continue; } - + $arrayofpermissions[$rights[0]] = array('label'=> 'user->rights->'.$module->rights_class.'->'.$rights[4].(empty($rights[5]) ? '' : '->'.$rights[5])); $permission[] = $rights[0]; array_push($rights_ids, $rights[0]); @@ -336,8 +337,10 @@ foreach ($moduleList as $module) { $idperms = ''; foreach ($module->permission as $permission) { - $idperms .= ($idperms ? ", " : "").$permission; $translationKey = "Permission".$permission; + $labelpermission = $langs->trans($translationKey); + $labelpermission .= ' : '.$arrayofpermissions[$permission]['label']; + $idperms .= ($idperms ? ", " : "").''.$permission.''; if (!empty($conf->global->MAIN_SHOW_PERMISSION)) { if (empty($langs->tab_translate[$translationKey])) { diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index 758a93a765d..bbfa4b85c41 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -63,7 +63,7 @@ print '
'; print ''.$langs->trans("XDebug").': '; $test = !function_exists('xdebug_is_enabled'); if ($test) { - print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotSlowedDownByThis"); + print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' '.$langs->trans("NotSlowedDownByThis").''; } else { print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("XDebug")); print ' - '.$langs->trans("MoreInformation").' XDebug admin page'; diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 5385f56dc72..b0614c7501d 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -98,7 +98,7 @@ if (!ini_get('session.cookie_samesite') || ini_get('session.cookie_samesite') == print '   '.img_warning().' '.$langs->trans("WarningPaypalPaymentNotCompatibleWithStrict").""; } print "
\n"; -print "PHP open_basedir = ".(ini_get('open_basedir') ? ini_get('open_basedir') : yn(0).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("ARestrictedPath").', '.$langs->transnoentitiesnoconv("Example").' '.$_SERVER["DOCUMENT_ROOT"]).')')."
\n"; +print "PHP open_basedir = ".(ini_get('open_basedir') ? ini_get('open_basedir') : yn(0).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("ARestrictedPath").', '.$langs->transnoentitiesnoconv("Example").': '.$_SERVER["DOCUMENT_ROOT"].','.DOL_DATA_ROOT).')')."
\n"; print "PHP allow_url_fopen = ".(ini_get('allow_url_fopen') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_fopen') : yn(0)).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).")
\n"; print "PHP allow_url_include = ".(ini_get('allow_url_include') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_include') : yn(0)).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).")
\n"; //print "PHP safe_mode = ".(ini_get('safe_mode') ? ini_get('safe_mode') : yn(0)).'   '.$langs->trans("Deprecated")." (removed in PHP 5.4)
\n"; @@ -258,6 +258,8 @@ print '
'; print '$dolibarr_nocsrfcheck: '.(empty($dolibarr_nocsrfcheck) ? '0' : $dolibarr_nocsrfcheck); if (!empty($dolibarr_nocsrfcheck)) { print '   '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 0); +} else { + print '   ('.$langs->trans("Recommended").': 0)'; } print '
'; @@ -391,7 +393,7 @@ if (empty($conf->api->enabled) && empty($conf->webservices->enabled)) { print '
'; } if (!empty($conf->api->enabled)) { - print 'API_ENDPOINT_RULES = '.(empty($conf->global->API_ENDPOINT_RULES) ? ''.$langs->trans("Undefined").'   ('.$langs->trans("Example").': endpoint1:1,endpoint2:1,...)' : $conf->global->API_ENDPOINT_RULES)."
\n"; + print 'API_ENDPOINT_RULES = '.(empty($conf->global->API_ENDPOINT_RULES) ? ''.$langs->trans("Undefined").'   ('.$langs->trans("Example").': login:0,users:0,setup:1,status:1,tickets:1,...)' : $conf->global->API_ENDPOINT_RULES)."
\n"; print '
'; } } @@ -442,7 +444,7 @@ print '
'; print 'MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = '.(empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES) ? ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': 1)' : $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)."
"; print '
'; -print 'MAIN_SECURITY_CSRF_WITH_TOKEN = '.(empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN) ? ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': 1)' : $conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)."
"; +print 'MAIN_SECURITY_CSRF_WITH_TOKEN = '.(empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN) ? ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': 2)' : $conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)."
"; print '
'; print 'MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL = '.(empty($conf->global->MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL) ? ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)' : $conf->global->MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL)."
"; diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 4f6977ffb41..ec363ad112d 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -513,7 +513,7 @@ if (!empty($_SESSION["commandbackuplastdone"])) { $_SESSION["commandbackupresult"] = ''; } if (!empty($_SESSION["commandbackuptorun"])) { - print '
'.$langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser", $dolibarr_main_db_user, $dolibarr_main_db_user).':
'."\n"; + print '
'.$langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser", $dolibarr_main_db_user, $dolibarr_main_db_user).':
'."\n"; print '
'."\n"; print ajax_autoselect("commandbackuptoruntext", 0); print '
'; diff --git a/htdocs/admin/tools/purge.php b/htdocs/admin/tools/purge.php index f246a9eb0b2..f6ce58a40c0 100644 --- a/htdocs/admin/tools/purge.php +++ b/htdocs/admin/tools/purge.php @@ -110,7 +110,7 @@ if (!empty($conf->syslog->enabled)) { print '

'; +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/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index f5f301e9c16..16138cdd58c 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2017 Regis Houssin * Copyright (C) 2017 Neil Orley * Copyright (C) 2018-2021 Frédéric France - * Copyright (C) 2018-2020 Thibault FOUCART + * Copyright (C) 2018-2021 Thibault FOUCART * * * This program is free software; you can redistribute it and/or modify @@ -1239,7 +1239,6 @@ class Setup extends DolibarrApi { $list = array(); - //TODO link with multicurrency module $sql = "SELECT t.rowid, t.code, t.label,t.short_label, t.active, t.scale, t.unit_type"; $sql .= " FROM ".MAIN_DB_PREFIX."c_units as t"; $sql .= " WHERE t.active = ".((int) $active); @@ -1279,6 +1278,126 @@ 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(); + + $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 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(); + + $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. * @@ -1683,7 +1802,7 @@ class Setup extends DolibarrApi if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') { $xmlfile = $xmlarray['content']; //print "xmlfilestart".$xmlfile."endxmlfile"; - $xml = simplexml_load_string($xmlfile); + $xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET); } else { $errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].(($xmlarray['http_code'] == 400 && $xmlarray['content']) ? ' '.$xmlarray['content'] : '').' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg']; throw new RestException(500, $errormsg); 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/barcode/codeinit.php b/htdocs/barcode/codeinit.php index 4ebbe832dc5..be76a00099c 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -274,7 +274,7 @@ if ($conf->product->enabled || $conf->product->service) { } else { $disabled = 1; $titleno = $langs->trans("NoBarcodeNumberingTemplateDefined"); - print ''.$langs->trans("NoBarcodeNumberingTemplateDefined").' ('.$langs->trans("ToGenerateCodeDefineAutomaticRuleFirst").')
'; + print ''.$langs->trans("NoBarcodeNumberingTemplateDefined").' ('.$langs->trans("ToGenerateCodeDefineAutomaticRuleFirst").')
'; } if (empty($nbno)) { $disabled1 = 1; diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index ed55f7cf29c..c649b207ef5 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -75,6 +75,7 @@ if ($object->id > 0) { $object->calculateCosts(); } + // Security check - Protection if external user //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; @@ -115,8 +116,13 @@ if (empty($reshook)) { $triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record + // Actions cancel, add, update, delete or clone include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; + // The fetch/fetch_lines was redone into the inc.php so we must recall the calculateCosts() + if ($action == 'confirm_validate' && $object->id > 0) { + $object->calculateCosts(); + } // Actions when linking object each other include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; 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/photos.php b/htdocs/categories/photos.php index 06c3caae43c..5c014b6206f 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -231,7 +231,7 @@ if ($object->id) { // On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i', $obj['photo']) && ($object->imgWidth > $maxWidth || $object->imgHeight > $maxHeight)) { - print ''.img_picto($langs->trans('GenerateThumb'), 'refresh').'  '; + print ''.img_picto($langs->trans('GenerateThumb'), 'refresh').'  '; } if ($user->rights->categorie->creer) { 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/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 79fb13a8717..4a7128fa865 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -865,6 +865,7 @@ class ActionComm extends CommonObject $this->fetchResources(); } } + $this->db->free($resql); } else { $this->error = $this->db->lasterror(); @@ -1245,7 +1246,6 @@ class ActionComm extends CommonObject * Load all objects with filters. * @todo WARNING: This make a fetch on all records instead of making one request with a join. * - * @param DoliDb $db Not used * @param int $socid Filter by thirdparty * @param int $fk_element Id of element action is linked to * @param string $elementtype Type of element action is linked to @@ -1255,7 +1255,7 @@ class ActionComm extends CommonObject * @param string $limit Limit number of answers * @return array|string Error string if KO, array with actions if OK */ - public static function getActions($db, $socid = 0, $fk_element = 0, $elementtype = '', $filter = '', $sortfield = 'a.datep', $sortorder = 'DESC', $limit = 0) + public function getActions($socid = 0, $fk_element = 0, $elementtype = '', $filter = '', $sortfield = 'a.datep', $sortorder = 'DESC', $limit = 0) { global $conf, $langs; @@ -1277,33 +1277,33 @@ class ActionComm extends CommonObject $sql .= " (SELECT fk_actioncomm FROM ".MAIN_DB_PREFIX."actioncomm_resources WHERE"; $sql .= " element_type = 'socpeople' AND fk_element = ".((int) $fk_element).')'; } else { - $sql .= " AND a.fk_element = ".((int) $fk_element)." AND a.elementtype = '".$db->escape($elementtype)."'"; + $sql .= " AND a.fk_element = ".((int) $fk_element)." AND a.elementtype = '".$this->db->escape($elementtype)."'"; } } if (!empty($filter)) { $sql .= $filter; } if ($sortorder && $sortfield) { - $sql .= $db->order($sortfield, $sortorder); + $sql .= $this->db->order($sortfield, $sortorder); } - $sql .= $db->plimit($limit, 0); + $sql .= $this->db->plimit($limit, 0); - $resql = $db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - $num = $db->num_rows($resql); + $num = $this->db->num_rows($resql); if ($num) { for ($i = 0; $i < $num; $i++) { - $obj = $db->fetch_object($resql); - $actioncommstatic = new ActionComm($db); + $obj = $this->db->fetch_object($resql); + $actioncommstatic = new ActionComm($this->db); $actioncommstatic->fetch($obj->id); $resarray[$i] = $actioncommstatic; } } - $db->free($resql); + $this->db->free($resql); return $resarray; } else { - return $db->lasterror(); + return $this->db->lasterror(); } } diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index f891bf722cc..c8ec0621394 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -351,7 +351,7 @@ if ($object->id > 0) { print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client)); $tmpcheck = $object->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongCustomerCode").')'; + print ' ('.$langs->trans("WrongCustomerCode").')'; } print ''; @@ -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/mailing/card.php b/htdocs/comm/mailing/card.php index 2ed56683c02..614bedb8268 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -912,7 +912,7 @@ if ($action == 'create') { } } if (empty($nbemail)) { - $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").''; + $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").''; } if ($text) { print $form->textwithpicto($nbemail, $text, 1, 'warning'); @@ -1161,7 +1161,7 @@ if ($action == 'create') { } } if (empty($nbemail)) { - $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").''; + $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").''; } if ($text) { print $form->textwithpicto($nbemail, $text, 1, 'warning'); diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 3283957f8a2..340ac1dfc8c 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -284,7 +284,7 @@ if ($object->fetch($id) >= 0) { } } if (empty($nbemail)) { - $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").''; + $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").''; } if ($text) { print $form->textwithpicto($nbemail, $text, 1, 'warning'); @@ -378,7 +378,7 @@ if ($object->fetch($id) >= 0) { $var = !$var; if ($allowaddtarget) { - print ''; + print ''; print ''; } else { print '
'; diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index 01abc1e5ef1..66860669e2d 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -184,7 +184,7 @@ if ($result) { $i++; } } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print "

"; $db->free($result); 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/comm/propal/list.php b/htdocs/comm/propal/list.php index da651bfdcd3..269cf9cfd91 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -13,9 +13,9 @@ * Copyright (C) 2016-2021 Ferran Marcet * Copyright (C) 2017-2018 Charlene Benke * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2019 Alexandre Spangaro + * Copyright (C) 2019-2021 Alexandre Spangaro * Copyright (C) 2021 Anthony Berton - * Copyright (C) 2021 Frédéric France + * Copyright (C) 2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -88,12 +88,30 @@ $search_zip = GETPOST('search_zip', 'alpha'); $search_state = GETPOST("search_state"); $search_country = GETPOST("search_country", 'int'); $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); -$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); -$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); -$search_dateend_start = dol_mktime(0, 0, 0, GETPOST('search_dateend_startmonth', 'int'), GETPOST('search_dateend_startday', 'int'), GETPOST('search_dateend_startyear', 'int')); -$search_dateend_end = dol_mktime(23, 59, 59, GETPOST('search_dateend_endmonth', 'int'), GETPOST('search_dateend_endday', 'int'), GETPOST('search_dateend_endyear', 'int')); -$search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int')); -$search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int')); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); +$search_date_end_startday = GETPOST('search_date_end_startday', 'int'); +$search_date_end_startmonth = GETPOST('search_date_end_startmonth', 'int'); +$search_date_end_startyear = GETPOST('search_date_end_startyear', 'int'); +$search_date_end_endday = GETPOST('search_date_end_endday', 'int'); +$search_date_end_endmonth = GETPOST('search_date_end_endmonth', 'int'); +$search_date_end_endyear = GETPOST('search_date_end_endyear', 'int'); +$search_date_end_start = dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear); // Use tzserver +$search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear); +$search_date_delivery_startday = GETPOST('search_date_delivery_startday', 'int'); +$search_date_delivery_startmonth = GETPOST('search_date_delivery_startmonth', 'int'); +$search_date_delivery_startyear = GETPOST('search_date_delivery_startyear', 'int'); +$search_date_delivery_endday = GETPOST('search_date_delivery_endday', 'int'); +$search_date_delivery_endmonth = GETPOST('search_date_delivery_endmonth', 'int'); +$search_date_delivery_endyear = GETPOST('search_date_delivery_endyear', 'int'); +$search_date_delivery_start = dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear); +$search_date_delivery_end = dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear); $search_availability = GETPOST('search_availability', 'int'); $search_categ_cus = GETPOST("search_categ_cus", 'int'); $search_fk_cond_reglement = GETPOST("search_fk_cond_reglement", 'int'); @@ -278,12 +296,30 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_type = ''; $search_country = ''; $search_type_thirdparty = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; $search_date_start = ''; $search_date_end = ''; - $search_dateend_start = ''; - $search_dateend_end = ''; - $search_datedelivery_start = ''; - $search_datedelivery_end = ''; + $search_date_end_startday = ''; + $search_date_end_startmonth = ''; + $search_date_end_startyear = ''; + $search_date_end_endday = ''; + $search_date_end_endmonth = ''; + $search_date_end_endyear = ''; + $search_date_end_start = ''; + $search_date_end_end = ''; + $search_date_delivery_startday = ''; + $search_date_delivery_startmonth = ''; + $search_date_delivery_startyear = ''; + $search_date_delivery_endday = ''; + $search_date_delivery_endmonth = ''; + $search_date_delivery_endyear = ''; + $search_date_delivery_start = ''; + $search_date_delivery_end = ''; $search_availability = ''; $search_status = ''; $object_statut = ''; @@ -472,7 +508,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"; } @@ -635,17 +671,17 @@ if ($search_date_start) { if ($search_date_end) { $sql .= " AND p.datep <= '".$db->idate($search_date_end)."'"; } -if ($search_dateend_start) { - $sql .= " AND p.fin_validite >= '".$db->idate($search_dateend_start)."'"; +if ($search_date_end_start) { + $sql .= " AND p.fin_validite >= '".$db->idate($search_date_end_start)."'"; } -if ($search_dateend_end) { - $sql .= " AND p.fin_validite <= '".$db->idate($search_dateend_end)."'"; +if ($search_date_end_end) { + $sql .= " AND p.fin_validite <= '".$db->idate($search_date_end_end)."'"; } -if ($search_datedelivery_start) { - $sql .= " AND p.date_livraison >= '".$db->idate($search_datedelivery_start)."'"; +if ($search_date_delivery_start) { + $sql .= " AND p.date_livraison >= '".$db->idate($search_date_delivery_start)."'"; } -if ($search_datedelivery_end) { - $sql .= " AND p.date_livraison <= '".$db->idate($search_datedelivery_end)."'"; +if ($search_date_delivery_end) { + $sql .= " AND p.date_livraison <= '".$db->idate($search_date_delivery_end)."'"; } if ($search_sale > 0) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); @@ -720,12 +756,60 @@ if ($resql) { if ($sall) { $param .= '&sall='.urlencode($sall); } - if ($search_date_start) $param .= '&search_date_startday='.urlencode(dol_print_date($search_date_start, '%d')).'&search_date_startmonth='.urlencode(dol_print_date($search_date_start, '%m')).'&search_date_startyear='.urlencode(dol_print_date($search_date_start, '%Y')); - if ($search_date_end) $param .= '&search_date_endday='.urlencode(dol_print_date($search_date_end, '%d')).'&search_date_endmonth='.urlencode(dol_print_date($search_date_end, '%m')).'&search_date_endyear='.urlencode(dol_print_date($search_date_end, '%Y')); - if ($search_dateend_start) $param .= '&search_dateend_startday='.urlencode(dol_print_date($search_dateend_start, '%d')).'&search_dateend_startmonth='.urlencode(dol_print_date($search_dateend_start, '%m')).'&search_dateend_startyear='.urlencode(dol_print_date($search_dateend_start, '%Y')); - if ($search_dateend_end) $param .= '&search_dateend_endday='.urlencode(dol_print_date($search_dateend_end, '%d')).'&search_dateend_endmonth='.urlencode(dol_print_date($search_dateend_end, '%m')).'&search_dateend_endyear='.urlencode(dol_print_date($search_dateend_end, '%Y')); - if ($search_datedelivery_start) $param .= '&search_datedelivery_startday='.urlencode(dol_print_date($search_datedelivery_start, '%d')).'&search_datedelivery_startmonth='.urlencode(dol_print_date($search_datedelivery_start, '%m')).'&search_datedelivery_startyear='.urlencode(dol_print_date($search_datedelivery_start, '%Y')); - if ($search_datedelivery_end) $param .= '&search_datedelivery_endday='.urlencode(dol_print_date($search_datedelivery_end, '%d')).'&search_datedelivery_endmonth='.urlencode(dol_print_date($search_datedelivery_end, '%m')).'&search_datedelivery_endyear='.urlencode(dol_print_date($search_datedelivery_end, '%Y')); + if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); + } + if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + } + if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); + } + if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); + } + if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + } + if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); + } + if ($search_date_end_startday) { + $param .= '&search_date_end_startday='.urlencode($search_date_end_startday); + } + if ($search_date_end_startmonth) { + $param .= '&search_date_end_startmonth='.urlencode($search_date_end_startmonth); + } + if ($search_date_end_startyear) { + $param .= '&search_date_end_startyear='.urlencode($search_date_end_startyear); + } + if ($search_date_end_endday) { + $param .= '&search_date_end_endday='.urlencode($search_date_end_endday); + } + if ($search_date_end_endmonth) { + $param .= '&search_date_end_endmonth='.urlencode($search_date_end_endmonth); + } + if ($search_date_end_endyear) { + $param .= '&search_date_end_endyear='.urlencode($search_date_end_endyear); + } + if ($search_date_delivery_startday) { + $param .= '&search_date_delivery_startday='.urlencode($search_date_delivery_startday); + } + if ($search_date_delivery_startmonth) { + $param .= '&search_date_delivery_startmonth='.urlencode($search_date_delivery_startmonth); + } + if ($search_date_delivery_startyear) { + $param .= '&search_date_delivery_startyear='.urlencode($search_date_delivery_startyear); + } + if ($search_date_delivery_endday) { + $param .= '&search_date_delivery_endday='.urlencode($search_date_delivery_endday); + } + if ($search_date_delivery_endmonth) { + $param .= '&search_date_delivery_endmonth='.urlencode($search_date_delivery_endmonth); + } + if ($search_date_delivery_endyear) { + $param .= '&search_date_delivery_endyear='.urlencode($search_date_delivery_endyear); + } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); } @@ -1025,10 +1109,10 @@ if ($resql) { if (!empty($arrayfields['p.fin_validite']['checked'])) { print ''; print '
'; - print $form->selectDate($search_dateend_start ? $search_dateend_start : -1, 'search_dateend_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print $form->selectDate($search_date_end_start ? $search_date_end_start : -1, 'search_date_end_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; print '
'; - print $form->selectDate($search_dateend_end ? $search_dateend_end : -1, 'search_dateend_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print $form->selectDate($search_date_end_end ? $search_date_end_end : -1, 'search_date_end_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print '
'; print ''; } @@ -1036,10 +1120,10 @@ if ($resql) { if (!empty($arrayfields['p.date_livraison']['checked'])) { print ''; print '
'; - print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print $form->selectDate($search_date_delivery_start ? $search_date_delivery_start : -1, 'search_date_delivery_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; print '
'; - print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print $form->selectDate($search_date_delivery_end ? $search_date_delivery_end : -1, 'search_date_delivery_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; print ''; } @@ -1716,8 +1800,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/class/commande.class.php b/htdocs/commande/class/commande.class.php index 5fce8a81a30..e3675129198 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -299,13 +299,9 @@ class Commande extends CommonOrder 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20), 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>25), - 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>56), - 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>60), + 'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>1, 'position'=>60), + 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>62), 'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>65), - 'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>70), - 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>75), - 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>80), 'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>85), 'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>90), 'source' =>array('type'=>'smallint(6)', 'label'=>'Source', 'enabled'=>1, 'visible'=>-1, 'position'=>95), @@ -344,6 +340,10 @@ class Commande extends CommonOrder 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>270), 'module_source' =>array('type'=>'varchar(32)', 'label'=>'POSModule', 'enabled'=>1, 'visible'=>-1, 'position'=>275), 'pos_source' =>array('type'=>'varchar(32)', 'label'=>'POSTerminal', 'enabled'=>1, 'visible'=>-1, 'position'=>280), + 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>300), + 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>302), + 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>304), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>306), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>400), 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'position'=>500), ); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 22b24c048a2..4e8a18821ff 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -428,7 +428,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)) { @@ -553,7 +553,7 @@ if ($search_state) { if ($search_country) { $sql .= " AND s.fk_pays IN (".$db->sanitize($search_country).')'; } -if ($search_type_thirdparty) { +if ($search_type_thirdparty && $search_type_thirdparty != '-1') { $sql .= " AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).')'; } if ($search_company) { @@ -795,7 +795,7 @@ if ($resql) { if ($search_country != '') { $param .= '&search_country='.urlencode($search_country); } - if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { + if ($search_type_thirdparty && $search_type_thirdparty != '-1') { $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); } if ($search_product_category != '') { @@ -1697,8 +1697,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/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index f6a03c1d11d..eabe47e54ca 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -932,10 +932,10 @@ if ($resql) { $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.urlencode($search_account).'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.urlencode($search_account)), '', $user->rights->banque->modifier); } else // If direct entries is not done using miscellaneous payments { - $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param, '', $user->rights->banque->modifier); + $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&token='.newToken().'&page='.$page.$param, '', $user->rights->banque->modifier); } } else { - $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param, '', -1); + $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&token='.newToken().'&page='.$page.$param, '', -1); } } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 9fd88f44d4f..8396979e247 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1503,7 +1503,7 @@ class Account extends CommonObject { $country_code = $this->getCountryCode(); - if (in_array($country_code, array('FR', 'ES', 'GA', 'IT', 'NC'))) { + if (in_array($country_code, array('AD', 'FR', 'ES', 'GA', 'IT', 'NC'))) { return 1; // France, Spain, Gabon, ... - Not valid for CH } if (in_array($country_code, array('AU', 'BE', 'CA', 'DE', 'DK', 'GR', 'GB', 'ID', 'IE', 'IR', 'KR', 'NL', 'NZ', 'UK', 'US'))) { @@ -1696,21 +1696,21 @@ class Account extends CommonObject /** * Function used to replace a thirdparty id with another one. * - * @param DoliDB $db Database handler + * @param DoliDB $dbs Database handler * @param int $origin_id Old thirdparty id * @param int $dest_id New thirdparty id - * @return bool + * @return bool True=SQL success, False=SQL error */ - public static function replaceThirdparty($db, $origin_id, $dest_id) + public static function replaceThirdparty($dbs, $origin_id, $dest_id) { $sql = "UPDATE ".MAIN_DB_PREFIX."bank_url SET url_id = ".((int) $dest_id)." WHERE url_id = ".((int) $origin_id)." AND type='company'"; - if (!$db->query($sql)) { - //if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B. - //$this->errors = $db->lasterror(); - return false; - } else { + if ($dbs->query($sql)) { return true; + } else { + //if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B. + //$this->errors = $dbs->lasterror(); + return false; } } } 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/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 22cd946275c..4b49c88f8ca 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5783,7 +5783,7 @@ class FactureLigne extends CommonInvoiceLine return 0; } - $sql = 'SELECT situation_percent FROM '.MAIN_DB_PREFIX.'facturedet WHERE rowid='.((int) $this->fk_prev_id); + $sql = "SELECT situation_percent FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".((int) $this->fk_prev_id); $resql = $this->db->query($sql); if ($resql && $resql->num_rows > 0) { $res = $this->db->fetch_array($resql); @@ -5793,9 +5793,9 @@ class FactureLigne extends CommonInvoiceLine if ($include_credit_note) { $sql = 'SELECT fd.situation_percent FROM '.MAIN_DB_PREFIX.'facturedet fd'; $sql .= ' JOIN '.MAIN_DB_PREFIX.'facture f ON (f.rowid = fd.fk_facture) '; - $sql .= ' WHERE fd.fk_prev_id = '.((int) $this->fk_prev_id); - $sql .= ' AND f.situation_cycle_ref = '.((int) $invoicecache[$invoiceid]->situation_cycle_ref); // Prevent cycle outed - $sql .= ' AND f.type = '.Facture::TYPE_CREDIT_NOTE; + $sql .= " WHERE fd.fk_prev_id = ".((int) $this->fk_prev_id); + $sql .= " AND f.situation_cycle_ref = ".((int) $invoicecache[$invoiceid]->situation_cycle_ref); // Prevent cycle outed + $sql .= " AND f.type = ".Facture::TYPE_CREDIT_NOTE; $res = $this->db->query($sql); if ($res) { diff --git a/htdocs/compta/facture/index.php b/htdocs/compta/facture/index.php index d3d3a33acb5..790b9d334c3 100644 --- a/htdocs/compta/facture/index.php +++ b/htdocs/compta/facture/index.php @@ -16,7 +16,7 @@ */ /** - * \file htdocs/compat/facture/index.php + * \file htdocs/compta/facture/index.php * \ingroup facture * \brief Home page of customer invoices area */ diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index e6a49cf6077..852589dbd1a 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -549,7 +549,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) { @@ -572,7 +572,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 } @@ -1846,8 +1846,8 @@ if ($resql) { } // Alias if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''; - print $obj->name_alias; + print ''; + print dol_escape_htmltag($obj->name_alias); print ''; if (!$i) { $totalarray['nbfield']++; @@ -1855,8 +1855,8 @@ if ($resql) { } // Town if (!empty($arrayfields['s.town']['checked'])) { - print ''; - print $obj->town; + print ''; + print dol_escape_htmltag($obj->town); print ''; if (!$i) { $totalarray['nbfield']++; @@ -1865,7 +1865,7 @@ if ($resql) { // Zip if (!empty($arrayfields['s.zip']['checked'])) { print ''; - print $obj->zip; + print dol_escape_htmltag($obj->zip); print ''; if (!$i) { $totalarray['nbfield']++; @@ -1873,7 +1873,7 @@ if ($resql) { } // State if (!empty($arrayfields['state.nom']['checked'])) { - print "".$obj->state_name."\n"; + print "".dol_escape_htmltag($obj->state_name)."\n"; if (!$i) { $totalarray['nbfield']++; } @@ -1936,7 +1936,7 @@ if ($resql) { // Module Source if (!empty($arrayfields['f.module_source']['checked'])) { print ''; - print $obj->module_source; + print dol_escape_htmltag($obj->module_source); print ''; if (!$i) { $totalarray['nbfield']++; @@ -1946,7 +1946,7 @@ if ($resql) { // POS Terminal if (!empty($arrayfields['f.pos_source']['checked'])) { print ''; - print $obj->pos_source; + print dol_escape_htmltag($obj->pos_source); print ''; if (!$i) { $totalarray['nbfield']++; @@ -2013,8 +2013,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/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/index.php b/htdocs/compta/index.php index ca7cd08a6fe..b0109d69fe5 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -206,6 +206,7 @@ if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) { print ''; print ''; + print ''; @@ -222,15 +223,19 @@ if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) { print '
'; print $tmpinvoice->getNomUrl(1, ''); print '
'; print ''; - print ''; + + print ''; print $thirdpartystatic->getNomUrl(1, 'customer', 44); print ''; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) { print ''.price($obj->total_ht).''; } print ''.price($obj->total_ttc).''; + print ''.dol_print_date($db->jdate($obj->tms), 'day').''; + print ''.$tmpinvoice->getLibStatut(3, $obj->am).''; + print ''; $total_ttc += $obj->total_ttc; @@ -706,7 +711,7 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user print "\n"; } - print ''.$langs->trans("Total").'   ('.$langs->trans("RemainderToBill").': '.price($tot_tobill).') '; + print ''.$langs->trans("Total").'   ('.$langs->trans("RemainderToBill").': '.price($tot_tobill).') '; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) { print ''.price($tot_ht).''; } 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/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 3e1dc59a52e..aab54e4ef81 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -304,8 +304,8 @@ class Paiement extends CommonObject $facid = $key; if (is_numeric($amount) && $amount <> 0) { $amount = price2num($amount); - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiement_facture (fk_facture, fk_paiement, amount, multicurrency_amount)'; - $sql .= ' VALUES ('.((int) $facid).', '.((int) $this->id).", ".((float) $amount).", ".((float) $this->multicurrency_amounts[$key]).')'; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement_facture (fk_facture, fk_paiement, amount, multicurrency_amount)"; + $sql .= " VALUES (".((int) $facid).", ".((int) $this->id).", ".((float) $amount).", ".((float) $this->multicurrency_amounts[$key]).")"; dol_syslog(get_class($this).'::create Amount line '.$key.' insert paiement_facture', LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index 25763dd8339..009f99fccf1 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -48,7 +48,7 @@ $result = restrictedArea($user, 'paymentbybanktransfer', '', ''); * Actions */ - +// None /* @@ -166,7 +166,7 @@ if ($resql) { $i++; } } else { - print ''.$langs->trans("NoSupplierInvoiceToWithdraw", $langs->transnoentitiesnoconv("BankTransfer")).''; + print ''.$langs->trans("NoSupplierInvoiceToWithdraw", $langs->transnoentitiesnoconv("BankTransfer")).''; } print "

"; } else { @@ -223,7 +223,7 @@ if ($result) { $i++; } } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print "

"; diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 257e7617531..a2de75123a0 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -33,11 +33,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadLangs(array('banks', 'categories', 'bills', 'companies', 'withdrawals')); -// Security check -if ($user->socid > 0) { - accessforbidden(); -} - // Get supervariables $action = GETPOST('action', 'aZ09'); $id = GETPOST('id', 'int'); @@ -71,11 +66,11 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ $hookmanager->initHooks(array('directdebitprevcard', 'globalcard', 'directdebitprevlist')); -if (!$user->rights->prelevement->bons->lire && $object->type != 'bank-transfer') { - accessforbidden(); -} -if (!$user->rights->paymentbybanktransfer->read && $object->type == 'bank-transfer') { - accessforbidden(); +$type = $object->type; +if ($type == 'bank-transfer') { + $result = restrictedArea($user, 'paymentbybanktransfer', '', '', ''); +} else { + $result = restrictedArea($user, 'prelevement', '', '', 'bons'); } @@ -198,8 +193,7 @@ if ($id > 0 || $ref) { print '
'; print ''; - //print ''; - print ''; + print ''; print ''; @@ -237,7 +231,7 @@ if ($id > 0 || $ref) { $acc = new Account($db); $result = $acc->fetch(($object->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT)); - print ''; print ''; - print ''; $thirdparty = new Societe($db); diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index 1c57feca37e..dfd8a920f93 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -137,29 +137,31 @@ class LignePrelevement return $langs->trans($this->statuts[$status]); } elseif ($mode == 1) { if ($status == 0) { - return img_picto($langs->trans($this->statuts[$status]), 'statut1').' '.$langs->trans($this->statuts[$status]); // Waiting + return img_picto($langs->trans($this->statuts[$status]), 'statut1', 'class="valignmiddle"').' '.$langs->trans($this->statuts[$status]); // Waiting } elseif ($status == 2) { - return img_picto($langs->trans($this->statuts[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); // Credited + return img_picto($langs->trans($this->statuts[$status]), 'statut6', 'class="valignmiddle"').' '.$langs->trans($this->statuts[$status]); // Credited } elseif ($status == 3) { - return img_picto($langs->trans($this->statuts[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]); // Refused + return img_picto($langs->trans($this->statuts[$status]), 'statut8', 'class="valignmiddle"').' '.$langs->trans($this->statuts[$status]); // Refused } } elseif ($mode == 2) { if ($status == 0) { - return img_picto($langs->trans($this->statuts[$status]), 'statut1'); + return img_picto($langs->trans($this->statuts[$status]), 'statut1', 'class="valignmiddle"'); } elseif ($status == 2) { - return img_picto($langs->trans($this->statuts[$status]), 'statut6'); + return img_picto($langs->trans($this->statuts[$status]), 'statut6', 'class="valignmiddle"'); } elseif ($status == 3) { - return img_picto($langs->trans($this->statuts[$status]), 'statut8'); + return img_picto($langs->trans($this->statuts[$status]), 'statut8', 'class="valignmiddle"'); } } elseif ($mode == 3) { if ($status == 0) { - return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut1'); + return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut1', 'class="valignmiddle"'); } elseif ($status == 2) { - return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut6'); + return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut6', 'class="valignmiddle"'); } elseif ($status == 3) { - return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut8'); + return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut8', 'class="valignmiddle"'); } } + + //return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } /** diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index fe074bcb9d0..03dfd0288bd 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -39,12 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies', 'bills')); -// Security check -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'prelevement', '', '', 'bons'); - $type = GETPOST('type', 'aZ09'); // Get supervariables @@ -63,6 +57,16 @@ $offset = $limit * $page; $hookmanager->initHooks(array('directdebitcreatecard', 'globalcard')); +// Security check +if ($user->socid) { + $socid = $user->socid; +} +if ($type == 'bank-transfer') { + $result = restrictedArea($user, 'paymentbybanktransfer', '', '', ''); +} else { + $result = restrictedArea($user, 'prelevement', '', '', 'bons'); +} + /* * Actions @@ -141,7 +145,11 @@ if (empty($reshook)) { } } $objectclass = "BonPrelevement"; - $uploaddir = $conf->prelevement->dir_output; + if ($type == 'bank-transfer') { + $uploaddir = $conf->paymentbybanktransfer->dir_output; + } else { + $uploaddir = $conf->prelevement->dir_output; + } include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 0230e4cb726..cb10e9248f1 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -37,10 +37,6 @@ $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies')); // Security check $socid = GETPOST('socid', 'int'); $status = GETPOST('status', 'int'); -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'prelevement', '', '', 'bons'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'directdebitcredittransferlist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page @@ -73,6 +69,15 @@ $massactionbutton = ''; $hookmanager->initHooks(array('withdrawalstodolist')); +if ($user->socid) { + $socid = $user->socid; +} +if ($type == 'bank-transfer') { + $result = restrictedArea($user, 'paymentbybanktransfer', '', '', ''); +} else { + $result = restrictedArea($user, 'prelevement', '', '', 'bons'); +} + /* * Actions diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index c00c29e1c39..067f76ed2c8 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -34,11 +34,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadLangs(array('banks', 'categories', 'bills', 'companies', 'withdrawals')); -// Securite acces client -if ($user->socid > 0) { - accessforbidden(); -} - // Get supervariables $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); @@ -70,11 +65,16 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ $hookmanager->initHooks(array('directdebitprevcard', 'globalcard', 'directdebitprevlist')); -if (!$user->rights->prelevement->bons->lire && $object->type != 'bank-transfer') { +// Security check +if ($user->socid > 0) { accessforbidden(); } -if (!$user->rights->paymentbybanktransfer->read && $object->type == 'bank-transfer') { - accessforbidden(); + +$type = $object->type; +if ($type == 'bank-transfer') { + $result = restrictedArea($user, 'paymentbybanktransfer', '', '', ''); +} else { + $result = restrictedArea($user, 'prelevement', '', '', 'bons'); } @@ -100,8 +100,8 @@ if ($id > 0 || $ref) { print '
'; print '
'.$langs->trans("Ref").''.$object->getNomUrl(1).'
'.$langs->trans("Date").''.dol_print_date($object->datec, 'day').'
'.$langs->trans("Date").''.dol_print_date($object->datec, 'day').'
'.$langs->trans("Amount").''.price($object->amount).'
'; + print '
'; $labelofbankfield = "BankToReceiveWithdraw"; if ($object->type == 'bank-transfer') { $labelofbankfield = 'BankToPayCreditTransfer'; @@ -251,7 +245,7 @@ if ($id > 0 || $ref) { print '
'; + print '
'; $labelfororderfield = 'WithdrawalFile'; if ($object->type == 'bank-transfer') { $labelfororderfield = 'CreditTransferFile'; @@ -412,10 +406,9 @@ if ($id > 0 || $ref) { // Status of line print ""; + print ''; print $ligne->LibStatut($obj->statut, 2); - print " "; - print ''; - print sprintf("%06s", $obj->rowid); + print ''.$obj->rowid.''; print '
'."\n"; - //print ''; - print ''; + //print ''; + print ''; print ''; if ($object->date_trans <> 0) { @@ -131,7 +131,7 @@ if ($id > 0 || $ref) { $acc = new Account($db); $result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT); - print ''; print ''; - print ''; + print ''; } print "
'.$langs->trans("Ref").''.$object->getNomUrl(1).'
'.$langs->trans("Date").''.dol_print_date($object->datec, 'day').'
'.$langs->trans("Ref").''.$object->getNomUrl(1).'
'.$langs->trans("Date").''.dol_print_date($object->datec, 'day').'
'.$langs->trans("Amount").''.price($object->amount).'
'; + print '
'; $labelofbankfield = "BankToReceiveWithdraw"; if ($object->type == 'bank-transfer') { $labelofbankfield = 'BankToPayCreditTransfer'; @@ -145,7 +145,7 @@ if ($id > 0 || $ref) { print '
'; + print '
'; $labelfororderfield = 'WithdrawalFile'; if ($object->type == 'bank-transfer') { $labelfororderfield = 'CreditTransferFile'; diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index 8711f663d55..febc4827a94 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -62,11 +62,16 @@ $object = new BonPrelevement($db); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals -if (!$user->rights->prelevement->bons->lire && $object->type != 'bank-transfer') { +// Security check +if ($user->socid > 0) { accessforbidden(); } -if (!$user->rights->paymentbybanktransfer->read && $object->type == 'bank-transfer') { - accessforbidden(); + +$type = $object->type; +if ($type == 'bank-transfer') { + $result = restrictedArea($user, 'paymentbybanktransfer', '', '', ''); +} else { + $result = restrictedArea($user, 'prelevement', '', '', 'bons'); } @@ -90,8 +95,8 @@ if ($prev_id > 0 || $ref) { print '
'; print ''."\n"; - //print ''; - print ''; + //print ''; + print ''; print ''; if ($object->date_trans <> 0) { @@ -121,7 +126,7 @@ if ($prev_id > 0 || $ref) { $acc = new Account($db); $result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT); - print ''; print ''; - print ''; print ''; - print ''; + + print ''; + print ''; if ($lipre->statut == 3) { @@ -159,6 +163,7 @@ if ($id) { $resf = $rej->fetch($lipre->id); if ($resf == 0) { print ''; + print ''; + print ''; } else { print ''; @@ -229,7 +235,7 @@ if ($id) { /* * Action bar */ - print "
"; + print '
'; if ($action == '') { if ($bon->statut == BonPrelevement::STATUS_CREDITED) { @@ -245,7 +251,7 @@ if ($id) { } } - print "
"; + print '
'; /* * List of invoices @@ -267,7 +273,7 @@ if ($id) { if ($socid) { $sql .= " AND s.rowid = ".((int) $socid); } - $sql .= " ORDER BY $sortfield $sortorder "; + $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($conf->liste_limit + 1, $offset); $result = $db->query($sql); diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index feb69bdc7fb..ae92286dfec 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -42,13 +42,6 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'di $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') -// Security check -$socid = GETPOST('socid', 'int'); -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'prelevement', '', '', 'bons'); - $type = GETPOST('type', 'aZ09'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; @@ -80,6 +73,17 @@ $company = new Societe($db); $hookmanager->initHooks(array('withdrawalsreceiptslineslist')); +// Security check +$socid = GETPOST('socid', 'int'); +if ($user->socid) { + $socid = $user->socid; +} +if ($type == 'bank-transfer') { + $result = restrictedArea($user, 'paymentbybanktransfer', '', '', ''); +} else { + $result = restrictedArea($user, 'prelevement', '', '', 'bons'); +} + /* * Actions @@ -274,7 +278,7 @@ if ($result) { $i++; } } else { - print ''; + print ''; } print "
'.$langs->trans("Ref").''.$object->getNomUrl(1).'
'.$langs->trans("Date").''.dol_print_date($object->datec, 'day').'
'.$langs->trans("Ref").''.$object->getNomUrl(1).'
'.$langs->trans("Date").''.dol_print_date($object->datec, 'day').'
'.$langs->trans("Amount").''.price($object->amount).'
'; + print '
'; $labelofbankfield = "BankToReceiveWithdraw"; if ($object->type == 'bank-transfer') { $labelofbankfield = 'BankToPayCreditTransfer'; @@ -135,7 +140,7 @@ if ($prev_id > 0 || $ref) { print '
'; + print '
'; $labelfororderfield = 'WithdrawalFile'; if ($object->type == 'bank-transfer') { $labelfororderfield = 'CreditTransferFile'; diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index 4a9bfbf6345..8255c537442 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -32,11 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadLangs(array("banks", "categories", 'withdrawals', 'bills')); -// Security check -if ($user->socid > 0) { - accessforbidden(); -} - // Get supervariables $prev_id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); @@ -61,11 +56,16 @@ $object = new BonPrelevement($db); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals -if (!$user->rights->prelevement->bons->lire && $object->type != 'bank-transfer') { +// Security check +if ($user->socid > 0) { accessforbidden(); } -if (!$user->rights->paymentbybanktransfer->read && $object->type == 'bank-transfer') { - accessforbidden(); + +$type = $object->type; +if ($type == 'bank-transfer') { + $result = restrictedArea($user, 'paymentbybanktransfer', '', '', ''); +} else { + $result = restrictedArea($user, 'prelevement', '', '', 'bons'); } @@ -89,8 +89,8 @@ if ($prev_id > 0 || $ref) { print '
'; print ''."\n"; - //print ''; - print ''; + //print ''; + print ''; print ''; if ($object->date_trans <> 0) { @@ -120,7 +120,7 @@ if ($prev_id > 0 || $ref) { $acc = new Account($db); $result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT); - print ''; + print ''; } print "
'.$langs->trans("Ref").''.$object->getNomUrl(1).'
'.$langs->trans("Date").''.dol_print_date($object->datec, 'day').'
'.$langs->trans("Ref").''.$object->getNomUrl(1).'
'.$langs->trans("Date").''.dol_print_date($object->datec, 'day').'
'.$langs->trans("Amount").''.price($object->amount).'
'; + print '
'; $labelofbankfield = "BankToReceiveWithdraw"; if ($object->type == 'bank-transfer') { $labelofbankfield = 'BankToPayCreditTransfer'; diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index c0f89a7e046..93f2305c60f 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -41,14 +41,14 @@ $socid = GETPOST('socid', 'int'); if ($user->socid) { $socid = $user->socid; } -$result = restrictedArea($user, 'prelevement', '', ''); +$result = restrictedArea($user, 'prelevement', '', 'bons'); /* * Actions */ - +// None /* @@ -225,7 +225,7 @@ if ($result) { $i++; } } else { - print '
'.$langs->trans("None").'
'.$langs->trans("None").'

"; diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index bea351ac46c..38ea2fb1d52 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -35,11 +35,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadlangs(array('banks', 'categories', 'bills', 'withdrawals')); -// Security check -if ($user->socid > 0) { - accessforbidden(); -} - // Get supervariables $action = GETPOST('action', 'aZ09'); $id = GETPOST('id', 'int'); @@ -66,6 +61,13 @@ if ($sortfield == "") { $sortfield = "pl.fk_soc"; } +$type = $object->type; +if ($type == 'bank-transfer') { + $result = restrictedArea($user, 'paymentbybanktransfer', '', '', ''); +} else { + $result = restrictedArea($user, 'prelevement', '', '', 'bons'); +} + /* * Actions @@ -151,7 +153,9 @@ if ($id) { print $bon->getNomUrl(1).'
'.$langs->trans("Date").''.dol_print_date($bon->datec, 'day').'
'.$langs->trans("Amount").''.price($lipre->amount).'
'.$langs->trans("Amount").''.price($lipre->amount).'
'.$langs->trans("Status").''.$lipre->LibStatut($lipre->statut, 1).'
'.$langs->trans("RefusedReason").''.$rej->motif.'
'.$langs->trans("RefusedData").''; if ($rej->date_rejet == 0) { /* Historique pour certaines install */ @@ -167,6 +172,7 @@ if ($id) { print dol_print_date($rej->date_rejet, 'day'); } print '
'.$langs->trans("RefusedInvoicing").''.$rej->invoicing.'
'.$resf.'
'.$langs->trans("None").'
'.$langs->trans("None").'
"; print ''; diff --git a/htdocs/compta/prelevement/orders_list.php b/htdocs/compta/prelevement/orders_list.php index 3ca9ce32fbe..be7c72907fd 100644 --- a/htdocs/compta/prelevement/orders_list.php +++ b/htdocs/compta/prelevement/orders_list.php @@ -33,13 +33,6 @@ $langs->loadLangs(array('banks', 'categories', 'withdrawals')); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'directdebitcredittransferlist'; // To manage different context of search -// Security check -$socid = GETPOST('socid', 'int'); -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'prelevement', '', '', 'bons'); - $type = GETPOST('type', 'aZ09'); $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; @@ -72,6 +65,17 @@ if ($type == 'bank-transfer') { $usercancreate = $user->rights->paymentbybanktransfer->create; } +// Security check +$socid = GETPOST('socid', 'int'); +if ($user->socid) { + $socid = $user->socid; +} +if ($type == 'bank-transfer') { + $result = restrictedArea($user, 'paymentbybanktransfer', '', '', ''); +} else { + $result = restrictedArea($user, 'prelevement', '', '', 'bons'); +} + /* * Actions @@ -137,15 +141,15 @@ if ($result) { $newcardbutton = ''; if ($usercancreate) { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewStandingOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php'); + $newcardbutton .= dolGetButtonTitle($langs->trans('NewStandingOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php?type='.urlencode($type)); } // Lines of title fields print ''; + print ''; if ($optioncss != '') { print ''; } - print ''; print ''; print ''; print ''; @@ -217,7 +221,7 @@ if ($result) { $i++; } } else { - print '
'.$langs->trans("None").'
'.$langs->trans("None").'
"; diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php index ed8c704bcfa..029d5dd8598 100644 --- a/htdocs/compta/prelevement/rejets.php +++ b/htdocs/compta/prelevement/rejets.php @@ -33,13 +33,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies')); -// Security check -$socid = GETPOST('socid', 'int'); -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'prelevement', '', '', 'bons'); - $type = GETPOST('type', 'aZ09'); // Get supervariables @@ -54,6 +47,17 @@ $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; +// Security check +$socid = GETPOST('socid', 'int'); +if ($user->socid) { + $socid = $user->socid; +} +if ($type == 'bank-transfer') { + $result = restrictedArea($user, 'paymentbybanktransfer', '', '', ''); +} else { + $result = restrictedArea($user, 'prelevement', '', '', 'bons'); +} + /* * View @@ -140,7 +144,7 @@ if ($result) { $i++; } } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print ""; diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php index ae1dd54a13c..9c30db6e08a 100644 --- a/htdocs/compta/prelevement/stats.php +++ b/htdocs/compta/prelevement/stats.php @@ -31,14 +31,18 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies')); +$type = GETPOST('type', 'aZ09'); + // Security check $socid = GETPOST('socid', 'int'); if ($user->socid) { $socid = $user->socid; } -$result = restrictedArea($user, 'prelevement', '', '', 'bons'); - -$type = GETPOST('type', 'aZ09'); +if ($type == 'bank-transfer') { + $result = restrictedArea($user, 'paymentbybanktransfer', '', '', ''); +} else { + $result = restrictedArea($user, 'prelevement', '', '', 'bons'); +} /* 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/class/contact.class.php b/htdocs/contact/class/contact.class.php index e03010cb5a5..1aecac97f19 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -165,7 +165,8 @@ class Contact extends CommonObject /** * @var int Thirdparty ID */ - public $socid; + public $socid; // both socid and fk_soc are used + public $fk_soc; // both socid and fk_soc are used /** * @var int 0=inactive, 1=active @@ -1027,7 +1028,8 @@ class Contact extends CommonObject $this->country_code = $obj->country_id ? $obj->country_code : ''; $this->country = $obj->country_id ? ($langs->trans('Country'.$obj->country_code) != 'Country'.$obj->country_code ? $langs->transnoentities('Country'.$obj->country_code) : $obj->country) : ''; - $this->socid = $obj->fk_soc; + $this->fk_soc = $obj->fk_soc; // Both fk_soc and socid are used + $this->socid = $obj->fk_soc; // Both fk_soc and socid are used $this->socname = $obj->socname; $this->poste = $obj->poste; $this->statut = $obj->statut; diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 974bfb15e77..bb610baa4b0 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -645,7 +645,7 @@ if ($sql_select) { print_liste_field_titre('Quantity', $_SERVER['PHP_SELF'], 'prod_qty', '', $param, '', $sortfield, $sortorder, 'right '); print "\n"; - print ''.$langs->trans("SelectElementAndClick", $langs->transnoentitiesnoconv("Search")).''; + print ''.$langs->trans("SelectElementAndClick", $langs->transnoentitiesnoconv("Search")).''; print ""; } else { @@ -653,7 +653,7 @@ if ($sql_select) { print ''."\n"; - print ''; + print ''; print "
'.$langs->trans("FeatureNotYetAvailable").'
'.$langs->trans("FeatureNotYetAvailable").'
"; } diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php index 79696d12997..8babb849e7e 100644 --- a/htdocs/contact/ldap.php +++ b/htdocs/contact/ldap.php @@ -173,7 +173,7 @@ if ($result > 0) { // Show tree if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) { if (!is_array($records)) { - print ''.$langs->trans("ErrorFailedToReadLDAP").''; + print ''.$langs->trans("ErrorFailedToReadLDAP").''; } else { $result = show_ldap_content($records, 0, $records['count'], true); } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index bae32e8b3b1..71e888540b2 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -575,13 +575,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/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/contrat/list.php b/htdocs/contrat/list.php index 66d84874d76..7e19ec13e22 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -431,40 +431,40 @@ if ($search_ref_supplier != '') { if ($search_op2df != '') { $param .= '&search_op2df='.urlencode($search_op2df); } -if ($search_date_startday) { +if ($search_date_startday > 0) { $param .= '&search_date_startday='.urlencode($search_date_startday); } -if ($search_date_startmonth) { +if ($search_date_startmonth > 0) { $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); } -if ($search_date_startyear) { +if ($search_date_startyear > 0) { $param .= '&search_date_startyear='.urlencode($search_date_startyear); } -if ($search_date_endday) { +if ($search_date_endday > 0) { $param .= '&search_date_endday='.urlencode($search_date_endday); } -if ($search_date_endmonth) { +if ($search_date_endmonth > 0) { $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); } -if ($search_date_endyear) { +if ($search_date_endyear > 0) { $param .= '&search_date_endyear='.urlencode($search_date_endyear); } -if ($search_dfyear != '') { +if ($search_dfyear > 0) { $param .= '&search_dfyear='.urlencode($search_dfyear); } -if ($search_dfmonth != '') { +if ($search_dfmonth > 0) { $param .= '&search_dfmonth='.urlencode($search_dfmonth); } -if ($search_sale != '') { +if ($search_sale > 0) { $param .= '&search_sale='.urlencode($search_sale); } -if ($search_user != '') { +if ($search_user > 0) { $param .= '&search_user='.urlencode($search_user); } -if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { +if ($search_type_thirdparty > 0) { $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); } -if ($search_product_category != '') { +if ($search_product_category > 0) { $param .= '&search_product_category='.urlencode($search_product_category); } if ($show_files) { diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 2cc477520ea..a6157d2a26b 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -129,6 +129,7 @@ if ($action == 'add' && !empty($permissiontoadd)) { if (!$error) { $result = $object->create($user); + var_dump($object);exit; if ($result > 0) { // Creation OK if ($conf->categorie->enabled && method_exists($object, 'setCategories')) { diff --git a/htdocs/core/actions_builddoc.inc.php b/htdocs/core/actions_builddoc.inc.php index 4e2165d6f38..c813e8af4a0 100644 --- a/htdocs/core/actions_builddoc.inc.php +++ b/htdocs/core/actions_builddoc.inc.php @@ -102,12 +102,12 @@ if ($action == 'builddoc' && $permissiontoadd) { if (empty($donotredirect)) { // This is set when include is done by bulk action "Bill Orders" setEventMessages($langs->trans("FileGenerated"), null); - $urltoredirect = $_SERVER['REQUEST_URI']; + /*$urltoredirect = $_SERVER['REQUEST_URI']; $urltoredirect = preg_replace('/#builddoc$/', '', $urltoredirect); $urltoredirect = preg_replace('/action=builddoc&?/', '', $urltoredirect); // To avoid infinite loop header('Location: '.$urltoredirect.'#builddoc'); - exit; + exit;*/ } } } diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index d10cd2d2f02..00bfe865aaa 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -357,7 +357,7 @@ if (!$error && $massaction == 'confirm_presend') { $tmp = explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES); $from = trim($tmp[($reg[1] - 1)]); } elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) { - $sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE rowid = '.(int) $reg[1]; + $sql = "SELECT rowid, label, email FROM ".MAIN_DB_PREFIX."c_email_senderprofile WHERE rowid = ".(int) $reg[1]; $resql = $db->query($sql); $obj = $db->fetch_object($resql); if ($obj) { diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 810a23957fd..a3da2812067 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -334,7 +334,7 @@ if ($type == 'directory') { $textifempty = $langs->trans('NoFileFound'); } elseif ($section === '0') { if ($module == 'ecm') { - $textifempty = '
'.$langs->trans("DirNotSynchronizedSyncFirst").'

'; + $textifempty = '
'.$langs->trans("DirNotSynchronizedSyncFirst").'

'; } else { $textifempty = $langs->trans('NoFileFound'); } diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index 9a0a11f04d4..d63726dcea6 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -283,7 +283,7 @@ if (empty($conf->use_javascript_ajax) || !empty($conf->global->MAIN_ECM_DISABLE_ print ''; print ''; if ($nbofsubdir && $nboffilesinsubdir) { - print '+'.$nboffilesinsubdir.' '; + print '+'.$nboffilesinsubdir.' '; } print ''; @@ -439,7 +439,7 @@ function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, print ''; print ''; if ($nbofsubdir > 0 && $nboffilesinsubdir > 0) { - print '+'.$nboffilesinsubdir.' '; + print '+'.$nboffilesinsubdir.' '; } print ''; diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php index 6047d8d289c..52cc23faf8f 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; } elseif ($table_element_line == 'projet_task' && $fk_element == 'fk_projet' && $user->rights->projet->creer) { $perm = 1; } else { diff --git a/htdocs/core/boxes/box_members_by_type.php b/htdocs/core/boxes/box_members_by_type.php index 5b95b58d29d..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 = !($user->rights->adherent->lire); + $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire); } /** diff --git a/htdocs/core/boxes/box_members_last_modified.php b/htdocs/core/boxes/box_members_last_modified.php index 9de6a3af12f..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 = !($user->rights->adherent->lire); + $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire); } /** diff --git a/htdocs/core/boxes/box_members_last_subscriptions.php b/htdocs/core/boxes/box_members_last_subscriptions.php index 3cea44c2dc3..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 = !($user->rights->adherent->lire); + $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire); } /** diff --git a/htdocs/core/boxes/box_members_subscriptions_by_year.php b/htdocs/core/boxes/box_members_subscriptions_by_year.php index be835511c6b..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 = !($user->rights->adherent->lire); + $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire); } /** diff --git a/htdocs/core/boxes/box_validated_projects.php b/htdocs/core/boxes/box_validated_projects.php index d756e1461ea..3f2b2cdc221 100644 --- a/htdocs/core/boxes/box_validated_projects.php +++ b/htdocs/core/boxes/box_validated_projects.php @@ -157,7 +157,7 @@ class box_validated_projects extends ModeleBoxes ); if ($objp->fk_soc > 0) { - $sql = 'SELECT rowid, nom as name FROM '.MAIN_DB_PREFIX.'societe WHERE rowid = '.((int) $objp->fk_soc); + $sql = "SELECT rowid, nom as name FROM ".MAIN_DB_PREFIX."societe WHERE rowid = ".((int) $objp->fk_soc); $resql = $this->db->query($sql); //$socstatic = new Societe($this->db); $obj2 = $this->db->fetch_object($resql); diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 3f75ee30d02..7183605ae10 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -220,6 +220,7 @@ abstract class CommonDocGenerator // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Define array with couple substitution key => substitution value + * For example {company_name}, {company_name_alias} * * @param Societe $object Object * @param Translate $outputlangs Language object for output diff --git a/htdocs/core/class/commonincoterm.class.php b/htdocs/core/class/commonincoterm.class.php index 11af43c2914..d0485acc5a9 100644 --- a/htdocs/core/class/commonincoterm.class.php +++ b/htdocs/core/class/commonincoterm.class.php @@ -60,7 +60,7 @@ trait CommonIncoterm $this->label_incoterms = ''; if (!empty($this->fk_incoterms)) { - $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms; + $sql = "SELECT code FROM ".MAIN_DB_PREFIX."c_incoterms WHERE rowid = ".(int) $this->fk_incoterms; $result = $this->db->query($sql); if ($result) { $res = $this->db->fetch_object($result); @@ -80,7 +80,7 @@ trait CommonIncoterm */ public function getIncotermsForPDF() { - $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms; + $sql = "SELECT code FROM ".MAIN_DB_PREFIX."c_incoterms WHERE rowid = ".(int) $this->fk_incoterms; $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -107,7 +107,7 @@ trait CommonIncoterm { if ($this->id && $this->table_element) { $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; - $sql .= " SET fk_incoterms = ".($id_incoterm > 0 ? $id_incoterm : "null"); + $sql .= " SET fk_incoterms = ".($id_incoterm > 0 ? ((int) $id_incoterm) : "null"); $sql .= ", location_incoterms = ".($id_incoterm > 0 ? "'".$this->db->escape($location)."'" : "null"); $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this).'::setIncoterms', LOG_DEBUG); @@ -116,7 +116,7 @@ trait CommonIncoterm $this->fk_incoterms = $id_incoterm; $this->location_incoterms = $location; - $sql = 'SELECT libelle as label_incotermsFROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms; + $sql = "SELECT libelle as label_incoterms FROM ".MAIN_DB_PREFIX."c_incoterms WHERE rowid = ".(int) $this->fk_incoterms; $res = $this->db->query($sql); if ($res) { $obj = $this->db->fetch_object($res); diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index dfabfd24ebe..3b98d3f3356 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -226,8 +226,8 @@ abstract class CommonInvoice extends CommonObject $idarray = array(); $sql = 'SELECT rowid'; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element; - $sql .= ' WHERE fk_facture_source = '.((int) $this->id); + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; + $sql .= " WHERE fk_facture_source = ".((int) $this->id); $sql .= ' AND type = 2'; $resql = $this->db->query($sql); if ($resql) { @@ -253,8 +253,8 @@ abstract class CommonInvoice extends CommonObject public function getIdReplacingInvoice($option = '') { $sql = 'SELECT rowid'; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element; - $sql .= ' WHERE fk_facture_source = '.((int) $this->id); + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; + $sql .= " WHERE fk_facture_source = ".((int) $this->id); $sql .= ' AND type < 2'; if ($option == 'validated') { $sql .= ' AND fk_statut = 1'; @@ -306,8 +306,8 @@ abstract class CommonInvoice extends CommonObject $sharedentity = 'facture_fourn'; } - $sql = 'SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code'.$field3; - $sql .= ' FROM '.MAIN_DB_PREFIX.$table.' as pf, '.MAIN_DB_PREFIX.$table2.' as p, '.MAIN_DB_PREFIX.'c_paiement as t'; + $sql = "SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code".$field3; + $sql .= " FROM ".MAIN_DB_PREFIX.$table." as pf, ".MAIN_DB_PREFIX.$table2." as p, ".MAIN_DB_PREFIX."c_paiement as t"; $sql .= " WHERE pf.".$field." = ".((int) $this->id); $sql .= " AND pf.".$field2." = p.rowid"; $sql .= ' AND p.fk_paiement = t.id'; @@ -335,12 +335,12 @@ abstract class CommonInvoice extends CommonObject //look for credit notes and discounts and deposits $sql = ''; if ($this->element == 'facture' || $this->element == 'invoice') { - $sql = 'SELECT rc.amount_ttc as amount, rc.multicurrency_amount_ttc as multicurrency_amount, rc.datec as date, f.ref as ref, rc.description as type'; + $sql = "SELECT rc.amount_ttc as amount, rc.multicurrency_amount_ttc as multicurrency_amount, rc.datec as date, f.ref as ref, rc.description as type"; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture as f'; $sql .= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.((int) $this->id); $sql .= ' AND (f.type = 2 OR f.type = 0 OR f.type = 3)'; // Find discount coming from credit note or excess received or deposits (payments from deposits are always null except if FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is set) } elseif ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') { - $sql = 'SELECT rc.amount_ttc as amount, rc.multicurrency_amount_ttc as multicurrency_amount, rc.datec as date, f.ref as ref, rc.description as type'; + $sql = "SELECT rc.amount_ttc as amount, rc.multicurrency_amount_ttc as multicurrency_amount, rc.datec as date, f.ref as ref, rc.description as type"; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture_fourn as f'; $sql .= ' WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = '.((int) $this->id); $sql .= ' AND (f.type = 2 OR f.type = 0 OR f.type = 3)'; // Find discount coming from credit note or excess received or deposits (payments from deposits are always null except if FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is set) @@ -734,7 +734,7 @@ abstract class CommonInvoice extends CommonObject $sql .= 'fk_facture, '; } $sql .= ' amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib, sourcetype, entity)'; - $sql .= ' VALUES ('.((int) $this->id); + $sql .= " VALUES (".((int) $this->id); $sql .= ", ".((float) price2num($amount)); $sql .= ", '".$this->db->idate($now)."'"; $sql .= ", ".((int) $fuser->id); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7adf7a89079..f63081660d6 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1671,7 +1671,7 @@ abstract class CommonObject return 0; } - $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE '.$this->table_ref_field.' LIKE "'.$this->db->escape($ref).'" LIMIT 1'; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$this->table_element." WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."' LIMIT 1"; $query = $this->db->query($sql); @@ -2900,7 +2900,7 @@ abstract class CommonObject // Count number of lines to reorder (according to choice $renum) $nl = 0; - $sql = 'SELECT count(rowid) FROM '.MAIN_DB_PREFIX.$this->table_element_line; + $sql = "SELECT count(rowid) FROM ".MAIN_DB_PREFIX.$this->table_element_line; $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); if (!$renum) { $sql .= ' AND rang = 0'; @@ -2922,7 +2922,7 @@ abstract class CommonObject $rows = array(); // We first search all lines that are parent lines (for multilevel details lines) - $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element_line; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$this->table_element_line; $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); if ($fk_parent_line) { $sql .= ' AND fk_parent_line IS NULL'; @@ -2970,7 +2970,7 @@ abstract class CommonObject { $rows = array(); - $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element_line; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$this->table_element_line; $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); $sql .= ' AND fk_parent_line = '.((int) $id); $sql .= ' ORDER BY rang ASC'; @@ -3038,7 +3038,7 @@ abstract class CommonObject * * @param int $rowid Id of line * @param int $rang Position - * @return void + * @return int <0 if KO, >0 if OK */ public function updateRangOfLine($rowid, $rang) { @@ -3054,10 +3054,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 @@ -3145,8 +3148,8 @@ abstract class CommonObject */ public function getRangOfLine($rowid) { - $sql = 'SELECT rang FROM '.MAIN_DB_PREFIX.$this->table_element_line; - $sql .= ' WHERE rowid ='.((int) $rowid); + $sql = "SELECT rang FROM ".MAIN_DB_PREFIX.$this->table_element_line; + $sql .= " WHERE rowid = ".((int) $rowid); dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG); $resql = $this->db->query($sql); @@ -3164,9 +3167,9 @@ abstract class CommonObject */ public function getIdOfLine($rang) { - $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element_line; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$this->table_element_line; $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); - $sql .= ' AND rang = '.((int) $rang); + $sql .= " AND rang = ".((int) $rang); $resql = $this->db->query($sql); if ($resql) { $row = $this->db->fetch_row($resql); @@ -3193,7 +3196,7 @@ abstract class CommonObject if ($fk_parent_line) { $sql = "SELECT max(".$positionfield.") FROM ".MAIN_DB_PREFIX.$this->table_element_line; $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); - $sql .= ' AND fk_parent_line = '.((int) $fk_parent_line); + $sql .= " AND fk_parent_line = ".((int) $fk_parent_line); dol_syslog(get_class($this)."::line_max", LOG_DEBUG); $resql = $this->db->query($sql); @@ -3409,7 +3412,7 @@ abstract class CommonObject $sql .= ', situation_percent'; } $sql .= ', multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line; + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element_line; $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); if ($exclspec) { $product_field = 'product_type'; @@ -3569,7 +3572,7 @@ abstract class CommonObject } if (empty($nodatabaseupdate)) { - $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET'; + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element.' SET'; $sql .= " ".$fieldht." = ".((float) price2num($this->total_ht)).","; $sql .= " ".$fieldtva." = ".((float) price2num($this->total_tva)).","; $sql .= " ".$fieldlocaltax1." = ".((float) price2num($this->total_localtax1)).","; @@ -4264,8 +4267,8 @@ abstract class CommonObject */ public function getSpecialCode($lineid) { - $sql = 'SELECT special_code FROM '.MAIN_DB_PREFIX.$this->table_element_line; - $sql .= ' WHERE rowid = '.((int) $lineid); + $sql = "SELECT special_code FROM ".MAIN_DB_PREFIX.$this->table_element_line; + $sql .= " WHERE rowid = ".((int) $lineid); $resql = $this->db->query($sql); if ($resql) { $row = $this->db->fetch_row($resql); @@ -5321,7 +5324,7 @@ abstract class CommonObject $ecmfile->gen_or_uploaded = 'generated'; $ecmfile->description = ''; // indexed content $ecmfile->keywords = ''; // keyword content - $ecmfile->src_object_type = $this->table_element; + $ecmfile->src_object_type = $this->table_element.(empty($this->module) ? '' : '@'.$this->module); $ecmfile->src_object_id = $this->id; $result = $ecmfile->create($user); @@ -6684,8 +6687,8 @@ abstract class CommonObject } $sqlwhere = ''; - $sql = 'SELECT '.$keyList; - $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0]; + $sql = "SELECT ".$keyList; + $sql .= " FROM ".MAIN_DB_PREFIX.$InfoFieldList[0]; if (!empty($InfoFieldList[4])) { // can use SELECT request if (strpos($InfoFieldList[4], '$SEL$') !== false) { @@ -6836,7 +6839,7 @@ abstract class CommonObject } $sqlwhere = ''; - $sql = 'SELECT '.$keyList; + $sql = "SELECT ".$keyList; $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0]; if (!empty($InfoFieldList[4])) { // can use SELECT request @@ -7197,7 +7200,7 @@ abstract class CommonObject $keyList .= implode(', ', $fields_label); } - $sql = 'SELECT '.$keyList; + $sql = "SELECT ".$keyList; $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0]; if (strpos($InfoFieldList[4], 'extra') !== false) { $sql .= ' as main'; @@ -7280,7 +7283,7 @@ abstract class CommonObject $keyList .= implode(', ', $fields_label); } - $sql = 'SELECT '.$keyList; + $sql = "SELECT ".$keyList; $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0]; if (strpos($InfoFieldList[4], 'extra') !== false) { $sql .= ' as main'; @@ -7805,7 +7808,7 @@ abstract class CommonObject $out .= $labeltoshow; } if ($mode != 'view' && !empty($extrafields->attributes[$this->table_element]['required'][$key])) { - $out .= ' *'; + $out .= ' *'; } } else { if ($mode != 'view' && !empty($extrafields->attributes[$this->table_element]['required'][$key])) { @@ -8217,7 +8220,7 @@ abstract class CommonObject $return .= '
'; // On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites if ($photo_vignette && (image_format_supported($photo) > 0) && ($this->imgWidth > $maxWidth || $this->imgHeight > $maxHeight)) { - $return .= ''.img_picto($langs->trans('GenerateThumb'), 'refresh').'  '; + $return .= ''.img_picto($langs->trans('GenerateThumb'), 'refresh').'  '; } // Special cas for product if ($modulepart == 'product' && ($user->rights->produit->creer || $user->rights->service->creer)) { @@ -8679,7 +8682,7 @@ abstract class CommonObject // If field is an implicit foreign key field if (preg_match('/^integer:/i', $this->fields[$key]['type']) && empty($values[$key])) { if (isset($this->fields[$key]['default'])) { - $values[$key] = $this->fields[$key]['default']; + $values[$key] = ((int) $this->fields[$key]['default']); } else { $values[$key] = 'null'; } @@ -8696,9 +8699,9 @@ abstract class CommonObject $this->db->begin(); if (!$error) { - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element; - $sql .= ' ('.implode(", ", $keys).')'; - $sql .= ' VALUES ('.implode(", ", $values).')'; + $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element; + $sql .= " (".implode(", ", $keys).')'; + $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 $res = $this->db->query($sql); if ($res === false) { @@ -8714,7 +8717,7 @@ abstract class CommonObject // If we have a field ref with a default value of (PROV) if (!$error) { if (key_exists('ref', $this->fields) && $this->fields['ref']['notnull'] > 0 && key_exists('default', $this->fields['ref']) && $this->fields['ref']['default'] == '(PROV)') { - $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET ref = '(PROV".$this->id.")' WHERE (ref = '(PROV)' OR ref = '') AND rowid = ".((int) $this->id); + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET ref = '(PROV".((int) $this->id).")' WHERE (ref = '(PROV)' OR ref = '') AND rowid = ".((int) $this->id); $resqlupdate = $this->db->query($sql); if ($resqlupdate === false) { @@ -9402,6 +9405,11 @@ abstract class CommonObject */ public function setCategoriesCommon($categories, $type_categ = '', $remove_existing = true) { + // Handle single category + if (!is_array($categories)) { + $categories = array($categories); + } + dol_syslog(get_class($this)."::setCategoriesCommon Oject Id:".$this->id.' type_categ:'.$type_categ.' nb tag add:'.count($categories), LOG_DEBUG); require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; @@ -9411,11 +9419,6 @@ abstract class CommonObject return -1; } - // Handle single category - if (!is_array($categories)) { - $categories = array($categories); - } - // Get current categories $c = new Categorie($this->db); $existing = $c->containing($this->id, $type_categ, 'id'); diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index ec145f89f43..ee91d67b9ce 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -624,14 +624,15 @@ class Conf if (!empty($this->global->MAILING_EMAIL_FROM)) { $this->mailing->email_from = $this->global->MAILING_EMAIL_FROM; } - if (!isset($this->global->MAIN_EMAIL_ADD_TRACK_ID)) { - $this->global->MAIN_EMAIL_ADD_TRACK_ID = 1; - } if (!isset($this->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { $this->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP = 1; } + if (!isset($this->global->MAIN_FIX_FOR_BUGGED_MTA)) { + $this->global->MAIN_FIX_FOR_BUGGED_MTA = 1; + } + // Format for date (used by default when not found or not searched in lang) $this->format_date_short = "%d/%m/%Y"; // Format of day with PHP/C tags (strftime functions) $this->format_date_short_java = "dd/MM/yyyy"; // Format of day with Java tags @@ -826,9 +827,13 @@ class Conf $this->global->MAIN_MODULE_DOLISTORE_API_KEY = 'dolistorecatalogpublickey1234567'; } - // If we are in develop mode, we activate the option MAIN_SECURITY_CSRF_WITH_TOKEN to 1 if not already defined. - if (!isset($this->global->MAIN_SECURITY_CSRF_WITH_TOKEN) && $this->global->MAIN_FEATURES_LEVEL >= 2) { + // Enable by default the CSRF protection by token. + if (!isset($this->global->MAIN_SECURITY_CSRF_WITH_TOKEN)) { + // Value 1 makes CSRF check for all POST parameters only + // Value 2 makes also CSRF check for GET requests with action = a sensitive requests like action=del, action=remove... + // Value 3 makes also CSRF check for all GET requests with a param action or massaction $this->global->MAIN_SECURITY_CSRF_WITH_TOKEN = 1; + // Note: Set MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL=1 to have a renewal of token at each page call instead of each session (not recommended) } if (defined('MAIN_ANTIVIRUS_COMMAND')) { diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index a1725526898..e4a91d903df 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -741,7 +741,7 @@ class DolGraph /** * Build a graph using JFlot library. Input when calling this method should be: * $this->data = array(array(0=>'labelxA',1=>yA), array('labelxB',yB)); - * $this->data = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn)); // or when there is n series to show for each x + * $this->data = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn)); // when there is n series to show for each x * $this->data = array(array('label'=>'labelxA','data'=>yA), array('labelxB',yB)); // Syntax deprecated * $this->legend= array("Val1",...,"Valn"); // list of n series name * $this->type = array('bars',...'lines','linesnopoint'); or array('pie') or array('polar') @@ -1028,7 +1028,7 @@ class DolGraph /** * Build a graph using Chart library. Input when calling this method should be: * $this->data = array(array(0=>'labelxA',1=>yA), array('labelxB',yB)); - * $this->data = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn)); // or when there is n series to show for each x + * $this->data = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn)); // when there is n series to show for each x * $this->data = array(array('label'=>'labelxA','data'=>yA), array('labelxB',yB)); // Syntax deprecated * $this->legend= array("Val1",...,"Valn"); // list of n series name * $this->type = array('bars',...'lines', 'linesnopoint'); or array('pie') or array('polar') or array('piesemicircle'); @@ -1303,6 +1303,8 @@ class DolGraph $this->stringtoshow .= 'var options = { maintainAspectRatio: false, aspectRatio: 2.5, '; if (empty($showlegend)) { $this->stringtoshow .= 'legend: { display: false }, '; + } else { + $this->stringtoshow .= 'legend: { position: \'' . ($showlegend == 2 ? 'right' : 'top') . '\' },'; } $this->stringtoshow .= 'scales: { xAxes: [{ '; if ($this->hideXValues) { diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 9eb84c39c89..4ec87d75974 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1252,7 +1252,7 @@ class ExtraFields } $sqlwhere = ''; - $sql = 'SELECT '.$keyList; + $sql = "SELECT ".$keyList; $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0]; if (!empty($InfoFieldList[4])) { // can use curent entity filter @@ -1420,7 +1420,7 @@ class ExtraFields } $sqlwhere = ''; - $sql = 'SELECT '.$keyList; + $sql = "SELECT ".$keyList; $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0]; if (!empty($InfoFieldList[4])) { // can use SELECT request @@ -1716,7 +1716,7 @@ class ExtraFields } } - $sql = 'SELECT '.$keyList; + $sql = "SELECT ".$keyList; $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0]; if (!empty($InfoFieldList[4]) && strpos($InfoFieldList[4], 'extra') !== false) { $sql .= ' as main'; @@ -1820,8 +1820,8 @@ class ExtraFields } } - $sql = 'SELECT '.$keyList; - $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0]; + $sql = "SELECT ".$keyList; + $sql .= " FROM ".MAIN_DB_PREFIX.$InfoFieldList[0]; if (strpos($InfoFieldList[4], 'extra') !== false) { $sql .= ' as main'; } @@ -2047,9 +2047,9 @@ class ExtraFields * * @param array $extralabels Deprecated (old $array of extrafields, now set this to null) * @param object $object Object - * @param string $onlykey Only some keys are filled:$this + * @param string $onlykey Only some keys are filled: * 'string' => When we make update of only one extrafield ($action = 'update_extras'), calling page can set this to avoid to have other extrafields being reset. - * '@GETPOSTISSET' => When we make update of extrafields ($action = 'update'), calling page can set this to avoid to have fields not into POST being reset. + * '@GETPOSTISSET' => When we make update of several extrafields ($action = 'update'), calling page can set this to avoid to have fields not into POST being reset. * @return int 1 if array_options set, 0 if no value, -1 if error (field required missing for example) */ public function setOptionalsFromPost($extralabels, &$object, $onlykey = '') diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 01bd1a13141..37155a4566e 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 .= ' : '; @@ -791,7 +791,7 @@ class Form // Warning: if you set submit button to disabled, post using 'Enter' will no more work if there is no another input submit. So we add a hidden button $ret .= ''; // Hidden button BEFORE so it is the one used when we submit with ENTER. - $ret .= 'use_javascript_ajax) ? '' : ' style="display: none"').' class="button'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'confirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">'; + $ret .= 'use_javascript_ajax) ? '' : ' style="display: none"').' class="button small'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'confirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">'; $ret .= '
'; if (!empty($conf->use_javascript_ajax)) { @@ -1268,6 +1268,7 @@ class Form $selected_input_value = $societetmp->name; unset($societetmp); } + // mode 1 $urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&filter='.urlencode($filter).(empty($excludeids) ? '' : '&excludeids='.join(',', $excludeids)).($showtype ? '&showtype='.urlencode($showtype) : ''); $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); @@ -1443,6 +1444,10 @@ class Form $label .= ' ('.$obj->name_alias.')'; } + if ($conf->global->SOCIETE_SHOW_VAT_IN_LIST && !empty($obj->tva_intra)) { + $label .= ' - '.$obj->tva_intra.''; + } + if ($showtype) { if ($obj->client || $obj->fournisseur) { $label .= ' ('; @@ -1680,11 +1685,6 @@ class Form if ($resql) { $num = $this->db->num_rows($resql); - if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $out .= ajax_combobox($htmlid, $events, getDolGlobalString("CONTACT_USE_SEARCH_TO_SELECT")); - } - if ($htmlname != 'none' && !$options_only) { $out .= ''; } + if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; + $out .= ajax_combobox($htmlid, $events, getDolGlobalString("CONTACT_USE_SEARCH_TO_SELECT")); + } + $this->num = $num; return $out; } else { @@ -5783,11 +5788,11 @@ class Form return $num; } else { - $this->error = ''.$langs->trans("ErrorNoVATRateDefinedForSellerCountry", $country_code).''; + $this->error = ''.$langs->trans("ErrorNoVATRateDefinedForSellerCountry", $country_code).''; return -1; } } else { - $this->error = ''.$this->db->error().''; + $this->error = ''.$this->db->error().''; return -2; } } @@ -5838,9 +5843,9 @@ class Form // Check parameters if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) { if ($societe_vendeuse->id == $mysoc->id) { - $return .= ''.$langs->trans("ErrorYourCountryIsNotDefined").''; + $return .= ''.$langs->trans("ErrorYourCountryIsNotDefined").''; } else { - $return .= ''.$langs->trans("ErrorSupplierCountryIsNotDefined").''; + $return .= ''.$langs->trans("ErrorSupplierCountryIsNotDefined").''; } return $return; } @@ -7923,7 +7928,7 @@ class Form } if (!$nboftypesoutput) { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print ''; @@ -8789,8 +8794,8 @@ class Form public function showFilterButtons() { $out = '
'; - $out .= ''; - $out .= ''; + $out .= ''; + $out .= ''; $out .= '
'; return $out; diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 0048031d0e7..0590566582d 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -178,7 +178,8 @@ class FormActions $sortfield = 'a.datep,a.id'; $sortorder = 'DESC,DESC'; - $listofactions = ActionComm::getActions($this->db, $socid, $object->id, $typeelement, '', $sortfield, $sortorder, ($max ? ($max + 1) : 0)); + $actioncomm = new ActionComm($this->db); + $listofactions = $actioncomm->getActions($socid, $object->id, $typeelement, '', $sortfield, $sortorder, ($max ? ($max + 1) : 0)); if (!is_array($listofactions)) { dol_print_error($this->db, 'FailedToGetActions'); } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index ca7e939fb6f..0d1d838aad4 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -136,6 +136,7 @@ class FormFile $out .= ''."\n"; $out .= ''."\n"; $out .= ''."\n"; + $out .= ''."\n"; } $out .= ''; @@ -215,13 +216,13 @@ class FormFile $langs->load('link'); $out .= ''; } - $out .= 'trans("Upload").'"'; $out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : ''); $out .= '>'; if ($addcancel) { $out .= '   '; - $out .= ''; + $out .= ''; } if (!empty($conf->global->MAIN_UPLOAD_DOC)) { @@ -275,6 +276,7 @@ class FormFile $out .= ''."\n"; $out .= ''."\n"; $out .= ''."\n"; + $out .= ''."\n"; } $out .= '
'; @@ -293,7 +295,7 @@ class FormFile $out .= ''; $out .= '
'; $out .= '
'; - $out .= 'trans("ToLink").'"'; $out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : ''); $out .= '>'; $out .= '
'; @@ -391,6 +393,38 @@ class FormFile global $langs, $conf, $user, $hookmanager; global $form; + $reshook = 0; + if (is_object($hookmanager)) { + $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'); + } + } + // Remode default action if $reskook > 0 + if ($reshook > 0) { + return $hookmanager->resPrint; + } + if (!is_object($form)) { $form = new Form($this->db); } @@ -700,9 +734,10 @@ class FormFile $urlsource .= '#'.$forname.'_form'; // So we switch to form after a generation } if (empty($noform)) { - $out .= ''; + $out .= ''; } $out .= ''; + $out .= ''; $out .= ''; $out .= load_fiche_titre($titletoshow, '', ''); @@ -752,7 +787,7 @@ class FormFile } // Button - $genbutton = ''.img_picto($langs->trans("Delete"), 'delete').''; } if ($printer) { - //$out.= ''."\n"; + $out .= ''."\n"; } } @@ -1454,7 +1489,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) { @@ -1672,7 +1707,8 @@ class FormFile dol_include_once($hookmanager->resArray['classpath']); if (array_key_exists('classname', $hookmanager->resArray) && !empty($hookmanager->resArray['classname'])) { if (class_exists($hookmanager->resArray['classname'])) { - $object_instance = new ${$hookmanager->resArray['classname']}($this->db); + $tmpclassname = $hookmanager->resArray['classname']; + $object_instance = new $tmpclassname($this->db); } } } @@ -1811,9 +1847,11 @@ class FormFile print ''; // File + // Check if document source has external module part, if it the case use it for module part on document.php + preg_match('/^[^@]*@([^@]*)$/', $modulepart.'@expertisemedical', $modulesuffix); print '\n"; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 8c30d42075f..99ee1b6af9b 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -863,9 +863,9 @@ class FormOther } }, function(color, context) { console.log("close"); }, - function(color, context) { var hex = color.val(\'hex\'); console.log("new color selected in jpicker "+hex);'; + function(color, context) { var hex = color.val(\'hex\'); console.log("new color selected in jpicker "+hex+" setpropertyonselect='.dol_escape_js($setpropertyonselect).'");'; if ($setpropertyonselect) { - $out .= ' if (hex != null) document.documentElement.style.setProperty(\'--'.$setpropertyonselect.'\', \'#\'+hex);'; + $out .= ' if (hex != null) document.documentElement.style.setProperty(\'--'.dol_escape_js($setpropertyonselect).'\', \'#\'+hex);'; } $out .= '}, function(color, context) { console.log("cancel"); } diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php index 0ce9cae7b4e..60811956c32 100644 --- a/htdocs/core/class/html.formsms.class.php +++ b/htdocs/core/class/html.formsms.class.php @@ -178,7 +178,7 @@ function limitChars(textarea, limit, infodiv) } else { if ($this->fromtype) { $langs->load("errors"); - print ' <'.$langs->trans("ErrorNoPhoneDefinedForThisUser").'> '; + print ' <'.$langs->trans("ErrorNoPhoneDefinedForThisUser").'> '; } } print "\n"; diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index c37766b24df..a4b18470be4 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -762,7 +762,7 @@ class FormTicket $arraycodenotparent[] = ""; $stringtoprint = ''.$langs->trans("GroupOfTicket").' '; - $stringtoprint .= ''; $stringtoprint .= ''; $sql = "SELECT ctc.rowid, ctc.code, ctc.label, ctc.fk_parent, ctc.public, "; diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index fb59e2b7c42..bdd0f79a0aa 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -83,7 +83,7 @@ class InfoBox /** * Return array of boxes qualified for area and user * - * @param DoliDB $db Database handler + * @param DoliDB $dbs Database handler * @param string $mode 'available' or 'activated' * @param int $zone Name or area (-1 for all, 0 for Homepage, 1 for Accountancy, 2 for xxx, ...) * @param User|null $user Object user to filter @@ -91,7 +91,7 @@ class InfoBox * @param int $includehidden Include also hidden boxes * @return array Array of boxes */ - public static function listBoxes($db, $mode, $zone, $user = null, $excludelist = array(), $includehidden = 1) + public static function listBoxes($dbs, $mode, $zone, $user = null, $excludelist = array(), $includehidden = 1) { global $conf; @@ -119,12 +119,12 @@ class InfoBox } dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user) ? $user->id : '')."", LOG_DEBUG); - $resql = $db->query($sql); + $resql = $dbs->query($sql); if ($resql) { - $num = $db->num_rows($resql); + $num = $dbs->num_rows($resql); $j = 0; while ($j < $num) { - $obj = $db->fetch_object($resql); + $obj = $dbs->fetch_object($resql); if (!in_array($obj->box_id, $excludelist)) { $regs = array(); @@ -144,7 +144,7 @@ class InfoBox // Goal is to avoid making a "new" done for each boxes returned by select. dol_include_once($relsourcefile); if (class_exists($boxname)) { - $box = new $boxname($db, $obj->note); // Constructor may set properties like box->enabled. obj->note is note into box def, not user params. + $box = new $boxname($dbs, $obj->note); // Constructor may set properties like box->enabled. obj->note is note into box def, not user params. //$box=new stdClass(); // box properties @@ -204,8 +204,8 @@ class InfoBox $j++; } } else { - dol_syslog($db->lasterror(), LOG_ERR); - return array('error'=>$db->lasterror()); + dol_syslog($dbs->lasterror(), LOG_ERR); + return array('error'=>$dbs->lasterror()); } return $boxes; @@ -215,13 +215,13 @@ class InfoBox /** * Save order of boxes for area and user * - * @param DoliDB $db Database handler + * @param DoliDB $dbs Database handler * @param int $zone Name of area (0 for Homepage, ...) * @param string $boxorder List of boxes with correct order 'A:123,456,...-B:789,321...' * @param int $userid Id of user * @return int <0 if KO, 0=Nothing done, > 0 if OK */ - public static function saveboxorder($db, $zone, $boxorder, $userid = 0) + public static function saveboxorder($dbs, $zone, $boxorder, $userid = 0) { global $conf; @@ -235,18 +235,18 @@ class InfoBox return 0; } - $user = new User($db); + $user = new User($dbs); $user->id = $userid; - $db->begin(); + $dbs->begin(); // Save parameters to say user has a dedicated setup $tab = array(); $confuserzone = 'MAIN_BOXES_'.$zone; $tab[$confuserzone] = 1; - if (dol_set_user_param($db, $conf, $user, $tab) < 0) { - $error = $db->lasterror(); - $db->rollback(); + if (dol_set_user_param($dbs, $conf, $user, $tab) < 0) { + $error = $dbs->lasterror(); + $dbs->rollback(); return -3; } @@ -257,7 +257,7 @@ class InfoBox $sql .= " AND position = ".((int) $zone); dol_syslog(get_class()."::saveboxorder", LOG_DEBUG); - $result = $db->query($sql); + $result = $dbs->query($sql); if ($result) { $colonnes = explode('-', $boxorder); foreach ($colonnes as $collist) { @@ -279,12 +279,12 @@ class InfoBox $sql .= " values ("; $sql .= " ".((int) $id).","; $sql .= " ".((int) $zone).","; - $sql .= " '".$db->escape($colonne.$ii)."',"; + $sql .= " '".$dbs->escape($colonne.$ii)."',"; $sql .= " ".((int) $userid).","; $sql .= " ".((int) $conf->entity); $sql .= ")"; - $result = $db->query($sql); + $result = $dbs->query($sql); if ($result < 0) { $error++; break; @@ -297,10 +297,10 @@ class InfoBox } if ($error) { - $db->rollback(); + $dbs->rollback(); return -2; } else { - $db->commit(); + $dbs->commit(); return 1; } } diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php index 2a5e0f99c64..eaf4804b213 100644 --- a/htdocs/core/class/link.class.php +++ b/htdocs/core/class/link.class.php @@ -274,24 +274,24 @@ class Link extends CommonObject /** * Return nb of links * - * @param DoliDb $db Database handler + * @param DoliDb $dbs Database handler * @param string $objecttype Type of the associated object in dolibarr * @param int $objectid Id of the associated object in dolibarr * @return int Nb of links, -1 if error **/ - public static function count($db, $objecttype, $objectid) + public static function count($dbs, $objecttype, $objectid) { global $conf; $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."links"; - $sql .= " WHERE objecttype = '".$db->escape($objecttype)."' AND objectid = ".((int) $objectid); + $sql .= " WHERE objecttype = '".$dbs->escape($objecttype)."' AND objectid = ".((int) $objectid); if ($conf->entity != 0) { $sql .= " AND entity = ".$conf->entity; } - $resql = $db->query($sql); + $resql = $dbs->query($sql); if ($resql) { - $obj = $db->fetch_object($resql); + $obj = $dbs->fetch_object($resql); if ($obj) { return $obj->nb; } diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index 6a8a91dbb05..c3c434d1aed 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -240,7 +240,7 @@ class RssParser if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { //print 'xx'.LIBXML_NOCDATA; libxml_use_internal_errors(false); - $rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA); + $rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA|LIBXML_NOCDATA); } else { if (!function_exists('xml_parser_create')) { $this->error = 'Function xml_parser_create are not supported by your PHP'; diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php index 9b812df8dc2..c6769ad0619 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 02a1e5d13d3..0db4e16a897 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -440,6 +440,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 9d17d4b9099..5997349d0c5 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -713,6 +713,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 e2a2c124737..c03d2a5ee04 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -645,6 +645,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/barcode.lib.php b/htdocs/core/lib/barcode.lib.php index 12022ed178c..702d6673527 100644 --- a/htdocs/core/lib/barcode.lib.php +++ b/htdocs/core/lib/barcode.lib.php @@ -59,7 +59,10 @@ if (empty($font_loc)) { if (defined('PHP-BARCODE_PATH_COMMAND')) { $genbarcode_loc = constant('PHP-BARCODE_PATH_COMMAND'); } else { - $genbarcode_loc = $conf->global->GENBARCODE_LOCATION; + $genbarcode_loc = ''; + if (!empty($conf->global->GENBARCODE_LOCATION)) { + $genbarcode_loc = $conf->global->GENBARCODE_LOCATION; + } } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index d0be91d8614..03435b2dd71 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -724,7 +724,7 @@ function getFormeJuridiqueLabel($code) function getCountriesInEEC() { // List of all country codes that are in europe for european vat rules - // List found on http://ec.europa.eu/taxation_customs/common/faq/faq_1179_en.htm#9 + // List found on https://ec.europa.eu/taxation_customs/territorial-status-eu-countries-and-certain-territories_en global $conf, $db; $country_code_in_EEC = array(); @@ -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 ''; } @@ -2007,7 +2007,7 @@ function show_subsidiaries($conf, $langs, $db, $object) print ''; print ''; diff --git a/htdocs/core/lib/eventorganization.lib.php b/htdocs/core/lib/eventorganization.lib.php index 2f8ea573c1f..51ff1f2a90f 100644 --- a/htdocs/core/lib/eventorganization.lib.php +++ b/htdocs/core/lib/eventorganization.lib.php @@ -16,7 +16,7 @@ */ /** - * \file eventorganization/lib/eventorganization.lib.php + * \file htdocs/core/lib/eventorganization.lib.php * \ingroup eventorganization * \brief Library files with common functions for EventOrganization */ diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 698bf4410da..897b248824f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3732,7 +3732,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'action'=>'infobox-action', 'account'=>'infobox-bank_account', 'accountline'=>'infobox-bank_account', 'accountancy'=>'infobox-bank_account', 'asset'=>'infobox-bank_account', 'bank_account'=>'bg-infobox-bank_account', 'bill'=>'infobox-commande', 'billa'=>'infobox-commande', 'billr'=>'infobox-commande', 'billd'=>'infobox-commande', - 'conferenceorbooth'=>'infobox-project', + 'margin'=>'infobox-bank_account', 'conferenceorbooth'=>'infobox-project', 'cash-register'=>'infobox-bank_account', 'contract'=>'infobox-contrat', 'check'=>'font-status4', 'collab'=>'infobox-action', 'conversation'=>'infobox-contrat', 'donation'=>'infobox-commande', 'dolly'=>'infobox-commande', 'dollyrevert'=>'flip infobox-order_supplier', 'ecm'=>'infobox-action', 'eventorganization'=>'infobox-project', @@ -4386,7 +4386,7 @@ function img_mime($file, $titlealt = '', $morecss = '') } //return img_picto_common($titlealt, 'mime/'.$mimeimg, 'class="'.$morecss.'"'); - return ''; + return ''; } @@ -6156,7 +6156,7 @@ function yn($yesno, $case = 1, $color = 0) } } if ($color) { - return ''.$result.''; + return ''.$result.''; } return $result; } @@ -6977,7 +6977,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = 'Security key for payment on a member subscription (one key per member)'; $substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = 'Security key for payment on an order'; $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = 'Security key for payment on an invoice'; - $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = 'Security key for payment on a a service'; + $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = 'Security key for payment on a service of a contract'; $substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = 'Direct download url of a proposal'; $substitutionarray['__DIRECTDOWNLOAD_URL_ORDER__'] = 'Direct download url of an order'; diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 28b56efb20d..e18ec3e3678 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -480,7 +480,8 @@ function getNumberInvoicesPieChart($mode) date_add($datenowadd30, $interval30days); date_add($datenowadd15, $interval15days); - $sql = "SELECT sum(".$db->ifsql("f.date_lim_reglement < '".date_format($datenowsub30, 'Y-m-d')."'", 1, 0).") as nblate30"; + $sql = "SELECT"; + $sql .= " sum(".$db->ifsql("f.date_lim_reglement < '".date_format($datenowsub30, 'Y-m-d')."'", 1, 0).") as nblate30"; $sql .= ", sum(".$db->ifsql("f.date_lim_reglement < '".date_format($datenowsub15, 'Y-m-d')."'", 1, 0).") as nblate15"; $sql .= ", sum(".$db->ifsql("f.date_lim_reglement < '".date_format($now, 'Y-m-d')."'", 1, 0).") as nblatenow"; $sql .= ", sum(".$db->ifsql("f.date_lim_reglement >= '".date_format($now, 'Y-m-d')."'", 1, 0).") as nbnotlatenow"; @@ -508,24 +509,26 @@ function getNumberInvoicesPieChart($mode) while ($i < $num) { $obj = $db->fetch_object($resql); - $dataseries = array(array($langs->trans('InvoiceLate30Days'), $obj->nblate30) + /*$dataseries = array(array($langs->trans('InvoiceLate30Days'), $obj->nblate30) ,array($langs->trans('InvoiceLate15Days'), $obj->nblate15 - $obj->nblate30) ,array($langs->trans('InvoiceLateMinus15Days'), $obj->nblatenow - $obj->nblate15) ,array($langs->trans('InvoiceNotLate'), $obj->nbnotlatenow - $obj->nbnotlate15) ,array($langs->trans('InvoiceNotLate15Days'), $obj->nbnotlate15 - $obj->nbnotlate30) - ,array($langs->trans('InvoiceNotLate30Days'), $obj->nbnotlate30)); + ,array($langs->trans('InvoiceNotLate30Days'), $obj->nbnotlate30));*/ + $dataseries[0]=array($langs->trans('NbOfOpenInvoices'), $obj->nblate30, $obj->nblate15 - $obj->nblate30, $obj->nblatenow - $obj->nblate15, $obj->nbnotlatenow - $obj->nbnotlate15, $obj->nbnotlate15 - $obj->nbnotlate30, $obj->nbnotlate30); $i++; } foreach ($dataseries as $key=>$value) { $total += $value[1]; } + $legend = array($langs->trans('InvoiceLate30Days'), $langs->trans('InvoiceLate15Days'), $langs->trans('InvoiceLateMinus15Days'), $langs->trans('InvoiceNotLate'), $langs->trans('InvoiceNotLate15Days'), $langs->trans('InvoiceNotLate30Days')); $colorseries = array($badgeStatus8, $badgeStatus1, $badgeStatus3, $badgeStatus4, $badgeStatus11, '-'.$badgeStatus11); $result = '
'; $result .= '
'; - $out .= ''.img_picto($langs->trans("PrintFile", $relativepath), 'printer.png').''; } @@ -957,7 +992,7 @@ class FormFile } if (count($file_list) == 0 && count($link_list) == 0 && $headershown) { - $out .= '
'.$langs->trans("None").'
'.$langs->trans("None").'
'; //print "XX".$file['name']; //$file['name'] must be utf8 - print 'getDocumentsLink($modulepart, $modulesubdir, $filedir, '^'.preg_quote($file['name'],'/').'$'); - print $this->showPreview($file, $modulepart, $file['relativename']); + print $this->showPreview($file, (empty($modulesuffix) ? $modulepart : $modulesuffix[1]), $file['relativename']); print "
'.$obj->code_client.''; - print ''; + print ''; print img_edit(); print '
'; $result .= ''; - $result .= ''; if ($conf->use_javascript_ajax) { + //var_dump($dataseries); $dolgraph = new DolGraph(); $dolgraph->SetData($dataseries); + + $dolgraph->setLegend($legend); + $dolgraph->SetDataColor(array_values($colorseries)); $dolgraph->setShowLegend(2); $dolgraph->setShowPercent(1); - $dolgraph->SetType(['pie']); - $dolgraph->setHeight('150'); - $dolgraph->setWidth('300'); + $dolgraph->SetType(array('bars', 'bars', 'bars', 'bars', 'bars', 'bars')); + $dolgraph->setHeight('160'); + $dolgraph->setWidth('400'); + $dolgraph->setHideXValues(true); if ($mode == 'customers') { $dolgraph->draw('idgraphcustomerinvoices'); } elseif ($mode == 'fourn' || $mode == 'suppliers') { @@ -1218,7 +1226,7 @@ function getCustomerInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0) print "\n"; } - print ''; + print ''; print ''; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) { print ''; @@ -1383,7 +1391,7 @@ function getPurchaseInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0) print "\n"; } - print ''; + print ''; print ''; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) { print ''; diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 4621e22d122..390961f5db2 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -224,7 +224,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag } if ($type == 'free') { - $out = $urltouse.'/public/payment/newpayment.php?amount='.($mode ? '' : '').$amount.($mode ? '' : '').'&tag='.($mode ? '' : '').$freetag.($mode ? '' : ''); + $out = $urltouse.'/public/payment/newpayment.php?amount='.($mode ? '' : '').$amount.($mode ? '' : '').'&tag='.($mode ? '' : '').$freetag.($mode ? '' : ''); if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { $out .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); @@ -234,120 +234,120 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag } //if ($mode) $out.='&noidempotency=1'; } elseif ($type == 'order') { - $out = $urltouse.'/public/payment/newpayment.php?source=order&ref='.($mode ? '' : ''); + $out = $urltouse.'/public/payment/newpayment.php?source=order&ref='.($mode ? '' : ''); if ($mode == 1) { $out .= 'order_ref'; } if ($mode == 0) { $out .= urlencode($ref); } - $out .= ($mode ? '' : ''); + $out .= ($mode ? '' : ''); if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { $out .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); } else { - $out .= '&securekey='.($mode ? '' : ''); + $out .= '&securekey='.($mode ? '' : ''); if ($mode == 1) { $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)"; } if ($mode == 0) { $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); } - $out .= ($mode ? '' : ''); + $out .= ($mode ? '' : ''); } } } elseif ($type == 'invoice') { - $out = $urltouse.'/public/payment/newpayment.php?source=invoice&ref='.($mode ? '' : ''); + $out = $urltouse.'/public/payment/newpayment.php?source=invoice&ref='.($mode ? '' : ''); if ($mode == 1) { $out .= 'invoice_ref'; } if ($mode == 0) { $out .= urlencode($ref); } - $out .= ($mode ? '' : ''); + $out .= ($mode ? '' : ''); if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { $out .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); } else { - $out .= '&securekey='.($mode ? '' : ''); + $out .= '&securekey='.($mode ? '' : ''); if ($mode == 1) { $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)"; } if ($mode == 0) { $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); } - $out .= ($mode ? '' : ''); + $out .= ($mode ? '' : ''); } } } elseif ($type == 'contractline') { - $out = $urltouse.'/public/payment/newpayment.php?source=contractline&ref='.($mode ? '' : ''); + $out = $urltouse.'/public/payment/newpayment.php?source=contractline&ref='.($mode ? '' : ''); if ($mode == 1) { $out .= 'contractline_ref'; } if ($mode == 0) { $out .= urlencode($ref); } - $out .= ($mode ? '' : ''); + $out .= ($mode ? '' : ''); if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { $out .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); } else { - $out .= '&securekey='.($mode ? '' : ''); + $out .= '&securekey='.($mode ? '' : ''); if ($mode == 1) { $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)"; } if ($mode == 0) { $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); } - $out .= ($mode ? '' : ''); + $out .= ($mode ? '' : ''); } } } elseif ($type == 'member' || $type == 'membersubscription') { $newtype = 'member'; - $out = $urltouse.'/public/payment/newpayment.php?source=member&ref='.($mode ? '' : ''); + $out = $urltouse.'/public/payment/newpayment.php?source=member&ref='.($mode ? '' : ''); if ($mode == 1) { $out .= 'member_ref'; } if ($mode == 0) { $out .= urlencode($ref); } - $out .= ($mode ? '' : ''); + $out .= ($mode ? '' : ''); if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { $out .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); } else { - $out .= '&securekey='.($mode ? '' : ''); + $out .= '&securekey='.($mode ? '' : ''); if ($mode == 1) { $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$newtype."' + member_ref)"; } if ($mode == 0) { $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$newtype.$ref, 2); } - $out .= ($mode ? '' : ''); + $out .= ($mode ? '' : ''); } } } if ($type == 'donation') { - $out = $urltouse.'/public/payment/newpayment.php?source=donation&ref='.($mode ? '' : ''); + $out = $urltouse.'/public/payment/newpayment.php?source=donation&ref='.($mode ? '' : ''); if ($mode == 1) { $out .= 'donation_ref'; } if ($mode == 0) { $out .= urlencode($ref); } - $out .= ($mode ? '' : ''); + $out .= ($mode ? '' : ''); if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { $out .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); } else { - $out .= '&securekey='.($mode ? '' : ''); + $out .= '&securekey='.($mode ? '' : ''); if ($mode == 1) { $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)"; } if ($mode == 0) { $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); } - $out .= ($mode ? '' : ''); + $out .= ($mode ? '' : ''); } } } @@ -450,7 +450,7 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, } } - print '

'."\n"; + print '

'."\n"; print $fromcompany->name.'
'; print $line1; if (strlen($line1.$line2) > 50) { @@ -459,5 +459,5 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, print ' - '; } print $line2; - print '
'."\n"; + print ''."\n"; } diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index c2257cd20fe..a2c08977b37 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -49,7 +49,7 @@ function pdf_admin_prepare_head() $head = array(); $head[$h][0] = DOL_URL_ROOT.'/admin/pdf.php'; - $head[$h][1] = $langs->trans("Common"); + $head[$h][1] = $langs->trans("Parameters"); $head[$h][2] = 'general'; $h++; @@ -2240,6 +2240,7 @@ function pdf_getTotalQty($object, $type, $outputlangs) if (!empty($object->lines[$i]->fk_parent_line)) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } + $hidedetails = ''; $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); $action = ''; $reshook = $hookmanager->executeHooks('pdf_getTotalQty', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index da5d9388bd8..be804dc184c 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -853,7 +853,7 @@ function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $sho print $hookmanager->resPrint; if (empty($reshook)) { if ($user->login) { - print $langs->trans("CurrentLogin").': '.$user->login.'
'; + print $langs->trans("CurrentLogin").': '.$user->login.'
'; print $langs->trans("ErrorForbidden2", $langs->transnoentitiesnoconv("Home"), $langs->transnoentitiesnoconv("Users")); } else { print $langs->trans("ErrorForbidden3"); diff --git a/htdocs/core/lib/signature.lib.php b/htdocs/core/lib/signature.lib.php index 82f446f04c7..bcb430dac41 100644 --- a/htdocs/core/lib/signature.lib.php +++ b/htdocs/core/lib/signature.lib.php @@ -63,16 +63,16 @@ function getOnlineSignatureUrl($mode, $type, $ref = '') $out = ''; if ($type == 'proposal') { - $out = DOL_MAIN_URL_ROOT.'/public/onlinesign/newonlinesign.php?source=proposal&ref='.($mode ? '' : ''); + $out = DOL_MAIN_URL_ROOT.'/public/onlinesign/newonlinesign.php?source=proposal&ref='.($mode ? '' : ''); if ($mode == 1) { $out .= 'proposal_ref'; } if ($mode == 0) { $out .= urlencode($ref); } - $out .= ($mode ? '' : ''); + $out .= ($mode ? '' : ''); if ($mode == 1) { - $out .= '&hashp=hash_of_file'; + $out .= '&hashp=hash_of_file'; } else { include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $propaltmp = new Propal($db); 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 '
  • '.$langs->trans("Statistics").' - '; + $result .= ''.$langs->trans("NbOfOpenInvoices").' - '; if ($mode == 'customers') { $result .= $langs->trans("CustomerInvoice"); } elseif ($mode == 'fourn' || $mode == 'suppliers') { @@ -537,14 +540,19 @@ function getNumberInvoicesPieChart($mode) $result .= '
    '.$langs->trans("Total").'   ('.$langs->trans("RemainderToTake").': '.price($total_ttc - $totalam).')
    '.$langs->trans("Total").'   ('.$langs->trans("RemainderToTake").': '.price($total_ttc - $totalam).')  '.price($total).'
    '.$langs->trans("Total").'   ('.$langs->trans("RemainderToPay").': '.price($total_ttc - $totalam).')
    '.$langs->trans("Total").'   ('.$langs->trans("RemainderToPay").': '.price($total_ttc - $totalam).')  '.price($total).'
    '; $texte .= ''; @@ -223,10 +227,7 @@ class doc_generic_reception_odt extends ModelePdfReception $sav_charset_output = $outputlangs->charset_output; $outputlangs->charset_output = 'UTF-8'; - $outputlangs->load("main"); - $outputlangs->load("dict"); - $outputlangs->load("companies"); - $outputlangs->load("bills"); + $outputlangs->loadLangs(array("main", "dict", "companies", "bills")); if ($conf->reception->dir_output."/reception") { // If $object is id instead of object @@ -288,21 +289,25 @@ class doc_generic_reception_odt extends ModelePdfReception return -1; } - // If BILLING contact defined on invoice, we use it + // If CUSTOMER contact defined on reception, we use it $usecontact = false; - $arrayidcontact = $object->getIdContact('external', 'BILLING'); + $arrayidcontact = $object->getIdContact('external', 'CUSTOMER'); if (count($arrayidcontact) > 0) { $usecontact = true; $result = $object->fetch_contact($arrayidcontact[0]); } // Recipient name + $contactobject = null; if (!empty($usecontact)) { - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { - $socobject = $object->contact; + // We can use the company of contact instead of thirdparty company + if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) { + $object->contact->fetch_thirdparty(); + $socobject = $object->contact->thirdparty; + $contactobject = $object->contact; } else { $socobject = $object->thirdparty; - // if we have a BILLING contact and we dont use it as recipient we store the contact object for later use + // if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use $contactobject = $object->contact; } } else { @@ -318,6 +323,7 @@ class doc_generic_reception_odt extends ModelePdfReception '__TOTAL_VAT__' => $object->total_tva ); complete_substitutions_array($substitutionarray, $langs, $object); + // Call the ODTSubstitution hook $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks @@ -343,6 +349,7 @@ class doc_generic_reception_odt extends ModelePdfReception ); } catch (Exception $e) { $this->error = $e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } // After construction $odfHandler->contentXml contains content and @@ -359,67 +366,23 @@ class doc_generic_reception_odt extends ModelePdfReception dol_syslog($e->getMessage(), LOG_INFO); } - // Make substitutions into odt of user info - $tmparray = $this->get_substitutionarray_user($user, $outputlangs); - //var_dump($tmparray); exit; - foreach ($tmparray as $key => $value) { - try { - if (preg_match('/logo$/', $key)) { // Image - //var_dump($value);exit; - if (file_exists($value)) { - $odfHandler->setImage($key, $value); - } else { - $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - } else // Text - { - $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - } catch (OdfException $e) { - dol_syslog($e->getMessage(), LOG_INFO); - } + // Define substitution array + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); + $array_object_from_properties = $this->get_substitutionarray_each_var_object($object, $outputlangs); + $array_objet = $this->get_substitutionarray_object($object, $outputlangs); + $array_user = $this->get_substitutionarray_user($user, $outputlangs); + $array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs); + $array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs); + $array_other = $this->get_substitutionarray_other($outputlangs); + // retrieve contact information for use in object as contact_xxx tags + $array_thirdparty_contact = array(); + if ($usecontact && is_object($contactobject)) { + $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact'); } - // Make substitutions into odt of mysoc - $tmparray = $this->get_substitutionarray_mysoc($mysoc, $outputlangs); - //var_dump($tmparray); exit; - foreach ($tmparray as $key => $value) { - try { - if (preg_match('/logo$/', $key)) { // Image - //var_dump($value);exit; - if (file_exists($value)) { - $odfHandler->setImage($key, $value); - } else { - $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - } else // Text - { - $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - } catch (OdfException $e) { - dol_syslog($e->getMessage(), LOG_INFO); - } - } - // Make substitutions into odt of thirdparty - $tmparray = $this->get_substitutionarray_thirdparty($socobject, $outputlangs); - foreach ($tmparray as $key => $value) { - try { - if (preg_match('/logo$/', $key)) { // Image - if (file_exists($value)) { - $odfHandler->setImage($key, $value); - } else { - $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - } else // Text - { - $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - } catch (OdfException $e) { - dol_syslog($e->getMessage(), LOG_INFO); - } - } - // Replace tags of object + external modules - $tmparray = $this->get_substitutionarray_reception($object, $outputlangs); + + $tmparray = array_merge($substitutionarray, $array_object_from_properties, $array_user, $array_soc, $array_thirdparty, $array_objet, $array_other, $array_thirdparty_contact); complete_substitutions_array($tmparray, $outputlangs, $object); + // Call the ODTSubstitution hook $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks @@ -441,25 +404,36 @@ class doc_generic_reception_odt extends ModelePdfReception } // Replace tags of lines try { - $listlines = $odfHandler->setSegment('lines'); - foreach ($object->lines as $line) { - $tmparray = $this->get_substitutionarray_reception_lines($line, $outputlangs); - complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); - // Call the ODTSubstitutionLine hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line); - $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - foreach ($tmparray as $key => $val) { - try { - $listlines->setVars($key, $val, true, 'UTF-8'); - } catch (OdfException $e) { - dol_syslog($e->getMessage(), LOG_INFO); - } catch (SegmentException $e) { - dol_syslog($e->getMessage(), LOG_INFO); - } - } - $listlines->merge(); + $foundtagforlines = 1; + try { + $listlines = $odfHandler->setSegment('lines'); + } catch (OdfException $e) { + // We may arrive here if tags for lines not present into template + $foundtagforlines = 0; + dol_syslog($e->getMessage(), LOG_INFO); + } + if ($foundtagforlines) { + $linenumber = 0; + foreach ($object->lines as $line) { + $linenumber++; + $tmparray = $this->get_substitutionarray_reception_lines($line, $outputlangs); + complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); + // Call the ODTSubstitutionLine hook + $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line); + $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + foreach ($tmparray as $key => $val) { + try { + $listlines->setVars($key, $val, true, 'UTF-8'); + } catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); + } catch (SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); + } + } + $listlines->merge(); + } + $odfHandler->mergeSegment($listlines); } - $odfHandler->mergeSegment($listlines); } catch (OdfException $e) { $this->error = $e->getMessage(); dol_syslog($this->error, LOG_WARNING); @@ -486,6 +460,7 @@ class doc_generic_reception_odt extends ModelePdfReception $odfHandler->exportAsAttachedPDF($file); } catch (Exception $e) { $this->error = $e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } else { @@ -493,6 +468,7 @@ class doc_generic_reception_odt extends ModelePdfReception $odfHandler->saveToDisk($file); } catch (Exception $e) { $this->error = $e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } @@ -505,6 +481,8 @@ class doc_generic_reception_odt extends ModelePdfReception $odfHandler = null; // Destroy object + $this->result = array('fullpath'=>$file); + return 1; // Success } else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 68ceb87ba96..38344a5f486 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -972,7 +972,7 @@ class pdf_squille extends ModelePdfReception } // Recipient name - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { + if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { $thirdparty = $object->contact; } else { $thirdparty = $object->thirdparty; diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index 2e48160d038..1d02b8003da 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -308,11 +308,14 @@ class doc_generic_stock_odt extends ModelePDFStock // Recipient name $contactobject = null; if (!empty($usecontact)) { - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { - $socobject = $object->contact; + // We can use the company of contact instead of thirdparty company + if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) { + $object->contact->fetch_thirdparty(); + $socobject = $object->contact->thirdparty; + $contactobject = $object->contact; } else { $socobject = $object->thirdparty; - // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + // if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use $contactobject = $object->contact; } } else { diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 3119ffa8dc5..c4fb2ef7b50 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -1238,7 +1238,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices } // Recipient name - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { + if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { $thirdparty = $object->contact; } else { $thirdparty = $mysoc; diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index 49ba1ec6cdf..dfb05d2d55f 100644 --- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -298,11 +298,14 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders // Recipient name $contactobject = null; if (!empty($usecontact)) { - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { - $socobject = $object->contact; + // We can use the company of contact instead of thirdparty company + if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) { + $object->contact->fetch_thirdparty(); + $socobject = $object->contact->thirdparty; + $contactobject = $object->contact; } else { $socobject = $object->thirdparty; - // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + // if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use $contactobject = $object->contact; } } else { diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 3e04844119b..436017cda0a 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -1407,7 +1407,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders } // Recipient name - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { + if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { $thirdparty = $object->contact; } else { $thirdparty = $object->thirdparty; diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index bb12b19c829..8c706f59db3 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -1314,7 +1314,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } // Recipient name - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { + if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { $thirdparty = $object->contact; } else { $thirdparty = $object->thirdparty; diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 8cd572a1bcf..18e5a210aa1 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -332,11 +332,14 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal // Recipient name $contactobject = null; if (!empty($usecontact)) { - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { - $socobject = $object->contact; + // We can use the company of contact instead of thirdparty company + if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) { + $object->contact->fetch_thirdparty(); + $socobject = $object->contact->thirdparty; + $contactobject = $object->contact; } else { $socobject = $object->thirdparty; - // if we have a BILLING contact and we dont use it as recipient we store the contact object for later use + // if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use $contactobject = $object->contact; } } else { diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 5bd9b8cf339..1bf47275599 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -1418,7 +1418,7 @@ class pdf_aurore extends ModelePDFSupplierProposal // Recipient name if (!empty($usecontact)) { - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { + if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { $socname = $object->contact; } else { $socname = $object->thirdparty; diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php index 82ce006447e..e20cbf44cf7 100644 --- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php +++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php @@ -293,11 +293,14 @@ class doc_generic_ticket_odt extends ModelePDFTicket // Recipient name if (!empty($usecontact)) { - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { - $socobject = $object->contact; + // We can use the company of contact instead of thirdparty company + if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) { + $object->contact->fetch_thirdparty(); + $socobject = $object->contact->thirdparty; + $contactobject = $object->contact; } else { $socobject = $object->thirdparty; - // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + // if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use $contactobject = $object->contact; } } else { diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 7e07539aa8e..050eb43d44a 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -325,7 +325,7 @@ class doc_generic_user_odt extends ModelePDFUser // Recipient name if (!empty($usecontact)) { - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { + if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) { $socobject = $object->contact; } else { $socobject = $object->thirdparty; diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index cf91120d3f8..134c5e00362 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -315,11 +315,14 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup // Recipient name if (!empty($usecontact)) { - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { - $socobject = $object->contact; + // We can use the company of contact instead of thirdparty company + if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) { + $object->contact->fetch_thirdparty(); + $socobject = $object->contact->thirdparty; + $contactobject = $object->contact; } else { $socobject = $object->thirdparty; - // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + // if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use $contactobject = $object->contact; } } else { diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index 2f1c113fcf5..6750cc0b1a5 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -141,9 +141,9 @@ if (isset($extrafields->attributes[$elementtype]['type']) && is_array($extrafiel } print ''; - print ''; + print ''; print ''; } diff --git a/htdocs/core/tpl/ajaxrow.tpl.php b/htdocs/core/tpl/ajaxrow.tpl.php index acc5fad8125..61428170f50 100644 --- a/htdocs/core/tpl/ajaxrow.tpl.php +++ b/htdocs/core/tpl/ajaxrow.tpl.php @@ -61,6 +61,7 @@ $(document).ready(function(){ console.log("tableDND onDrop"); console.log(decodeURI($("#").tableDnDSerialize())); $('# tr[data-element=extrafield]').attr('id', ''); // Set extrafields id to empty value in order to ignore them in tableDnDSerialize function + $('# tr[data-ignoreidfordnd=1]').attr('id', ''); // Set id to empty value in order to ignore them in tableDnDSerialize function var roworder = cleanSerialize(decodeURI($("#").tableDnDSerialize())); var table_element_line = ""; var fk_element = ""; diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 2961dea7c96..212e766589c 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -146,10 +146,6 @@ if ($action == 'presend') { $formmail->trackid = $trackid; - if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) { // If bit 2 is set - include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid); - } $formmail->withfrom = 1; // Fill list of recipient with email inside <>. diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 078b68d864e..3def83f4e0d 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -135,19 +135,19 @@ if ($permission) { + '; } ?> -
    +
    socid) ? 0 : $object->socid); $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); ?>
    - -
    +
    selectcontacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 1, 'minwidth100imp'); + print img_object('', 'contact', 'class="pictofixedwidth"').$form->selectcontacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 1, 'minwidth100imp widthcentpercentminusxx maxwidth400'); $nbofcontacts = $form->num; $newcardbutton = ''; @@ -157,7 +157,7 @@ if ($permission) { print $newcardbutton; ?>
    -
    +
    element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) { 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 '
    '; + 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..84b0ada3487 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -339,7 +339,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) $thumbsbyrow = 6; print '
    '; - print ''; + print '
    '; // Title if ($foruserprofile) { @@ -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/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/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index b191e24b117..6504cfa27a6 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -546,7 +546,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t print ''."\n"; $lastlevel0 = 'enabled'; } elseif ($showmenu) { // Not enabled but visible (so greyed) - print ''."\n"; + print ''."\n"; $lastlevel0 = 'greyed'; } else { $lastlevel0 = 'hidden'; @@ -582,7 +582,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t } print ''."\n"; } elseif ($showmenu && $lastlevel0 == 'enabled') { // Not enabled but visible (so greyed), except if parent was not enabled. - print ''."\n"; + print ''."\n"; } } diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index 77725be2ae7..ebb5edc1c3b 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -309,7 +309,7 @@ class MenuManager print ''; } if ($val['enabled'] == 2) { - print ''.$val['titre'].''; + print ''.$val['titre'].''; } print ''; print ''."\n"; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 2dd0f055344..32dc909f2e2 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -2104,7 +2104,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM print ''."\n"; $lastlevel0 = 'enabled'; } elseif ($showmenu) { // Not enabled but visible (so greyed) - print ''."\n"; + print ''."\n"; $lastlevel0 = 'greyed'; } else { $lastlevel0 = 'hidden'; @@ -2145,7 +2145,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Not enabled but visible (so greyed), except if parent was not enabled. print ''."\n"; + print ''.$menu_array[$i]['titre'].'
    '."\n"; } } diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index a9817f3d1a5..35186e423ef 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -317,14 +317,14 @@ class MenuManager print ''; } if ($val['enabled'] == 2) { - print ''; + print ''; // Add font-awesome if ($val['level'] == 0 && !empty($val['prefix'])) { print $val['prefix']; } print $val['titre']; - print ''; + print ''; } print ''; print ''."\n"; diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index d1c222570cf..9a45a9b7fc2 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -320,7 +320,7 @@ class MenuManager print ''; } if ($val['enabled'] == 2) { - print ''.$val['titre'].''; + print ''.$val['titre'].''; } print ''; print ''."\n"; @@ -407,7 +407,7 @@ class MenuManager if ($menu_array[$i]['enabled']) { print '
    '."\n"; } else { - print ''."\n"; + print ''."\n"; } print ''."\n"; } @@ -433,7 +433,7 @@ class MenuManager print ''; } } else { - print $tabstring.''.$menu_array[$i]['titre'].''; + print $tabstring.''.$menu_array[$i]['titre'].''; } // If title is not pure text and contains a table, no carriage return added diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php index 2e1ab3b5ef4..08d31e3cd95 100644 --- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php +++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php @@ -295,12 +295,14 @@ class doc_generic_bom_odt extends ModelePDFBom // Recipient name $contactobject = null; if (!empty($usecontact)) { - // On peut utiliser le nom de la societe du contact - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { - $socobject = $object->contact; + // We can use the company of contact instead of thirdparty company + if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) { + $object->contact->fetch_thirdparty(); + $socobject = $object->contact->thirdparty; + $contactobject = $object->contact; } else { $socobject = $object->thirdparty; - // if we have a CUSTOMER contact and we dont use as recipient we store the contact object for later use + // if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use $contactobject = $object->contact; } } else { diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index adb26a38e0a..1e6aeac79e5 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -53,7 +53,8 @@ class doc_generic_order_odt extends ModelePDFCommandes public $phpmin = array(5, 6); /** - * @var string Dolibarr version of the loaded document + * Dolibarr version of the loaded document + * @var string */ public $version = 'dolibarr'; @@ -96,7 +97,7 @@ class doc_generic_order_odt extends ModelePDFCommandes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts - // Recupere emetteur + // Get source company $this->emetteur = $mysoc; if (!$this->emetteur->country_code) { $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined @@ -234,6 +235,7 @@ class doc_generic_order_odt extends ModelePDFCommandes $sav_charset_output = $outputlangs->charset_output; $outputlangs->charset_output = 'UTF-8'; + // Load translation files required by the page $outputlangs->loadLangs(array("main", "dict", "companies", "bills")); if ($conf->commande->dir_output) { @@ -271,7 +273,7 @@ class doc_generic_order_odt extends ModelePDFCommandes $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); $newfiletmp = $objectref.'_'.$newfiletmp; - //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt'; + // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); if (!empty($conf->global->MAIN_DOC_USE_TIMING)) { @@ -307,11 +309,14 @@ class doc_generic_order_odt extends ModelePDFCommandes // Recipient name $contactobject = null; if (!empty($usecontact)) { - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { - $socobject = $object->contact; + // We can use the company of contact instead of thirdparty company + if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) { + $object->contact->fetch_thirdparty(); + $socobject = $object->contact->thirdparty; + $contactobject = $object->contact; } else { $socobject = $object->thirdparty; - // if we have a CUSTOMER contact and we dont use as recipient we store the contact object for later use + // if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use $contactobject = $object->contact; } } else { @@ -379,6 +384,7 @@ class doc_generic_order_odt extends ModelePDFCommandes $array_other = $this->get_substitutionarray_other($outputlangs); // retrieve contact information for use in object as contact_xxx tags $array_thirdparty_contact = array(); + if ($usecontact && is_object($contactobject)) { $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact'); } @@ -455,7 +461,6 @@ class doc_generic_order_odt extends ModelePDFCommandes } // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index d45bab013e9..d83bf427ead 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1449,7 +1449,7 @@ class pdf_einstein extends ModelePDFCommandes } // Recipient name - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { + if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { $thirdparty = $object->contact; } else { $thirdparty = $object->thirdparty; diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 52f96764473..01fde021cb0 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -1634,7 +1634,7 @@ class pdf_eratosthene extends ModelePDFCommandes } //Recipient name - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { + if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { $thirdparty = $object->contact; } else { $thirdparty = $object->thirdparty; diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index b1e441175d9..a640d342ddc 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -295,11 +295,14 @@ class doc_generic_contract_odt extends ModelePDFContract // Recipient name $contactobject = null; if (!empty($usecontact)) { - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { - $socobject = $object->contact; + // We can use the company of contact instead of thirdparty company + if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) { + $object->contact->fetch_thirdparty(); + $socobject = $object->contact->thirdparty; + $contactobject = $object->contact; } else { $socobject = $object->thirdparty; - // if we have a CUSTOMER contact and we dont use as recipient we store the contact object for later use + // if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use $contactobject = $object->contact; } } else { diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 638c22221bd..69a4d5ce96e 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -720,7 +720,7 @@ class pdf_strato extends ModelePDFContract $this->recipient = $object->thirdparty; // Recipient name - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { + if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { $thirdparty = $object->contact; } else { $thirdparty = $object->thirdparty; diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php index 2893234e719..9c549576818 100644 --- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -860,7 +860,7 @@ class pdf_storm extends ModelePDFDeliveryOrder } // Recipient name - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { + if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { $thirdparty = $object->contact; } else { $thirdparty = $object->thirdparty; diff --git a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php index 4656784f50d..19e319d0522 100644 --- a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php @@ -859,7 +859,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder } // Recipient name - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { + if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { $thirdparty = $object->contact; } else { $thirdparty = $object->thirdparty; diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 5229645afe5..c504d97a854 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -307,11 +307,14 @@ class doc_generic_shipment_odt extends ModelePdfExpedition // Recipient name $contactobject = null; if (!empty($usecontact)) { - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { - $socobject = $object->contact; + // We can use the company of contact instead of thirdparty company + if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) { + $object->contact->fetch_thirdparty(); + $socobject = $object->contact->thirdparty; + $contactobject = $object->contact; } else { $socobject = $object->thirdparty; - // if we have a SHIPPING contact and we dont use as recipient we store the contact object for later use + // if we have a SHIPPING contact and we dont use it as thirdparty recipient we store the contact object for later use $contactobject = $object->contact; } } else { diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 28d797acffc..2752f9a9c9b 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; - +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; /** * Class to build sending documents with model espadon @@ -651,6 +651,11 @@ class pdf_espadon extends ModelePdfExpedition $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); $nexY = max($pdf->GetY(), $nexY); @@ -1121,7 +1126,7 @@ class pdf_espadon extends ModelePdfExpedition } // Recipient name - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { + if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { $thirdparty = $object->contact; } else { $thirdparty = $object->thirdparty; @@ -1312,6 +1317,20 @@ class pdf_espadon extends ModelePdfExpedition ), ); + $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( 'rank' => $rank, diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index f2434c93d26..56c8fb143fb 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -676,7 +676,7 @@ class pdf_merou extends ModelePdfExpedition } // Recipient name - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { + if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { $thirdparty = $object->contact; } else { $thirdparty = $object->thirdparty; diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index aa6603fa35a..4b542e4e636 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -1071,7 +1071,7 @@ class pdf_rouget extends ModelePdfExpedition } // Recipient name - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { + if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { $thirdparty = $object->contact; } else { $thirdparty = $object->thirdparty; diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index ec494302e93..ef20b4ff389 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -308,11 +308,14 @@ class doc_generic_invoice_odt extends ModelePDFFactures // Recipient name $contactobject = null; if (!empty($usecontact)) { - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { - $socobject = $object->contact; + // We can use the company of contact instead of thirdparty company + if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) { + $object->contact->fetch_thirdparty(); + $socobject = $object->contact->thirdparty; + $contactobject = $object->contact; } else { $socobject = $object->thirdparty; - // if we have a BILLING contact and we dont use it as recipient we store the contact object for later use + // if we have a BILLING contact and we dont use it as thirdparty recipient we store the contact object for later use $contactobject = $object->contact; } } else { diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 0fe149af0df..037074bce23 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1927,7 +1927,7 @@ class pdf_crabe extends ModelePDFFactures } // Recipient name - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { + if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { $thirdparty = $object->contact; } else { $thirdparty = $object->thirdparty; diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 021f195c577..b919b90abfd 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -2143,7 +2143,7 @@ class pdf_sponge extends ModelePDFFactures } // Recipient name - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { + if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { $thirdparty = $object->contact; } else { $thirdparty = $object->thirdparty; diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 37d64c43e17..e23a0aa1701 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -674,7 +674,7 @@ class pdf_soleil extends ModelePDFFicheinter } // Recipient name - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { + if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { $thirdparty = $object->contact; } else { $thirdparty = $object->thirdparty; diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index 7b2af1e0032..6ba84727b3f 100644 --- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -295,11 +295,14 @@ class doc_generic_member_odt extends ModelePDFMember // Recipient name if (!empty($usecontact)) { - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { - $socobject = $object->contact; + // We can use the company of contact instead of thirdparty company + if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) { + $object->contact->fetch_thirdparty(); + $socobject = $object->contact->thirdparty; + $contactobject = $object->contact; } else { $socobject = $object->thirdparty; - // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + // if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use $contactobject = $object->contact; } } else { diff --git a/htdocs/core/modules/modMultiCurrency.class.php b/htdocs/core/modules/modMultiCurrency.class.php index 5bf91ec341e..e89a2a4fe3e 100644 --- a/htdocs/core/modules/modMultiCurrency.class.php +++ b/htdocs/core/modules/modMultiCurrency.class.php @@ -300,10 +300,11 @@ class modMultiCurrency extends DolibarrModules { global $conf, $user, $langs; - if (!MultiCurrency::checkCodeAlreadyExists($conf->currency)) { + $multicurrency = new MultiCurrency($this->db); + + if (! $multicurrency->checkCodeAlreadyExists($conf->currency)) { $langs->loadCacheCurrencies(''); - $multicurrency = new MultiCurrency($this->db); $multicurrency->code = $conf->currency; $multicurrency->name = $langs->cache_currencies[$conf->currency]['label'].' ('.$langs->getCurrencySymbol($conf->currency).')'; $r = $multicurrency->create($user); 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', diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php index b6ad4c6b8ff..c2d697b4a4d 100644 --- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php +++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php @@ -302,11 +302,14 @@ class doc_generic_mo_odt extends ModelePDFMo // Recipient name $contactobject = null; if (!empty($usecontact)) { - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { - $socobject = $object->contact; + // We can use the company of contact instead of thirdparty company + if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) { + $object->contact->fetch_thirdparty(); + $socobject = $object->contact->thirdparty; + $contactobject = $object->contact; } else { $socobject = $object->thirdparty; - // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + // if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use $contactobject = $object->contact; } } else { diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index 05eef305c37..d702299769e 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -118,15 +118,10 @@ class doc_generic_product_odt extends ModelePDFProduct $form = new Form($this->db); $texte = $this->description.".
    \n"; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; - if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) { - $texte .= ''; - $texte .= ''; - $texte .= ''; - } $texte .= '
    '; // List of directories area @@ -165,35 +160,25 @@ class doc_generic_product_odt extends ModelePDFProduct $texte .= '
    '; // Scan directories - if (count($listofdir)) { + $nbofiles = count($listoffiles); + if (!empty($conf->global->PRODUCT_ADDON_PDF_ODT_PATH)) { $texte .= $langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; - - /*if ($conf->global->MAIN_PRODUCT_CHOOSE_ODT_DOCUMENT > 0) - { - // Model for creation - $liste=ModelePDFProduct::liste_modeles($this->db); - $texte.= '
    '; - $texte.= ''; - $texte.= ''; - $texte.= '"; - - $texte.= ''; - $texte.= ''; - $texte.= '"; - $texte.= ''; - - $texte.= ''; - $texte.= '"; - $texte.= '
    '.$langs->trans("DefaultModelPropalCreate").''; - $texte.= $form->selectarray('value2',$liste,$conf->global->PRODUCT_ADDON_PDF_ODT_DEFAULT); - $texte.= "
    '.$langs->trans("DefaultModelPropalToBill").''; - $texte.= $form->selectarray('value3',$liste,$conf->global->PRODUCT_ADDON_PDF_ODT_TOBILL); - $texte.= "
    '.$langs->trans("DefaultModelPropalClosed").''; - $texte.= $form->selectarray('value4',$liste,$conf->global->PRODUCT_ADDON_PDF_ODT_CLOSED); - $texte.= "
    '; - }*/ } + if ($nbofiles) { + $texte .= '
    '; + // Show list of found files + foreach ($listoffiles as $file) { + $texte .= '- '.$file['name'].' '.img_picto('', 'listlight').'
    '; + } + $texte .= '
    '; + } + // Add input to upload a new template file. + $texte .= '
    '.$langs->trans("UploadNewTemplate").' '; + $texte .= ''; + $texte .= ''; + $texte .= '
    '; + $texte .= '
    '; @@ -319,11 +304,14 @@ class doc_generic_product_odt extends ModelePDFProduct // Recipient name $contactobject = null; if (!empty($usecontact)) { - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { - $socobject = $object->contact; + // We can use the company of contact instead of thirdparty company + if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) { + $object->contact->fetch_thirdparty(); + $socobject = $object->contact->thirdparty; + $contactobject = $object->contact; } else { $socobject = $object->thirdparty; - // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + // if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use $contactobject = $object->contact; } } else { @@ -344,7 +332,7 @@ class doc_generic_product_odt extends ModelePDFProduct // Line of free text $newfreetext = ''; - $paramfreetext = 'product_FREE_TEXT'; + $paramfreetext = 'PRODUCT_FREE_TEXT'; if (!empty($conf->global->$paramfreetext)) { $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); } @@ -372,7 +360,6 @@ class doc_generic_product_odt extends ModelePDFProduct //print html_entity_decode($odfHandler->__toString()); //print exit; - $object->fetch_optionals(); // Make substitutions into odt of freetext try { @@ -399,7 +386,7 @@ class doc_generic_product_odt extends ModelePDFProduct complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $value) { @@ -480,6 +467,7 @@ class doc_generic_product_odt extends ModelePDFProduct } } + $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if (!empty($conf->global->MAIN_UMASK)) { diff --git a/htdocs/core/modules/product_batch/mod_lot_free.php b/htdocs/core/modules/product_batch/mod_lot_free.php index 0f069143ab1..def14bd37b3 100644 --- a/htdocs/core/modules/product_batch/mod_lot_free.php +++ b/htdocs/core/modules/product_batch/mod_lot_free.php @@ -18,7 +18,7 @@ */ /** - * \file htdocs/core/modules/product/mod_lot_free.php + * \file htdocs/core/modules/product_batch/mod_lot_free.php * \ingroup productbatch * \brief File containing class for numbering model of Lot free */ diff --git a/htdocs/core/modules/product_batch/mod_sn_advanced.php b/htdocs/core/modules/product_batch/mod_sn_advanced.php index 5e8fde199c1..abe094220d2 100644 --- a/htdocs/core/modules/product_batch/mod_sn_advanced.php +++ b/htdocs/core/modules/product_batch/mod_sn_advanced.php @@ -22,7 +22,7 @@ */ /** - * \file htdocs/core/modules/product_batch/mod_batch_advanced.php + * \file htdocs/core/modules/product_batch/mod_sn_advanced.php * \ingroup productbatch * \brief File containing class for numbering model of SN advanced */ diff --git a/htdocs/core/modules/product_batch/mod_sn_free.php b/htdocs/core/modules/product_batch/mod_sn_free.php index 95e1bd20359..67d39ec085a 100644 --- a/htdocs/core/modules/product_batch/mod_sn_free.php +++ b/htdocs/core/modules/product_batch/mod_sn_free.php @@ -18,7 +18,7 @@ */ /** - * \file htdocs/core/modules/product/mod_sn_free.php + * \file htdocs/core/modules/product_batch/mod_sn_free.php * \ingroup productbatch * \brief File containing class for numbering model of SN free */ diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index bd2fcfa471f..fb0991c8da1 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -335,11 +335,14 @@ class doc_generic_proposal_odt extends ModelePDFPropales // Recipient name $contactobject = null; if (!empty($usecontact)) { - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { - $socobject = $object->contact; + // We can use the company of contact instead of thirdparty company + if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) { + $object->contact->fetch_thirdparty(); + $socobject = $object->contact->thirdparty; + $contactobject = $object->contact; } else { $socobject = $object->thirdparty; - // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + // if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use $contactobject = $object->contact; } } else { diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index bf079c47b66..e964d61cda3 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1616,7 +1616,7 @@ class pdf_azur extends ModelePDFPropales } // Recipient name - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { + if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { $thirdparty = $object->contact; } else { $thirdparty = $object->thirdparty; diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 97f76df31bb..9dcccb92fdc 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1731,7 +1731,7 @@ class pdf_cyan extends ModelePDFPropales } // Recipient name - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { + if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { $thirdparty = $object->contact; } else { $thirdparty = $object->thirdparty; diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index 34d34ec3e19..4729231ac8b 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -62,8 +62,7 @@ class doc_generic_reception_odt extends ModelePdfReception { global $conf, $langs, $mysoc; - $langs->load("main"); - $langs->load("companies"); + $langs->loadLangs(array("main", "companies")); $this->db = $db; $this->name = "ODT templates"; @@ -173,6 +172,11 @@ class doc_generic_reception_odt extends ModelePdfReception } $texte .= ''; } + // Add input to upload a new template file. + $texte .= '
    '.$langs->trans("UploadNewTemplate").' '; + $texte .= ''; + $texte .= ''; + $texte .= '
    '; $texte .= '
    '; + print ''; print $langs->trans("None"); - print '
    '.img_edit().''.img_edit().'
    '; print ''; diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 7b20e7209f7..0a4bb149986 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -310,7 +310,7 @@ if (isset($conf->file->main_authentication) && preg_match('/openid/', $conf->fil print ''.$langs->trans("LoginUsingOpenID").''; } else { $langs->load("errors"); - print ''.$langs->trans("ErrorOpenIDSetupNotComplete", 'MAIN_AUTHENTICATION_OPENID_URL').''; + print ''.$langs->trans("ErrorOpenIDSetupNotComplete", 'MAIN_AUTHENTICATION_OPENID_URL').''; } echo '
    '; @@ -346,7 +346,7 @@ if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) { $resgetcommitstrip = getURLContent("https://www.commitstrip.com/en/feed/"); } if ($resgetcommitstrip && $resgetcommitstrip['http_code'] == '200') { - $xml = simplexml_load_string($resgetcommitstrip['content']); + $xml = simplexml_load_string($resgetcommitstrip['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET); $little = $xml->channel->item[0]->children('content', true); print preg_replace('/width="650" height="658"/', '', $little->encoded); } diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 4d715ed8797..4d0772225c7 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -114,10 +114,6 @@ if ($massaction == 'presend') { $formmail->fromid = $user->id; } $formmail->trackid = $trackid; - if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) { // If bit 2 is set - include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid); - } $formmail->withfrom = 1; $liste = $langs->trans("AllRecipientSelected", count($arrayofselected)); if (count($listofselectedthirdparties) == 1) { // Only 1 different recipient selected, we can suggest contacts diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 8ebb767a4d8..c4ddc7d0c4c 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -195,15 +195,16 @@ if (($line->info_bits & 2) == 2) { } } - - - //print get_date_range($line->date_start, $line->date_end, $format); } // Add description in form if ($line->fk_product > 0 && !empty($conf->global->PRODUIT_DESC_IN_FORM)) { - print (!empty($line->description) && $line->description != $line->product_label) ? (($line->date_start || $line->date_end) ? '' : '
    ').'
    '.dol_htmlentitiesbr($line->description) : ''; + if ($line->element == 'facturedetrec') { + print (!empty($line->description) && $line->description != $line->product_label) ? (($line->date_start_fill || $line->date_end_fill) ? '' : '
    ').'
    '.dol_htmlentitiesbr($line->description) : ''; + } else { + print (!empty($line->description) && $line->description != $line->product_label) ? (($line->date_start || $line->date_end) ? '' : '
    ').'
    '.dol_htmlentitiesbr($line->description) : ''; + } } // Line extrafield @@ -384,7 +385,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 +393,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 +403,12 @@ if ($this->statut == 0 && !empty($object_rights->creer) && $action != 'selectlin print ''; $coldisplay++; if ($i > 0) { ?> - id; ?>"> + id; ?>"> - id; ?>"> + id; ?>"> db); $contactdefault->socid = $socid; - $TContact = $contactdefault->getContactRoles($object->element); + + $TContact = array(); + if (method_exists($contactdefault, 'getContactRoles')) { // For backward compatibility + $TContact = $contactdefault->getContactRoles($object->element); + } if (is_array($TContact) && !empty($TContact)) { $TContactAlreadyLinked = array(); diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 727bf56f836..270fe3f57c4 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -745,7 +745,7 @@ if (($action == "create") || ($action == "edit")) { if (!$user->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/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index 267c79ab08e..2d9f70a1eb5 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 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/don/class/don.class.php b/htdocs/don/class/don.class.php index 792edbcc928..7ca70a31aa2 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -1116,7 +1116,7 @@ class Don extends CommonObject return -1; } - $sql = 'SELECT SUM(amount) as sum_amount FROM '.MAIN_DB_PREFIX.'payment_donation WHERE fk_donation = '.((int) $this->id); + $sql = "SELECT SUM(amount) as sum_amount FROM ".MAIN_DB_PREFIX."payment_donation WHERE fk_donation = ".((int) $this->id); $resql = $this->db->query($sql); if (!$resql) { dol_print_error($this->db); 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/ecm/index.php b/htdocs/ecm/index.php index 20d948b4b3b..813ee69b6fb 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -42,6 +42,7 @@ if (!$section) { $section = 0; } $section_dir = GETPOST('section_dir', 'alpha'); +$overwritefile = GETPOST('overwritefile', 'int'); $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); @@ -120,7 +121,6 @@ if (GETPOST("sendit", 'alphanohtml') && !empty($conf->global->MAIN_UPLOAD_DOC)) if (!$error) { $generatethumbs = 0; - $overwritefile = GETPOST('overwritefile', 'int')?GETPOST('overwritefile', 'int'):0; $res = dol_add_file_process($upload_dir, $overwritefile, 1, 'userfile', '', null, '', $generatethumbs); if ($res > 0) { $result = $ecmdir->changeNbOfFiles('+'); diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 1e76e3544e5..0826a53b772 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/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 7defb3dbf3c..9b997c8b0e9 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) @@ -643,6 +643,7 @@ print ''; print ''; print ''; print ''; +print ''; $title = $langs->trans("ListOfConferencesOrBooths"); diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index c5562e39c37..03e309aa41d 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 */ @@ -134,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__'); } } } @@ -650,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/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index 19d35a4be0e..709d3255e13 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -697,6 +697,7 @@ print ''; print ''; print ''; print ''; +print ''; $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.(empty($confOrBooth->id) ? '' : '&conforboothid='.$confOrBooth->id).$withProjectUrl), '', $permissiontoadd); diff --git a/htdocs/eventorganization/core/actions_massactions_mail.inc.php b/htdocs/eventorganization/core/actions_massactions_mail.inc.php index 483a1e5bc84..2f8e2959f2b 100644 --- a/htdocs/eventorganization/core/actions_massactions_mail.inc.php +++ b/htdocs/eventorganization/core/actions_massactions_mail.inc.php @@ -173,7 +173,7 @@ if (!$error && $massaction == 'confirm_presend_attendees') { $tmp = explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES); $from = trim($tmp[($reg[1] - 1)]); } elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) { - $sql = 'SELECT rowid, label, email FROM ' . MAIN_DB_PREFIX . 'c_email_senderprofile WHERE rowid = ' . (int) $reg[1]; + $sql = "SELECT rowid, label, email FROM " . MAIN_DB_PREFIX . "c_email_senderprofile WHERE rowid = " . (int) $reg[1]; $resql = $db->query($sql); $obj = $db->fetch_object($resql); if ($obj) { diff --git a/htdocs/eventorganization/tpl/massactions_mail_pre.tpl.php b/htdocs/eventorganization/tpl/massactions_mail_pre.tpl.php index 17c78babfea..e4990da6424 100644 --- a/htdocs/eventorganization/tpl/massactions_mail_pre.tpl.php +++ b/htdocs/eventorganization/tpl/massactions_mail_pre.tpl.php @@ -58,7 +58,7 @@ if ($massaction == 'presend_attendees') { print dol_get_fiche_head(null, '', ''); - // Cree l'objet formulaire mail + // Create form for email include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->withform = -1; @@ -68,10 +68,6 @@ if ($massaction == 'presend_attendees') { $formmail->fromid = $user->id; } $formmail->trackid = $trackid; - if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) { // If bit 2 is set - include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid); - } $formmail->withfrom = 1; $liste = $langs->trans("AllRecipientSelected", count($listofselectedid)); $formmail->withtoreadonly = 1; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index c36442915e6..3ff8cd490ad 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -137,8 +137,15 @@ if ($reshook < 0) { if (empty($reshook)) { if ($cancel) { - $action = ''; - $object->fetch($id); // show shipment also after canceling modification + if ($origin && $origin_id > 0) { + if ($origin == 'commande') { + header("Location: ".DOL_URL_ROOT.'/expedition/shipment.php?id='.((int) $origin_id)); + exit; + } + } else { + $action = ''; + $object->fetch($id); // show shipment also after canceling modification + } } include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once @@ -1049,7 +1056,7 @@ if ($action == 'create') { print ''.$langs->trans("QtyShipped").''; print ''.$langs->trans("QtyToShip"); if (empty($conf->productbatch->enabled)) { - print '
    '.img_picto($langs->trans("Autofill"), 'autofill', 'class="paddingrightonly"').$langs->trans("Fill").''; + print '
    '.img_picto($langs->trans("Autofill"), 'autofill', 'class="paddingrightonly"').''; print ' / '; } else { print '
    '; @@ -1153,10 +1160,16 @@ if ($action == 'create') { 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 @@ -1164,7 +1177,7 @@ if ($action == 'create') { $quantityDelivered = $object->expeditions[$line->id]; print $quantityDelivered; print ''; - print ''; + print ''.$unit_order.''; // Qty to ship $quantityAsked = $line->qty; @@ -1760,7 +1773,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 +1905,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 +1942,7 @@ if ($action == 'create') { print $langs->trans('IncotermLabel'); print ''; if ($user->rights->expedition->creer) { - print ''.img_edit().''; + print ''.img_edit().''; } else { print ' '; } @@ -2049,7 +2062,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"; @@ -2169,8 +2182,13 @@ if ($action == 'create') { 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) { @@ -2234,7 +2252,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 @@ -2245,7 +2263,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 @@ -2260,7 +2278,7 @@ if ($action == 'create') { print ''; print ''; // Qty to ship or shipped - print ''; + print ''.$unit_order.''; // Warehouse source print ''; // Batch number managment @@ -2282,7 +2300,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)) { @@ -2482,7 +2500,7 @@ if ($action == 'create') { $label = "ClassifyBilled"; $paramaction = 'classifybilled'; } - print ''.$langs->trans($label).''; + print ''.$langs->trans($label).''; } } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index a9372564280..623d3635ba5 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -43,9 +43,7 @@ if (!empty($conf->propal->enabled)) { if (!empty($conf->commande->enabled)) { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; } -if (!empty($conf->productbatch->enabled)) { - require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php'; -} +require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionlinebatch.class.php'; /** @@ -1188,7 +1186,6 @@ class Expedition extends CommonObject global $conf, $langs, $user; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php'; $error = 0; $this->error = ''; @@ -1230,6 +1227,9 @@ class Expedition extends CommonObject $resql = $this->db->query($sql); if ($resql) { $cpt = $this->db->num_rows($resql); + + $shipmentlinebatch = new ExpeditionLineBatch($this->db); + for ($i = 0; $i < $cpt; $i++) { dol_syslog(get_class($this)."::delete movement index ".$i); $obj = $this->db->fetch_object($resql); @@ -1240,11 +1240,12 @@ class Expedition extends CommonObject // get lot/serial $lotArray = null; if ($conf->productbatch->enabled) { - $lotArray = ExpeditionLineBatch::fetchAll($this->db, $obj->expeditiondet_id); + $lotArray = $shipmentlinebatch->fetchAll($obj->expeditiondet_id); if (!is_array($lotArray)) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } } + if (empty($lotArray)) { // no lot/serial // We increment stock of product (and sub-products) @@ -1276,7 +1277,8 @@ class Expedition extends CommonObject // delete batch expedition line if (!$error && $conf->productbatch->enabled) { - if (ExpeditionLineBatch::deletefromexp($this->db, $this->id) < 0) { + $shipmentlinebatch = new ExpeditionLineBatch($this->db); + if ($shipmentlinebatch->deleteFromShipment($this->id) < 0) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } } @@ -1372,7 +1374,6 @@ class Expedition extends CommonObject global $conf, $langs, $user; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php'; $error = 0; $this->error = ''; @@ -1460,15 +1461,16 @@ class Expedition extends CommonObject // delete batch expedition line (we try deletion even if module not enabled in case of the module were enabled and disabled previously) if (!$error) { - if (ExpeditionLineBatch::deletefromexp($this->db, $this->id) < 0) { + $shipmentlinebatch = ExpeditionLineBatch($this->db); + if ($shipmentlinebatch->deleteFromShipment($this->id) < 0) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } } if (!$error) { - $main = MAIN_DB_PREFIX.'expeditiondet'; - $ef = $main."_extrafields"; - $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_expedition = ".((int) $this->id).")"; + $main = MAIN_DB_PREFIX.'expeditiondet'; + $ef = $main."_extrafields"; + $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_expedition = ".((int) $this->id).")"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet"; $sql .= " WHERE fk_expedition = ".((int) $this->id); @@ -1480,8 +1482,8 @@ class Expedition extends CommonObject $error++; } - // delete extrafields - $res = $this->deleteExtraFields(); + // delete extrafields + $res = $this->deleteExtraFields(); if ($res < 0) { $error++; } @@ -1597,6 +1599,7 @@ class Expedition extends CommonObject $this->total_localtax2 = 0; $line = new ExpeditionLigne($this->db); + $shipmentlinebatch = new ExpeditionLineBatch($this->db); while ($i < $num) { $obj = $this->db->fetch_object($resql); @@ -1695,9 +1698,8 @@ class Expedition extends CommonObject // Detail of batch if (!empty($conf->productbatch->enabled) && $obj->line_id > 0 && $obj->product_tobatch > 0) { - require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php'; + $newdetailbatch = $shipmentlinebatch->fetchAll($obj->line_id, $obj->fk_product); - $newdetailbatch = ExpeditionLineBatch::fetchAll($this->db, $obj->line_id, $obj->fk_product); if (is_array($newdetailbatch)) { if ($originline != $obj->fk_origin_line) { $line->detail_batch = $newdetailbatch; @@ -2925,8 +2927,9 @@ class ExpeditionLigne extends CommonObjectLine } // fetch remaining lot qty - require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php'; - if (!$error && ($lotArray = ExpeditionLineBatch::fetchAll($this->db, $this->id)) < 0) { + $shipmentlinebatch = new ExpeditionLineBatch($this->db); + + if (!$error && ($lotArray = $shipmentlinebatch->fetchAll($this->id)) < 0) { $this->errors[] = $this->db->lasterror()." - ExpeditionLineBatch::fetchAll"; $error++; } else { diff --git a/htdocs/expedition/class/expeditionbatch.class.php b/htdocs/expedition/class/expeditionlinebatch.class.php similarity index 85% rename from htdocs/expedition/class/expeditionbatch.class.php rename to htdocs/expedition/class/expeditionlinebatch.class.php index 03066869450..b2562734447 100644 --- a/htdocs/expedition/class/expeditionbatch.class.php +++ b/htdocs/expedition/class/expeditionlinebatch.class.php @@ -17,7 +17,7 @@ */ /** - * \file expedition/class/expeditionbatch.class.php + * \file htdocs/expedition/class/expeditionlinebatch.class.php * \ingroup productbatch * \brief This file implements CRUD method for managing shipment batch lines * with batch record @@ -33,7 +33,10 @@ class ExpeditionLineBatch extends CommonObject */ public $element = 'expeditionlignebatch'; - private static $_table_element = 'expeditiondet_batch'; //!< Name of table without prefix where object is stored + /** + * @var string Name of table without prefix where object is stored. This is also the key used for extrafields management. + */ + public $table_element = 'expeditiondet_batch'; public $sellby; public $eatby; @@ -44,6 +47,7 @@ class ExpeditionLineBatch extends CommonObject public $fk_origin_stock; public $fk_expeditiondet; + /** * Constructor * @@ -74,6 +78,7 @@ class ExpeditionLineBatch extends CommonObject $sql .= " WHERE pb.rowid = ".(int) $id_stockdluo; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); + $resql = $this->db->query($sql); if ($resql) { if ($this->db->num_rows($resql)) { @@ -106,7 +111,7 @@ class ExpeditionLineBatch extends CommonObject $id_line_expdet = (int) $id_line_expdet; - $sql = "INSERT INTO ".MAIN_DB_PREFIX.self::$_table_element." ("; + $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element." ("; $sql .= "fk_expeditiondet"; $sql .= ", sellby"; $sql .= ", eatby"; @@ -129,7 +134,8 @@ class ExpeditionLineBatch extends CommonObject } if (!$error) { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.self::$_table_element); + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); + $this->fk_expeditiondet = $id_line_expdet; return $this->id; } else { @@ -145,17 +151,16 @@ class ExpeditionLineBatch extends CommonObject /** * Delete batch record attach to a shipment * - * @param DoliDB $db Database object * @param int $id_expedition rowid of shipment * @return int -1 if KO, 1 if OK */ - public static function deletefromexp($db, $id_expedition) + public function deleteFromShipment($id_expedition) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX.self::$_table_element; + $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element; $sql .= " WHERE fk_expeditiondet in (SELECT rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition=".((int) $id_expedition).")"; dol_syslog(__METHOD__, LOG_DEBUG); - if ($db->query($sql)) { + if ($this->db->query($sql)) { return 1; } else { return -1; @@ -165,12 +170,11 @@ class ExpeditionLineBatch extends CommonObject /** * Retrieve all batch number detailed information of a shipment line * - * @param DoliDB $db Database object * @param int $id_line_expdet id of shipment line * @param int $fk_product If provided, load also detailed information of lot * @return int|array -1 if KO, array of ExpeditionLineBatch if OK */ - public static function fetchAll($db, $id_line_expdet, $fk_product = 0) + public function fetchAll($id_line_expdet, $fk_product = 0) { $sql = "SELECT"; $sql .= " eb.rowid,"; @@ -184,25 +188,24 @@ class ExpeditionLineBatch extends CommonObject $sql .= ", pl.sellby"; $sql .= ", pl.eatby"; } - $sql .= " FROM ".MAIN_DB_PREFIX.self::$_table_element." as eb"; + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as eb"; if ($fk_product > 0) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lot as pl ON pl.batch = eb.batch AND pl.fk_product = ".((int) $fk_product); } $sql .= " WHERE fk_expeditiondet=".(int) $id_line_expdet; dol_syslog(__METHOD__."", LOG_DEBUG); - $resql = $db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - $num = $db->num_rows($resql); + $num = $this->db->num_rows($resql); $i = 0; $ret = array(); while ($i < $num) { - $tmp = new self($db); + $obj = $this->db->fetch_object($resql); - $obj = $db->fetch_object($resql); - - $tmp->sellby = $db->jdate($obj->sellby ? $obj->sellby : $obj->oldsellby); - $tmp->eatby = $db->jdate($obj->eatby ? $obj->eatby : $obj->oldeatby); + $tmp = new self($this->db); + $tmp->sellby = $this->db->jdate($obj->sellby ? $obj->sellby : $obj->oldsellby); + $tmp->eatby = $this->db->jdate($obj->eatby ? $obj->eatby : $obj->oldeatby); $tmp->batch = $obj->batch; $tmp->id = $obj->rowid; $tmp->fk_origin_stock = $obj->fk_origin_stock; @@ -213,10 +216,12 @@ class ExpeditionLineBatch extends CommonObject $ret[] = $tmp; $i++; } - $db->free($resql); + + $this->db->free($resql); + return $ret; } else { - dol_print_error($db); + dol_print_error($this->db); return -1; } } diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index f543b8baee4..b8814450030 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 ' '; } @@ -617,7 +617,7 @@ 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,'; @@ -625,8 +625,10 @@ if ($id > 0 || !empty($ref)) { $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 .= ', p.tobatch, p.tosell, p.tobuy, p.barcode'; + $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"; @@ -766,7 +768,7 @@ if ($id > 0 || !empty($ref)) { } // Qty ordered - print ''.$objp->qty.''; + print ''.$objp->qty.($objp->unit_order ? ' '.$objp->unit_order : '').''; // Qty already shipped $qtyProdCom = $objp->qty; @@ -774,7 +776,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 ? ' '.$objp->unit_order : '').''; // Qty remains to ship print ''; @@ -785,7 +787,7 @@ if ($id > 0 || !empty($ref)) { } else { print '0 ('.$langs->trans("Service").')'; } - print ''; + print ($objp->unit_order ? ' '.$objp->unit_order : '').''; if ($objp->fk_product > 0) { $product = new Product($db); diff --git a/htdocs/expensereport/ajax/ajaxik.php b/htdocs/expensereport/ajax/ajaxik.php index c2cc8345671..6cd8c05fe5b 100644 --- a/htdocs/expensereport/ajax/ajaxik.php +++ b/htdocs/expensereport/ajax/ajaxik.php @@ -76,7 +76,8 @@ if (empty($fk_expense) || $fk_expense < 0) { if ($userauthor->fetch($expense->fk_user_author) <= 0) { echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorRecordNotFound'), 'fk_user_author' => $expense->fk_user_author)); } else { - $range = ExpenseReportIk::getRangeByUser($userauthor, $fk_c_exp_tax_cat); + $expenseik = new ExpenseReportIk($db); + $range = $expenseik->getRangeByUser($userauthor, $fk_c_exp_tax_cat); if (empty($range)) { echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorRecordNotFound'), 'range' => $range)); diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 7aa08d30c39..6e40b6b3a77 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -68,6 +68,17 @@ $socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('socid_id', $childids = $user->getAllChildIds(1); +if (! empty($conf->global->EXPENSEREPORT_PREFILL_DATES_WITH_CURRENT_MONTH)) { + if (empty($date_start)) { + $date_start = dol_mktime(0, 0, 0, (int) dol_print_date(dol_now(), '%m'), 1, (int) dol_print_date(dol_now(), '%Y')); + } + + if (empty($date_end)) { + // date('t') => number of days in the month, so last day of the month too + $date_end = dol_mktime(0, 0, 0, (int) dol_print_date(dol_now(), '%m'), (int) date('t'), (int) dol_print_date(dol_now(), '%Y')); + } +} + // Hack to use expensereport dir $rootfordata = DOL_DATA_ROOT; $rootforuser = DOL_DATA_ROOT; @@ -106,6 +117,8 @@ $permissiontoadd = $user->rights->expensereport->creer; // Used by the include o $upload_dir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($object->ref); +$projectRequired = $conf->projet->enabled && ! empty($conf->global->EXPENSEREPORT_PROJECT_IS_REQUIRED); + if ($object->id > 0) { // Check current user can read this expense report $canread = 0; @@ -266,10 +279,14 @@ if (empty($reshook)) { } } - if (!$error && empty($conf->global->EXPENSEREPORT_ALLOW_OVERLAPPING_PERIODS) && $object->periode_existe($fuser, $object->date_debut, $object->date_fin)) { - $error++; - setEventMessages($langs->trans("ErrorDoubleDeclaration"), null, 'errors'); - $action = 'create'; + if (!$error && empty($conf->global->EXPENSEREPORT_ALLOW_OVERLAPPING_PERIODS)) { + $overlappingExpenseReportID = $object->periode_existe($fuser, $object->date_debut, $object->date_fin, true); + + if ($overlappingExpenseReportID > 0) { + $error++; + setEventMessages($langs->trans("ErrorDoubleDeclaration").' '. $langs->trans('ShowTrip').'', null, 'errors'); + $action = 'create'; + } } if (!$error) { @@ -1132,6 +1149,12 @@ if (empty($reshook)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PriceUTTC")), null, 'errors'); } + // If no project entered + if ($projectRequired && $fk_project <= 0) { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Project")), null, 'errors'); + } + if (!$error) { $type = 0; // TODO What if service ? We should take the type product/service from the type of expense report llx_c_type_fees @@ -1265,6 +1288,12 @@ if (empty($reshook)) { setEventMessages($langs->trans("WarningDateOfLineMustBeInExpenseReportRange"), null, 'warnings'); } + // If no project entered + if ($projectRequired && $projet_id <= 0) { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Project")), null, 'errors'); + } + if (!$error) { // TODO Use update method of ExpenseReportLine $result = $object->updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $id, $fk_c_exp_tax_cat, $fk_ecm_files); @@ -1565,6 +1594,8 @@ if ($action == 'create') { print ''; } else { + $taxlessUnitPriceDisabled = ! empty($conf->global->EXPENSEREPORT_FORCE_LINE_AMOUNTS_INCLUDING_TAXES_ONLY) ? ' disabled' : ''; + print dol_get_fiche_head($head, 'card', $langs->trans("ExpenseReport"), -1, 'trip'); // Clone confirmation @@ -2075,7 +2106,7 @@ if ($action == 'create') { } else { $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $line->vatrate)); $pricenettoshow = price2num($line->value_unit / (1 + $tmpvat / 100), 'MU'); - print $pricenettoshow; + print price($pricenettoshow); } print ''; @@ -2252,7 +2283,7 @@ if ($action == 'create') { // Select project if (!empty($conf->projet->enabled)) { print ''; - $formproject->select_projects(-1, $line->fk_project, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300'); + $formproject->select_projects(-1, $line->fk_project, 'fk_project', 0, 0, $projectRequired ? 0 : 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300'); print ''; } @@ -2281,7 +2312,7 @@ if ($action == 'create') { // Unit price print ''; - print ''; + print ''; print ''; // Unit price with tax @@ -2428,7 +2459,7 @@ if ($action == 'create') { // Select project if (!empty($conf->projet->enabled)) { print ''; - $formproject->select_projects(-1, $fk_project, 'fk_project', 0, 0, 1, -1, 0, 0, 0, '', 0, 0, 'maxwidth300'); + $formproject->select_projects(-1, $fk_project, 'fk_project', 0, 0, $projectRequired ? 0 : 1, -1, 0, 0, 0, '', 0, 0, 'maxwidth300'); print ''; } @@ -2460,7 +2491,7 @@ if ($action == 'create') { // Unit price net print ''; - print ''; + print ''; print ''; // Unit price with tax @@ -2554,11 +2585,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 +2602,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/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index df1c79c82dd..64034c10a3f 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1887,7 +1887,8 @@ class ExpenseReport extends CommonObject } //$buyer = new Societe($this->db); - $rulestocheck = ExpenseReportRule::getAllRule($this->line->fk_c_type_fees, $this->line->date, $this->fk_user_author); + $expensereportrule = new ExpenseReportRule($db); + $rulestocheck = $expensereportrule->getAllRule($this->line->fk_c_type_fees, $this->line->date, $this->fk_user_author); $violation = 0; $rule_warning_message_tab = array(); @@ -1974,7 +1975,8 @@ class ExpenseReport extends CommonObject } //$buyer = new Societe($this->db); - $range = ExpenseReportIk::getRangeByUser($userauthor, $this->line->fk_c_exp_tax_cat); + $expenseik = new ExpenseReportIk($db); + $range = $expenseik->getRangeByUser($userauthor, $this->line->fk_c_exp_tax_cat); if (empty($range)) { $this->error = 'ErrorNoRangeAvailable'; @@ -2211,8 +2213,6 @@ class ExpenseReport extends CommonObject $date_d_form = $date_debut; $date_f_form = $date_fin; - $existe = false; - while ($i < $num_rows) { $objp = $this->db->fetch_object($result); @@ -2220,17 +2220,13 @@ class ExpenseReport extends CommonObject $date_f_req = $this->db->jdate($objp->date_fin); // 4 if (!($date_f_form < $date_d_req || $date_d_form > $date_f_req)) { - $existe = true; + return $objp->rowid; } $i++; } - if ($existe) { - return 1; - } else { - return 0; - } + return 0; } else { return 0; } diff --git a/htdocs/expensereport/class/expensereport_ik.class.php b/htdocs/expensereport/class/expensereport_ik.class.php index 358a2fe06ca..da2312bdcb1 100644 --- a/htdocs/expensereport/class/expensereport_ik.class.php +++ b/htdocs/expensereport/class/expensereport_ik.class.php @@ -87,8 +87,6 @@ class ExpenseReportIk extends CoreObject */ public function __construct(DoliDB &$db) { - global $conf; - parent::__construct($db); parent::init(); @@ -102,29 +100,28 @@ class ExpenseReportIk extends CoreObject * @param int $mode 1=only active; 2=only inactive; other value return all * @return array of category */ - public static function getTaxCategories($mode = 1) + public function getTaxCategories($mode = 1) { - global $db; - $categories = array(); $sql = 'SELECT rowid, label, entity, active'; $sql .= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat'; - $sql .= ' WHERE entity IN ('.getEntity('c_exp_tax_cat').')'; + $sql .= ' WHERE entity IN (0, '.getEntity($this->element).')'; if ($mode == 1) { $sql .= ' AND active = 1'; } elseif ($mode == 2) { $sql .= 'AND active = 0'; } - dol_syslog(get_called_class().'::getTaxCategories sql='.$sql, LOG_DEBUG); - $resql = $db->query($sql); + dol_syslog(get_called_class().'::getTaxCategories', LOG_DEBUG); + + $resql = $this->db->query($sql); if ($resql) { - while ($obj = $db->fetch_object($resql)) { + while ($obj = $this->db->fetch_object($resql)) { $categories[$obj->rowid] = $obj; } } else { - dol_print_error($db); + dol_print_error($this->db); } return $categories; @@ -137,10 +134,10 @@ class ExpenseReportIk extends CoreObject * @param int $fk_c_exp_tax_cat category * @return boolean|array */ - public static function getRangeByUser(User $userauthor, int $fk_c_exp_tax_cat) + public function getRangeByUser(User $userauthor, int $fk_c_exp_tax_cat) { $default_range = (int) $userauthor->default_range; // if not defined, then 0 - $ranges = self::getRangesByCategory($fk_c_exp_tax_cat); + $ranges = $this->getRangesByCategory($fk_c_exp_tax_cat); // substract 1 because array start from 0 if (empty($ranges) || !isset($ranges[$default_range - 1])) { @@ -157,10 +154,8 @@ class ExpenseReportIk extends CoreObject * @param int $active active * @return array */ - public static function getRangesByCategory(int $fk_c_exp_tax_cat, $active = 1) + public function getRangesByCategory(int $fk_c_exp_tax_cat, $active = 1) { - global $db; - $ranges = array(); dol_syslog(get_called_class().'::getRangesByCategory for fk_c_exp_tax_cat='.$fk_c_exp_tax_cat, LOG_DEBUG); @@ -170,24 +165,25 @@ class ExpenseReportIk extends CoreObject $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)'; } $sql .= ' WHERE r.fk_c_exp_tax_cat = '.((int) $fk_c_exp_tax_cat); + $sql .= " AND entity IN(0, ".getEntity($this->element).")"; if ($active) { $sql .= ' AND r.active = 1 AND c.active = 1'; } $sql .= ' ORDER BY r.range_ik'; - $resql = $db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - $num = $db->num_rows($resql); + $num = $this->db->num_rows($resql); if ($num > 0) { - while ($obj = $db->fetch_object($resql)) { - $object = new ExpenseReportIk($db); + while ($obj = $this->db->fetch_object($resql)) { + $object = new ExpenseReportIk($this->db); $object->fetch($obj->rowid); $ranges[] = $object; } } } else { - dol_print_error($db); + dol_print_error($this->db); } return $ranges; @@ -198,24 +194,23 @@ class ExpenseReportIk extends CoreObject * * @return array */ - public static function getAllRanges() + public function getAllRanges() { - global $db; - $ranges = array(); $sql = ' SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, c.label, i.rowid as fk_expense_ik, r.active as range_active, c.active as cat_active'; $sql .= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r'; $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'expensereport_ik i ON (r.rowid = i.fk_range)'; - $sql .= ' WHERE r.entity IN (0, '.getEntity('').')'; + $sql .= ' WHERE r.entity IN (0, '.getEntity($this->element).')'; $sql .= ' ORDER BY r.fk_c_exp_tax_cat, r.range_ik'; - dol_syslog(get_called_class().'::getAllRanges sql='.$sql, LOG_DEBUG); - $resql = $db->query($sql); + dol_syslog(get_called_class().'::getAllRanges', LOG_DEBUG); + + $resql = $this->db->query($sql); if ($resql) { - while ($obj = $db->fetch_object($resql)) { - $ik = new ExpenseReportIk($db); + while ($obj = $this->db->fetch_object($resql)) { + $ik = new ExpenseReportIk($this->db); if ($obj->fk_expense_ik > 0) { $ik->fetch($obj->fk_expense_ik); } @@ -227,7 +222,7 @@ class ExpenseReportIk extends CoreObject $ranges[$obj->fk_c_exp_tax_cat]['ranges'][] = $obj; } } else { - dol_print_error($db); + dol_print_error($this->db); } return $ranges; @@ -236,30 +231,28 @@ class ExpenseReportIk extends CoreObject /** * Return the max number of range by a category * - * @param int $default_c_exp_tax_cat id - * @return int + * @param int $default_c_exp_tax_cat id Default c_exp_tax_cat + * @return int Max nb */ - public static function getMaxRangeNumber($default_c_exp_tax_cat = 0) + public function getMaxRangeNumber($default_c_exp_tax_cat = 0) { - global $db, $conf; - $sql = 'SELECT MAX(counted) as nbRange FROM ('; $sql .= ' SELECT COUNT(*) as counted'; $sql .= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r'; - $sql .= ' WHERE r.entity IN (0, '.$conf->entity.')'; + $sql .= ' WHERE r.entity IN (0, '.getEntity($this->element).')'; if ($default_c_exp_tax_cat > 0) { $sql .= ' AND r.fk_c_exp_tax_cat = '.((int) $default_c_exp_tax_cat); } $sql .= ' GROUP BY r.fk_c_exp_tax_cat'; $sql .= ') as counts'; - dol_syslog(get_called_class().'::getMaxRangeNumber sql='.$sql, LOG_DEBUG); - $resql = $db->query($sql); + dol_syslog(get_called_class().'::getMaxRangeNumber', LOG_DEBUG); + $resql = $this->db->query($sql); if ($resql) { - $obj = $db->fetch_object($resql); + $obj = $this->db->fetch_object($resql); return $obj->nbRange; } else { - dol_print_error($db); + dol_print_error($this->db); } return 0; diff --git a/htdocs/expensereport/class/expensereport_rule.class.php b/htdocs/expensereport/class/expensereport_rule.class.php index 6299dd7c5bd..ae89b4b0f51 100644 --- a/htdocs/expensereport/class/expensereport_rule.class.php +++ b/htdocs/expensereport/class/expensereport_rule.class.php @@ -148,20 +148,19 @@ class ExpenseReportRule extends CoreObject * @param int $fk_user user of expense * @return array Array with ExpenseReportRule */ - public static function getAllRule($fk_c_type_fees = '', $date = '', $fk_user = '') + public function getAllRule($fk_c_type_fees = '', $date = '', $fk_user = '') { - global $db; - $rules = array(); + $sql = 'SELECT er.rowid'; $sql .= ' FROM '.MAIN_DB_PREFIX.'expensereport_rules er'; - $sql .= ' WHERE er.entity IN (0,'.getEntity('').')'; + $sql .= ' WHERE er.entity IN (0,'.getEntity($this->element).')'; if (!empty($fk_c_type_fees)) { $sql .= ' AND er.fk_c_type_fees IN (-1, '.((int) $fk_c_type_fees).')'; } if (!empty($date)) { - $sql .= " AND er.dates <= '".dol_print_date($date, '%Y-%m-%d')."'"; - $sql .= " AND er.datee >= '".dol_print_date($date, '%Y-%m-%d')."'"; + $sql .= " AND er.dates <= '".$this->db->idate($date)."'"; + $sql .= " AND er.datee >= '".$this->db->idate($date)."'"; } if ($fk_user > 0) { $sql .= ' AND (er.is_for_all = 1'; @@ -172,18 +171,18 @@ class ExpenseReportRule extends CoreObject dol_syslog("ExpenseReportRule::getAllRule"); - $resql = $db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - while ($obj = $db->fetch_object($resql)) { - $rule = new ExpenseReportRule($db); + while ($obj = $this->db->fetch_object($resql)) { + $rule = new ExpenseReportRule($this->db); if ($rule->fetch($obj->rowid) > 0) { $rules[$rule->id] = $rule; } else { - dol_print_error($db); + dol_print_error($this->db); } } } else { - dol_print_error($db); + dol_print_error($this->db); } return $rules; @@ -201,7 +200,7 @@ class ExpenseReportRule extends CoreObject if ($this->fk_usergroup > 0) { $group = new UserGroup($this->db); if ($group->fetch($this->fk_usergroup) > 0) { - return $group->nom; + return $group->name; } else { $this->error = $group->error; $this->errors[] = $this->error; 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..67ed2d4e741 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -212,7 +212,7 @@ if ($object->id > 0) { print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur)); $tmpcheck = $object->check_codefournisseur(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongSupplierCode").')'; + print ' ('.$langs->trans("WrongSupplierCode").')'; } print ''; print ''; @@ -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/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 09a43fb95ab..99ef4e54e87 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -112,6 +112,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,11 +376,16 @@ 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); $this->date_commande = $this->db->jdate($obj->date_commande); // date we make the order to supplier + if (isset($obj->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; @@ -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); 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/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index b08d9237c63..5b523d8d7e8 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -846,7 +846,7 @@ class ProductFournisseur extends Product $this->fourn_qty = $record["quantity"]; $this->fourn_remise_percent = $record["remise_percent"]; $this->fourn_remise = $record["remise"]; - $this->fourn_unitprice = $record["unitprice"]; + $this->fourn_unitprice = $fourn_unitprice; $this->fourn_charges = $record["charges"]; // deprecated $this->fourn_tva_tx = $record["tva_tx"]; $this->fourn_id = $record["fourn_id"]; @@ -1183,7 +1183,7 @@ class ProductFournisseur extends Product $label .= $this->displayPriceProductFournisseurLog($logPrices); } - $url = dol_buildpath('/product/fournisseurs.php', 1).'?id='.$this->id.'&action=add_price&socid='.$this->fourn_id.'&rowid='.$this->product_fourn_price_id; + $url = dol_buildpath('/product/fournisseurs.php', 1).'?id='.$this->id.'&action=add_price&token='.newToken().'&socid='.$this->fourn_id.'&rowid='.$this->product_fourn_price_id; if ($option != 'nolink') { // Add param to save lastsearch_values or not diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index e579c07ac14..4c8bed6bfe6 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 ' '; } @@ -2625,8 +2625,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 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/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 6a23cdbdd91..a325f9db780 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -418,7 +418,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"; +$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'; if ($search_categ_sup && $search_categ_sup != '-1') { $sql .= ", cs.fk_categorie, cs.fk_soc"; } @@ -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"; } @@ -634,7 +634,7 @@ if (!$search_all) { $sql .= " state.code_departement, state.nom,"; $sql .= ' country.code,'; $sql .= " p.rowid, p.ref, p.title,"; - $sql .= " u.login"; + $sql .= " u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender"; if ($search_categ_sup && $search_categ_sup != '-1') { $sql .= ", cs.fk_categorie, cs.fk_soc"; } @@ -1585,13 +1585,25 @@ if ($resql) { $totalarray['val']['f.total_ttc'] += $obj->total_ttc; } + $userstatic->id = $obj->fk_user_author; + $userstatic->login = $obj->login; + $userstatic->lastname = $obj->lastname; + $userstatic->firstname = $obj->firstname; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_statut; + $userstatic->entity = $obj->entity; + $userstatic->photo = $obj->photo; + $userstatic->office_phone = $obj->office_phone; + $userstatic->office_fax = $obj->office_fax; + $userstatic->user_mobile = $obj->user_mobile; + $userstatic->job = $obj->job; + $userstatic->gender = $obj->gender; + // Author if (!empty($arrayfields['u.login']['checked'])) { - $userstatic->id = $obj->fk_user_author; - $userstatic->login = $obj->login; - print ''; + print ''; if ($userstatic->id) { - print $userstatic->getLoginUrl(1); + print $userstatic->getLoginUrl(-1); } else { print ' '; } 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/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index e13d43c612d..55d92b7835b 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1447,7 +1447,7 @@ class Holiday extends CommonObject // Update each user counter foreach ($users as $userCounter) { - $nbDaysToAdd = (isset($typeleaves[$userCounter['type']]['newByMonth']) ? $typeleaves[$userCounter['type']]['newByMonth'] : 0); + $nbDaysToAdd = (isset($typeleaves[$userCounter['type']]['newbymonth']) ? $typeleaves[$userCounter['type']]['newbymonth'] : 0); if (empty($nbDaysToAdd)) { continue; } @@ -2081,7 +2081,7 @@ class Holiday extends CommonObject { global $mysoc; - $sql = "SELECT rowid, code, label, affect, delay, newByMonth"; + $sql = "SELECT rowid, code, label, affect, delay, newbymonth"; $sql .= " FROM ".MAIN_DB_PREFIX."c_holiday_types"; $sql .= " WHERE (fk_country IS NULL OR fk_country = ".((int) $mysoc->country_id).')'; if ($active >= 0) { @@ -2096,7 +2096,7 @@ class Holiday extends CommonObject $num = $this->db->num_rows($result); if ($num) { while ($obj = $this->db->fetch_object($result)) { - $types[$obj->rowid] = array('rowid'=> $obj->rowid, 'code'=> $obj->code, 'label'=>$obj->label, 'affect'=>$obj->affect, 'delay'=>$obj->delay, 'newByMonth'=>$obj->newByMonth); + $types[$obj->rowid] = array('rowid'=> $obj->rowid, 'code'=> $obj->code, 'label'=>$obj->label, 'affect'=>$obj->affect, 'delay'=>$obj->delay, 'newbymonth'=>$obj->newbymonth); } return $types; diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index fdcdb5f88e6..621443fb408 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -358,7 +358,7 @@ if (count($typeleaves) == 0) { //var_dump($users['rowid'].' - '.$val['rowid']); print ''; if ($canedit) { - print ''; + print ''; } else { print $nbtoshow; } 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/imports/import.php b/htdocs/imports/import.php index 5139e12ab7a..2ab7e3976aa 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -1205,7 +1205,7 @@ if ($step == 4 && $datatoimport) { // async: false // });'."\n"; // Now reload page - print 'var newlocation= \''.$_SERVER["PHP_SELF"].'?step=4'.$param.'&action=saveorder&boxorder=\' + boxorder;'."\n"; + print 'var newlocation= \''.$_SERVER["PHP_SELF"].'?step=4'.$param.'&action=saveorder&token='.newToken().'&boxorder=\' + boxorder;'."\n"; //print 'alert(newlocation);'; print 'window.location.href=newlocation;'."\n"; print '}'."\n"; diff --git a/htdocs/index.php b/htdocs/index.php index 880b5577bbb..8c1433c79cb 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -337,6 +337,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { ), 'supplier_proposal' => array( + 'lang' => 'supplier_proposal', 'groupName' => 'SupplierProposals', 'globalStatsKey' => 'askprice', 'stats' => @@ -486,6 +487,9 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { } if (!empty($boards)) { + if (!empty($groupElement['lang'])) { + $langs->load($groupElement['lang']); + } $groupName = $langs->trans($groupElement['groupName']); $groupKeyLowerCase = strtolower($groupKey); $nbTotalForGroup = 0; diff --git a/htdocs/install/lib/repair.lib.php b/htdocs/install/lib/repair.lib.php index aa0866fac69..aea82107d29 100644 --- a/htdocs/install/lib/repair.lib.php +++ b/htdocs/install/lib/repair.lib.php @@ -32,8 +32,8 @@ function checkElementExist($id, $table) { global $db; - $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$table; - $sql .= ' WHERE rowid = '.((int) $id); + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$table; + $sql .= " WHERE rowid = ".((int) $id); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); @@ -87,8 +87,8 @@ function checkLinkedElements($sourcetype, $targettype) $out = $langs->trans('SourceType').': '.$sourcetype.' => '.$langs->trans('TargetType').': '.$targettype.' '; - $sql = 'SELECT rowid, fk_source, fk_target FROM '.MAIN_DB_PREFIX.'element_element'; - $sql .= " WHERE sourcetype='".$db->escape($sourcetype)."' AND targettype='".$db->escape($targettype)."'"; + $sql = "SELECT rowid, fk_source, fk_target FROM ".MAIN_DB_PREFIX."element_element"; + $sql .= " WHERE sourcetype = '".$db->escape($sourcetype)."' AND targettype = '".$db->escape($targettype)."'"; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); @@ -106,7 +106,7 @@ function checkLinkedElements($sourcetype, $targettype) foreach ($elements as $key => $element) { if (!checkElementExist($element[$sourcetype], $sourcetable) || !checkElementExist($element[$targettype], $targettable)) { $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'element_element'; - $sql .= ' WHERE rowid = '.((int) $key); + $sql .= " WHERE rowid = ".((int) $key); $resql = $db->query($sql); $deleted++; } diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index 4465756f00a..7217fda7d09 100644 --- a/htdocs/install/mysql/data/llx_00_c_country.sql +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -279,5 +279,5 @@ INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (24 -- Set field eec -UPDATE llx_c_country SET eec = 1 WHERE code IN ('AT','BE','BG','CY','CZ','DE','DK','EE','ES','FI','FR','GR','HR','NL','HU','IE','IM','IT','LT','LU','LV','MC','MT','PL','PT','RO','SE','SK','SI'); +UPDATE llx_c_country SET eec = 1 WHERE code IN ('AT','BE','BG','CY','CZ','DE','DK','EE','ES','FI','FR','GR','HR','NL','HU','IE','IT','LT','LU','LV','MC','MT','PL','PT','RO','SE','SK','SI'); 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/data/llx_c_holiday_type.sql b/htdocs/install/mysql/data/llx_c_holiday_type.sql index addd7f9942e..65f9a51b037 100644 --- a/htdocs/install/mysql/data/llx_c_holiday_type.sql +++ b/htdocs/install/mysql/data/llx_c_holiday_type.sql @@ -25,12 +25,12 @@ -- -- Generic to all countries -insert into llx_c_holiday_types(code, label, affect, delay, newByMonth, fk_country, active) values ('LEAVE_SICK', 'Sick leave', 0, 0, 0, NULL, 1); -insert into llx_c_holiday_types(code, label, affect, delay, newByMonth, fk_country, active) values ('LEAVE_OTHER', 'Other leave', 0, 0, 0, NULL, 1); +insert into llx_c_holiday_types(code, label, affect, delay, newbymonth, fk_country, active) values ('LEAVE_SICK', 'Sick leave', 0, 0, 0, NULL, 1); +insert into llx_c_holiday_types(code, label, affect, delay, newbymonth, fk_country, active) values ('LEAVE_OTHER', 'Other leave', 0, 0, 0, NULL, 1); -- Not enabled by default, we prefer to have an entrey dedicated to country -insert into llx_c_holiday_types(code, label, affect, delay, newByMonth, fk_country, active) values ('LEAVE_PAID', 'Paid vacation', 1, 7, 0, NULL, 0); +insert into llx_c_holiday_types(code, label, affect, delay, newbymonth, fk_country, active) values ('LEAVE_PAID', 'Paid vacation', 1, 7, 0, NULL, 0); -- Leaves specific to France -insert into llx_c_holiday_types(code, label, affect, delay, newByMonth, fk_country, active) values ('LEAVE_RTT_FR', 'RTT' , 1, 7, 0.83, 1, 1); -insert into llx_c_holiday_types(code, label, affect, delay, newByMonth, fk_country, active) values ('LEAVE_PAID_FR', 'Paid vacation', 1, 30, 2.08334, 1, 1); +insert into llx_c_holiday_types(code, label, affect, delay, newbymonth, fk_country, active) values ('LEAVE_RTT_FR', 'RTT' , 1, 7, 0.83, 1, 1); +insert into llx_c_holiday_types(code, label, affect, delay, newbymonth, fk_country, active) values ('LEAVE_PAID_FR', 'Paid vacation', 1, 30, 2.08334, 1, 1); diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index cae269783e4..12b0b92a13e 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -330,7 +330,7 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (10 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (105,10, '15','0','VAT 12% Majoré à 25% (15%)',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (106,10, '22.5','0','VAT 18% Majoré à 25% (22.5%)',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (107,10, '6','0','VAT 6%', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (107,10,'18.18','0','VAT 18%+FODEC', 1, 1, '4', 0, 0); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (108,10,'18.18','0','VAT 18%+FODEC', 1, 1, '4', 0, 0); -- UKRAINE (id country=226) INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2261,226, '0','0','VAT rate 0',1); @@ -379,10 +379,6 @@ INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 4 INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 462, 46, '15','0','VAT 15%',1); INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 463, 46, '7.5','0','VAT 7.5%',1); --- SOUTH AFRICA (id country=205) -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2051,205, '0','0','No VAT',1); -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2052,205, '14','0','VAT 14%',1); - -- VENEZUELA (id country=232) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2321,232, '0','0','No VAT',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2322,232, '12','0','VAT 12%',1); diff --git a/htdocs/install/mysql/data/llx_const.sql b/htdocs/install/mysql/data/llx_const.sql index 2f2975a158c..d7193d87a49 100644 --- a/htdocs/install/mysql/data/llx_const.sql +++ b/htdocs/install/mysql/data/llx_const.sql @@ -85,7 +85,7 @@ insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_EXP -- -- Mail Mailing -- -insert into llx_const (name, value, type, note, visible) values ('MAIN_FIX_FOR_BUGGED_MTA','1','chaine','Set constant to fix email ending from PHP with some linux ike system',1); +--insert into llx_const (name, value, type, note, visible) values ('MAIN_FIX_FOR_BUGGED_MTA','1','chaine','Set constant to fix email ending from PHP with some linux like system',1); insert into llx_const (name, value, type, note, visible) values ('MAILING_EMAIL_FROM','no-reply@mydomain.com','chaine','EMail emmetteur pour les envois d emailings',0); 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..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 @@ -425,14 +425,22 @@ 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 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); 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/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 9555bcd15da..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 @@ -35,8 +35,9 @@ -- VMYSQL4.3 ALTER TABLE llx_partnership MODIFY COLUMN date_partnership_end date NULL; -- VPGSQL8.2 ALTER TABLE llx_partnership ALTER COLUMN date_partnership_end DROP NOT NULL; --- VMYSQL4.3 ALTER TABLE llx_eventorganization_conferenceorboothattendee MODIFY COLUMN fk_actioncomm integer NULL; --- VPGSQL8.2 ALTER TABLE llx_eventorganization_conferenceorboothattendee ALTER COLUMN fk_actioncomm DROP NOT NULL; + +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 FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_soc; ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_actioncomm; @@ -54,7 +55,11 @@ ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_evento ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_project, email, fk_actioncomm); -ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_project integer NOT NULL; + +-- VMYSQL4.3 ALTER TABLE llx_eventorganization_conferenceorboothattendee MODIFY COLUMN fk_actioncomm integer NULL; +-- VPGSQL8.2 ALTER TABLE llx_eventorganization_conferenceorboothattendee ALTER COLUMN fk_actioncomm DROP NOT NULL; + + UPDATE llx_extrafields SET elementtype = 'salary' WHERE elementtype = 'payment_salary'; ALTER TABLE llx_payment_salary_extrafields RENAME TO llx_salary_extrafields; @@ -73,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; @@ -98,6 +106,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 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); @@ -122,9 +131,242 @@ ALTER TABLE llx_categorie_knowledgemanagement ADD INDEX idx_categorie_knowledgem ALTER TABLE llx_categorie_knowledgemanagement ADD INDEX idx_categorie_knowledgemanagement_fk_knowledgemanagement (fk_knowledgemanagement); ALTER TABLE llx_categorie_knowledgemanagement ADD CONSTRAINT fk_categorie_knowledgemanagement_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); -ALTER TABLE llx_categorie_knowledgemanagement ADD CONSTRAINT fk_categorie_knowledgemanagement_knowledgemanagement_rowid FOREIGN KEY (fk_knowledgemanagement) REFERENCES llx_knowledgemanagement (rowid); +ALTER TABLE llx_categorie_knowledgemanagement ADD CONSTRAINT fk_categorie_knowledgemanagement_knowledgemanagement_rowid FOREIGN KEY (fk_knowledgemanagement) REFERENCES llx_knowledgemanagement_knowledgerecord (rowid); 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; + +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'); + +-- START GRH/HRM MODULE + + +CREATE TABLE llx_hrm_evaluation( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + ref varchar(128) DEFAULT '(PROV)' NOT NULL, + label varchar(255), + description text, + note_public text, + note_private text, + date_creation datetime NOT NULL, + tms timestamp, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + import_key varchar(14), + status smallint NOT NULL, + date_eval date, + fk_user integer NOT NULL, + fk_job integer NOT NULL + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; +ALTER TABLE llx_hrm_evaluation ADD INDEX idx_hrm_evaluation_rowid (rowid); +ALTER TABLE llx_hrm_evaluation ADD INDEX idx_hrm_evaluation_ref (ref); +ALTER TABLE llx_hrm_evaluation ADD CONSTRAINT llx_hrm_evaluation_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); +ALTER TABLE llx_hrm_evaluation ADD INDEX idx_hrm_evaluation_status (status); + + +create table llx_hrm_evaluation_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + +ALTER TABLE llx_hrm_evaluation_extrafields ADD INDEX idx_evaluation_fk_object(fk_object); + + +CREATE TABLE llx_hrm_evaluationdet( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + date_creation datetime NOT NULL, + tms timestamp, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + fk_skill integer NOT NULL, + fk_evaluation integer NOT NULL, + rank integer NOT NULL, + required_rank integer NOT NULL, + import_key varchar(14) + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; + +ALTER TABLE llx_hrm_evaluationdet ADD INDEX idx_hrm_evaluationdet_rowid (rowid); +ALTER TABLE llx_hrm_evaluationdet ADD CONSTRAINT llx_hrm_evaluationdet_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); +ALTER TABLE llx_hrm_evaluationdet ADD INDEX idx_hrm_evaluationdet_fk_skill (fk_skill); +ALTER TABLE llx_hrm_evaluationdet ADD INDEX idx_hrm_evaluationdet_fk_evaluation (fk_evaluation); + + +create table llx_hrm_evaluationdet_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + +ALTER TABLE llx_hrm_evaluationdet_extrafields ADD INDEX idx_evaluationdet_fk_object(fk_object); + + + + +CREATE TABLE llx_hrm_job( + + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + label varchar(255) NOT NULL, + description text, + date_creation datetime NOT NULL, + tms timestamp, + deplacement varchar(255), + note_public text, + note_private text, + fk_user_creat integer, + fk_user_modif integer + +) ENGINE=innodb; + +ALTER TABLE llx_hrm_job ADD INDEX idx_hrm_job_rowid (rowid); +ALTER TABLE llx_hrm_job ADD INDEX idx_hrm_job_label (label); + + +create table llx_hrm_job_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + +ALTER TABLE llx_hrm_job_extrafields ADD INDEX idx_job_fk_object(fk_object); + + + +CREATE TABLE llx_hrm_job_user( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + -- ref varchar(128) NOT NULL, + description text, + date_creation datetime NOT NULL, + tms timestamp, + fk_contrat integer, + fk_user integer NOT NULL, + fk_job integer NOT NULL, + date_start date, + date_end date, + commentaire_abandon varchar(255), + note_public text, + note_private text, + fk_user_creat integer, + fk_user_modif integer + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; + +ALTER TABLE llx_hrm_job_user ADD INDEX idx_hrm_job_user_rowid (rowid); +-- ALTER TABLE llx_hrm_job_user ADD INDEX idx_hrm_job_user_ref (ref); + + +create table llx_hrm_job_user_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + +ALTER TABLE llx_hrm_job_user_extrafields ADD INDEX idx_position_fk_object(fk_object); + + + +CREATE TABLE llx_hrm_skill( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + label varchar(255), + description text, + date_creation datetime NOT NULL, + tms timestamp, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + required_level integer NOT NULL, + date_validite integer NOT NULL, + temps_theorique double(24,8) NOT NULL, + skill_type integer NOT NULL, + note_public text, + note_private text + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; + +ALTER TABLE llx_hrm_skill ADD INDEX idx_hrm_skill_rowid (rowid); +ALTER TABLE llx_hrm_skill ADD CONSTRAINT llx_hrm_skill_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); +ALTER TABLE llx_hrm_skill ADD INDEX idx_hrm_skill_skill_type (skill_type); + +create table llx_hrm_skill_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + +ALTER TABLE llx_hrm_skill_extrafields ADD INDEX idx_skill_fk_object(fk_object); + + +CREATE TABLE llx_hrm_skilldet( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + description text, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + fk_skill integer NOT NULL, + rank integer + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; + +ALTER TABLE llx_hrm_skilldet ADD INDEX idx_hrm_skilldet_rowid (rowid); +ALTER TABLE llx_hrm_skilldet ADD CONSTRAINT llx_hrm_skilldet_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); + +create table llx_hrm_skilldet_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + +ALTER TABLE llx_hrm_skilldet_extrafields ADD INDEX idx_skilldet_fk_object(fk_object); + + +CREATE TABLE llx_hrm_skillrank( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + fk_skill integer NOT NULL, + rank integer NOT NULL, + fk_object integer NOT NULL, + date_creation datetime NOT NULL, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + objecttype varchar(128) NOT NULL + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; + +ALTER TABLE llx_hrm_skillrank ADD INDEX idx_hrm_skillrank_rowid (rowid); +ALTER TABLE llx_hrm_skillrank ADD INDEX idx_hrm_skillrank_fk_skill (fk_skill); +ALTER TABLE llx_hrm_skillrank ADD CONSTRAINT llx_hrm_skillrank_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); + +--END GRH/HRM MODULE diff --git a/htdocs/install/mysql/tables/llx_c_holiday_types.sql b/htdocs/install/mysql/tables/llx_c_holiday_types.sql index 9c09d486bec..b602ee1d330 100644 --- a/htdocs/install/mysql/tables/llx_c_holiday_types.sql +++ b/htdocs/install/mysql/tables/llx_c_holiday_types.sql @@ -22,7 +22,7 @@ CREATE TABLE llx_c_holiday_types ( label varchar(255) NOT NULL, affect integer NOT NULL, -- a request will change sold or not delay integer NOT NULL, -- Minimum delay to be allowed to make request - newByMonth double(8,5) DEFAULT 0 NOT NULL, -- Amount of new days for each user each month + newbymonth double(8,5) DEFAULT 0 NOT NULL, -- Amount of new days for each user each month fk_country integer DEFAULT NULL, -- This type is dedicated to a country active integer DEFAULT 1 ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.sql b/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.sql index 9489cca9652..a693fb19c41 100644 --- a/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.sql +++ b/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.sql @@ -13,7 +13,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see https://www.gnu.org/licenses/. -create table llx_categorie_knowledgemanagement +create table llx_categorie_knowledgemanagement( fk_categorie integer NOT NULL, fk_knowledgemanagement integer NOT NULL, import_key varchar(14) 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/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); diff --git a/htdocs/install/mysql/tables/llx_hrm_evaluation.key.sql b/htdocs/install/mysql/tables/llx_hrm_evaluation.key.sql new file mode 100644 index 00000000000..804bc6b4803 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_evaluation.key.sql @@ -0,0 +1,29 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_hrm_evaluation ADD INDEX idx_hrm_evaluation_rowid (rowid); +ALTER TABLE llx_hrm_evaluation ADD INDEX idx_hrm_evaluation_ref (ref); +ALTER TABLE llx_hrm_evaluation ADD CONSTRAINT llx_hrm_evaluation_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); +ALTER TABLE llx_hrm_evaluation ADD INDEX idx_hrm_evaluation_status (status); +-- END MODULEBUILDER INDEXES + +--ALTER TABLE llx_hrm_evaluation ADD UNIQUE INDEX uk_hrm_evaluation_fieldxy(fieldx, fieldy); + +--ALTER TABLE llx_hrm_evaluation ADD CONSTRAINT llx_hrm_evaluation_fk_field FOREIGN KEY (fk_field) REFERENCES llx_hrm_myotherobject(rowid); + diff --git a/htdocs/install/mysql/tables/llx_hrm_evaluation.sql b/htdocs/install/mysql/tables/llx_hrm_evaluation.sql new file mode 100644 index 00000000000..bc9b7a1effc --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_evaluation.sql @@ -0,0 +1,37 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +CREATE TABLE llx_hrm_evaluation( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + ref varchar(128) DEFAULT '(PROV)' NOT NULL, + label varchar(255), + description text, + note_public text, + note_private text, + date_creation datetime NOT NULL, + tms timestamp, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + import_key varchar(14), + status smallint NOT NULL, + date_eval date, + fk_user integer NOT NULL, + fk_job integer NOT NULL + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_hrm_evaluation_extrafields.key.sql b/htdocs/install/mysql/tables/llx_hrm_evaluation_extrafields.key.sql new file mode 100644 index 00000000000..ff9ba9d6cb6 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_evaluation_extrafields.key.sql @@ -0,0 +1,21 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_hrm_evaluation_extrafields ADD INDEX idx_evaluation_fk_object(fk_object); +-- END MODULEBUILDER INDEXES diff --git a/htdocs/install/mysql/tables/llx_hrm_evaluation_extrafields.sql b/htdocs/install/mysql/tables/llx_hrm_evaluation_extrafields.sql new file mode 100644 index 00000000000..da00cc3c333 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_evaluation_extrafields.sql @@ -0,0 +1,25 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + +create table llx_hrm_evaluation_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + diff --git a/htdocs/install/mysql/tables/llx_hrm_evaluationdet.key.sql b/htdocs/install/mysql/tables/llx_hrm_evaluationdet.key.sql new file mode 100644 index 00000000000..05309ce57e2 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_evaluationdet.key.sql @@ -0,0 +1,29 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_hrm_evaluationdet ADD INDEX idx_hrm_evaluationdet_rowid (rowid); +ALTER TABLE llx_hrm_evaluationdet ADD CONSTRAINT llx_hrm_evaluationdet_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); +ALTER TABLE llx_hrm_evaluationdet ADD INDEX idx_hrm_evaluationdet_fk_skill (fk_skill); +ALTER TABLE llx_hrm_evaluationdet ADD INDEX idx_hrm_evaluationdet_fk_evaluation (fk_evaluation); +-- END MODULEBUILDER INDEXES + +--ALTER TABLE llx_hrm_evaluationdet ADD UNIQUE INDEX uk_hrm_evaluationdet_fieldxy(fieldx, fieldy); + +--ALTER TABLE llx_hrm_evaluationdet ADD CONSTRAINT llx_hrm_evaluationdet_fk_field FOREIGN KEY (fk_field) REFERENCES llx_hrm_myotherobject(rowid); + diff --git a/htdocs/install/mysql/tables/llx_hrm_evaluationdet.sql b/htdocs/install/mysql/tables/llx_hrm_evaluationdet.sql new file mode 100644 index 00000000000..0509cc80146 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_evaluationdet.sql @@ -0,0 +1,32 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +CREATE TABLE llx_hrm_evaluationdet( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + date_creation datetime NOT NULL, + tms timestamp, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + fk_skill integer NOT NULL, + fk_evaluation integer NOT NULL, + rank integer NOT NULL, + required_rank integer NOT NULL, + import_key varchar(14) + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_hrm_evaluationdet_extrafields.key.sql b/htdocs/install/mysql/tables/llx_hrm_evaluationdet_extrafields.key.sql new file mode 100644 index 00000000000..5072e2eb67b --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_evaluationdet_extrafields.key.sql @@ -0,0 +1,21 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_hrm_evaluationdet_extrafields ADD INDEX idx_evaluationdet_fk_object(fk_object); +-- END MODULEBUILDER INDEXES diff --git a/htdocs/install/mysql/tables/llx_hrm_evaluationdet_extrafields.sql b/htdocs/install/mysql/tables/llx_hrm_evaluationdet_extrafields.sql new file mode 100644 index 00000000000..4d4031ba228 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_evaluationdet_extrafields.sql @@ -0,0 +1,24 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + +create table llx_hrm_evaluationdet_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_hrm_job.key.sql b/htdocs/install/mysql/tables/llx_hrm_job.key.sql new file mode 100644 index 00000000000..6fe7da6016e --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_job.key.sql @@ -0,0 +1,27 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_hrm_job ADD INDEX idx_hrm_job_rowid (rowid); +ALTER TABLE llx_hrm_job ADD INDEX idx_hrm_job_label (label); +-- END MODULEBUILDER INDEXES + +--ALTER TABLE llx_hrm_job ADD UNIQUE INDEX uk_hrm_job_fieldxy(fieldx, fieldy); + +--ALTER TABLE llx_hrm_job ADD CONSTRAINT llx_hrm_job_fk_field FOREIGN KEY (fk_field) REFERENCES llx_hrm_myotherobject(rowid); + diff --git a/htdocs/install/mysql/tables/llx_hrm_job.sql b/htdocs/install/mysql/tables/llx_hrm_job.sql new file mode 100644 index 00000000000..51f472af377 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_job.sql @@ -0,0 +1,32 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +CREATE TABLE llx_hrm_job( + + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + label varchar(255) NOT NULL, + description text, + date_creation datetime NOT NULL, + tms timestamp, + deplacement varchar(255), + note_public text, + note_private text, + fk_user_creat integer, + fk_user_modif integer + +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_hrm_job_extrafields.key.sql b/htdocs/install/mysql/tables/llx_hrm_job_extrafields.key.sql new file mode 100644 index 00000000000..b5226dc4c38 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_job_extrafields.key.sql @@ -0,0 +1,21 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_hrm_job_extrafields ADD INDEX idx_job_fk_object(fk_object); +-- END MODULEBUILDER INDEXES diff --git a/htdocs/install/mysql/tables/llx_hrm_job_extrafields.sql b/htdocs/install/mysql/tables/llx_hrm_job_extrafields.sql new file mode 100644 index 00000000000..10cccf1c36f --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_job_extrafields.sql @@ -0,0 +1,25 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + +create table llx_hrm_job_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + diff --git a/htdocs/install/mysql/tables/llx_hrm_job_user.key.sql b/htdocs/install/mysql/tables/llx_hrm_job_user.key.sql new file mode 100644 index 00000000000..ead2f7f3b18 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_job_user.key.sql @@ -0,0 +1,27 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_hrm_job_user ADD INDEX idx_hrm_job_user_rowid (rowid); +-- ALTER TABLE llx_hrm_job_user ADD INDEX idx_hrm_job_user_ref (ref); +-- END MODULEBUILDER INDEXES + +--ALTER TABLE llx_hrm_job_user ADD UNIQUE INDEX uk_hrm_job_user_fieldxy(fieldx, fieldy); + +--ALTER TABLE llx_hrm_job_user ADD CONSTRAINT llx_hrm_job_user_fk_field FOREIGN KEY (fk_field) REFERENCES llx_hrm_myotherobject(rowid); + diff --git a/htdocs/install/mysql/tables/llx_hrm_job_user.sql b/htdocs/install/mysql/tables/llx_hrm_job_user.sql new file mode 100644 index 00000000000..ce9620623dd --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_job_user.sql @@ -0,0 +1,36 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + +CREATE TABLE llx_hrm_job_user( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + -- ref varchar(128) NOT NULL, + description text, + date_creation datetime NOT NULL, + tms timestamp, + fk_contrat integer, + fk_user integer NOT NULL, + fk_job integer NOT NULL, + date_start datetime, + date_end datetime, + commentaire_abandon varchar(255), + note_public text, + note_private text, + fk_user_creat integer, + fk_user_modif integer + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_hrm_job_user_extrafields.key.sql b/htdocs/install/mysql/tables/llx_hrm_job_user_extrafields.key.sql new file mode 100644 index 00000000000..99ed1f4c1bc --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_job_user_extrafields.key.sql @@ -0,0 +1,21 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_hrm_job_user_extrafields ADD INDEX idx_position_fk_object(fk_object); +-- END MODULEBUILDER INDEXES diff --git a/htdocs/install/mysql/tables/llx_hrm_job_user_extrafields.sql b/htdocs/install/mysql/tables/llx_hrm_job_user_extrafields.sql new file mode 100644 index 00000000000..7495563f68d --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_job_user_extrafields.sql @@ -0,0 +1,25 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + +create table llx_hrm_job_user_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + diff --git a/htdocs/install/mysql/tables/llx_hrm_skill.key.sql b/htdocs/install/mysql/tables/llx_hrm_skill.key.sql new file mode 100644 index 00000000000..b3196bf8522 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_skill.key.sql @@ -0,0 +1,28 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_hrm_skill ADD INDEX idx_hrm_skill_rowid (rowid); +ALTER TABLE llx_hrm_skill ADD CONSTRAINT llx_hrm_skill_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); +ALTER TABLE llx_hrm_skill ADD INDEX idx_hrm_skill_skill_type (skill_type); +-- END MODULEBUILDER INDEXES + +--ALTER TABLE llx_hrm_skill ADD UNIQUE INDEX uk_hrm_skill_fieldxy(fieldx, fieldy); + +--ALTER TABLE llx_hrm_skill ADD CONSTRAINT llx_hrm_skill_fk_field FOREIGN KEY (fk_field) REFERENCES llx_hrm_myotherobject(rowid); + diff --git a/htdocs/install/mysql/tables/llx_hrm_skill.sql b/htdocs/install/mysql/tables/llx_hrm_skill.sql new file mode 100644 index 00000000000..96a31be588a --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_skill.sql @@ -0,0 +1,35 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +CREATE TABLE llx_hrm_skill( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + label varchar(255), + description text, + date_creation datetime NOT NULL, + tms timestamp, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + required_level integer NOT NULL, + date_validite integer NOT NULL, + temps_theorique double(24,8) NOT NULL, + skill_type integer NOT NULL, + note_public text, + note_private text + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_hrm_skill_extrafields.key.sql b/htdocs/install/mysql/tables/llx_hrm_skill_extrafields.key.sql new file mode 100644 index 00000000000..a4ae591731e --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_skill_extrafields.key.sql @@ -0,0 +1,21 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_hrm_skill_extrafields ADD INDEX idx_skill_fk_object(fk_object); +-- END MODULEBUILDER INDEXES diff --git a/htdocs/install/mysql/tables/llx_hrm_skill_extrafields.sql b/htdocs/install/mysql/tables/llx_hrm_skill_extrafields.sql new file mode 100644 index 00000000000..d47657e34f8 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_skill_extrafields.sql @@ -0,0 +1,25 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + +create table llx_hrm_skill_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + diff --git a/htdocs/install/mysql/tables/llx_hrm_skilldet.key.sql b/htdocs/install/mysql/tables/llx_hrm_skilldet.key.sql new file mode 100644 index 00000000000..289276e07b5 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_skilldet.key.sql @@ -0,0 +1,27 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_hrm_skilldet ADD INDEX idx_hrm_skilldet_rowid (rowid); +ALTER TABLE llx_hrm_skilldet ADD CONSTRAINT llx_hrm_skilldet_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); +-- END MODULEBUILDER INDEXES + +--ALTER TABLE llx_hrm_skilldet ADD UNIQUE INDEX uk_hrm_skilldet_fieldxy(fieldx, fieldy); + +--ALTER TABLE llx_hrm_skilldet ADD CONSTRAINT llx_hrm_skilldet_fk_field FOREIGN KEY (fk_field) REFERENCES llx_hrm_myotherobject(rowid); + diff --git a/htdocs/install/mysql/tables/llx_hrm_skilldet.sql b/htdocs/install/mysql/tables/llx_hrm_skilldet.sql new file mode 100644 index 00000000000..fba82645915 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_skilldet.sql @@ -0,0 +1,28 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +CREATE TABLE llx_hrm_skilldet( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + description text, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + fk_skill integer NOT NULL, + rank integer + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_hrm_skilldet_extrafields.key.sql b/htdocs/install/mysql/tables/llx_hrm_skilldet_extrafields.key.sql new file mode 100644 index 00000000000..319eb193a18 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_skilldet_extrafields.key.sql @@ -0,0 +1,21 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_hrm_skilldet_extrafields ADD INDEX idx_skilldet_fk_object(fk_object); +-- END MODULEBUILDER INDEXES diff --git a/htdocs/install/mysql/tables/llx_hrm_skilldet_extrafields.sql b/htdocs/install/mysql/tables/llx_hrm_skilldet_extrafields.sql new file mode 100644 index 00000000000..a6e14f476c0 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_skilldet_extrafields.sql @@ -0,0 +1,24 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + +create table llx_hrm_skilldet_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + diff --git a/htdocs/install/mysql/tables/llx_hrm_skillrank.key.sql b/htdocs/install/mysql/tables/llx_hrm_skillrank.key.sql new file mode 100644 index 00000000000..11d89b0187c --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_skillrank.key.sql @@ -0,0 +1,27 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_hrm_skillrank ADD INDEX idx_hrm_skillrank_rowid (rowid); +ALTER TABLE llx_hrm_skillrank ADD INDEX idx_hrm_skillrank_fk_skill (fk_skill); +ALTER TABLE llx_hrm_skillrank ADD CONSTRAINT llx_hrm_skillrank_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); +-- END MODULEBUILDER INDEXES + +--ALTER TABLE llx_hrm_skillrank ADD UNIQUE INDEX uk_hrm_skillrank_fieldxy(fieldx, fieldy); + +--ALTER TABLE llx_hrm_skillrank ADD CONSTRAINT llx_hrm_skillrank_fk_field FOREIGN KEY (fk_field) REFERENCES llx_hrm_myotherobject(rowid); + diff --git a/htdocs/install/mysql/tables/llx_hrm_skillrank.sql b/htdocs/install/mysql/tables/llx_hrm_skillrank.sql new file mode 100644 index 00000000000..5c4deb95938 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_hrm_skillrank.sql @@ -0,0 +1,30 @@ +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2021 Greg Rastklan +-- Copyright (C) 2021 Jean-Pascal BOUDET +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +CREATE TABLE llx_hrm_skillrank( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + fk_skill integer NOT NULL, + rank integer NOT NULL, + fk_object integer NOT NULL, + date_creation datetime NOT NULL, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + objecttype varchar(128) NOT NULL + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 78560c5a05e..80e3f90b828 100644 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -104,8 +104,7 @@ create table llx_product fk_unit integer DEFAULT NULL, price_autogen tinyint DEFAULT 0, fk_project integer DEFAULT NULL, -- Used when product was generated by a project or is specifif to a project - mandatory_period tinyint DEFAULT 0 -- is used to signal to the user that the start and end dates are mandatory for this type of product the fk_product_type == 1 (service) (non-blocking action) + mandatory_period tinyint DEFAULT 0, -- is used to signal to the user that the start and end dates are mandatory for this type of product the fk_product_type == 1 (service) (non-blocking action) - fk_default_bom integer DEFAULT NULL, - fk_project integer DEFAULT NULL -- Used when the product was generated by a project or is specific to a project + fk_default_bom integer DEFAULT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_product_association.sql b/htdocs/install/mysql/tables/llx_product_association.sql index 91cc14882f1..f97e2aa6a0b 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 + rang integer DEFAULT 0 )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_workstation_workstation_user_group.sql b/htdocs/install/mysql/tables/llx_workstation_workstation_usergroup.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_workstation_workstation_user_group.sql rename to htdocs/install/mysql/tables/llx_workstation_workstation_usergroup.sql diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 8160f6e89b8..3bc37960bf3 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -1180,7 +1180,7 @@ if ($ok && GETPOST('clean_perm_table', 'alpha')) { foreach ($conf->modules as $key => $val) { $listofmods .= ($listofmods ? ',' : '')."'".$val."'"; } - $sql = 'SELECT id, libelle as label, module from '.MAIN_DB_PREFIX.'rights_def WHERE module NOT IN ('.$db->sanitize($listofmods).') AND id > 100000'; + $sql = "SELECT id, libelle as label, module from ".MAIN_DB_PREFIX."rights_def WHERE module NOT IN (".$db->sanitize($listofmods).") AND id > 100000"; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); @@ -1191,7 +1191,7 @@ if ($ok && GETPOST('clean_perm_table', 'alpha')) { if ($obj->id > 0) { print 'Found line with id '.$obj->id.', label "'.$obj->label.'" of module "'.$obj->module.'" to delete'; if (GETPOST('clean_perm_table', 'alpha') == 'confirmed') { - $sqldelete = 'DELETE FROM '.MAIN_DB_PREFIX.'rights_def WHERE id = '.$obj->id; + $sqldelete = "DELETE FROM ".MAIN_DB_PREFIX."rights_def WHERE id = ".((int) $obj->id); $resqldelete = $db->query($sqldelete); if (!$resqldelete) { dol_print_error($db); diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 129ee9d7827..b36914ad36b 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -283,7 +283,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $db->free($resql); } else { if ($db->lasterrno() != 'DB_ERROR_NOSUCHTABLE') { - print ''.dol_escape_htmltag($sql).' : '.dol_escape_htmltag($db->lasterror())."\n"; + print ''.dol_escape_htmltag($sql).' : '.dol_escape_htmltag($db->lasterror())."\n"; } } } 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/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index e9fa70e53d2..75aa11cf771 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -371,13 +371,13 @@ $param .= $hookmanager->resPrint; // List of mass actions available $arrayofmassactions = array( - 'validate'=>$langs->trans("Validate"), - //'generate_doc'=>$langs->trans("ReGeneratePDF"), - //'builddoc'=>$langs->trans("PDFMerge"), - //'presend'=>$langs->trans("SendByMail"), + 'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"), + //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), + //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), + //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); if ($permissiontodelete) { - $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); + $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { $arrayofmassactions = array(); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 53355dd15ce..def603e653e 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -133,7 +133,6 @@ IdModule=Module ID IdPermissions=Permissions ID LanguageBrowserParameter=Parameter %s LocalisationDolibarrParameters=Localization parameters -ClientTZ=Client Time Zone (user) ClientHour=Client time (user) OSTZ=Server OS Time Zone PHPTZ=PHP server Time Zone @@ -161,7 +160,7 @@ Purge=Purge PurgeAreaDesc=This page allows you to delete all files generated or stored by Dolibarr (temporary files or all files in %s directory). Using this feature is not normally necessary. It is provided as a workaround for users whose Dolibarr is hosted by a provider that does not offer permissions to delete files generated by the web server. PurgeDeleteLogFile=Delete log files, including %s defined for Syslog module (no risk of losing data) PurgeDeleteTemporaryFiles=Delete all log and temporary files (no risk of losing data). Parameter can be 'tempfilesold', 'logfiles' or both 'tempfilesold+logfiles'. Note: Deletion of temporary files is done only if the temp directory was created more than 24 hours ago. -PurgeDeleteTemporaryFilesShort=Delete log and temporary files +PurgeDeleteTemporaryFilesShort=Delete log and temporary files (no risk of losing data) PurgeDeleteAllFilesInDocumentsDir=Delete all files in directory: %s.
    This will delete all generated documents related to elements (third parties, invoices etc...), files uploaded into the ECM module, database backup dumps and temporary files. PurgeRunNow=Purge now PurgeNothingToDelete=No directory or files to delete. @@ -517,6 +516,9 @@ Field=Field ProductDocumentTemplates=Document templates to generate product document FreeLegalTextOnExpenseReports=Free legal text on expense reports WatermarkOnDraftExpenseReports=Watermark on draft expense reports +ProjectIsRequiredOnExpenseReports=The project is mandatory for entering an expense report +PrefillExpenseReportDatesWithCurrentMonth=Pre-fill start and end dates of new expense report with start and end dates of the current month +ForceExpenseReportsLineAmountsIncludingTaxesOnly=Force the entry of expense report amounts always in amount with taxes AttachMainDocByDefault=Set this to 1 if you want to attach main document to email by default (if applicable) FilesAttachedToEmail=Attach file SendEmailsReminders=Send agenda reminders by emails @@ -1040,7 +1042,7 @@ DictionaryFees=Expense report - Types of expense report lines DictionarySendingMethods=Shipping methods DictionaryStaff=Number of Employees DictionaryAvailability=Delivery delay -DictionaryOrderMethods=Ordering methods +DictionaryOrderMethods=Order methods DictionarySource=Origin of proposals/orders DictionaryAccountancyCategory=Personalized groups for reports DictionaryAccountancysystem=Models for chart of accounts @@ -1347,6 +1349,7 @@ BrowserIsKO=You are using the %s web browser. This browser is known to be a bad PHPModuleLoaded=PHP component %s is loaded PreloadOPCode=Preloaded OPCode is used AddRefInList=Display Customer/Vendor ref. info list (select list or combobox) and most of hyperlink.
    Third Parties will appear with a name format of "CC12345 - SC45678 - The Big Company corp." instead of "The Big Company corp". +AddVatInList=Display Customer/Vendor VAT number. info list (select list or combobox). AddAdressInList=Display Customer/Vendor adress info list (select list or combobox)
    Third Parties will appear with a name format of "The Big Company corp. - 21 jump street 123456 Big town - USA" instead of "The Big Company corp". AddEmailPhoneTownInContactList=Display Contact email (or phones if not defined) and town info list (select list or combobox)
    Contacts will appear with a name format of "Dupond Durand - dupond.durand@email.com - Paris" or "Dupond Durand - 06 07 59 65 66 - Paris" instead of "Dupond Durand". AskForPreferredShippingMethod=Ask for preferred shipping method for Third Parties. @@ -1634,8 +1637,8 @@ NumberOfProductShowInSelect=Maximum number of products to show in combo select l ViewProductDescInFormAbility=Display product descriptions in lines of items (otherwise show description in a tooltip popup) OnProductSelectAddProductDesc=How to use the description of the products when adding a product as a line of a document AutoFillFormFieldBeforeSubmit=Auto fill the description input field with the description of product -DoNotAutofillButAutoConcat=Do not autofill the input field with description of product. Description of the product will be concatenated to the entered description automatically. -DoNotUseDescriptionOfProdut=Description of the product will never be included into the description of lines of documents +DoNotAutofillButAutoConcat=Do not autofill the input field with description of product. Description of the product will be concatenated to the entered description automatically. +DoNotUseDescriptionOfProdut=Description of the product will never be included into the description of lines of documents MergePropalProductCard=Activate in product/service Attached Files tab an option to merge product PDF document to proposal PDF azur if product/service is in the proposal ViewProductDescInThirdpartyLanguageAbility=Display products descriptions in forms in the language of the third party (otherwise in the language of the user) UseSearchToSelectProductTooltip=Also if you have a large number of products (> 100 000), you can increase speed by setting constant PRODUCT_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string. @@ -1926,7 +1929,7 @@ SellTaxRate=Sales tax rate RecuperableOnly=Yes for VAT "Not Perceived but Recoverable" dedicated for some state in France. Keep value to "No" in all other cases. UrlTrackingDesc=If the provider or transport service offers a page or web site to check the status of your shipments, you may enter it here. You can use the key {TRACKID} in the URL parameters so the system will replace it with the tracking number the user entered into the shipment card. OpportunityPercent=When you create a lead, you will define an estimated amount of project/lead. According to status of the lead, this amount may be multiplied by this rate to evaluate a total amount all your leads may generate. Value is a percentage (between 0 and 100). -TemplateForElement=This template record is dedicated to which element +TemplateForElement=This mail template is related to what type of object? An email template is available only when using the "Send Email" button from the related object. TypeOfTemplate=Type of template TemplateIsVisibleByOwnerOnly=Template is visible to owner only VisibleEverywhere=Visible everywhere @@ -2156,7 +2159,7 @@ NoWritableFilesFoundIntoRootDir=No writable files or directories of the common p RecommendedValueIs=Recommended: %s Recommended=Recommended NotRecommended=Not recommended -ARestrictedPath=A restricted path +ARestrictedPath=Some restricted path CheckForModuleUpdate=Check for external modules updates CheckForModuleUpdateHelp=This action will connect to editors of external modules to check if a new version is available. ModuleUpdateAvailable=An update is available diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index cbe238ad2a4..bc9c7dab537 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -64,6 +64,7 @@ ShipmentClassifyClosedInDolibarr=Shipment %s classified billed ShipmentUnClassifyCloseddInDolibarr=Shipment %s classified re-open ShipmentBackToDraftInDolibarr=Shipment %s go back to draft status ShipmentDeletedInDolibarr=Shipment %s deleted +ShipmentCanceledInDolibarr=Shipment %s canceled ReceptionValidatedInDolibarr=Reception %s validated OrderCreatedInDolibarr=Order %s created OrderValidatedInDolibarr=Order %s validated diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index e475a815ac9..afdff97ded6 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -265,6 +265,7 @@ DateInvoice=Invoice date DatePointOfTax=Point of tax NoInvoice=No invoice NoOpenInvoice=No open invoice +NbOfOpenInvoices=Number of open invoices ClassifyBill=Classify invoice SupplierBillsToPay=Unpaid vendor invoices CustomerBillsUnpaid=Unpaid customer invoices diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index ca962811831..d486fef0f5c 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -73,6 +73,7 @@ Language_it_IT=Italian Language_it_CH=Italian (Switzerland) Language_ja_JP=Japanese Language_ka_GE=Georgian +Language_kk_KZ=Kazakh Language_km_KH=Khmer Language_kn_IN=Kannada Language_ko_KR=Korean @@ -93,6 +94,7 @@ Language_ro_MD=Romanian (Moldavia) Language_ro_RO=Romanian Language_ru_RU=Russian Language_ru_UA=Russian (Ukraine) +Language_tg_TJ=Tajik Language_tr_TR=Turkish Language_sl_SI=Slovenian Language_sv_SV=Swedish diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index b68b62c2a43..fb6e20adcca 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1155,4 +1155,5 @@ ConfirmMassLeaveApproval=Mass leave approval confirmation RecordAproved=Record approved RecordsApproved=%s Record(s) approved Properties=Properties -hasBeenValidated=%s has been validated \ No newline at end of file +hasBeenValidated=%s has been validated +ClientTZ=Client Time Zone (user) diff --git a/htdocs/langs/en_US/printing.lang b/htdocs/langs/en_US/printing.lang index 16494583550..bd9094f213d 100644 --- a/htdocs/langs/en_US/printing.lang +++ b/htdocs/langs/en_US/printing.lang @@ -1,10 +1,10 @@ # Dolibarr language file - Source file is en_US - printing -Module64000Name=Direct Printing -Module64000Desc=Enable Direct Printing System -PrintingSetup=Setup of Direct Printing System -PrintingDesc=This module adds a Print button to various modules to allow documents to be printed directly to a printer without needing to open the document in another application. -MenuDirectPrinting=Direct Printing jobs -DirectPrint=Direct print +Module64000Name=One click Printing +Module64000Desc=Enable One click Printing System +PrintingSetup=Setup of One click Printing System +PrintingDesc=This module adds a Print button to various modules to allow documents to be printed directly to a printer with no need to open the document into another application. +MenuDirectPrinting=One click Printing jobs +DirectPrint=One click Print PrintingDriverDesc=Configuration variables for printing driver. ListDrivers=List of drivers PrintTestDesc=List of Printers. diff --git a/htdocs/langs/en_US/productbatch.lang b/htdocs/langs/en_US/productbatch.lang index 763af20c6b4..71e44e8f281 100644 --- a/htdocs/langs/en_US/productbatch.lang +++ b/htdocs/langs/en_US/productbatch.lang @@ -37,7 +37,8 @@ ManufacturingDate=Manufacturing date DestructionDate=Destruction date FirstUseDate=First use date QCFrequency=Quality control frequency (in days) - +ShowAllLots=Show all lots +HideLots=Hide lots #Traceability - qc status OutOfOrder=Out of order InWorkingOrder=In working order diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 128eb120e0b..19349fb35a8 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -401,11 +401,10 @@ DeleteLinkedProduct=Delete the child product linked to the combination AmountUsedToUpdateWAP=Amount to use to update the Weighted Average Price PMPValue=Weighted average price PMPValueShort=WAP - mandatoryperiod=Mandatory periods mandatoryPeriodNeedTobeSet=Attention periods not entered and mandatory mandatoryPeriodNeedTobeSetMsgValidate=A service requires a start and end period mandatoryHelper=Message to the user on the need to enter a start date and an end date on a service when creating / validating an invoice, commercial proposal, sales order.
    This action is not blocking in the process of confirmation 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'. - +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/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/admin.lang b/htdocs/langs/fr_FR/admin.lang index efab72ea66b..9579e51920d 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -189,7 +189,7 @@ Compression=Compression CommandsToDisableForeignKeysForImport=Commande pour désactiver les clés étrangères à l'importation CommandsToDisableForeignKeysForImportWarning=Requis si vous voulez être en mesure de restaurer votre « dump » SQL plus tard ExportCompatibility=Compatibilité du fichier d'exportation généré -ExportUseMySQLQuickParameter=Utiliser le paramètre --quick +ExportUseMySQLQuickParameter=Utiliser le paramètre --quick ExportUseMySQLQuickParameterHelp=Le paramètre '--quick' aide à réduire la consommation de RAM pour les longues listes MySqlExportParameters=Paramètres de l'exportation MySQL PostgreSqlExportParameters= Paramètres de l'exportation PostgreSQL @@ -336,7 +336,7 @@ MenuHandlers=Gestionnaires de menu MenuAdmin=Édition menu DoNotUseInProduction=Ne pas utiliser en production ThisIsProcessToFollow=Procédure de mise à jour: -ThisIsAlternativeProcessToFollow=Voici une procédure de configuration alternative +ThisIsAlternativeProcessToFollow=Voici une procédure de configuration alternative StepNb=Étape %s FindPackageFromWebSite=Rechercher le paquet qui répond à votre besoin (par exemple sur le site web %s). DownloadPackageFromWebSite=Télécharger le package (par exemple depuis le site web officiel %s) @@ -1341,6 +1341,7 @@ BrowserIsKO=Vous utilisez le navigateur %s. Ce navigateur est déconseillé pour PHPModuleLoaded=Le composant PHP %s est chargé PreloadOPCode=Le code OP préchargé est utilisé AddRefInList=Afficher les références client/fournisseur dans les listes (listes déroulantes ou à autocomplétion) et les libellés des liens clicables.
    Les tiers apparaîtront alors sous la forme "CC12345 - SC45678 - La big company coorp", au lieu de "La big company coorp". +AddVatInList=Afficher le numéro de TVA client/fournisseur dans les listes (listes déroulantes ou à autocomplétion). AddAdressInList=Affiche les informations sur l’adresse du client/fournisseur (liste de sélection ou liste déroulante)
    Les tiers apparaîtront avec le format de nom suivant: "The Big Company corp. - 21, rue du saut 123456 Big town - USA" au lieu de "The Big Company corp". AddEmailPhoneTownInContactList=Afficher l'adresse e-mail du contact (ou les téléphones si non définis) et la ville
    Les contacts apparaîtront avec un nom au format "Dupond Durand - dupond.durand@email.com - Paris" ou "Dupond Durand - 06 07 59 65 66 - Paris" au lieu de "Dupond Durand". AskForPreferredShippingMethod=Demander la méthode d'expédition préférée pour les Tiers @@ -1351,7 +1352,7 @@ NumberingModules=Modèles de numérotation DocumentModules=Modèles de documents ##### Module password generation PasswordGenerationStandard=Renvoie un mot de passe généré selon l'algorythme interne de Dolibarr :%s caractères contenant chiffres et minuscules -PasswordGenerationNone=Ne pas suggérer un mot de passe généré. Le mot de passe doit être entré manuellement. +PasswordGenerationNone=Ne pas suggérer un mot de passe généré. Le mot de passe doit être entré manuellement. PasswordGenerationPerso=Renvoie un mot de passe en fonction d'une configuration personnalisée. SetupPerso=Selon votre configuration PasswordPatternDesc=Description du masque du mot de passe @@ -1427,7 +1428,7 @@ OrdersNumberingModules=Modèles de numérotation des commandes OrdersModelModule=Modèles de document des commandes FreeLegalTextOnOrders=Mention complémentaire sur les commandes WatermarkOnDraftOrders=Filigrane sur les brouillons de commandes (aucun si vide) -ShippableOrderIconInList=Ajouter une icône dans la liste des commandes qui indique si la commande est expédiable. +ShippableOrderIconInList=Ajouter une icône dans la liste des commandes qui indique si la commande est expédiable. BANK_ASK_PAYMENT_BANK_DURING_ORDER=Demander le compte bancaire cible durant la commande ##### Interventions ##### InterventionsSetup=Configuration du module Interventions @@ -1617,7 +1618,7 @@ TestNotPossibleWithCurrentBrowsers=Une détection automatique n'est pas possible DefaultValuesDesc=Vous pouvez définir/forcer ici la valeur par défaut que vous voulez obtenir lorsque vous créez un nouvel enregistrement, et/ou les filtres par défaut ou ordre de tri des listes. DefaultCreateForm=Valeurs par défaut (sur les formulaires de création) DefaultSearchFilters=Filtres de recherche par défaut -DefaultSortOrder=Ordre de tri par défaut +DefaultSortOrder=Ordre de tri par défaut DefaultFocus=Champs par défaut ayant le focus DefaultMandatory=Champs de formulaire obligatoires ##### Products ##### @@ -1832,7 +1833,7 @@ ChequeReceiptsNumberingModule=Module de numérotation des bordereaux de remises MultiCompanySetup=Configuration du module Multi-société ##### Suppliers ##### SuppliersSetup=Configuration du module Fournisseurs -SuppliersCommandModel=Modèle de commande fournisseur complet +SuppliersCommandModel=Modèle de commande fournisseur complet SuppliersCommandModelMuscadet=Modèle de commande fournisseur complet (ancienne implémentation du modèle Cornas) SuppliersInvoiceModel=Modèle de facture fournisseur complet SuppliersInvoiceNumberingModel=Modèles de numérotation des factures fournisseur @@ -1867,7 +1868,7 @@ NbMajMin=Nombre minimal de caractères majuscules NbNumMin=Nombre minimal de caractères numériques NbSpeMin=Nombre minimal de caractères spéciaux NbIteConsecutive=Nombre maximal de répétition des mêmes caractères -NoAmbiCaracAutoGeneration=Ne pas utiliser des caractères ambigus ("1","l","i","|","0","O") pour la génération automatique +NoAmbiCaracAutoGeneration=Ne pas utiliser des caractères ambigus ("1","l","i","|","0","O") pour la génération automatique SalariesSetup=Configuration du module salaires SortOrder=Ordre de tri Format=Format @@ -1887,7 +1888,7 @@ GoOntoContactCardToAddMore=Rendez-vous sur l'onglet "Notifications" d'un tiers p Threshold=Seuil BackupDumpWizard=Assistant pour créer le fichier dump de la base de données BackupZipWizard=Assistant pour générer l'archive du répertoire documents -SomethingMakeInstallFromWebNotPossible=L'installation de module externe est impossible depuis l'interface web pour la raison suivante : +SomethingMakeInstallFromWebNotPossible=L'installation de module externe est impossible depuis l'interface web pour la raison suivante : SomethingMakeInstallFromWebNotPossible2=Pour cette raison, le processus de mise à jour décrit ici est une processus manuel que seul un utilisateur ayant des droits privilégiés peut réaliser. InstallModuleFromWebHasBeenDisabledByFile=L'installation de module externe depuis l'application a été désactivé par l'administrator. Vous devez lui demander de supprimer le fichier %s pour permettre cette fonctionnalité. ConfFileMustContainCustom=Installer ou créer un module externe à partir de l'application nécessite de sauvegarder les fichiers du module dans le répertoire %s. Pour que ce répertoire soit reconnu par Dolibarr, vous devez paramétrer le fichier de configuration conf/conf.php en ajoutant les 2 lignes suivantes :
    $dolibarr_main_url_root_alt='/custom'
    $dolibarr_main_document_root_alt='%s/custom'; diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 83514bd95ff..24e5c062cc7 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -399,6 +399,7 @@ ProductSupplierExtraFields=Attributs supplémentaires (Prix fournisseur) DeleteLinkedProduct=Supprimer le produit enfant lié à la combinaison PMPValue=Prix moyen pondéré (PMP) PMPValueShort=PMP +Rank=Rang mandatoryperiod=Périodes obligatoires mandatoryPeriodNeedTobeSet=Attention périodes non saisies et obligatoires mandatoryPeriodNeedTobeSetMsgValidate=Un service nécessite une période de début et de fin 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/langs/gl_ES/main.lang b/htdocs/langs/gl_ES/main.lang index a330cb6d7c1..1e13deb814d 100644 --- a/htdocs/langs/gl_ES/main.lang +++ b/htdocs/langs/gl_ES/main.lang @@ -4,7 +4,7 @@ DIRECTION=ltr # msungstdlight or cid0ct are for traditional Chinese (traditional does not render with Ubuntu pdf reader) # stsongstdlight or cid0cs are for simplified Chinese # To read Chinese pdf with Linux: sudo apt-get install poppler-data -FONTFORPDF=helvética +FONTFORPDF=helvetica FONTSIZEFORPDF=10 SeparatorDecimal=, SeparatorThousand=. diff --git a/htdocs/langs/ko_KR/main.lang b/htdocs/langs/ko_KR/main.lang index d4c9db86587..4866f431c83 100644 --- a/htdocs/langs/ko_KR/main.lang +++ b/htdocs/langs/ko_KR/main.lang @@ -4,7 +4,7 @@ DIRECTION=ltr # msungstdlight or cid0ct are for traditional Chinese (traditional does not render with Ubuntu pdf reader) # stsongstdlight or cid0cs are for simplified Chinese # To read Chinese pdf with Linux: sudo apt-get install poppler-data -FONTFORPDF=헬 베티 카 +FONTFORPDF=cid0kr FONTSIZEFORPDF=10 SeparatorDecimal=. SeparatorThousand=None diff --git a/htdocs/langs/lv_LV/main.lang b/htdocs/langs/lv_LV/main.lang index d380a59d050..9f0539dac39 100644 --- a/htdocs/langs/lv_LV/main.lang +++ b/htdocs/langs/lv_LV/main.lang @@ -4,7 +4,7 @@ DIRECTION=ltr # msungstdlight or cid0ct are for traditional Chinese (traditional does not render with Ubuntu pdf reader) # stsongstdlight or cid0cs are for simplified Chinese # To read Chinese pdf with Linux: sudo apt-get install poppler-data -FONTFORPDF=Helvetica +FONTFORPDF=helvetica FONTSIZEFORPDF=10 SeparatorDecimal=, SeparatorThousand=None diff --git a/htdocs/langs/th_TH/main.lang b/htdocs/langs/th_TH/main.lang index 367ef49849e..7f635f1da50 100644 --- a/htdocs/langs/th_TH/main.lang +++ b/htdocs/langs/th_TH/main.lang @@ -4,7 +4,7 @@ DIRECTION=ltr # msungstdlight or cid0ct are for traditional Chinese (traditional does not render with Ubuntu pdf reader) # stsongstdlight or cid0cs are for simplified Chinese # To read Chinese pdf with Linux: sudo apt-get install poppler-data -FONTFORPDF=Helvetica +FONTFORPDF=helvetica FONTSIZEFORPDF=10 SeparatorDecimal=. SeparatorThousand=, 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/main.inc.php b/htdocs/main.inc.php index 0a64a4a913e..7775071a55c 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -465,13 +465,13 @@ if (!defined('NOTOKENRENEWAL') && !defined('NOSESSION')) { if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN')) || defined('CSRFCHECK_WITH_TOKEN')) { // Array of action code where CSRFCHECK with token will be forced (so token must be provided on url request) $sensitiveget = false; - if ((GETPOSTISSET('massaction') || GETPOST('action', 'aZ09')) && getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') == 2) { + if ((GETPOSTISSET('massaction') || GETPOST('action', 'aZ09')) && getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') >= 3) { // All GET actions and mass actions are processed as sensitive. $sensitiveget = true; - } else { - // Only GET actions coded with a &token into url are processed as sensitive. + } elseif (getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') >= 2) { + // Few GET actions coded with a &token into url are processed as sensitive. $arrayofactiontoforcetokencheck = array( - 'activate', 'add', 'addrights', 'addtimespent', + 'activate', 'doprev', 'donext', 'dvprev', 'dvnext', 'install', 'reopen' @@ -479,7 +479,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( if (in_array(GETPOST('action', 'aZ09'), $arrayofactiontoforcetokencheck)) { $sensitiveget = true; } - if (preg_match('/^(classify|close|confirm|del|disable|enable|remove|set|unset|update)/', GETPOST('action', 'aZ09'))) { + if (preg_match('/^(add|classify|close|confirm|copy|del|disable|enable|remove|set|unset|update|save)/', GETPOST('action', 'aZ09'))) { $sensitiveget = true; } } @@ -506,7 +506,11 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( } else { dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"])?'':$_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused by CSRF protection (POST method or GET with a sensible value for 'action' parameter) in main.inc.php. Token not provided.", LOG_WARNING); print "Access to this page this way (POST method or GET with a sensible value for 'action' parameter) is refused by CSRF protection in main.inc.php. Token not provided.\n"; - print "If you access your server behind a proxy using url rewriting and the parameter is provided by caller, you might check that all HTTP header are propagated (or add the line \$dolibarr_nocsrfcheck=1 into your conf.php file or MAIN_SECURITY_CSRF_WITH_TOKEN to 0 into setup).\n"; + print "If you access your server behind a proxy using url rewriting and the parameter is provided by caller, you might check that all HTTP header are propagated (or add the line \$dolibarr_nocsrfcheck=1 into your conf.php file or MAIN_SECURITY_CSRF_WITH_TOKEN to 0"; + if (! empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)) { + print " instead of ".$conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN; + } + print " into setup).\n"; } die; } @@ -3077,7 +3081,7 @@ if (!function_exists("llxFooter")) { */ function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0) { - global $conf, $db, $langs, $user, $mysoc, $object; + global $conf, $db, $langs, $user, $mysoc, $object, $hookmanager; global $delayedhtmlcontent; global $contextpage, $page, $limit; global $dolibarr_distrib; @@ -3300,6 +3304,11 @@ if (!function_exists("llxFooter")) { } } + $reshook = $hookmanager->executeHooks('beforeBodyClose'); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + print $hookmanager->resPrint; + } + print "\n"; print "\n"; } diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 1b3cc468e5c..43e9c87c6e6 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -124,7 +124,7 @@ if ($socid > 0) { print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client)); $tmpcheck = $object->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongCustomerCode").')'; + print ' ('.$langs->trans("WrongCustomerCode").')'; } print ''; } @@ -135,7 +135,7 @@ if ($socid > 0) { print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur)); $tmpcheck = $object->check_codefournisseur(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongSupplierCode").')'; + print ' ('.$langs->trans("WrongSupplierCode").')'; } print ''; } diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index db8bc85816e..ea0af722885 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").' :
    '; @@ -2309,7 +2309,7 @@ if ($module == 'initmodule') { $i++; } } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print ''; @@ -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 '
    '; @@ -3106,7 +3106,7 @@ if ($module == 'initmodule') { print ''; } } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } 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 '
    '; @@ -3199,7 +3199,7 @@ if ($module == 'initmodule') { print ''; } } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } 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 '
    '; @@ -3696,7 +3696,7 @@ if ($module == 'initmodule') { print ''; } } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } 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/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index e7db2a1275a..ad1774b149e 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -430,13 +430,13 @@ class MyObject extends CommonObject $records = array(); - $sql = 'SELECT '; + $sql = "SELECT "; $sql .= $this->getFieldList('t'); - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) { - $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')'; + $sql .= " WHERE t.entity IN (".getEntity($this->table_element).")"; } else { - $sql .= ' WHERE 1 = 1'; + $sql .= " WHERE 1 = 1"; } // Manage filter $sqlwhere = array(); @@ -908,10 +908,11 @@ class MyObject extends CommonObject */ public function info($id) { - $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; - $sql .= ' fk_user_creat, fk_user_modif'; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; - $sql .= ' WHERE t.rowid = '.((int) $id); + $sql = "SELECT rowid, date_creation as datec, tms as datem,"; + $sql .= " fk_user_creat, fk_user_modif"; + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; + $sql .= " WHERE t.rowid = ".((int) $id); + $result = $this->db->query($sql); if ($result) { if ($this->db->num_rows($result)) { diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index 4e154b5665d..9126da0070d 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -301,11 +301,14 @@ class doc_generic_myobject_odt extends ModelePDFMyObject // Recipient name $contactobject = null; if (!empty($usecontact)) { - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { - $socobject = $object->contact; + // We can use the company of contact instead of thirdparty company + if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) { + $object->contact->fetch_thirdparty(); + $socobject = $object->contact->thirdparty; + $contactobject = $object->contact; } else { $socobject = $object->thirdparty; - // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + // if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use $contactobject = $object->contact; } } else { diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index 1b95a2a0c20..1a435d3763d 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -1110,7 +1110,7 @@ class pdf_standard_myobject extends ModelePDFMyObject } // Recipient name - if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) { + if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) { $thirdparty = $object->contact; } else { $thirdparty = $object->thirdparty; diff --git a/htdocs/mrp/class/api_mos.class.php b/htdocs/mrp/class/api_mos.class.php index 8fbd25090c7..59b4cbfa16b 100644 --- a/htdocs/mrp/class/api_mos.class.php +++ b/htdocs/mrp/class/api_mos.class.php @@ -22,7 +22,7 @@ require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; /** - * \file mrp/class/api_mo.class.php + * \file htdocs/mrp/class/api_mos.class.php * \ingroup mrp * \brief File for API management of MO. */ diff --git a/htdocs/mrp/lib/mrp_mo.lib.php b/htdocs/mrp/lib/mrp_mo.lib.php index 8fe07df89c1..08bc07f298a 100644 --- a/htdocs/mrp/lib/mrp_mo.lib.php +++ b/htdocs/mrp/lib/mrp_mo.lib.php @@ -104,5 +104,7 @@ function moPrepareHead($object) //); // to remove a tab complete_head_from_modules($conf, $langs, $object, $head, $h, 'mo@mrp'); + complete_head_from_modules($conf, $langs, $object, $head, $h, 'mo@mrp', 'remove'); + return $head; } 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/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 84dab109b91..510e7a433f4 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -704,7 +704,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $newlinetext = ''; if ($object->status != $object::STATUS_PRODUCED && $object->status != $object::STATUS_CANCELED && $action != 'consumeorproduce' && $action != 'consumeandproduceall') { - $newlinetext = ''.$langs->trans("AddNewConsumeLines").''; + $newlinetext = ''.$langs->trans("AddNewConsumeLines").''; } print load_fiche_titre($langs->trans('Consumption'), '', '', 0, '', '', $newlinetext); @@ -945,7 +945,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($action == 'consumeorproduce' && !GETPOSTISSET('qty-'.$line->id.'-'.$i)) { $preselected = 0; } - print ''; + + $disable = ''; + if (!empty($conf->global->MRP_NEVER_CONSUME_MORE_THAN_EXPECTED) && ($line->qty - $alreadyconsumed) <= 0) { + $disable = 'disabled'; + } + + print ''; if ($permissiontoupdatecost && !empty($conf->global->MRP_SHOW_COST_FOR_CONSUMPTION)) { print ''; } @@ -967,7 +973,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; if ($tmpproduct->status_batch) { $preselected = (GETPOSTISSET('batch-'.$line->id.'-'.$i) ? GETPOST('batch-'.$line->id.'-'.$i) : ''); - print ''; + print ''; + print $formproduct->selectLot('batch-'.$line->id.'-'.$i, 0, $line->fk_product, '', ''); } print ''; } @@ -996,7 +1003,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $newlinetext = ''; if ($object->status != $object::STATUS_PRODUCED && $object->status != $object::STATUS_CANCELED && $action != 'consumeorproduce' && $action != 'consumeandproduceall') { if ($nblinetoproduce == 0 || $object->mrptype == 1) { - $newlinetext = ''.$langs->trans("AddNewProduceLines").''; + $newlinetext = ''.$langs->trans("AddNewProduceLines").''; } } print load_fiche_titre($langs->trans('Production'), '', '', 0, '', '', $newlinetext); diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index a811a396811..73eab7773bd 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -133,7 +133,7 @@ class MultiCurrency extends CommonObject $now = dol_now(); // Insert request - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'('; + $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."("; $sql .= ' code,'; $sql .= ' name,'; $sql .= ' entity,'; @@ -194,7 +194,7 @@ class MultiCurrency extends CommonObject global $conf; - $sql = 'SELECT'; + $sql = "SELECT"; $sql .= ' c.rowid, c.name, c.code, c.entity, c.date_create, c.fk_user'; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' AS c'; if (!empty($code)) { @@ -243,7 +243,7 @@ class MultiCurrency extends CommonObject */ public function fetchAllCurrencyRate() { - $sql = 'SELECT cr.rowid'; + $sql = "SELECT cr.rowid"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as cr'; $sql .= ' WHERE cr.fk_multicurrency = '.((int) $this->id); $sql .= ' ORDER BY cr.date_sync DESC'; @@ -298,10 +298,10 @@ class MultiCurrency extends CommonObject } // Update request - $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET'; - $sql .= ' name=\''.$this->db->escape($this->name).'\''; - $sql .= ' code=\''.$this->db->escape($this->code).'\''; - $sql .= ' WHERE rowid='.((int) $this->id); + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; + $sql .= " name = '".$this->db->escape($this->name)."'"; + $sql .= " code = '".$this->db->escape($this->code)."'"; + $sql .= " WHERE rowid = ".((int) $this->id); $this->db->begin(); @@ -362,8 +362,8 @@ class MultiCurrency extends CommonObject dol_syslog('Currency::delete '.join(',', $this->errors), LOG_ERR); } - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element; - $sql .= ' WHERE rowid='.((int) $this->id); + $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element; + $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); @@ -432,17 +432,17 @@ class MultiCurrency extends CommonObject */ public function addRateFromDolibarr($code, $rate) { - global $db, $user; + global $user; $currency = new MultiCurrency($this->db); $currency->code = $code; $currency->name = $code; - $sql = 'SELECT label FROM '.MAIN_DB_PREFIX."c_currencies WHERE code_iso = '".$this->db->escape($code)."'"; + $sql = "SELECT label FROM ".MAIN_DB_PREFIX."c_currencies WHERE code_iso = '".$this->db->escape($code)."'"; dol_syslog(__METHOD__, LOG_DEBUG); - $resql = $db->query($sql); - if ($resql && ($line = $db->fetch_object($resql))) { + $resql = $this->db->query($sql); + if ($resql && ($line = $this->db->fetch_object($resql))) { $currency->name = $line->label; } @@ -477,8 +477,8 @@ class MultiCurrency extends CommonObject */ public function getRate() { - $sql = 'SELECT cr.rowid'; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as cr'; + $sql = "SELECT cr.rowid"; + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element_line." as cr"; $sql .= " WHERE cr.fk_multicurrency = ".((int) $this->id); $sql .= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX.$this->table_element_line." AS cr2 WHERE cr2.fk_multicurrency = ".((int) $this->id).")"; @@ -502,7 +502,7 @@ class MultiCurrency extends CommonObject { global $conf; - $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX."multicurrency WHERE code = '".$db->escape($code)."' AND entity = ".$conf->entity; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."multicurrency WHERE code = '".$db->escape($code)."' AND entity = ".$conf->entity; dol_syslog(__METHOD__, LOG_DEBUG); $resql = $db->query($sql); @@ -521,13 +521,13 @@ class MultiCurrency extends CommonObject * @param integer $date_document Date from document (propal, order, invoice, ...) * * @return array [0] => id currency - * [1] => rate + * [1] => rate */ public static function getIdAndTxFromCode($db, $code, $date_document = '') { global $conf; - $sql1 = 'SELECT m.rowid, mc.rate FROM '.MAIN_DB_PREFIX.'multicurrency m'; + $sql1 = "SELECT m.rowid, mc.rate FROM ".MAIN_DB_PREFIX."multicurrency m"; $sql1 .= ' LEFT JOIN '.MAIN_DB_PREFIX.'multicurrency_rate mc ON (m.rowid = mc.fk_multicurrency)'; $sql1 .= " WHERE m.code = '".$db->escape($code)."'"; @@ -537,7 +537,7 @@ class MultiCurrency extends CommonObject $tmparray = dol_getdate($date_document); $sql2 .= " AND mc.date_sync <= '".$db->idate(dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year'], true))."'"; } - $sql3 = ' ORDER BY mc.date_sync DESC LIMIT 1'; + $sql3 = " ORDER BY mc.date_sync DESC LIMIT 1"; dol_syslog(__METHOD__, LOG_DEBUG); $resql = $db->query($sql1.$sql2.$sql3); @@ -591,7 +591,7 @@ class MultiCurrency extends CommonObject { global $db; - $sql = 'SELECT multicurrency_tx FROM '.MAIN_DB_PREFIX.$table.' WHERE rowid = '.((int) $fk_facture); + $sql = "SELECT multicurrency_tx FROM ".MAIN_DB_PREFIX.$table." WHERE rowid = ".((int) $fk_facture); dol_syslog(__METHOD__, LOG_DEBUG); $resql = $db->query($sql); @@ -687,12 +687,10 @@ class MultiCurrency extends CommonObject * @param string $code current code to search * @return boolean True if exists, false if not exists */ - public static function checkCodeAlreadyExists($code) + public function checkCodeAlreadyExists($code) { - global $db; - - $currency = new MultiCurrency($db); - if ($currency->fetch('', $code) > 0) { + $currencytmp = new MultiCurrency($this->db); + if ($currencytmp->fetch('', $code) > 0) { return true; } else { return false; @@ -775,7 +773,7 @@ class CurrencyRate extends CommonObjectLine $now = empty($this->date_sync) ? dol_now() : $this->date_sync; // Insert request - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'('; + $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."("; $sql .= ' rate,'; $sql .= ' date_sync,'; $sql .= ' fk_multicurrency,'; @@ -831,9 +829,9 @@ class CurrencyRate extends CommonObjectLine { dol_syslog('CurrencyRate::fetch', LOG_DEBUG); - $sql = 'SELECT cr.rowid, cr.rate, cr.date_sync, cr.fk_multicurrency, cr.entity'; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' AS cr'; - $sql .= ' WHERE cr.rowid = '.((int) $id); + $sql = "SELECT cr.rowid, cr.rate, cr.date_sync, cr.fk_multicurrency, cr.entity"; + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." AS cr"; + $sql .= " WHERE cr.rowid = ".((int) $id); dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); @@ -880,15 +878,15 @@ class CurrencyRate extends CommonObjectLine $this->rate = price2num($this->rate); // Update request - $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql .= "SET rate =".((float) $this->rate); + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; + $sql .= "SET rate = ".((float) $this->rate); if (!empty($this->date_sync)) { - $sql .= ", date_sync='".$this->db->idate($this->date_sync)."'"; + $sql .= ", date_sync = '".$this->db->idate($this->date_sync)."'"; } if (!empty($this->fk_multicurrency)) { - $sql .= ', fk_multicurrency='.((int) $this->fk_multicurrency); + $sql .= ', fk_multicurrency = '.((int) $this->fk_multicurrency); } - $sql .= ' WHERE rowid='.((int) $this->id); + $sql .= " WHERE rowid =".((int) $this->id); $this->db->begin(); diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index c32b49ff1a1..19aff377c65 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -254,18 +254,6 @@ if ($action == 'edit') { } print ''; -// EMail -//If linked user, then emails are going to be sent to users' email -if (!$object->fk_user_creat) { - print ''.$langs->trans("EMail").''; - if ($action == 'edit') { - print ''; - } else { - print dol_print_email($object->mail_admin, 0, 0, 1, 0, 1, 1); - } - print ''; -} - // Receive an email with each vote print ''.$langs->trans('ToReceiveEMailForEachVote').''; if ($action == 'edit') { @@ -323,10 +311,14 @@ print ''; // Author print ''; print $langs->trans("Author").''; -if ($object->fk_user_creat) { +if ($object->fk_user_creat > 0) { print $userstatic->getLoginUrl(1); } else { - print dol_htmlentities($object->nom_admin); + if ($action == 'edit') { + print ''; + } else { + print dol_print_email($object->mail_admin, 0, 0, 1, 0, 1, 1); + } } print ''; diff --git a/htdocs/opensurvey/wizard/create_survey.php b/htdocs/opensurvey/wizard/create_survey.php index 30e662be7ea..6ed1f2073d2 100644 --- a/htdocs/opensurvey/wizard/create_survey.php +++ b/htdocs/opensurvey/wizard/create_survey.php @@ -170,7 +170,7 @@ if ($_SESSION["mailsonde"]) { $cochemail = "checked"; } -print ' '.$langs->trans("ToReceiveEMailForEachVote").'
    '."\n"; +print '
    '."\n"; if ($_SESSION['allow_comments']) { $allow_comments = 'checked'; @@ -178,7 +178,7 @@ if ($_SESSION['allow_comments']) { if (GETPOSTISSET('allow_comments')) { $allow_comments = GETPOST('allow_comments') ? 'checked' : ''; } -print ' '.$langs->trans('CanComment').'
    '."\n"; +print '
    '."\n"; if ($_SESSION['allow_spy']) { $allow_spy = 'checked'; @@ -186,7 +186,7 @@ if ($_SESSION['allow_spy']) { if (GETPOSTISSET('allow_spy')) { $allow_spy = GETPOST('allow_spy') ? 'checked' : ''; } -print ' '.$langs->trans('CanSeeOthersVote').'
    '."\n"; +print '
    '."\n"; if (GETPOST('choix_sondage')) { if (GETPOST('choix_sondage') == 'date') { 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/admin/dynamic_prices.php b/htdocs/product/admin/dynamic_prices.php index 9a354a8dcdb..e1e23feac86 100644 --- a/htdocs/product/admin/dynamic_prices.php +++ b/htdocs/product/admin/dynamic_prices.php @@ -182,9 +182,9 @@ if ($action != 'create_updater' && $action != 'edit_updater') { print ''; } } else { - print ''; + print ''; print $langs->trans("None"); - print ''; + print ''; } print ''; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index fd9b129e30d..b4c951a953f 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -640,7 +640,7 @@ if (empty($reshook)) { // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); if ($ret < 0) { $error++; } @@ -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/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 9804daf1bba..e7709b3af41 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'); + $keys = array('rowid', 'qty', 'fk_product_type', 'label', 'incdec', 'ref'); $childs = array(); foreach ($childsArbo as $values) { $childs[] = array_combine($keys, $values); diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 64517c25443..f17b583c5b8 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -591,6 +591,7 @@ class FormProduct } $out .= '
    '; dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', ''); @@ -136,7 +223,7 @@ if ($object->id) { print dol_print_date($object->dateep, 'day'); print ''; - print '' . $langs->trans("Amount") . '' . price($object->amount, 0, $langs, 1, -1, -1, $conf->currency) . ''; + print '' . $langs->trans("Amount") . '' . price($object->amount, 0, $langs, 1, -1, -1, $conf->currency) . ''; print ''.$langs->trans("NbOfAttachedFiles").''.count($filearray).''; diff --git a/htdocs/salaries/info.php b/htdocs/salaries/info.php index 0f94f405fa1..173e03c2c7d 100644 --- a/htdocs/salaries/info.php +++ b/htdocs/salaries/info.php @@ -28,6 +28,10 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/salaries.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +if (!empty($conf->projet->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +} // Load translation files required by the page $langs->loadLangs(array("compta", "bills", "users", "salaries", "hrm")); @@ -36,23 +40,68 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); -$object = new Salary($db); -if ($id > 0 || !empty($ref)) { - $object->fetch($id, $ref); -} +$label = GETPOST('label', 'alphanohtml'); +$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int')); // Security check $socid = GETPOST('socid', 'int'); if ($user->socid) { $socid = $user->socid; } + +$object = new Salary($db); +$extrafields = new ExtraFields($db); + +$childids = $user->getAllChildIds(1); + +// fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); + +$object = new Salary($db); +if ($id > 0 || !empty($ref)) { + $object->fetch($id, $ref); + + // Check current user can read this salary + $canread = 0; + if (!empty($user->rights->salaries->readall)) { + $canread = 1; + } + if (!empty($user->rights->salaries->read) && $object->fk_user > 0 && in_array($object->fk_user, $childids)) { + $canread = 1; + } + if (!$canread) { + accessforbidden(); + } +} + restrictedArea($user, 'salaries', $object->id, 'salary', ''); +/* + * Actions + */ + +// Link to a project +if ($action == 'classin' && $user->rights->banque->modifier) { + $object->fetch($id); + $object->setProject($projectid); +} + +// set label +if ($action == 'setlabel' && $user->rights->salaries->write) { + $object->fetch($id); + $object->label = $label; + $object->update($user); +} + + + /* * View */ +if (!empty($conf->projet->enabled)) $formproject = new FormProjets($db); + $title = $langs->trans('Salary')." - ".$langs->trans('Info'); $help_url = ""; llxHeader("", $title, $help_url); @@ -72,7 +121,54 @@ $morehtmlref = '
    '; $userstatic = new User($db); $userstatic->fetch($object->fk_user); -$morehtmlref .= $langs->trans('Employee').' : '.$userstatic->getNomUrl(1); + +// Label +if ($action != 'editlabel') { + $morehtmlref .= $form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->salaries->write, 'string', '', 0, 1); + $morehtmlref .= $object->label; +} else { + $morehtmlref .= $langs->trans('Label').' : '; + $morehtmlref .= '
    '; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= '
    '; +} + +$morehtmlref .= '
    '.$langs->trans('Employee').' : '.$userstatic->getNomUrl(1); + +// Project +if (!empty($conf->projet->enabled)) { + $morehtmlref .= '
    '.$langs->trans('Project').' '; + if ($user->rights->salaries->write) { + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + } + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref .= '
    '; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects(-1, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500'); + $morehtmlref .= ''; + $morehtmlref .= '
    '; + } else { + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ''; + $morehtmlref .= $proj->ref; + $morehtmlref .= ''; + } else { + $morehtmlref .= ''; + } + } +} + $morehtmlref .= '
    '; dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', ''); diff --git a/htdocs/salaries/paiement_salary.php b/htdocs/salaries/paiement_salary.php index 9f9a1ae7b50..b1e03866d7e 100644 --- a/htdocs/salaries/paiement_salary.php +++ b/htdocs/salaries/paiement_salary.php @@ -18,7 +18,7 @@ */ /** - * \file htdocs/compta/paiement_salary.php + * \file htdocs/salaries/paiement_salary.php * \ingroup salary * \brief Page to add payment of a salary */ diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 29f8d0b175d..18bc3a3785b 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -183,6 +183,20 @@ if ($action == "setaddrefinlist") { } } +//Activate Set vat in list +if ($action == "setvatinlist") { + $setvatinlist = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "SOCIETE_SHOW_VAT_IN_LIST", $setvatinlist, 'yesno', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + //Activate Set adress in list if ($action == "setaddadressinlist") { $val = GETPOST('value', 'int'); @@ -776,6 +790,20 @@ if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) { print ''; print ''; +print ''; +print ''.$langs->trans("AddVatInList").''; +print ' '; +print ''; +if (!empty($conf->global->SOCIETE_SHOW_VAT_IN_LIST)) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); +} else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); +} +print ''; +print ''; + print ''; print ''.$langs->trans("AddAdressInList").''; print ' '; diff --git a/htdocs/societe/canvas/company/tpl/card_view.tpl.php b/htdocs/societe/canvas/company/tpl/card_view.tpl.php index 7dfe7c212f2..e57421bf8b5 100644 --- a/htdocs/societe/canvas/company/tpl/card_view.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_view.tpl.php @@ -62,7 +62,7 @@ print dol_get_fiche_head($head, 'card', $langs->trans("ThirdParty"), 0, 'company trans('CustomerCode'); ?> control->tpl['code_client']; ?> control->tpl['checkcustomercode'] <> 0) { ?> - (trans("WrongCustomerCode"); ?>) + (trans("WrongCustomerCode"); ?>) @@ -73,7 +73,7 @@ print dol_get_fiche_head($head, 'card', $langs->trans("ThirdParty"), 0, 'company trans('SupplierCode'); ?> control->tpl['code_fournisseur']; ?> control->tpl['checksuppliercode'] <> 0) { ?> - (trans("WrongSupplierCode"); ?>) + (trans("WrongSupplierCode"); ?>) @@ -134,7 +134,7 @@ for ($i = 1; $i <= 4; $i++) { if ($this->control->tpl['checkprofid'.$i] > 0) { echo '   '.$this->control->tpl['urlprofid'.$i]; } else { - echo ' ('.$langs->trans("ErrorWrongValue").')'; + echo ' ('.$langs->trans("ErrorWrongValue").')'; } } echo ''; @@ -260,14 +260,14 @@ for ($i = 1; $i <= 4; $i++) {
    rights->societe->creer) { ?> -">trans("Modify"); ?> +">trans("Modify"); ?> rights->societe->supprimer) { ?> use_javascript_ajax) { ?> trans('Delete'); ?> - ">trans('Delete'); ?> + ">trans('Delete'); ?>
    diff --git a/htdocs/societe/canvas/individual/tpl/card_view.tpl.php b/htdocs/societe/canvas/individual/tpl/card_view.tpl.php index 86c7d9c9f65..16cd9f1e637 100644 --- a/htdocs/societe/canvas/individual/tpl/card_view.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_view.tpl.php @@ -57,7 +57,7 @@ if ($this->control->tpl['action_delete']) { trans('CustomerCode'); ?> control->tpl['code_client']; ?> control->tpl['checkcustomercode'] <> 0) { ?> - (trans("WrongCustomerCode"); ?>) + (trans("WrongCustomerCode"); ?>) @@ -68,7 +68,7 @@ if ($this->control->tpl['action_delete']) { trans('SupplierCode'); ?> control->tpl['code_fournisseur']; ?> control->tpl['checksuppliercode'] <> 0) { ?> - (trans("WrongSupplierCode"); ?>) + (trans("WrongSupplierCode"); ?>) @@ -187,14 +187,14 @@ if ($this->control->tpl['action_delete']) {
    rights->societe->creer) { ?> -">trans("Modify"); ?> +">trans("Modify"); ?> rights->societe->supprimer) { ?> use_javascript_ajax) { ?> trans('Delete'); ?> - ">trans('Delete'); ?> + ">trans('Delete'); ?>
    diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index a155f08e529..334793985f0 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2284,7 +2284,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$form->editfieldkey('Capital', 'capital', '', $object, 0).''; print ' '.$langs->trans("Currency".$conf->currency).''; + print '"> '.$langs->trans("Currency".$conf->currency).''; // Default language if (!empty($conf->global->MAIN_MULTILANGS)) { @@ -2511,7 +2511,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; $tmpcheck = $object->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongCustomerCode").')'; + print ' ('.$langs->trans("WrongCustomerCode").')'; } print ''; print ''; @@ -2524,7 +2524,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur)); $tmpcheck = $object->check_codefournisseur(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongSupplierCode").')'; + print ' ('.$langs->trans("WrongSupplierCode").')'; } print ''; print ''; @@ -2552,7 +2552,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($object->id_prof_check($i, $object) > 0) { print '   '.$object->id_prof_url($i, $object); } else { - print ' ('.$langs->trans("ErrorWrongValue").')'; + print ' ('.$langs->trans("ErrorWrongValue").')'; } } print ''; @@ -2592,7 +2592,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
    '; print ''; print ''; - print ''.$langs->transcountry("Localtax1", $mysoc->country_code).' id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + print ''.$langs->transcountry("Localtax1", $mysoc->country_code).' id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; if ($action == 'editRE') { print ''; $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); @@ -2606,7 +2606,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print ''; print ''; - print ''.$langs->transcountry("Localtax2", $mysoc->country_code).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + print ''.$langs->transcountry("Localtax2", $mysoc->country_code).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; if ($action == 'editIRPF') { print ''; $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); @@ -2624,7 +2624,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print ''; print ''; - print ' '.$langs->transcountry("Localtax1", $mysoc->country_code).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + print ' '.$langs->transcountry("Localtax1", $mysoc->country_code).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; if ($action == 'editRE') { print ''; $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); @@ -2642,7 +2642,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print ''; print ''; - print ' '.$langs->transcountry("Localtax2", $mysoc->country_code).' id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + print ' '.$langs->transcountry("Localtax2", $mysoc->country_code).' id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; if ($action == 'editIRPF') { print ''; $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); @@ -2744,7 +2744,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print ''; if ($action != 'editthirdpartytype' && $user->rights->societe->creer) { - print ''; + print ''; } print '
    '.$langs->trans('ThirdPartyType').'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'
    '; print ''; @@ -2787,7 +2787,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print ''; if ($action != 'editincoterm' && $user->rights->societe->creer) { - print ''; + print ''; } print '
    '.$langs->trans('IncotermLabel').''.img_edit('', 1).''.img_edit('', 1).'
    '; print ''; @@ -2851,7 +2851,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print ''; if ($action != 'editparentcompany' && $user->rights->societe->creer) { - print ''; + print ''; } print '
    '.$langs->trans('ParentCompany').'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'
    '; print ''; @@ -2923,7 +2923,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } if ($user->rights->societe->creer) { - print '
    '.$langs->trans("Modify").''."\n"; + print ''.$langs->trans("Modify").''."\n"; } if (!empty($conf->adherent->enabled)) { diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index 21cd629dc67..dc88baf0c28 100644 --- a/htdocs/societe/checkvat/checkVatPopup.php +++ b/htdocs/societe/checkvat/checkVatPopup.php @@ -49,7 +49,7 @@ $vatNumber = GETPOST("vatNumber", 'alpha'); if (!$vatNumber) { print '
    '; - print ''.$langs->transnoentities("ErrorFieldRequired", $langs->trans("VATIntraShort")).'
    '; + print ''.$langs->transnoentities("ErrorFieldRequired", $langs->trans("VATIntraShort")).'
    '; } else { $vatNumber = preg_replace('/\^\w/', '', $vatNumber); $vatNumber = str_replace(array(' ', '.'), '', $vatNumber); @@ -97,16 +97,16 @@ if (!$vatNumber) { // Service indisponible if (!is_array($result) || preg_match('/SERVICE_UNAVAILABLE/i', $result['faultstring'])) { - print ''.$langs->trans("ErrorServiceUnavailableTryLater").'
    '; + print ''.$langs->trans("ErrorServiceUnavailableTryLater").'
    '; $messagetoshow = $soapclient->response; } elseif (preg_match('/TIMEOUT/i', $result['faultstring'])) { - print ''.$langs->trans("ErrorServiceUnavailableTryLater").'
    '; + print ''.$langs->trans("ErrorServiceUnavailableTryLater").'
    '; $messagetoshow = $soapclient->response; } elseif (preg_match('/SERVER_BUSY/i', $result['faultstring'])) { - print ''.$langs->trans("ErrorServiceUnavailableTryLater").'
    '; + print ''.$langs->trans("ErrorServiceUnavailableTryLater").'
    '; $messagetoshow = $soapclient->response; } elseif ($result['faultstring']) { - print ''.$langs->trans("Error").'
    '; + print ''.$langs->trans("Error").'
    '; $messagetoshow = $result['faultstring']; } elseif (preg_match('/INVALID_INPUT/i', $result['faultstring']) || ($result['requestDate'] && !$result['valid'])) { @@ -114,26 +114,26 @@ if (!$vatNumber) { if ($result['requestDate']) { print $langs->trans("Date").': '.$result['requestDate'].'
    '; } - print $langs->trans("VATIntraSyntaxIsValid").': '.$langs->trans("No").' (Might be a non europeen VAT)
    '; - print $langs->trans("ValueIsValid").': '.$langs->trans("No").' (Might be a non europeen VAT)
    '; + print $langs->trans("VATIntraSyntaxIsValid").': '.$langs->trans("No").' (Might be a non europeen VAT)
    '; + print $langs->trans("ValueIsValid").': '.$langs->trans("No").' (Might be a non europeen VAT)
    '; //$messagetoshow=$soapclient->response; } else { // Syntaxe ok if ($result['requestDate']) { print $langs->trans("Date").': '.$result['requestDate'].'
    '; } - print $langs->trans("VATIntraSyntaxIsValid").': '.$langs->trans("Yes").'
    '; + print $langs->trans("VATIntraSyntaxIsValid").': '.$langs->trans("Yes").'
    '; print $langs->trans("ValueIsValid").': '; if (preg_match('/MS_UNAVAILABLE/i', $result['faultstring'])) { - print ''.$langs->trans("ErrorVATCheckMS_UNAVAILABLE", $countryCode).'
    '; + print ''.$langs->trans("ErrorVATCheckMS_UNAVAILABLE", $countryCode).'
    '; } else { if (!empty($result['valid']) && ($result['valid'] == 1 || $result['valid'] == 'true')) { - print ''.$langs->trans("Yes").''; + print ''.$langs->trans("Yes").''; print '
    '; print $langs->trans("Name").': '.$result['name'].'
    '; print $langs->trans("Address").': '.$result['address'].'
    '; } else { - print ''.$langs->trans("No").''; + print ''.$langs->trans("No").''; print '
    '."\n"; } } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 8f0e2c84805..8c5ef8ca5ca 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2575,13 +2575,13 @@ class Societe extends CommonObject $label .= ' '.$this->getLibStatut(5); } - if (!empty($this->name)) { - $label .= '
    '.$langs->trans('Name').': '.dol_escape_htmltag($this->name); - if (!empty($this->name_alias)) { - $label .= ' ('.dol_escape_htmltag($this->name_alias).')'; - } + $label .= '
    '.$langs->trans('Name').': '.dol_escape_htmltag($this->name); + if (!empty($this->name_alias)) { + $label .= ' ('.dol_escape_htmltag($this->name_alias).')'; + } + if ($this->email) { + $label .= '
    '.img_picto('', 'email', 'class="pictofixedwidth"').$this->email; } - $label .= '
    '.img_picto('', 'email', 'class="pictofixedwidth"').$this->email; if (!empty($this->phone) || !empty($this->fax)) { $phonelist = array(); if ($this->phone) { @@ -3743,7 +3743,7 @@ class Societe extends CommonObject public function has_projects() { // phpcs:enable - $sql = 'SELECT COUNT(*) as numproj FROM '.MAIN_DB_PREFIX.'projet WHERE fk_soc = '.((int) $this->id); + $sql = "SELECT COUNT(*) as numproj FROM ".MAIN_DB_PREFIX."projet WHERE fk_soc = ".((int) $this->id); $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 5f996e6f37d..c4bd26e1fc2 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -148,7 +148,7 @@ if ($object->client) { print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client)); $tmpcheck = $object->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongCustomerCode").')'; + print ' ('.$langs->trans("WrongCustomerCode").')'; } print ''; $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".((int) $socid); @@ -185,7 +185,7 @@ if ($object->fournisseur) { print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur)); $tmpcheck = $object->check_codefournisseur(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongSupplierCode").')'; + print ' ('.$langs->trans("WrongSupplierCode").')'; } print ''; $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."commande_fournisseur where fk_soc = ".((int) $socid); @@ -686,7 +686,7 @@ if ($sql_select) { print_liste_field_titre('Quantity', $_SERVER['PHP_SELF'], 'prod_qty', '', $param, '', $sortfield, $sortorder, 'right '); print "\n"; - print ''.$langs->trans("SelectElementAndClick", $langs->transnoentitiesnoconv("Search")).''; + print ''.$langs->trans("SelectElementAndClick", $langs->transnoentitiesnoconv("Search")).''; print ""; } else { @@ -694,7 +694,7 @@ if ($sql_select) { print ''."\n"; - print ''; + print ''; print "
    '.$langs->trans("FeatureNotYetAvailable").'
    '.$langs->trans("FeatureNotYetAvailable").'
    "; } diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 60184d4ed15..23720ebd54c 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -152,7 +152,7 @@ if ($object->id) { print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client)); $tmpcheck = $object->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongCustomerCode").')'; + print ' ('.$langs->trans("WrongCustomerCode").')'; } print ''; } @@ -163,7 +163,7 @@ if ($object->id) { print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur)); $tmpcheck = $object->check_codefournisseur(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongSupplierCode").')'; + print ' ('.$langs->trans("WrongSupplierCode").')'; } print ''; } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index bc786a540d6..ab567733959 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,10 +494,10 @@ $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) { +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"; diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index c896d4df70a..b932fb11595 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -118,7 +118,7 @@ if ($object->id > 0) { print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client)); $tmpcheck = $object->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongCustomerCode").')'; + print ' ('.$langs->trans("WrongCustomerCode").')'; } print ''; } @@ -129,7 +129,7 @@ if ($object->id > 0) { print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur)); $tmpcheck = $object->check_codefournisseur(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongSupplierCode").')'; + print ' ('.$langs->trans("WrongSupplierCode").')'; } print ''; } diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index b52b8b4a650..4ed16e948c5 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -178,7 +178,7 @@ if ($result > 0) { print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client)); $tmpcheck = $object->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongCustomerCode").')'; + print ' ('.$langs->trans("WrongCustomerCode").')'; } print ''; } @@ -189,7 +189,7 @@ if ($result > 0) { print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur)); $tmpcheck = $object->check_codefournisseur(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongSupplierCode").')'; + print ' ('.$langs->trans("WrongSupplierCode").')'; } print ''; } diff --git a/htdocs/societe/partnership.php b/htdocs/societe/partnership.php index 85223e856f3..443126290ab 100644 --- a/htdocs/societe/partnership.php +++ b/htdocs/societe/partnership.php @@ -189,7 +189,7 @@ if ($id > 0) { print showValueWithClipboardCPButton(dol_escape_htmltag($societe->code_client)); $tmpcheck = $societe->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongCustomerCode").')'; + print ' ('.$langs->trans("WrongCustomerCode").')'; } print ''; } @@ -200,7 +200,7 @@ if ($id > 0) { print showValueWithClipboardCPButton(dol_escape_htmltag($societe->code_fournisseur)); $tmpcheck = $societe->check_codefournisseur(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongSupplierCode").')'; + print ' ('.$langs->trans("WrongSupplierCode").')'; } print ''; print ''; diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index f80bebd9bf5..6a0b9fac742 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -761,7 +761,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client)); $tmpcheck = $object->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongCustomerCode").')'; + print ' ('.$langs->trans("WrongCustomerCode").')'; } print ''; $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".((int) $socid); @@ -823,7 +823,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur)); $tmpcheck = $object->check_codefournisseur(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongSupplierCode").')'; + print ' ('.$langs->trans("WrongSupplierCode").')'; } print ''; $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".((int) $socid); @@ -1032,7 +1032,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print $img ? $img.' ' : ''; print getCountry($companypaymentmodetemp->country_code, 1); } else { - print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; + print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; } print ''; // Default @@ -1141,7 +1141,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print $img ? $img.' ' : ''; print getCountry($src->country, 1); } else { - print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; + print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; } } elseif ($src->object == 'source' && $src->type == 'card') { print ''.$src->owner->name.'
    ....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; @@ -1152,7 +1152,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print $img ? $img.' ' : ''; print getCountry($src->card->country, 1); } else { - print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; + print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; } } elseif ($src->object == 'source' && $src->type == 'sepa_debit') { print ''.$src->billing_details->name.'
    ....'.$src->sepa_debit->last4; @@ -1162,7 +1162,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print $img ? $img.' ' : ''; print getCountry($src->sepa_debit->country, 1); } else { - print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; + print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; } } elseif ($src->object == 'payment_method' && $src->type == 'card') { print ''.$src->billing_details->name.'
    ....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; @@ -1173,7 +1173,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print $img ? $img.' ' : ''; print getCountry($src->card->country, 1); } else { - print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; + print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; } } elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') { print ''.$src->billing_details->name.'
    ....'.$src->sepa_debit->last4; @@ -1183,7 +1183,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print $img ? $img.' ' : ''; print getCountry($src->sepa_debit->country, 1); } else { - print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; + print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; } } else { print ''; @@ -1227,7 +1227,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' if ($nbremote == 0 && $nblocal == 0) { $colspan = (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD) ? 10 : 9); - print ''.$langs->trans("None").''; + print '>'.$langs->trans("None").''; } print ""; print "
    "; diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index dbb0e8f0553..bf19fc0385b 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -218,7 +218,7 @@ if ($object->client) { print $object->code_client; $tmpcheck = $object->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongCustomerCode").')'; + print ' ('.$langs->trans("WrongCustomerCode").')'; } print ''; } @@ -229,7 +229,7 @@ if ($object->fournisseur) { print $object->code_fournisseur; $tmpcheck = $object->check_codefournisseur(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongSupplierCode").')'; + print ' ('.$langs->trans("WrongSupplierCode").')'; } print ''; } @@ -525,7 +525,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print "\n".'
    '."\n"; if ($user->rights->produit->creer || $user->rights->service->creer) { - print ''; + print ''; } print "\n
    \n"; @@ -616,11 +616,11 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { // Action if ($user->rights->produit->creer || $user->rights->service->creer) { print ''; - print 'id.'&prodid='.$line->fk_product.'">'; + print 'id.'&prodid='.$line->fk_product.'">'; print img_info(); print ''; print ' '; - print 'id.'&lineid='.$line->id.'">'; + print 'id.'&lineid='.$line->id.'">'; print img_edit('default', 0, 'style="vertical-align: middle;"'); print ''; print ' '; diff --git a/htdocs/societe/project.php b/htdocs/societe/project.php index c6256324257..ef68a03ab78 100644 --- a/htdocs/societe/project.php +++ b/htdocs/societe/project.php @@ -112,7 +112,7 @@ if ($socid) { print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client)); $tmpcheck = $object->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongCustomerCode").')'; + print ' ('.$langs->trans("WrongCustomerCode").')'; } print ''; } @@ -123,7 +123,7 @@ if ($socid) { print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur)); $tmpcheck = $object->check_codefournisseur(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongSupplierCode").')'; + print ' ('.$langs->trans("WrongSupplierCode").')'; } print ''; } diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index 7425f094958..d0511d53a1f 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -181,7 +181,7 @@ if ($id > 0 || !empty($ref)) { print $object->code_client; $tmpcheck = $object->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongCustomerCode").')'; + print ' ('.$langs->trans("WrongCustomerCode").')'; } print ''; } @@ -192,7 +192,7 @@ if ($id > 0 || !empty($ref)) { print $object->code_fournisseur; $tmpcheck = $object->check_codefournisseur(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongSupplierCode").')'; + print ' ('.$langs->trans("WrongSupplierCode").')'; } print ''; } diff --git a/htdocs/societe/tpl/linesalesrepresentative.tpl.php b/htdocs/societe/tpl/linesalesrepresentative.tpl.php index f67acf2f2d3..a885cab03ed 100644 --- a/htdocs/societe/tpl/linesalesrepresentative.tpl.php +++ b/htdocs/societe/tpl/linesalesrepresentative.tpl.php @@ -28,7 +28,7 @@ print $langs->trans('SalesRepresentatives'); print ''; if ($action != 'editsalesrepresentatives' && $user->rights->societe->creer) { print ''; - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; print ''; } print ''; diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 0ea53355629..0bc51450e44 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -222,7 +222,7 @@ if ($object->client) { print $object->code_client; $tmpcheck = $object->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongCustomerCode").')'; + print ' ('.$langs->trans("WrongCustomerCode").')'; } print ''; } @@ -233,7 +233,7 @@ if ($object->fournisseur) { print $object->code_fournisseur; $tmpcheck = $object->check_codefournisseur(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongSupplierCode").')'; + print ' ('.$langs->trans("WrongSupplierCode").')'; } print ''; } diff --git a/htdocs/stripe/lib/stripe.lib.php b/htdocs/stripe/lib/stripe.lib.php index 8749847b958..b0503a7103f 100644 --- a/htdocs/stripe/lib/stripe.lib.php +++ b/htdocs/stripe/lib/stripe.lib.php @@ -118,9 +118,9 @@ function html_print_stripe_footer($fromcompany, $langs) } print '


    '."\n"; - print '
    '."\n"; + print '
    '."\n"; print $fromcompany->name.'
    '; print $line1.'
    '; print $line2; - print '
    '."\n"; + print '
    '."\n"; } diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index bc677f29f53..cf1ac2cfdd9 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1529,7 +1529,7 @@ if ($action == 'create') { print $langs->trans('PaymentConditionsShort'); print ''; if ($action != 'editconditions' && $object->statut != SupplierProposal::STATUS_NOTSIGNED) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).''; + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).''; } print ''; print ''; @@ -1548,7 +1548,7 @@ if ($action == 'create') { print $langs->trans('DeliveryDate'); print ''; if ($action != 'editdate_livraison' && $object->statut == SupplierProposal::STATUS_VALIDATED) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'), 1).''; + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'), 1).''; } print ''; print ''; @@ -1572,7 +1572,7 @@ if ($action == 'create') { print $langs->trans('PaymentMode'); print ''; if ($action != 'editmode' && $object->statut != SupplierProposal::STATUS_NOTSIGNED) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).''; + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).''; } print ''; print ''; @@ -1592,7 +1592,7 @@ if ($action == 'create') { print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print ''; if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_VALIDATED) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).''; } print ''; print ''; @@ -1611,7 +1611,7 @@ if ($action == 'create') { print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print ''; if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_VALIDATED && $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 ''; @@ -1653,7 +1653,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 ''; diff --git a/htdocs/support/index.php b/htdocs/support/index.php index 4c80445865b..7330c034aa7 100644 --- a/htdocs/support/index.php +++ b/htdocs/support/index.php @@ -83,9 +83,9 @@ print ''; print '
    '.img_picto('', 'who.png', 'class="valignmiddle"', 1).''; -print ''.$langs->trans("CommunitySupport").''; +print ''.$langs->trans("CommunitySupport").''; print ''; -print '
    '.$langs->trans("TypeOfSupport").': '.$langs->trans("TypeSupportCommunauty").''; +print '
    '.$langs->trans("TypeOfSupport").': '.$langs->trans("TypeSupportCommunauty").''; print '
    '.$langs->trans("TypeOfHelp").'/'.$langs->trans("Efficiency").'/'.$langs->trans("Price").': '; print $langs->trans("TypeHelpDev").'/'.img_picto_common('', 'redstar', 'class="valignmiddle"', 1).img_picto_common('', 'redstar', 'class="valignmiddle"', 1).'/'.img_picto_common('', 'star', 'class="valignmiddle"', 1).img_picto_common('', 'star', 'class="valignmiddle"', 1).img_picto_common('', 'star', 'class="valignmiddle"', 1).img_picto_common('', 'star', 'class="valignmiddle"', 1); print '
    '; @@ -147,9 +147,9 @@ print '
    '; print ''; } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index ace3960e38d..9c68aff2f48 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2728,7 +2728,7 @@ class User extends CommonObject /** * Return clickable link of login (eventualy with picto) * - * @param int $withpictoimg Include picto into link + * @param int $withpictoimg Include picto into link (1=picto, -1=photo) * @param string $option On what the link point to ('leave', 'accountancy', 'nolink', ) * @param integer $notooltip 1=Disable tooltip on picto and name * @param string $morecss Add more css on link diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index 79450f2d811..2207e3358ae 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -119,7 +119,7 @@ if ($id > 0) { print ''; if (empty($conf->global->CLICKTODIAL_URL) && empty($object->clicktodial_url)) { $langs->load("errors"); - print ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("ClickToDial")).''; + print ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("ClickToDial")).''; } else { print '     '.$form->textwithpicto($langs->trans("KeepEmptyToUseDefault").': '.$conf->global->CLICKTODIAL_URL, $langs->trans("ClickToDialUrlDesc")); } @@ -158,7 +158,7 @@ if ($id > 0) { } if (empty($url)) { $langs->load("errors"); - print ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("ClickToDial")).''; + print ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("ClickToDial")).''; } else { print $form->textwithpicto((empty($object->clicktodial_url) ? ''.$langs->trans("DefaultLink").': ' : '').$url, $langs->trans("ClickToDialUrlDesc")); } @@ -200,7 +200,7 @@ if ($id > 0) { print '
    '; if (!empty($user->admin) && $action <> 'edit') { - print ''.$langs->trans("Modify").''; + print ''.$langs->trans("Modify").''; } print "
    \n"; diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 4fb9c51644f..2e9625f17c3 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -415,7 +415,7 @@ if ($action == 'create') { print '
    '.img_picto('', 'mail.png', 'class="valignmiddle"', 1).''; -print ''.$langs->trans("EMailSupport").''; +print ''.$langs->trans("EMailSupport").''; print ''; -print '
    '.$langs->trans("TypeOfSupport").': '.$langs->trans("TypeSupportCommercial").''; +print '
    '.$langs->trans("TypeOfSupport").': '.$langs->trans("TypeSupportCommercial").''; print '
    '.$langs->trans("TypeOfHelp").'/'.$langs->trans("Efficiency").'/'.$langs->trans("Price").': '; print $langs->trans("TypeHelpOnly").'/'.img_picto_common('', 'redstar', 'class="valignmiddle"', 1).img_picto_common('', 'redstar', 'class="valignmiddle"', 1).img_picto_common('', 'redstar', 'class="valignmiddle"', 1).'/'.img_picto_common('', 'star', 'class="valignmiddle"', 1).img_picto_common('', 'star', 'class="valignmiddle"', 1); print '
    '; @@ -182,9 +182,9 @@ print '
    '; print ''; diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php index dbd553f9c1f..bee8358e5aa 100644 --- a/htdocs/ticket/contact.php +++ b/htdocs/ticket/contact.php @@ -176,7 +176,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { if (!empty($conf->societe->enabled)) { $morehtmlref .= '
    '.$langs->trans('ThirdParty'); /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; }*/ $morehtmlref .= ' : '; if ($action == 'editcustomer') { diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php index 8b45b8ebbf7..0daac15e765 100644 --- a/htdocs/ticket/document.php +++ b/htdocs/ticket/document.php @@ -145,7 +145,7 @@ if ($object->id) { if (!empty($conf->societe->enabled)) { $morehtmlref .= '
    '.$langs->trans('ThirdParty'); /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; }*/ $morehtmlref .= ' : '; if ($action == 'editcustomer') { diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index aeab9ac6e27..118d6208237 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -45,7 +45,7 @@ $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'tickep#selectedfieldstlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'ticketlist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') @@ -511,7 +511,7 @@ if ($socid && !$projectid && !$project_ref && $user->rights->societe->lire) { print showValueWithClipboardCPButton(dol_escape_htmltag($socstat->code_client)); $tmpcheck = $socstat->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongCustomerCode").')'; + print ' ('.$langs->trans("WrongCustomerCode").')'; } print ''; print ''; @@ -523,7 +523,7 @@ if ($socid && !$projectid && !$project_ref && $user->rights->societe->lire) { print showValueWithClipboardCPButton(dol_escape_htmltag($socstat->code_fournisseur)); $tmpcheck = $socstat->check_codefournisseur(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongSupplierCode").')'; + print ' ('.$langs->trans("WrongSupplierCode").')'; } print ''; print ''; @@ -698,6 +698,7 @@ print ''; print ''; print ''; print ''; + if ($socid) { print ''; } @@ -759,6 +760,7 @@ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfi $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
    '; // You can use div-table-responsive-no-min if you dont need reserved height for your table +print '
    '; print '
    '.img_picto('', 'pagemaster.png', 'class="valignmiddle"', 1).''; -print ''.$langs->trans("OtherSupport").''; +print ''.$langs->trans("OtherSupport").''; print ''; -print '
    '.$langs->trans("TypeOfSupport").': '.$langs->trans("TypeSupportCommercial").''; +print '
    '.$langs->trans("TypeOfSupport").': '.$langs->trans("TypeSupportCommercial").''; //print '
    '.$langs->trans("Efficiency").'/'.$langs->trans("Price").': '.img_picto_common('','redstar').img_picto_common('','redstar').img_picto_common('','redstar').' / '.img_picto_common('','star'); print '
    '.$langs->trans("TypeOfHelp").'/'.$langs->trans("Efficiency").'/'.$langs->trans("Price").': '; print $langs->trans("TypeHelpDevForm").'/?/?'; diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index ec05dd89796..1fe95ff57d8 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -44,8 +44,8 @@ $langs->loadLangs(array("admin", "cashdesk", "commercial")); 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', '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); diff --git a/htdocs/takepos/floors.php b/htdocs/takepos/floors.php index b3ba955f4e8..64040a24466 100644 --- a/htdocs/takepos/floors.php +++ b/htdocs/takepos/floors.php @@ -212,9 +212,9 @@ $( document ).ready(function() { admin) {?> &place="+place+"&idproduct="+idproduct+"&selectedline="+selectedline, function() { global->TAKEPOS_CUSTOMER_DISPLAY)) echo "CustomerDisplay();";?> }); } diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index ae12665e008..8b2e5ca78b7 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -914,7 +914,7 @@ $(document).ready(function() { selectedtext=$('#'+selectedline).find("td:first").html(); @@ -1056,12 +1056,12 @@ function DolibarrTakeposPrinting(id) { } function CreditNote() { - $("#poslines").load("invoice.php?action=creditnote&invoiceid="+placeid, function() { + $("#poslines").load("invoice.php?action=creditnote&token=&invoiceid="+placeid, function() { }); } function SetNote() { - $("#poslines").load("invoice.php?action=addnote&invoiceid="+placeid+"&idline="+selectedline+"&addnote="+$("#textinput").val(), function() { + $("#poslines").load("invoice.php?action=addnote&token=&invoiceid="+placeid+"&idline="+selectedline+"&addnote="+$("#textinput").val(), function() { }); } diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 51744ce0528..f79263bfce3 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -255,7 +255,7 @@ if ($conf->global->TAKEPOS_NUMPAD == 0) { }); }, 2500); } - + global->TAKEPOS_CUSTOMER_DISPLAY)) { echo "var line1='".$langs->trans('TotalTTC')."'.substring(0,20);"; @@ -274,18 +274,18 @@ if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) {
    -
    trans('TotalTTC'); ?>: total_ttc, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?>
    +
    trans('TotalTTC'); ?>: total_ttc, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?>
    total_ttc) { ?>
    -
    trans('RemainToPay'); ?>: multicurrency_code); ?>
    +
    trans('RemainToPay'); ?>: multicurrency_code); ?>
    -
    trans("Received"); ?>: multicurrency_code); ?>
    +
    trans("Received"); ?>: multicurrency_code); ?>
    -
    trans("Change"); ?>: multicurrency_code); ?>
    +
    trans("Change"); ?>: multicurrency_code); ?>
    global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) { @@ -293,7 +293,7 @@ if (!empty($conf->global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) {
    '; $filter = ''; $form = new Form($db); - print ''.$langs->trans("BankAccount").': '; + print ''.$langs->trans("BankAccount").': '; $form->select_comptes(0, 'accountid', 0, $filter, 1, ''); print ajax_combobox('selectaccountid'); print '
    @@ -343,7 +343,7 @@ print ''; + print ''; } else { print ''; } @@ -369,7 +369,7 @@ print ''; + print ''; } else { $button = array_pop($action_buttons); print ''; @@ -396,7 +396,7 @@ print ''; + print ''; } else { $button = array_pop($action_buttons); print ''; @@ -408,7 +408,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; } diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php index 7eaa4d9ec68..b655d9f7789 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -238,10 +238,10 @@ function AddProductConfirm(placeid, productid){ place=placeid; diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index d978d2ac792..627a6c99565 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -119,7 +119,7 @@ if (!empty($conf->global->TAKEPOS_HEADER) || !empty($conf->global->{$constFreeTe if (!empty($conf->global->{$constFreeText})) { $newfreetext .= make_substitutions($conf->global->{$constFreeText}, $substitutionarray); } - print $newfreetext; + print nl2br($newfreetext); } ?>

    diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 708870eeaa6..308114e89a7 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -13,7 +13,7 @@ --colorbacktitle1: rgb(); --colorbacktabcard1: rgb(); --colorbacktabactive: rgb(); - --colorbacklineimpair1: rgb(); + --colorbacklinepair1: rgb(); --colorbacklineimpair2: rgb(); --colorbacklinepair1: rgb(); --colorbacklinepair2: rgb(); @@ -28,8 +28,9 @@ --colortexttitlelink: rgba(, 0.9); --colortext: rgb(); --colortextlink: rgb(); - --colortextbackhmenu: #; + --colortextbackhmenu: #; --colortextbackvmenu: #; + --colortopbordertitle1: rgb(); --listetotal: #888888; --inputbackgroundcolor: #FFF; --inputbordercolor: rgba(0,0,0,.2); @@ -1737,6 +1738,20 @@ td.showDragHandle { display: inline-block; } +/* +.classforhorizontalscrolloftabs .fiche .div-table-responsive +{ + transform:rotateX(180deg); + -ms-transform:rotateX(180deg); + -webkit-transform:rotateX(180deg); +} +.classforhorizontalscrolloftabs .fiche .div-table-responsive-inside +{ + transform:rotateX(180deg); + -ms-transform:rotateX(180deg); + -webkit-transform:rotateX(180deg); +} +*/ global->THEME_DISABLE_STICKY_TOPMENU)) { ?> @@ -1847,10 +1862,11 @@ div.vmenu, td.vmenu { display: none; } - /* if no side-nav, we don't need to have width forced */ + /* if no side-nav, we don't need to have width forced to calc(100% - 210px); */ .classforhorizontalscrolloftabs #id-right { - width: unset; - display: unset; + width: 100%; + /* width: unset; */ + /* display: unset; */ } body.sidebar-collapse .login_block { @@ -2222,12 +2238,12 @@ img.photorefnoborder { .underrefbanner { } .underbanner { - border-bottom: px solid rgb(); + border-bottom: px solid var(--colortopbordertitle1); /* border-bottom: 2px solid var(--colorbackhmenu1); */ } .trextrafieldseparator td, .trextrafields_collapse_last td { /* border-bottom: 2px solid var(--colorbackhmenu1) !important; */ - border-bottom: 2px solid rgb() !important; + border-bottom: 2px solid var(--colortopbordertitle1) !important; } .tdhrthin { @@ -3364,10 +3380,10 @@ td.border, div.tagtable div div.border { border-bottom: none !important; } .bordertop { - border-top: 1px solid rgb(); + border-top: 1px solid var(--colortopbordertitle1); } .borderbottom { - border-bottom: 1px solid rgb(); + border-bottom: 1px solid var(--colortopbordertitle1); } @@ -3379,10 +3395,15 @@ table.liste, table.noborder, table.formdoc, div.noborder { border-collapse: separate !important; border-spacing: 0px; border-top-width: px; - border-top-color: rgb(); + border-top-color: var(--colortopbordertitle1); border-top-style: solid; margin: 0px 0px 5px 0px; + + border-left: 1px solid var(--colortopbordertitle1); + border-right: 1px solid var(--colortopbordertitle1); + /*width: calc(100% - 7px); border-collapse: separate !important; border-spacing: 0px; @@ -3395,20 +3416,20 @@ table.liste, table.noborder, table.formdoc, div.noborder { } #tablelines { border-bottom-width: 1px; - border-bottom-color: rgb(); + border-bottom-color: var(--colortopbordertitle1); border-bottom-style: solid; } table.liste tr:last-of-type td, table.noborder:not(#tablelines) tr:last-of-type td, table.formdoc tr:last-of-type td, div.noborder tr:last-of-type td { border-bottom-width: 1px; - border-bottom-color: rgb(); + border-bottom-color: var(--colortopbordertitle1); border-bottom-style: solid; } div.tabBar div.fichehalfright table.noborder:not(.margintable):not(.paymenttable):not(.lastrecordtable):last-of-type { - border-bottom: 1px solid rgb(); + border-bottom: 1px solid var(--colortopbordertitle1); } div.tabBar table.border>tbody>tr:last-of-type>td { border-bottom-width: 1px; - border-bottom-color: rgb(); + border-bottom-color: var(--colortopbordertitle1); border-bottom-style: solid; } div.tabBar div.fichehalfright table.noborder { @@ -3442,7 +3463,7 @@ tr.liste_titre_filter td.liste_titre:first-of-type { { border-bottom-width: 0 !important; border-top-width: 1px; - border-top-color: rgb(); + border-top-color: var(--colortopbordertitle1); border-top-style: solid; } tr#trlinefordates td { @@ -3451,7 +3472,7 @@ tr#trlinefordates td { .liste_titre_add td, .liste_titre_add th, .liste_titre_add .tagtd { border-top-width: 1px; - border-top-color: rgb(); + border-top-color: var(--colortopbordertitle1); border-top-style: solid; } table.liste tr, table.noborder tr, div.noborder form { @@ -3716,14 +3737,14 @@ table.hidepaginationnext .paginationnext { { font-family: ; margin-bottom: 1px; - color: var(--oddevencolor); + color: var(--oddeven); } .impair, .nohover .impair:hover, tr.impair td.nohover { - background: var(--colorbacklineimpair1); + background-color: var(--colorbacklineimpair2); } #GanttChartDIV { - background-color: var(--colorbacklineimpair1); + background-color: var(--colorbacklineimpair2); } .oddeven, .evenodd, .pair, .nohover .pair:hover, tr.pair td.nohover, .tagtr.oddeven { @@ -3732,21 +3753,21 @@ table.hidepaginationnext .paginationnext { color: var(--oddevencolor); } .pair, .nohover .pair:hover, tr.pair td.nohover { - background-color: var(--colorbacklinepair1); + background-color: var(--colorbacklinepair2); } table.dataTable tr.oddeven { - background-color: var(--colorbacklinepair1) !important; + background-color: var(--colorbacklinepair2) !important; } /* For no hover style */ td.oddeven, table.nohover tr.impair, table.nohover tr.pair, table.nohover tr.impair td, table.nohover tr.pair td, tr.nohover td, form.nohover, form.nohover:hover { - background-color: var(--colorbacklineimpair1) !important; - background: var(--colorbacklineimpair1) !important; + background-color: var(--colorbacklineimpair2) !important; + background: var(--colorbacklineimpair2) !important; } td.evenodd, tr.nohoverpair td, #trlinefordates td { - background-color: var(--colorbacklinepair1) !important; - background: var(--colorbacklinepair1) !important; + background-color: var(--colorbacklinepair2) !important; + background: var(--colorbacklinepair2) !important; } .trforbreak td { font-weight: 500; @@ -3781,7 +3802,9 @@ tr.pair td .nobordernopadding tr td, tr.impair td .nobordernopadding tr td { } table.nobottomiftotal tr.liste_total td { background-color: #fff; + border-bottom: 0px !important; + } table.nobottom, td.nobottom { border-bottom: 0px !important; @@ -3797,8 +3820,12 @@ div.liste_titre { } div.liste_titre_bydiv { border-top-width: px; - border-top-color: rgb(); + border-top-color: var(--colortopbordertitle1); border-top-style: solid; + + border-left: px solid var(--colortopbordertitle1); + /* border-right: px solid var(--colortopbordertitle1); */ + border-collapse: collapse; display: table; @@ -3829,7 +3856,7 @@ div.liste_titre_bydiv, .liste_titre div.tagtr, tr.liste_titre, tr.liste_titre_se } tr.liste_titre th, tr.liste_titre td, th.liste_titre { - border-bottom: 1px solid rgb(); + border-bottom: 1px solid var(--colortopbordertitle1); } tr.liste_titre:first-child th, tr:first-child th.liste_titre { /* border-bottom: 1px solid #ddd ! important; */ @@ -3848,7 +3875,7 @@ tr.liste_titre th a, th.liste_titre a, tr.liste_titre td a, td.liste_titre a, fo } tr.liste_titre_topborder td { border-top-width: px; - border-top-color: rgb(); + border-top-color: var(--colortopbordertitle1); border-top-style: solid; } .liste_titre td a { @@ -3949,7 +3976,7 @@ div.tabBar .noborder { } #tablelines tr.liste_titre td, .paymenttable tr.liste_titre td, .margintable tr.liste_titre td, .tableforservicepart1 tr.liste_titre td { - border-bottom: 1px solid rgb() !important; + border-bottom: 1px solid var(--colortopbordertitle1) !important; } #tablelines tr td { height: unset; @@ -3961,11 +3988,10 @@ div.tabBar .noborder { div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft) > .border > tbody > tr:nth-of-type(even):not(.liste_titre), .liste > tbody > tr:nth-of-type(even):not(.liste_titre), div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft) .oddeven.tagtr:nth-of-type(even):not(.liste_titre) { - background: linear-gradient(bottom, var(--colorbacklineimpair1) 85%, var(--colorbacklineimpair2) 100%); - background: -o-linear-gradient(bottom, var(--colorbacklineimpair1) 85%, var(--colorbacklineimpair2) 100%); - background: -moz-linear-gradient(bottom, var(--colorbacklineimpair1) 85%, var(--colorbacklineimpair2) 100%); - background: -webkit-linear-gradient(bottom, var(--colorbacklineimpair1) 85%, var(--colorbacklineimpair2) 100%); - /* background: -ms-linear-gradient(bottom, var(--colorbacklineimpair1) 85%, var(--colorbacklineimpair2) 100%); */ + background: linear-gradient(bottom, var(----colorbacklineimpair2) 0%, var(--colorbacklineimpair2) 100%); + background: -o-linear-gradient(bottom, var(--colorbacklineimpair2) 0%, var(--colorbacklineimpair2) 100%); + background: -moz-linear-gradient(bottom, var(--colorbacklineimpair2) 0%, var(--colorbacklineimpair2) 100%); + background: -webkit-linear-gradient(bottom, var(--colorbacklineimpair2) 0%, var(--colorbacklineimpair2) 100%); } .noborder > tbody > tr:nth-child(even):not(:last-child) td:not(.liste_titre), .liste > tbody > tr:nth-child(even):not(:last-child) td:not(.liste_titre), .noborder .oddeven.tagtr:nth-child(even):not(:last-child) .tagtd:not(.liste_titre) @@ -3977,11 +4003,10 @@ div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft) > .border > tbody > tr:nth-of-type(odd):not(.liste_titre), .liste > tbody > tr:nth-of-type(odd):not(.liste_titre), div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft) .oddeven.tagtr:nth-of-type(odd):not(.liste_titre) { - background: linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%); - background: -o-linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%); - background: -moz-linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%); - background: -webkit-linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%); - /* background: -ms-linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%); */ + background: linear-gradient(bottom, var(--colorbacklinepair2) 0%, var(--colorbacklinepair2) 100%); + background: -o-linear-gradient(bottom, var(--colorbacklinepair2) 0%, var(--colorbacklinepair2) 100%); + background: -moz-linear-gradient(bottom, var(--colorbacklinepair2) 0%, var(--colorbacklinepair2) 100%); + background: -webkit-linear-gradient(bottom, var(--colorbacklinepair2) 0%, var(--colorbacklinepair2) 100%); } .noborder > tbody > tr:nth-child(odd):not(:last-child) td:not(.liste_titre), .liste > tbody > tr:nth-child(odd):not(:last-child) td:not(.liste_titre), .noborder .oddeven.tagtr:nth-child(odd):not(:last-child) .tagtd:not(.liste_titre) @@ -4196,7 +4221,7 @@ span.dashboardlineko { margin-bottom: 25px !important; border-bottom-width: 1px; background: var(--colorbackbody); - border-top: px solid rgb(); + border-top: px solid var(--colortopbordertitle1); /* border-top: 2px solid var(--colorbackhmenu1) !important; */ } table.noborder.boxtable tr td { @@ -4878,11 +4903,10 @@ table.cal_month td { padding-left: 1px !important; padding-right: 1px !important .cal_past { } .cal_peruser { padding-top: 0 !important; padding-bottom: 0 !important; padding-: 1px !important; padding-: 1px !important; } .cal_impair { - background: linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%); - background: -o-linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%); - background: -moz-linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%); - background: -webkit-linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%); - /* background: -ms-linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%); */ + background: linear-gradient(bottom, var(--colorbacklinepair2) 85%, var(--colorbacklinepair2) 100%); + background: -o-linear-gradient(bottom, var(--colorbacklinepair2) 85%, var(--colorbacklinepair2) 100%); + background: -moz-linear-gradient(bottom, var(--colorbacklinepair2) 85%, var(--colorbacklinepair2) 100%); + background: -webkit-linear-gradient(bottom, var(--colorbacklinepair2) 85%, var(--colorbacklinepair2) 100%); } .cal_today_peruser_impair { background: #F8F8F0; } .peruser_busy { } @@ -5654,7 +5678,7 @@ span#select2-taskid-container[title^='--'] { } .select2-container--default .select2-results__option--highlighted[aria-selected] { - background-color: rgb(); + background-color: var(--colorbackhmenu1); color: var(--colortextbackhmenu); } .select2-container--default .select2-results__option--highlighted[aria-selected] span { @@ -6659,7 +6683,6 @@ div.tabsElem a.tab { background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(230,230,230,0.4) 100%); background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(230,230,230,0.4) 100%); background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(230,230,230,0.4) 100%); - background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(230,230,230,0.4) 100%); background-image: linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(230,230,230,0.4) 100%); } .cd-timeline-content:after { diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 44a0a7d7b20..de089ecba54 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -118,7 +118,8 @@ $dol_no_mouse_hover = $conf->dol_no_mouse_hover; //$user->conf->THEME_ELDY_ENABLE_PERSONALIZED=0; //var_dump($user->conf->THEME_ELDY_RGB); -$useboldtitle = (isset($conf->global->THEME_ELDY_USEBOLDTITLE) ? $conf->global->THEME_ELDY_USEBOLDTITLE : 0); +$useboldtitle = getDolGlobalInt('THEME_ELDY_USEBOLDTITLE'); +$userborderontable = getDolGlobalInt('THEME_ELDY_USEBORDERONTABLE'); $borderwidth = 1; // Case of option always editable @@ -208,6 +209,8 @@ if ($tmpval <= 460) { $colortextbackvmenu = '000000'; } +$colortopbordertitle1 = join(',', colorStringToArray($colortopbordertitle1)); // Normalize value to 'x,y,z' + $colorbacktitle1 = join(',', colorStringToArray($colorbacktitle1)); // Normalize value to 'x,y,z' $tmppart = explode(',', $colorbacktitle1); if ($colortexttitle == '') { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index d68bfa78ee9..691ffa8f658 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -118,6 +118,7 @@ $dol_no_mouse_hover = $conf->dol_no_mouse_hover; $useboldtitle = (isset($conf->global->THEME_ELDY_USEBOLDTITLE) ? $conf->global->THEME_ELDY_USEBOLDTITLE : 0); $borderwidth = 2; +$userborderontable = 1; // Case of option always editable if (!isset($conf->global->THEME_ELDY_BACKBODY)) { @@ -210,6 +211,8 @@ if ($tmpval <= 460) { $colortextbackvmenu = '000000'; } +$colortopbordertitle1 = join(',', colorStringToArray($colortopbordertitle1)); // Normalize value to 'x,y,z' + $colorbacktitle1 = join(',', colorStringToArray($colorbacktitle1)); // Normalize value to 'x,y,z' $tmppart = explode(',', $colorbacktitle1); if ($colortexttitle == '') { @@ -270,12 +273,13 @@ print 'colorbacklinepair1='.$colorbacklinepair1."\n"; print 'colorbacklinepair2='.$colorbacklinepair2."\n"; print 'colorbacklinepairhover='.$colorbacklinepairhover."\n"; print 'colorbacklinepairchecked='.$colorbacklinepairchecked."\n"; -print '$colortexttitlenotab='.$colortexttitlenotab."\n"; -print '$colortexttitle='.$colortexttitle."\n"; -print '$colortext='.$colortext."\n"; -print '$colortextlink='.$colortextlink."\n"; -print '$colortextbackhmenu='.$colortextbackhmenu."\n"; -print '$colortextbackvmenu='.$colortextbackvmenu."\n"; +print 'colortexttitlenotab='.$colortexttitlenotab."\n"; +print 'colortexttitle='.$colortexttitle."\n"; +print 'colortext='.$colortext."\n"; +print 'colortextlink='.$colortextlink."\n"; +print 'colortexttitlelink='.$colortexttitlelink."\n"; +print 'colortextbackhmenu='.$colortextbackhmenu."\n"; +print 'colortextbackvmenu='.$colortextbackvmenu."\n"; print 'dol_hide_topmenu='.$dol_hide_topmenu."\n"; print 'dol_hide_leftmenu='.$dol_hide_leftmenu."\n"; print 'dol_optimize_smallscreen='.$dol_optimize_smallscreen."\n"; @@ -306,12 +310,15 @@ print '*/'."\n"; --colorbacklinepairchecked: rgb(); --colorbacklinebreak: rgb(); --colorbackbody: rgb(); + --colorbackmobilemenu: #f8f8f8; --colortexttitlenotab: rgb(); --colortexttitle: rgb(); + --colortexttitlelink: rgba(, 0.9); --colortext: rgb(); --colortextlink: rgb(); - --colortextbackhmenu: #; + --colortextbackhmenu: #; --colortextbackvmenu: #; + --colortopbordertitle1: rgb(); --listetotal: #551188; --inputbackgroundcolor: #FFF; --inputbordercolor: rgba(0,0,0,.2); @@ -328,13 +335,16 @@ print '*/'."\n"; --amountremaintopaycolor:#880000; --amountpaymentcomplete:#008800; --amountremaintopaybackcolor:none; + --productlinestockod: #002200; + --productlinestocktoolow: #884400; + --infoboxmoduleenabledbgcolor : linear-gradient(0.4turn, #fff, #fff, #fff, #e4efe8); } body { background-color: #FFFFFF; - background: rgb(); + background: var(--colorbackbody); color: rgb(); font-size: ; @@ -580,7 +590,7 @@ input.pageplusone { } .optionblue { - color: rgb(); + color: var(--colortextlink); } .optiongrey, .opacitymedium { opacity: 0.5; @@ -984,7 +994,7 @@ body[class*="colorblind-"] .text-success{ color: #ccc !important; } .editfielda span.fa-pencil-alt:hover, .editfielda span.fa-trash:hover { - color: rgb() !important; + color: var(--colortexttitle) !important; } .size15x { font-size: 1.5em !important; } @@ -1765,7 +1775,7 @@ td.showDragHandle { display: none; - background: rgb(); + background: var(--colorbackvmenu1); border-right: 1px solid rgba(0,0,0,0.2); box-shadow: 3px 0 6px -2px #eee; bottom: 0; @@ -1859,6 +1869,7 @@ body.sidebar-collapse .side-nav, body.sidebar-collapse .login_block div.login_block { /* border-right: none ! important; */ top: inherit !important; + border-right: 1px solid rgba(0,0,0,0.3); } .side-nav { @@ -1909,12 +1920,12 @@ div.login_block { } #id-left { z-index: 91; - background: rgb(); + background: var(--colorbackvmenu1); border-right: 1px solid rgba(0,0,0,0.3); padding-top: 20px; browser->layout, array('phone', 'tablet')) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?> - top: 50px ! important; + top: 66px ! important; top: 60px ! important; @@ -2204,11 +2215,11 @@ img.photorefnoborder { .underrefbanner { } .underbanner { - border-bottom: px solid rgb(); + border-bottom: px solid var(--colortopbordertitle1); } .trextrafieldseparator td, .trextrafields_collapse_last td { - border-bottom: 1px solid rgb() !important; + border-bottom: 1px solid var(--colortopbordertitle1) !important; } .tdhrthin { margin: 0; @@ -2239,13 +2250,12 @@ div#tmenu_tooltip { display:none; - background: rgb(); + background: var(--colorbackhmenu1); /* background-image: linear-gradient(to top, rgba(255,255,255,.3) 0%, rgba(128,128,128,.3) 100%); background-image: -o-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(128,128,128,.3) 100%); background-image: -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(128,128,128,.3) 100%); background-image: -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(128,128,128,.3) 100%); - background-image: -ms-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(128,128,128,.3) 100%); background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.3)), color-stop(1, rgba(128,128,128,.3)) ); */ @@ -2322,13 +2332,12 @@ ul.tmenu { /* t r b l */ padding-left: 5px; } ul.tmenu li { - background: rgb(); + background: var(--colorbackhmenu1); /* background-image: linear-gradient(to top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%); background-image: -o-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%); background-image: -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%); background-image: -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%); - background-image: -ms-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%); background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.3)), color-stop(1, rgba(0,0,0,.3)) ); */ } @@ -2729,7 +2738,7 @@ div.login_block { z-index: 10; text-align: center; vertical-align: middle; - background: rgb(); + background: var(--colorbackvmenu1); width: 228px; height: 70px; @@ -2810,9 +2819,9 @@ img.login, img.printer, img.entity { font-weight: bold; } .userimg.atoplogin img.userphoto, .userimgatoplogin img.userphoto { /* size for user photo in login bar */ - border-radius: 8px; - width: 16px; - height: 16px; + /* border-radius: 8px; */ + width: 20px; + height: 20px; background-size: contain; vertical-align: text-bottom; background-color: #FFF; @@ -3115,7 +3124,7 @@ div.tabBar { border-left: 1px solid #BBB; border-top: 1px solid #CCC; width: auto; - background: rgb(); + background: var(--colorbacktabcard1); border-bottom: 1px solid #aaa; } @@ -3208,8 +3217,8 @@ a.tab:link, a.tab:visited, a.tab:hover, a.tab#active { } .tabactive, a.tab#active { - color: # !important; - background: rgb() !important; + color: var(--colortextbacktab) !important; + background: var(--colorbacktabcard1) !important; border-right: 1px solid #AAA !important; border-left: 1px solid #AAA !important; @@ -3225,8 +3234,8 @@ a.tab:link, a.tab:visited, a.tab:hover, a.tab#active { a.tab:hover { /* - background: rgba(, 0.5) url() 50% 0 repeat-x; - color: #; + background: var(--colorbacktabcard1) url() 50% 0 repeat-x; + color: var(--colortextbacktab); */ text-decoration: underline; } @@ -3386,10 +3395,10 @@ td.border, div.tagtable div div.border { border-bottom: none !important; } .bordertop { - border-top: 1px solid rgb(); + border-top: 1px solid var(--colortopbordertitle1); } .borderbottom { - border-bottom: 1px solid rgb(); + border-bottom: 1px solid var(--colortopbordertitle1); } .fichehalfright table.noborder { @@ -3397,7 +3406,7 @@ td.border, div.tagtable div div.border { } div.colorback { - background: rgb(); + background: var(--colorbacktitle1); padding: 10px; margin-top: 5px; } @@ -3412,7 +3421,7 @@ table.liste, table.noborder, table.formdoc, div.noborder { border-spacing: 0px; border-top-width: px; - border-top-color: rgb(); + border-top-color: var(--colortopbordertitle1); border-top-style: solid; border-bottom-width: 1px; @@ -3445,7 +3454,7 @@ table.paddingtopbottomonly tr td { } .liste_titre_filter { - background: rgb() !important; + background: var(--colorbacktitle1) !important; } tr.liste_titre_filter td.liste_titre { padding-top: 4px; @@ -3454,19 +3463,19 @@ tr.liste_titre_filter td.liste_titre { .liste_titre_create td, .liste_titre_create th, .liste_titre_create .tagtd { border-top-width: 1px; - border-top-color: rgb(); + border-top-color: var(--colortopbordertitle1); border-top-style: solid; } .liste_titre_add td, .liste_titre_add th, .liste_titre_add .tagtd { border-top-width: 2px; - border-top-color: rgb(); + border-top-color: var(--colortopbordertitle1); border-top-style: solid; } .liste_titre_add td, .liste_titre_add .tagtd { border-top-width: 1px; - border-top-color: rgb(); + border-top-color: var(--colortopbordertitle1); border-top-style: solid; } @@ -3534,7 +3543,7 @@ div.refidpadding { } div.refid { font-weight: bold; - color: rgb(); + color: rgb(--colortexttitlenotab); font-size: 160%; } div.refidno { @@ -3627,7 +3636,7 @@ div.pagination li .active span:focus { z-index: 2; color: #fff; cursor: default; - background-color: rgb(); + background-color: var(--colorbackhmenu1); border-color: #337ab7; } div.pagination .disabled span, @@ -3672,11 +3681,10 @@ table.hidepaginationnext .paginationnext { /* Prepare to remove class pair - impair .noborder > tbody > tr:nth-child(even) td { - background: linear-gradient(to bottom, rgb() 85%, rgb() 100%); - background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: linear-gradient(to bottom, var(--colorbacklineimpair1) 85%, var(--colorbacklineimpair2) 100%); + background: -o-linear-gradient(bottom, var(--colorbacklineimpair1) 85%, var(--colorbacklineimpair2) 100%); + background: -moz-linear-gradient(bottom, var(--colorbacklineimpair1) 85%, var(--colorbacklineimpair2) 100%); + background: -webkit-linear-gradient(bottom, var(--colorbacklineimpair1) 85%, var(--colorbacklineimpair2) 100%); font-family: ; border: 0px; margin-bottom: 1px; @@ -3685,11 +3693,10 @@ table.hidepaginationnext .paginationnext { } .noborder > tbody > tr:nth-child(odd) td { - background: linear-gradient(to bottom, rgb() 85%, rgb() 100%); - background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: linear-gradient(to bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%); + background: -o-linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%); + background: -moz-linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%); + background: -webkit-linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%); font-family: ; border: 0px; margin-bottom: 1px; @@ -3698,11 +3705,7 @@ table.hidepaginationnext .paginationnext { */ ul.noborder li:nth-child(odd):not(.liste_titre) { - background-color: rgb() !important; - background-color: rgb() !important; - background-color: rgb() !important; - background-color: rgb() !important; - background-color: rgb() !important; + background-color: var(--colorbacklinepair2) !important; } @@ -3827,7 +3830,7 @@ div.liste_titre { } div.liste_titre_bydiv { border-top-width: px; - border-top-color: rgb(); + border-top-color: var(--colortopbordertitle1); border-top-style: solid; box-shadow: none; @@ -3842,11 +3845,11 @@ tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, tabl } div.liste_titre_bydiv, .liste_titre div.tagtr, tr.liste_titre, tr.liste_titre_sel, .tagtr.liste_titre, .tagtr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr { - background: rgb(); + background: var(--colorbacktitle1); font-weight: ; /* border-bottom: 1px solid #FDFFFF; */ - color: rgb(); + color: var(--colortexttitle); font-family: ; text-align: ; } @@ -3867,25 +3870,25 @@ tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste } tr.liste_titre th a, th.liste_titre a, tr.liste_titre td a, td.liste_titre a, form.liste_titre div a, div.liste_titre a { text-shadow: none !important; - color: rgb(); + color: var(--colortexttitlelink); } tr.liste_titre_topborder td { border-top-width: px; - border-top-color: rgb(); + border-top-color: var(--colortopbordertitle1); border-top-style: solid; } .liste_titre td a { text-shadow: none !important; - color: rgb(); + color: var(--colortexttitle); } .liste_titre td a.notasortlink { - color: rgb(); + color: var(--colortextlink); } .liste_titre td a.notasortlink:hover { background: transparent; } tr.liste_titre:last-child th.liste_titre, tr.liste_titre:last-child th.liste_titre_sel, tr.liste_titre td.liste_titre, tr.liste_titre td.liste_titre_sel, form.liste_titre div.tagtd { /* For last line of table headers only */ - border-bottom: 1px solid rgb(); + border-bottom: 1px solid var(--colortopbordertitle1); } div.liste_titre { @@ -3933,7 +3936,7 @@ tr.liste_sub_total, tr.liste_sub_total td { } .paymenttable, .margintable:not(.margintablenotop) { border-top-width: px !important; - border-top-color: rgb() !important; + border-top-color: var(--colortopbordertitle1) !important; border-top-style: solid !important; } .margintable.margintablenotop { @@ -3986,11 +3989,10 @@ div .tdtop { div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft) > .border > tbody > tr:nth-of-type(even):not(.liste_titre), .liste > tbody > tr:nth-of-type(even):not(.liste_titre), div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft) .oddeven.tagtr:nth-of-type(even):not(.liste_titre) { - background: linear-gradient(to bottom, rgb() 85%, rgb() 100%); - background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: linear-gradient(to bottom, var(--colorbacklineimpair1) 0%, var(--colorbacklineimpair2) 100%); + background: -o-linear-gradient(bottom, var(--colorbacklineimpair1) 0%, var(--colorbacklineimpair2) 100%); + background: -moz-linear-gradient(bottom, var(--colorbacklineimpair1) 0%, var(--colorbacklineimpair2) 100%); + background: -webkit-linear-gradient(bottom, var(--colorbacklineimpair1) 0%, var(--colorbacklineimpair2) 100%); } .noborder > tbody > tr:nth-child(even):not(:last-child) td:not(.liste_titre), .liste > tbody > tr:nth-child(even):not(:last-child) td:not(.liste_titre), .noborder .tagtr:nth-child(even):not(:last-child) .oddeven.tagtd:not(.liste_titre) @@ -4002,11 +4004,10 @@ div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft) > .border > tbody > tr:nth-of-type(odd):not(.liste_titre), .liste > tbody > tr:nth-of-type(odd):not(.liste_titre), div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft) .oddeven.tagtr:nth-of-type(odd):not(.liste_titre) { - background: linear-gradient(to bottom, rgb() 85%, rgb() 100%); - background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: linear-gradient(to bottom, var(--colorbacklinepair1) 0%, var(--colorbacklinepair2) 100%); + background: -o-linear-gradient(bottom, var(--colorbacklinepair1) 0%, var(--colorbacklinepair2) 100%); + background: -moz-linear-gradient(bottom, var(--colorbacklinepair1) 0%, var(--colorbacklinepair2) 100%); + background: -webkit-linear-gradient(bottom, var(--colorbacklinepair1) 0%, var(--colorbacklinepair2) 100%); } .noborder > tbody > tr:nth-child(odd):not(:last-child) td:not(.liste_titre), .liste > tbody > tr:nth-child(odd):not(:last-child) td:not(.liste_titre), .noborder .tagtr:nth-child(odd):not(:last-child) .oddeven.tagtd:not(.liste_titre) @@ -4015,7 +4016,7 @@ div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft } ul.noborder li:nth-child(even):not(.liste_titre) { - background-color: rgb() !important; + background-color: var(--colorbacklinepair2) !important; } @@ -6538,7 +6539,6 @@ border-top-right-radius: 6px; background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(230,230,230,0.4) 100%); background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(230,230,230,0.4) 100%); background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(230,230,230,0.4) 100%); - background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(230,230,230,0.4) 100%); background-image: linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(230,230,230,0.4) 100%); } .cd-timeline-content:after { diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index 9acf76b30c2..10bed42095e 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -174,7 +174,7 @@ if (!empty($object->origin_email)) { if (!empty($conf->societe->enabled)) { $morehtmlref .= '
    '.$langs->trans('ThirdParty'); /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; }*/ $morehtmlref .= ' : '; if ($action == 'editcustomer') { diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index f91fe4f01b3..4f0ddb962ca 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -931,7 +931,7 @@ if ($action == 'create' || $action == 'presend') { if (!empty($conf->societe->enabled)) { $morehtmlref .= '
    '.$langs->trans('ThirdParty').' '; if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('Edit'), 0).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('Edit'), 0).' : '; } if ($action == 'editcustomer') { $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index 643c2f34b11..a8f96ae7c66 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -197,7 +197,7 @@ class ActionsTicket print $langs->trans("InitialMessage"); print '
    '; if ($user->rights->ticket->manage) { - print ''.img_edit($langs->trans('Modify')).''; + print ''.img_edit($langs->trans('Modify')).''; } print '
    '."\n"; @@ -1088,6 +1090,7 @@ print $hookmanager->resPrint; print '
    '."\n"; print ''."\n"; +print ''."\n"; print ''."\n"; diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index 365376f0add..61417805006 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -172,7 +172,7 @@ if (!empty($object->origin_email)) { if (!empty($conf->societe->enabled)) { $morehtmlref .= '
    '.$langs->trans('ThirdParty'); /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; }*/ $morehtmlref .= ' : '; if ($action == 'editcustomer') { diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 00b85dc23a6..1bb88ce3d8c 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -339,7 +339,10 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac $ret .= ''; $ret .= ''; $ret .= ''; - $maxRangeNum = ExpenseReportIk::getMaxRangeNumber($object->default_c_exp_tax_cat); + + $expensereportik = new ExpenseReportIk($db); + $maxRangeNum = $expensereportik->getMaxRangeNumber($object->default_c_exp_tax_cat); + $ret .= $form->selectarray('default_range', range(0, $maxRangeNum), $object->default_range); $ret .= ' '; $ret .= ''; @@ -609,7 +612,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac // Edit/Delete print '
    '; if ($permissiontoaddbankaccount) { - print ''; + print ''; print img_picto($langs->trans("Modify"), 'edit'); print ''; } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 480ff3a8a74..67269a5654b 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1861,11 +1861,11 @@ if ($action == 'create' || $action == 'adduserldap') { if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) { print ''; } else { - print ''; + print ''; } } elseif ($caneditpassword && !$object->ldap_sid && (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { - print ''; + print ''; } // Si on a un gestionnaire de generation de mot de passe actif @@ -2643,7 +2643,7 @@ if ($action == 'create' || $action == 'adduserldap') { if (!empty($conf->stock->enabled) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) { print '
    '.$langs->trans("DefaultWarehouse").''; print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1); - print ' '; + print ' '; print '
    '."\n"; print ''."\n"; print ''; + print ''; } else { $result = show_ldap_content($records, 0, $records['count'], true); } diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index 46506163c1f..478e345f2e3 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -248,9 +248,9 @@ if ($object->id > 0) { print ''; if ($caneditperms) { print ''; } print ''; @@ -302,9 +302,9 @@ if ($object->id > 0) { print ''; if ($caneditperms) { print ''; } else { print ''; @@ -353,7 +353,7 @@ if ($object->id > 0) { } else { // Do not own permission if ($caneditperms) { - print ''; diff --git a/htdocs/user/home.php b/htdocs/user/home.php index fbfe4638bd5..924dceb14ab 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -89,12 +89,12 @@ $searchbox .= ''; $searchbox .= '
    '.$langs->trans("NonAffectedUsers").''; - print $form->select_dolusers('', 'user', 1, $exclude, 0, '', '', $object->entity, 0, 0, '', 0, '', 'maxwidth300'); + print $form->select_dolusers('', 'user', 1, $exclude, 0, '', '', $object->entity, 0, 0, '', 0, '', 'minwidth200 maxwidth500'); print '   '; print ''; print ''; diff --git a/htdocs/user/group/ldap.php b/htdocs/user/group/ldap.php index e02eb3e25d0..710dab1ee22 100644 --- a/htdocs/user/group/ldap.php +++ b/htdocs/user/group/ldap.php @@ -184,7 +184,7 @@ if ($result > 0) { // Show tree if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) { if (!is_array($records)) { - print '
    '.$langs->trans("ErrorFailedToReadLDAP").'
    '.$langs->trans("ErrorFailedToReadLDAP").'
    '.$langs->trans("Module").''; - print ''.$langs->trans("All").""; + print ''.$langs->trans("All").""; print '/'; - print ''.$langs->trans("None").""; + print ''.$langs->trans("None").""; print ' '; - print 'module.'&token='.newToken().'">'.$langs->trans("All").""; + print 'module.'&token='.newToken().'">'.$langs->trans("All").""; print '/'; - print 'module.'&token='.newToken().'">'.$langs->trans("None").""; + print 'module.'&token='.newToken().'">'.$langs->trans("None").""; print ' id.'&confirm=yes&token='.newToken().'">'; + print 'id.'&confirm=yes&token='.newToken().'">'; //print img_edit_add($langs->trans("Add")); print img_picto($langs->trans("Add"), 'switch_off'); print '
    '; $searchbox .= ''; $searchbox .= ''; +$searchbox .= $langs->trans("User").':'; // Search Group if ($canreadperms) { $searchbox .= ''; + $searchbox .= $langs->trans("Group").':'; } $searchbox .= ''; diff --git a/htdocs/user/ldap.php b/htdocs/user/ldap.php index e8ceef77b0a..b7ea48f7734 100644 --- a/htdocs/user/ldap.php +++ b/htdocs/user/ldap.php @@ -189,7 +189,7 @@ if ($result > 0) { // Affichage arbre if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) { if (!is_array($records)) { - print ''; + print ''; } else { $result = show_ldap_content($records, 0, $records['count'], true); } diff --git a/htdocs/user/note.php b/htdocs/user/note.php index da8c57f918f..ba8c10f351b 100644 --- a/htdocs/user/note.php +++ b/htdocs/user/note.php @@ -148,7 +148,7 @@ if ($id) { print '
    '; if ($user->rights->user->user->creer && $action != 'edit') { - print "id."&action=edit\">".$langs->trans('Modify').""; + print ''.$langs->trans('Modify').""; } print "
    "; diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 76734c26886..45a2baf0bd8 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -405,12 +405,12 @@ if ($action == 'edit') { print '
    '; if (empty($user->admin) && !empty($dolibarr_main_demo)) { - print "trans("FeatureDisabledInDemo")."\" href=\"#\">".$langs->trans("Modify").""; + print ''.$langs->trans("Modify").''; } else { if ($caneditfield || !empty($user->admin)) { // Si utilisateur edite = utilisateur courant (pas besoin de droits particulier car il s'agit d'une page de modif d'output et non de données) ou si admin - print 'id.'">'.$langs->trans("Modify").''; + print 'id.'">'.$langs->trans("Modify").''; } else { - print "trans("NotEnoughPermissions")."\" href=\"#\">".$langs->trans("Modify").""; + print ''.$langs->trans("Modify").''; } } diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 7c7fe868b2f..d3ba33a5acf 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -420,7 +420,7 @@ if ($result) { } else { // Do not own permission if ($caneditperms) { - print '
    '; @@ -430,7 +430,7 @@ if ($result) { } else { // Do not own permission if ($caneditperms) { - print ''; diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index a3ad036ca9a..d70419060f5 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -587,7 +587,7 @@ if (!empty($id) || !empty($ref)) { $htmltext = $langs->trans("GoOnMenuToCreateVairants", $langs->transnoentities("Product"), $langs->transnoentities("VariantAttributes")); print $form->textwithpicto('', $htmltext); - /*print '     id).'">'; + /*print '     id).'">'; print $langs->trans("Create"); print '';*/ @@ -605,7 +605,7 @@ if (!empty($id) || !empty($ref)) { $htmltext = $langs->trans("GoOnMenuToCreateVairants", $langs->transnoentities("Product"), $langs->transnoentities("VariantAttributes")); print $form->textwithpicto('', $htmltext); /* - print '     id).'">'; + print '     id).'">'; print $langs->trans("Create"); print ''; */ diff --git a/htdocs/variants/list.php b/htdocs/variants/list.php index ecb42ba25e2..eedb24524e0 100644 --- a/htdocs/variants/list.php +++ b/htdocs/variants/list.php @@ -142,7 +142,7 @@ foreach ($variants as $key => $attribute) { print ''; print ''; print ''; print ''; // Language diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index ac035127f14..cbfbb3abaf3 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -302,7 +302,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } if ($user->rights->website->write) { - print ''."\n"; + print ''."\n"; } /* diff --git a/htdocs/workstation/workstation_card.php b/htdocs/workstation/workstation_card.php index 8bf2dc48e2d..853b13106e3 100755 --- a/htdocs/workstation/workstation_card.php +++ b/htdocs/workstation/workstation_card.php @@ -440,7 +440,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Modify if ($permissiontoadd) { - print ''.$langs->trans("Modify").''."\n"; + print ''.$langs->trans("Modify").''."\n"; } else { print ''.$langs->trans('Modify').''."\n"; } diff --git a/htdocs/zapier/admin/setup.php b/htdocs/zapier/admin/setup.php index 7249e8c3849..08d2c1703a8 100644 --- a/htdocs/zapier/admin/setup.php +++ b/htdocs/zapier/admin/setup.php @@ -112,7 +112,7 @@ if ($action == 'edit') { print '
    '.$langs->trans("Search").'
    '; -$searchbox .= $langs->trans("User").':
    '; - $searchbox .= $langs->trans("Group").':
    '.$langs->trans("ErrorFailedToReadLDAP").'
    '.$langs->trans("ErrorFailedToReadLDAP").'
    id.'&confirm=yes&token='.newToken().'">'; + print 'id.'&confirm=yes&token='.newToken().'">'; //print img_edit_add($langs->trans("Add")); print img_picto($langs->trans("Add"), 'switch_off'); print 'id.'&confirm=yes&token='.newToken().'">'; + print 'id.'&confirm=yes&token='.newToken().'">'; //print img_edit_add($langs->trans("Add")); print img_picto($langs->trans("Add"), 'switch_off'); print ''.$attribute->countChildValues().''.$attribute->countChildProducts().''; - print ''.img_edit().''; + print ''.img_edit().''; print ''.img_delete().''; print ''; diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index 6803133d527..926fa8f6418 100644 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -350,13 +350,9 @@ function getSupplierInvoicesForThirdParty($authentication, $idthirdparty) if (!$error) { $linesinvoice = array(); - $sql .= 'SELECT f.rowid as facid'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f'; - //$sql.=', '.MAIN_DB_PREFIX.'societe as s'; - //$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product = p.rowid'; - //$sql.=" WHERE f.fk_soc = s.rowid AND nom = '".$db->escape($idthirdparty)."'"; - //$sql.=" WHERE f.fk_soc = s.rowid AND nom = '".$db->escape($idthirdparty)."'"; - $sql .= " WHERE f.entity = ".$conf->entity; + $sql .= "SELECT f.rowid as facid"; + $sql .= " FROM '.MAIN_DB_PREFIX.'facture_fourn as f"; + $sql .= " WHERE f.entity = ".((int) $conf->entity); if ($idthirdparty != 'all') { $sql .= " AND f.fk_soc = ".((int) $idthirdparty); } diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index f80a705c3f2..f1a923642e2 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -297,8 +297,8 @@ class Website extends CommonObject { dol_syslog(__METHOD__, LOG_DEBUG); - $sql = 'SELECT'; - $sql .= ' t.rowid,'; + $sql = "SELECT"; + $sql .= " t.rowid,"; $sql .= " t.entity,"; $sql .= " t.ref,"; $sql .= " t.position,"; @@ -313,12 +313,12 @@ class Website extends CommonObject $sql .= " t.fk_user_modif,"; $sql .= " t.date_creation,"; $sql .= " t.tms as date_modification"; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; - $sql .= ' WHERE t.entity IN ('.getEntity('website').')'; + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; + $sql .= " WHERE t.entity IN (".getEntity('website').")"; if (!empty($ref)) { $sql .= " AND t.ref = '".$this->db->escape($ref)."'"; } else { - $sql .= ' AND t.rowid = '.(int) $id; + $sql .= " AND t.rowid = ".(int) $id; } $resql = $this->db->query($sql); @@ -395,8 +395,8 @@ class Website extends CommonObject { dol_syslog(__METHOD__, LOG_DEBUG); - $sql = 'SELECT'; - $sql .= ' t.rowid,'; + $sql = "SELECT"; + $sql .= " t.rowid,"; $sql .= " t.entity,"; $sql .= " t.ref,"; $sql .= " t.description,"; @@ -409,8 +409,8 @@ class Website extends CommonObject $sql .= " t.fk_user_modif,"; $sql .= " t.date_creation,"; $sql .= " t.tms as date_modification"; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; - $sql .= ' WHERE t.entity IN ('.getEntity('website').')'; + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; + $sql .= " WHERE t.entity IN (".getEntity('website').")"; // Manage filter $sqlwhere = array(); if (count($filter) > 0) { @@ -1252,7 +1252,7 @@ class Website extends CommonObject // Read record of website that has been updated by the run_sql function previously called so we can get the // value of fk_default_home that is ID of home page - $sql = 'SELECT fk_default_home FROM '.MAIN_DB_PREFIX.'website WHERE rowid = '.((int) $object->id); + $sql = "SELECT fk_default_home FROM ".MAIN_DB_PREFIX."website WHERE rowid = ".((int) $object->id); $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); @@ -1297,7 +1297,7 @@ class Website extends CommonObject $objectpagestatic = new WebsitePage($this->db); - $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'website_page WHERE fk_website = '.((int) $this->id); + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."website_page WHERE fk_website = ".((int) $this->id); $resql = $this->db->query($sql); if (!$resql) { diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 62b024047e4..4e21887ff04 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2668,7 +2668,7 @@ if (!GETPOST('hide_websitemenu')) { print '   '; //print ''; - print ''.dol_escape_htmltag($langs->trans($conf->dol_optimize_smallscreen ? "Properties" : "EditCss")).''; + print ''.dol_escape_htmltag($langs->trans($conf->dol_optimize_smallscreen ? "Properties" : "EditCss")).''; $importlabel = $langs->trans("ImportSite"); $exportlabel = $langs->trans("ExportSite"); @@ -2964,10 +2964,10 @@ if (!GETPOST('hide_websitemenu')) { print '   '; //print ''; - print ''.dol_escape_htmltag($langs->trans($conf->dol_optimize_smallscreen ? "Properties" : "EditPageMeta")).''; + print ''.dol_escape_htmltag($langs->trans($conf->dol_optimize_smallscreen ? "Properties" : "EditPageMeta")).''; //print ''; - print ''.dol_escape_htmltag($langs->trans($conf->dol_optimize_smallscreen ? "HTML" : "EditHTMLSource")).''; + print ''.dol_escape_htmltag($langs->trans($conf->dol_optimize_smallscreen ? "HTML" : "EditHTMLSource")).''; print ''."\n"; print '
    '; @@ -3825,7 +3825,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties print '
    '; if ($action != 'createcontainer') { // Has translation pages - $sql = 'SELECT rowid, lang from '.MAIN_DB_PREFIX.'website_page where fk_page = '.((int) $objectpage->id); + $sql = "SELECT rowid, lang from ".MAIN_DB_PREFIX."website_page where fk_page = ".((int) $objectpage->id); $resql = $db->query($sql); if ($resql) { $num_rows = $db->num_rows($resql); @@ -4341,7 +4341,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction = // Edit properties, HTML sources, status print ''; $disabled = ''; - $urltoedithtmlsource = $_SERVER["PHP_SELF"].'?action=editmeta&websiteid='.$website->id.'&pageid='.$answerrecord->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].$param); + $urltoedithtmlsource = $_SERVER["PHP_SELF"].'?action=editmeta&token='.newToken().'&websiteid='.$website->id.'&pageid='.$answerrecord->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].$param); if (empty($user->rights->website->write)) { $disabled = ' disabled'; $urltoedithtmlsource = ''; @@ -4349,7 +4349,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction = print ''.img_picto($langs->trans("EditPageMeta"), 'pencil-ruler').''; $disabled = ''; - $urltoedithtmlsource = $_SERVER["PHP_SELF"].'?action=editsource&websiteid='.$website->id.'&pageid='.$answerrecord->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].$param); + $urltoedithtmlsource = $_SERVER["PHP_SELF"].'?action=editsource&token='.newToken().'&websiteid='.$website->id.'&pageid='.$answerrecord->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].$param); if (empty($user->rights->website->write)) { $disabled = ' disabled'; $urltoedithtmlsource = ''; @@ -4408,7 +4408,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction = // Container url and label print ''; $backtopageurl = $_SERVER["PHP_SELF"].$param; - print 'ref.'&backtopage='.urlencode($backtopageurl).'">'.$langs->trans("EditCss").''; + print 'ref.'&backtopage='.urlencode($backtopageurl).'">'.$langs->trans("EditCss").''; print '
    '; print ''; } else { // Setup page goes here diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php index 40ca07c441f..c68f1162790 100644 --- a/test/phpunit/CodingPhpTest.php +++ b/test/phpunit/CodingPhpTest.php @@ -201,28 +201,21 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase || in_array($file['name'], array('modules_boxes.php', 'rapport.pdf.php', 'TraceableDB.php'))) { if (! in_array($file['name'], array( 'api.class.php', - 'actioncomm.class.php', 'commonobject.class.php', 'conf.class.php', 'html.form.class.php', 'html.formmail.class.php', - 'infobox.class.php', - 'link.class.php', 'translate.class.php', 'utils.class.php', 'modules_product.class.php', 'modules_societe.class.php', 'TraceableDB.php', - 'expeditionbatch.class.php', - 'expensereport_ik.class.php', - 'expensereport_rule.class.php', 'multicurrency.class.php', 'productbatch.class.php', 'reception.class.php', - 'societe.class.php' , - 'account.class.php' + 'societe.class.php' ))) { - // Must must not found $db-> + // Must not found $db-> $ok=true; $matches=array(); // Check string $db-> inside a class.php file (it should be $this->db-> insto such classes) @@ -232,7 +225,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase break; } //print __METHOD__." Result for checking we don't have non escaped string in sql requests for file ".$file."\n"; - $this->assertTrue($ok, 'Found string $db-> into a .class.php file in '.$file['relativename']); + $this->assertTrue($ok, 'Found string $db-> into a .class.php file in '.$file['relativename'].'. Inside a .class file, you should use $this->db-> instead.'); //exit; } } else { @@ -257,7 +250,6 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase $ok=true; $matches=array(); - // Check string get_class... preg_match_all('/'.preg_quote('get_class($this)."::".__METHOD__', '/').'/', $filecontent, $matches, PREG_SET_ORDER); foreach ($matches as $key => $val) { $ok=false; @@ -267,9 +259,9 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase $this->assertTrue($ok, 'Found string get_class($this)."::".__METHOD__ that must be replaced with __METHOD__ only in '.$file['relativename']); //exit; + // Check string $this->db->idate without quotes $ok=true; $matches=array(); - // Check string $this->db->idate without quotes preg_match_all('/(..)\s*\.\s*\$this->db->idate\(/', $filecontent, $matches, PREG_SET_ORDER); foreach ($matches as $key => $val) { if ($val[1] != '\'"' && $val[1] != '\'\'') { @@ -283,11 +275,10 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase //exit; - $ok=true; - $matches=array(); - // Check sql string DELETE|OR|AND|WHERE|INSERT ... yyy = ".$xxx // with xxx that is not 'thi' (for $this->db->sanitize) and 'db-' (for $db->sanitize). It means we forget a ' if string, or an (int) if int, when forging sql request. + $ok=true; + $matches=array(); preg_match_all('/(DELETE|OR|AND|WHERE|INSERT)\s.*([^\s][^\s][^\s])\s*=\s*"\s*\.\s*\$(...)/', $filecontent, $matches, PREG_SET_ORDER); foreach ($matches as $key => $val) { if ($val[2] == 'ity' && $val[3] == 'con') { // exclude entity = ".$conf->entity @@ -307,8 +298,37 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase $this->assertTrue($ok, 'Found non quoted or not casted var into sql request '.$file['relativename'].' - Bad.'); //exit; + // Check that forged sql string is using ' instead of " as string PHP quotes + $ok=true; + $matches=array(); + preg_match_all('/\$sql \.= \'\s*VALUES.*\$/', $filecontent, $matches, PREG_SET_ORDER); + foreach ($matches as $key => $val) { + //if ($val[1] != '\'"' && $val[1] != '\'\'') { + var_dump($matches); + $ok=false; + break; + //} + //if ($reg[0] != 'db') $ok=false; + } + //print __METHOD__." Result for checking we don't have non escaped string in sql requests for file ".$file."\n"; + $this->assertTrue($ok, 'Found a forged SQL string that mix on same line the use of \' for PHP string and PHP variables into file '.$file['relativename'].' Use " to forge PHP string like this: $sql = "SELET ".$myvar...'); + //exit; + + // Check that forged sql string is using ' instead of " as string PHP quotes + $ok=true; + $matches=array(); + preg_match_all('/\$sql \.?= \'SELECT.*\$/', $filecontent, $matches, PREG_SET_ORDER); + foreach ($matches as $key => $val) { + var_dump($matches); + $ok=false; + break; + } + $this->assertTrue($ok, 'Found a forged SQL string that mix on same line the use of \' for PHP string and PHP variables into file '.$file['relativename'].' Use " to forge PHP string like this: $sql = "SELET ".$myvar...'); + // Check sql string VALUES ... , ".$xxx // with xxx that is not 'db-' (for $db->escape). It means we forget a ' if string, or an (int) if int, when forging sql request. + $ok=true; + $matches=array(); preg_match_all('/(VALUES).*,\s*"\s*\.\s*\$(...)/', $filecontent, $matches, PREG_SET_ORDER); foreach ($matches as $key => $val) { if ($val[1] == 'VALUES' && $val[2] == 'db-') { // exclude $db->escape( @@ -328,6 +348,8 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase // Check '".$xxx non escaped // Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request. + $ok=true; + $matches=array(); preg_match_all('/=\s*\'"\s*\.\s*\$this->(....)/', $filecontent, $matches, PREG_SET_ORDER); foreach ($matches as $key => $val) { if ($val[1] != 'db->' && $val[1] != 'esca') { @@ -339,9 +361,11 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase $this->assertTrue($ok, 'Found non escaped string in building of a sql request (case 1) in '.$file['relativename'].' - Bad.'); // Check string sql|set...'".$yyy->xxx with xxx that is not 'escape', 'idate', .... It means we forget a db->escape when forging sql request. + $ok=true; + $matches=array(); preg_match_all('/(sql|SET|WHERE|INSERT|VALUES).+\s*\'"\s*\.\s*\$(.........)/', $filecontent, $matches, PREG_SET_ORDER); foreach ($matches as $key => $val) { - if (! in_array($val[2], array('this->db-', 'this->esc', 'db->escap', 'mydb->esc', 'dbsession', 'db->idate', 'escapedli', 'excludeGr', 'includeGr'))) { + if (! in_array($val[2], array('this->db-', 'this->esc', 'db->escap', 'dbs->esca', 'mydb->esc', 'dbsession', 'db->idate', 'escapedli', 'excludeGr', 'includeGr'))) { $ok=false; break; } @@ -352,6 +376,8 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase //exit; // Check string sql|set...'.$yyy->xxx with xxx that is not 'escape', 'idate', .... It means we forget a db->escape when forging sql request. + $ok=true; + $matches=array(); preg_match_all('/(\$sql|SET\s|WHERE\s|INSERT\s|VALUES\s|VALUES\().+\s*\'\s*\.\s*\$(.........)/', $filecontent, $matches, PREG_SET_ORDER); foreach ($matches as $key => $val) { if (! in_array($val[2], array('this->db-', 'db->sanit', 'conf->ent', 'key : \'\')', 'key])."\')', 'excludefi', 'regexstri', ''))) { @@ -368,6 +394,8 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase // Checks with IN // Check string 'IN (".xxx' or 'IN (\'.xxx' with xxx that is not '$this->db->sanitize' and not '$db->sanitize'. It means we forget a db->sanitize when forging sql request. + $ok=true; + $matches=array(); preg_match_all('/ IN \([\'"]\s*\.\s*(.........)/i', $filecontent, $matches, PREG_SET_ORDER); foreach ($matches as $key => $val) { if (!in_array($val[1], array('$db->sani', '$this->db', 'getEntity', 'WON\',\'L', 'self::STA', 'Commande:', 'CommandeF', 'Entrepot:', 'Facture::', 'FactureFo', 'ExpenseRe', 'Societe::', 'Ticket::S'))) { @@ -381,6 +409,8 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase //exit; // Check string 'IN (\'".xxx' with xxx that is not '$this->db->sanitize' and not '$db->sanitize'. It means we forget a db->sanitize when forging sql request. + $ok=true; + $matches=array(); preg_match_all('/ IN \(\'"\s*\.\s*(.........)/i', $filecontent, $matches, PREG_SET_ORDER); foreach ($matches as $key => $val) { if (!in_array($val[1], array('$db->sani', '$this->db', 'getEntity', 'WON\',\'L', 'self::STA', 'Commande:', 'CommandeF', 'Entrepot:', 'Facture::', 'FactureFo', 'ExpenseRe', 'Societe::', 'Ticket::S'))) { diff --git a/test/phpunit/LangTest.php b/test/phpunit/LangTest.php index 99f74dbd4fa..d3f91093124 100644 --- a/test/phpunit/LangTest.php +++ b/test/phpunit/LangTest.php @@ -184,17 +184,21 @@ class LangTest extends PHPUnit\Framework\TestCase $tmplangs->setDefaultLang($langcode); $tmplangs->load("main"); + $result=$tmplangs->transnoentitiesnoconv("FONTFORPDF"); + print __METHOD__." FONTFORPDF=".$result."\n"; + $this->assertTrue(in_array($result, array('msungstdlight', 'stsongstdlight', 'helvetica', 'DejaVuSans', 'cid0jp', 'cid0kr', 'freemono')), 'Error bad value '.$result.' for FONTFORPDF in main.lang file '.$code); + $result=$tmplangs->transnoentitiesnoconv("DIRECTION"); print __METHOD__." DIRECTION=".$result."\n"; - $this->assertTrue(in_array($result, array('rtl', 'ltr')), 'Error for vale of DIRECTION in main.lang file '.$code); + $this->assertTrue(in_array($result, array('rtl', 'ltr')), 'Error bad value for DIRECTION in main.lang file '.$code); $result=$tmplangs->transnoentitiesnoconv("SeparatorDecimal"); print __METHOD__." SeparatorDecimal=".$result."\n"; - $this->assertContains($result, array('.',',','/',' ','','None'), 'Error for decimal separator for lang code '.$code); // Note that ، that is coma for RTL languages is not supported + $this->assertContains($result, array('.',',','/',' ','','None'), 'Error on decimal separator for lang code '.$code); // Note that ، that is coma for RTL languages is not supported $result=$tmplangs->transnoentitiesnoconv("SeparatorThousand"); print __METHOD__." SeparatorThousand=".$result."\n"; - $this->assertContains($result, array('.',',','/',' ','','\'','None','Space'), 'Error for thousand separator for lang code '.$code); // Note that ، that is coma for RTL languages is not supported + $this->assertContains($result, array('.',',','/',' ','','\'','None','Space'), 'Error on thousand separator for lang code '.$code); // Note that ، that is coma for RTL languages is not supported // Test java string contains only d,M,y,/,-,. and not m,... $result=$tmplangs->transnoentitiesnoconv("FormatDateShortJava");