diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index b06a3ffc63a..a5000dda461 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -276,8 +276,12 @@ if ($action != 'export_csv') $accountingaccountstatic = new AccountingAccount($db); - $sql = "select t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance from ".MAIN_DB_PREFIX."accounting_bookkeeping as t where entity in ".$conf->entity; - $sql .= " AND t.doc_date < '".$db->idate($search_date_start)."' GROUP BY t.numero_compte"; + $sql = "SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance"; + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t"; + $sql .= " WHERE t.entity = ".$conf->entity; // Never do sharing into accounting features + $sql .= " AND t.doc_date < '".$db->idate($search_date_start)."'"; + $sql .= " GROUP BY t.numero_compte"; + $resql = $db->query($sql); $nrows = $resql->num_rows; $opening_balances = array(); @@ -340,7 +344,7 @@ if ($action != 'export_csv') print ''; print "\n"; - // Comptabilise le sous-total + // Records the sub-total $sous_total_debit += $line->debit; $sous_total_credit += $line->credit; } diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index fa8cd088604..130c0e97659 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -809,8 +809,8 @@ class AccountancyExport foreach ($objectLines as $line) { $date_creation = dol_print_date($line->date_creation, '%Y%m%d'); - $date_doc = dol_print_date($line->doc_date, '%Y%m%d'); - $date_valid = dol_print_date($line->date_validated, '%Y%m%d'); + $date_document = dol_print_date($line->doc_date, '%Y%m%d'); + $date_validation = dol_print_date($line->date_validated, '%Y%m%d'); // FEC:JournalCode print $line->code_journal.$separator; @@ -822,25 +822,25 @@ class AccountancyExport print $line->piece_num.$separator; // FEC:EcritureDate - print $date_creation.$separator; + print $date_document . $separator; // FEC:CompteNum print $line->numero_compte.$separator; // FEC:CompteLib - print $line->label_compte.$separator; + print dol_string_unaccent($line->label_compte) . $separator; // FEC:CompAuxNum print $line->subledger_account.$separator; // FEC:CompAuxLib - print $line->subledger_label.$separator; + print dol_string_unaccent($line->subledger_label) . $separator; // FEC:PieceRef print $line->doc_ref.$separator; // FEC:PieceDate - print $date_doc.$separator; + print dol_string_unaccent($date_creation) . $separator; // FEC:EcritureLib print $line->label_operation.$separator; @@ -858,7 +858,7 @@ class AccountancyExport print $line->date_lettering.$separator; // FEC:ValidDate - print $date_valid.$separator; + print $date_validation . $separator; // FEC:Montantdevise print $line->multicurrency_amount.$separator; diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 83bd00555d6..554edbb892e 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -32,7 +32,7 @@ class DolibarrApi /** * @var DoliDb $db Database object */ - protected static $db; + protected $db; /** * @var Restler $r Restler object diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index f806a786b73..d1936d9d17e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2019 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2010-2017 Philippe Grand * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2012 Cedric Salvador @@ -2911,9 +2911,9 @@ class Propal extends CommonObject if (!$error) { - $main = MAIN_DB_PREFIX.'propaldet'; - $ef = $main."_extrafields"; - $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_propal = ".$this->id.")"; + $main = MAIN_DB_PREFIX.'propaldet'; + $ef = $main."_extrafields"; + $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_propal = ".$this->id.")"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal = ".$this->id; if ($this->db->query($sqlef) && $this->db->query($sql)) { @@ -2930,6 +2930,9 @@ class Propal extends CommonObject if (!$error) { + // Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive + $this->deleteEcmFiles(); + // We remove directory $ref = dol_sanitizeFileName($this->ref); if ($conf->propal->multidir_output[$this->entity] && !empty($this->ref)) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 45523fab1e2..6c6c26c135f 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2016 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2011 Jean Heimburger * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2012 Cedric Salvador @@ -3380,6 +3380,9 @@ class Commande extends CommonOrder if (!$error) { + // Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive + $this->deleteEcmFiles(); + // Remove directory with files $comref = dol_sanitizeFileName($this->ref); if ($conf->commande->multidir_output[$this->entity] && !empty($this->ref)) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index e4058a873d3..fcbedc2f140 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -472,7 +472,7 @@ class Account extends CommonObject * @param string $oper 'VIR','PRE','LIQ','VAD','CB','CHQ'... * @param string $label Descripton * @param float $amount Amount - * @param string $num_chq Numero cheque ou virement + * @param string $num_chq Numero cheque or transfer * @param int $categorie Category id (optionnal) * @param User $user User that create * @param string $emetteur Name of cheque writer @@ -566,15 +566,18 @@ class Account extends CommonObject if (!$result) { $this->error = $this->db->lasterror(); $this->db->rollback(); + return -3; } } $this->db->commit(); + return $accline->id; } else { $this->error = $this->db->lasterror(); $this->db->rollback(); + return -2; } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index a6bb6a12cec..d47caa3b92a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2007 Franky Van Liedekerke - * Copyright (C) 2010-2016 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2012 Cédric Salvador @@ -2207,6 +2207,9 @@ class Facture extends CommonInvoice $resql = $this->db->query($sql); if ($resql) { + // Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive + $this->deleteEcmFiles(); + // On efface le repertoire de pdf provisoire $ref = dol_sanitizeFileName($this->ref); if ($conf->facture->dir_output && !empty($this->ref)) diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 6fa22885dee..78105cf9585 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -100,16 +100,16 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $object->label = GETPOST("label", 'alpha'); $object->note = GETPOST("note", 'none'); - if (empty($object->datev)) - { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateValue")), null, 'errors'); - $error++; - } if (empty($object->datep)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment")), null, 'errors'); $error++; } + if (empty($object->datev)) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PeriodEndDate")), null, 'errors'); + $error++; + } if (empty($object->type_payment) || $object->type_payment < 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors'); diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 3274a3eaebd..b4201d0bc36 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -499,6 +499,7 @@ class Tva extends CommonObject $this->amount = price2num(trim($this->amount)); $this->label = trim($this->label); $this->note = trim($this->note); + $this->num_payment = trim($this->num_payment); $this->fk_bank = (int) $this->fk_bank; $this->fk_user_creat = (int) $this->fk_user_creat; $this->fk_user_modif = (int) $this->fk_user_modif; @@ -583,9 +584,9 @@ class Tva extends CommonObject if ($result <= 0) dol_print_error($this->db); if ($this->amount > 0) { - $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, -abs($this->amount), '', '', $user); + $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, -abs($this->amount), $this->num_payment, '', $user); } else { - $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, abs($this->amount), '', '', $user); + $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, abs($this->amount), $this->num_payment, '', $user); } // Update fk_bank into llx_tva. So we know vat line used to generate bank transaction diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 73a6043f095..a90e3a2cf26 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -525,6 +525,9 @@ class CMailFile { //$this->message->attach(Swift_Attachment::fromPath($filename_list[$i],$mimetype_list[$i])); $attachment = Swift_Attachment::fromPath($filename_list[$i], $mimetype_list[$i]); + if (!empty($mimefilename_list[$i])) { + $attachment->setFilename($mimefilename_list[$i]); + } $this->message->attach($attachment); } } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1273d48a359..55b5628705d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2010-2015 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2011-2019 Philippe Grand * Copyright (C) 2012-2015 Marcos García @@ -8415,4 +8415,49 @@ abstract class CommonObject $this->db->commit(); return 1; } + + /** + * Delete related files of object in database + * + * @return bool + */ + public function deleteEcmFiles() + { + global $conf; + + $this->db->begin(); + + switch ($this->element){ + case 'propal': + $element = 'propale'; + break; + case 'product': + $element = 'produit'; + break; + case 'order_supplier': + $element ='fournisseur/commande'; + break; + case 'invoice_supplier': + $element = 'fournisseur/facture/' . get_exdir($this->id, 2, 0, 1, $this, 'invoice_supplier'); + break; + case 'shipping': + $element = 'expedition/sending'; + break; + default: + $element = $this->element; + } + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_files"; + $sql.= " WHERE filename LIKE '".$this->db->escape($this->ref)."%'"; + $sql.= " AND filepath = '".$element."/".$this->db->escape($this->ref)."' AND entity = ".$conf->entity; + + if (!$this->db->query($sql)) { + $this->error = $this->db->lasterror(); + $this->db->rollback(); + return false; + } + + $this->db->commit(); + return true; + } } diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index af8302d99fe..3c006d8810f 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1232,6 +1232,7 @@ class FormMail extends Form return -1; } else { // If there is no template at all $defaultmessage = ''; + if ($type_template == 'body') { // Special case to use this->withbody as content $defaultmessage = $this->withbody; @@ -1255,6 +1256,10 @@ class FormMail extends Form $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendFichInter"); } elseif ($type_template == 'actioncomm_send') { $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendActionComm"); + } elseif ($type_template == 'thirdparty') { + $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentThirdparty"); + } elseif ($type_template == 'user') { + $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentUser"); } elseif (!empty($type_template)) { $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentGeneric"); } diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index cf9683b4556..184724c0319 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -162,18 +162,19 @@ class Translate * * Value for hash are: 1:Loaded from disk, 2:Not found, 3:Loaded from cache * - * @param string $domain File name to load (.lang file). Must be "file" or "file@module" for module language files: - * If $domain is "file@module" instead of "file" then we look for module lang file - * in htdocs/custom/modules/mymodule/langs/code_CODE/file.lang - * then in htdocs/module/langs/code_CODE/file.lang instead of htdocs/langs/code_CODE/file.lang - * @param integer $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US) - * @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed) - * @param int $forcelangdir To force a different lang directory - * @param int $loadfromfileonly 1=Do not load overwritten translation from file or old conf. - * @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK + * @param string $domain File name to load (.lang file). Must be "file" or "file@module" for module language files: + * If $domain is "file@module" instead of "file" then we look for module lang file + * in htdocs/custom/modules/mymodule/langs/code_CODE/file.lang + * then in htdocs/module/langs/code_CODE/file.lang instead of htdocs/langs/code_CODE/file.lang + * @param integer $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US) + * @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed) + * @param int $forcelangdir To force a different lang directory + * @param int $loadfromfileonly 1=Do not load overwritten translation from file or old conf. + * @param int $forceloadifalreadynotfound Force attempt to reload lang file if it was previously not found + * @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK * @see loadLangs() */ - public function load($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = '', $loadfromfileonly = 0) + public function load($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = '', $loadfromfileonly = 0, $forceloadifalreadynotfound = 0) { global $conf, $db; @@ -204,7 +205,8 @@ class Translate } // Check cache - if (!empty($this->_tab_loaded[$newdomain])) // File already loaded for this domain + if (!empty($this->_tab_loaded[$newdomain]) + && ($this->_tab_loaded[$newdomain] != 2 || empty($forceloadifalreadynotfound))) // File already loaded and found and not forced for this domain { //dol_syslog("Translate::Load already loaded for newdomain=".$newdomain); return 0; diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 47347cce82d..d66c441c79c 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1014,7 +1014,8 @@ class Cronjob extends CommonObject if (!$error) { $result = $langs->load($this->module_name); - $result = $langs->load($this->module_name.'@'.$this->module_name); // If this->module_name was an existing language file, this will make nothing + $result = $langs->load($this->module_name.'@'.$this->module_name, 0, 0, '', 0, 1); + if ($result < 0) // If technical error { dol_syslog(get_class($this)."::run_jobs Cannot load module lang file - ".$langs->error, LOG_ERR); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 6d9b409b41d..f601f483d89 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2006-2012 Laurent Destailleur - * Copyright (C) 2011-2017 Juanjo Menent + * Copyright (C) 2011-2020 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Cedric GROSS * Copyright (C) 2014-2015 Marcos García @@ -1508,6 +1508,9 @@ class Expedition extends CommonObject { $this->db->commit(); + // Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive + $this->deleteEcmFiles(); + // We delete PDFs $ref = dol_sanitizeFileName($this->ref); if (!empty($conf->expedition->dir_output)) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 5c73985cbf8..bca82177381 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2002-2003 Rodolphe Quiedeville * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011-2013 Juanjo Menent + * Copyright (C) 2011-2020 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Charlie Benke * Copyright (C) 2018 Nicolas ZABOURI @@ -1009,6 +1009,9 @@ class Fichinter extends CommonObject if (!$error) { + // Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive + $this->deleteEcmFiles(); + // Remove directory with files $fichinterref = dol_sanitizeFileName($this->ref); if ($conf->ficheinter->dir_output) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 61b523767b0..a2130b6135e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke - * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2010-2018 Philippe Grand * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2013 Florian Henry @@ -2025,6 +2025,9 @@ class CommandeFournisseur extends CommonOrder if (!$error) { + // Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive + $this->deleteEcmFiles(); + // We remove directory $ref = dol_sanitizeFileName($this->ref); if ($conf->fournisseur->commande->dir_output) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index a078b2df022..b824796155e 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2017 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2013-2019 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2016 Marcos García @@ -1188,6 +1188,9 @@ class FactureFournisseur extends CommonInvoice if (!$error) { + // Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive + $this->deleteEcmFiles(); + // We remove directory if ($conf->fournisseur->facture->dir_output) { diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index e44a1d42995..831097ebf48 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -295,13 +295,14 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (21 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2132, 213, '5','0','VAT 5%',1); -- TUNISIA (id country=10) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (101,10, '0','0','VAT Rate 0', 1, 1, '4', 0, 0); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (102,10, '12','0','VAT 12%',1, 1, '4', 0, 0); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (103,10, '18','0','VAT 18%',1, 1, '4', 0, 0); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (104,10, '7.5','0','VAT 6% Majoré à 25% (7.5%)',1, 1, '4', 0, 0); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (105,10, '15','0','VAT 12% Majoré à 25% (15%)',1, 1, '4', 0, 0); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (106,10, '22.5','0','VAT 18% Majoré à 25% (22.5%)',1, 1, '4', 0, 0); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (107,10, '6','0','VAT 6%', 1, 1, '4', 0, 0); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (101,10, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (102,10, '12','0','VAT 12%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (103,10, '18','0','VAT 18%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (104,10, '7.5','0','VAT 6% Majoré à 25% (7.5%)',1); +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); -- 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); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 436dc185479..e59230427f3 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5230,7 +5230,7 @@ class Product extends CommonObject $resql = $this->db->query($sql); if ($resql && $this->db->num_rows($resql) > 0) { $res = $this->db->fetch_array($resql); - $label = ($label_type == 'short' ? $res[$label_type] : 'unit'.$res['code']); + $label = ($label_type == 'short_label' ? $res[$label_type] : 'unit'.$res['code']); $this->db->free($resql); return $label; } else { diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index d2e7f98c35c..1ffd3541344 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -376,7 +376,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ { $obj = $db->fetch_object($resql); $id = $obj->id; - header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withprojet=1'); + header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withproject=1'); exit; } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 5a4b7c77448..a5a489f014b 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2474,7 +2474,15 @@ class Societe extends CommonObject global $action; $hookmanager->initHooks(array('thirdpartydao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array( + 'id'=>$this->id, + 'getnomurl'=>$result, + 'withpicto '=> $withpicto, + 'option'=> $option, + 'maxlen'=> $maxlen, + 'notooltip'=> $notooltip, + 'save_lastsearch_value'=> $save_lastsearch_value + ); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $result = $hookmanager->resPrint; else $result .= $hookmanager->resPrint; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index e9e0a35e623..79b50071a18 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2015 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2010-2018 Philippe Grand * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2013 Florian Henry @@ -2015,6 +2015,9 @@ class SupplierProposal extends CommonObject if (!$error) { + // Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive + $this->deleteEcmFiles(); + // We remove directory $ref = dol_sanitizeFileName($this->ref); if ($conf->supplier_proposal->dir_output && !empty($this->ref))