diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 038120151e3..d7ac591755a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1025,7 +1025,7 @@ if (empty($reshook)) // Replacement invoice if ($_POST['type'] == Facture::TYPE_REPLACEMENT) { - $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($dateinvoice)) { $error++; @@ -1086,7 +1086,7 @@ if (empty($reshook)) $action = 'create'; } - $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($dateinvoice)) { $error++; @@ -1269,7 +1269,7 @@ if (empty($reshook)) // Standard invoice or Deposit invoice, created from a Predefined template invoice if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0) { - $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($dateinvoice)) { $error++; @@ -1320,7 +1320,7 @@ if (empty($reshook)) $action = 'create'; } - $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($dateinvoice)) { $error++; @@ -1745,7 +1745,7 @@ if (empty($reshook)) // Situation invoices if (GETPOST('type') == Facture::TYPE_SITUATION && (!empty($_POST['situations']))) { - $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($datefacture)) { $error++; $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")); diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 776c535d586..cdad3fcced6 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -157,9 +157,14 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) $tplcontent .= ''."\n"; $tplcontent .= ''."\n"; $tplcontent .= ''."\n"; + // Add canonical reference + if ($object->virtualhost) { + $tplcontent .= ''."\n"; + } // Add translation reference (main language) if ($object->isMultiLang()) { // Add myself + $tplcontent .= 'pageurl.'.php") { ?>'."\n"; $tplcontent .= ''."\n"; // Add page "translation of" @@ -194,10 +199,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) } } else dol_print_error($db); - } - // Add canonical reference - if ($object->virtualhost) { - $tplcontent .= ''."\n"; + $tplcontent .= ''."\n"; } // Add manifest.json on homepage $tplcontent .= 'use_manifest) { print \'\'."\n"; } ?>'."\n"; diff --git a/htdocs/datapolicy/class/datapolicycron.class.php b/htdocs/datapolicy/class/datapolicycron.class.php index 409df1362e9..8e3cfe10874 100644 --- a/htdocs/datapolicy/class/datapolicycron.class.php +++ b/htdocs/datapolicy/class/datapolicycron.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 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 @@ -482,7 +482,7 @@ class DataPolicyCron while ($i < $num && !$error) { - $obj = $db->fetch_object($resql); + $obj = $this->db->fetch_object($resql); $object->fetch($obj->rowid); $object->id = $obj->rowid; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 05cb43fceb8..7a3d3f02ae7 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -644,7 +644,7 @@ if (empty($reshook)) $ret = $extrafields->setOptionalsFromPost(null, $object); if ($ret < 0) $error++; - $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $datedue = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']); // Replacement invoice @@ -1758,7 +1758,7 @@ if ($action == 'create') if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; } - $datetmp = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $datetmp = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp); $datetmp = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']); $datedue = ($datetmp == '' ?-1 : $datetmp); @@ -1772,7 +1772,7 @@ if ($action == 'create') $cond_reglement_id = $societe->cond_reglement_supplier_id; $mode_reglement_id = $societe->mode_reglement_supplier_id; $fk_account = $societe->fk_account; - $datetmp = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $datetmp = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp); $datetmp = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']); $datedue = ($datetmp == '' ?-1 : $datetmp); diff --git a/htdocs/index.php b/htdocs/index.php index 48e87ee6829..932bf5919e7 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -437,7 +437,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->socid && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) { include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; $board = new RemiseCheque($db); - $dashboardlines['RemiseCheque'] = $board->load_board($user); + $dashboardlines[$board->element] = $board->load_board($user); } // Number of foundation members @@ -452,21 +452,21 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->approve) { include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; $board = new ExpenseReport($db); - $dashboardlines['ExpenseReport'] = $board->load_board($user, 'toapprove'); + $dashboardlines[$board->element . '_toapprove'] = $board->load_board($user, 'toapprove'); } // Number of expense reports to pay if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->to_paid) { include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; $board = new ExpenseReport($db); - $dashboardlines['ExpenseReport'] = $board->load_board($user, 'topay'); + $dashboardlines[$board->element . '_topay'] = $board->load_board($user, 'topay'); } // Number of holidays to approve if (!empty($conf->holiday->enabled) && $user->rights->holiday->approve) { include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; $board = new Holiday($db); - $dashboardlines['Holiday'] = $board->load_board($user); + $dashboardlines[$board->element] = $board->load_board($user); } $object = new stdClass(); @@ -551,28 +551,28 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { array( 'groupName' => 'BankAccount', 'stats' => - array('bank_account', 'RemiseCheque'), + array('bank_account', 'chequereceipt'), ), - 'Adherent' => + 'member' => array( 'groupName' => 'Members', 'globalStatsKey' => 'members', 'stats' => - array('member_shift', 'member_expired'), + array('member_shift', 'member_expired'), ), - 'ExpenseReport' => + 'expensereport' => array( 'groupName' => 'ExpenseReport', 'globalStatsKey' => 'expensereports', 'stats' => - array('ExpenseReport'), + array('expensereport_toapprove', 'expensereport_topay'), ), - 'Holiday' => + 'holiday' => array( 'groupName' => 'Holidays', 'globalStatsKey' => 'holidays', 'stats' => - array('Holiday'), + array('holiday'), ), ); diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index e2112b020b0..96506120263 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -252,6 +252,7 @@ ALTER TABLE llx_blockedlog ADD COLUMN object_version varchar(32) DEFAULT ''; ALTER TABLE llx_product_lot MODIFY COLUMN batch varchar(128); ALTER TABLE llx_product_batch MODIFY COLUMN batch varchar(128); +ALTER TABLE llx_expeditiondet_batch MODIFY COLUMN batch varchar(128); ALTER TABLE llx_commande_fournisseur_dispatch MODIFY COLUMN batch varchar(128); ALTER TABLE llx_stock_mouvement MODIFY COLUMN batch varchar(128); ALTER TABLE llx_mrp_production MODIFY COLUMN batch varchar(128); diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index ce152317710..0aa5b2dbf62 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015-2018 Frederic France + * Copyright (C) 2015-2020 Frederic 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 @@ -40,6 +40,11 @@ class PaymentLoan extends CommonObject */ public $table_element = 'payment_loan'; + /** + * @var string String with name of icon for PaymentLoan + */ + public $picto = 'money-bill-alt'; + /** * @var int Loan ID */ diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index ade71d73f39..2b734f037b3 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -235,7 +235,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES .bg-infobox-bank_account{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infobox-adherent{ +.bg-infobox-adherent, .bg-infobox-member { color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } .bg-infobox-expensereport{ @@ -273,7 +273,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES .fa-dol-bank_account:before { content: "\f19c"; } -.fa-dol-adherent:before { +.fa-dol-member:before { content: "\f0c0"; } .fa-dol-expensereport:before { diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index 2dec0087a1b..f2a2a8b810d 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -34,7 +34,7 @@ if (!empty($conf->global->THEME_INFOBOX_COLOR_ON_BACKGROUND)) $prefix = 'backgro .bg-infobox-bank_account{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infobox-adherent{ +.bg-infobox-adherent, .bg-infobox-member{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } .bg-infobox-expensereport{ @@ -258,7 +258,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES .bg-infobox-bank_account i.fa{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infobox-adherent i.fa{ +.bg-infobox-adherent i.fa, .bg-infobox-member i.fa{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } .bg-infobox-expensereport i.fa{ @@ -296,7 +296,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES .fa-dol-bank_account:before { content: "\f19c"; } -.fa-dol-adherent:before { +.fa-dol-member:before { content: "\f0c0"; } .fa-dol-expensereport:before { diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 118953c25ad..b67f56db935 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -71,12 +71,12 @@ class ProductCombination */ public $entity; - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct(DoliDB $db) + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct(DoliDB $db) { global $conf; @@ -189,16 +189,16 @@ class ProductCombination */ public function countNbOfCombinationForFkProductParent($fk_product_parent) { - $nb = 0; - $sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."product_attribute_combination WHERE fk_product_parent = ".(int) $fk_product_parent." AND entity IN (".getEntity('product').")"; + $nb = 0; + $sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."product_attribute_combination WHERE fk_product_parent = ".(int) $fk_product_parent." AND entity IN (".getEntity('product').")"; - $resql = $this->db->query($sql); - if ($resql) { - $obj = $this->db->fetch_object($resql); - if ($obj) $nb = $obj->nb; - } + $resql = $this->db->query($sql); + if ($resql) { + $obj = $this->db->fetch_object($resql); + if ($obj) $nb = $obj->nb; + } - return $nb; + return $nb; } /** @@ -326,20 +326,20 @@ class ProductCombination $child = new Product($this->db); $child->fetch($this->fk_product_child); - - $child->price_autogen = $parent->price_autogen; + + $child->price_autogen = $parent->price_autogen; $child->weight = $parent->weight; if ($this->variation_weight) { // If we must add a delta on weight $child->weight = ($child->weight ? $child->weight : 0) + $this->variation_weight; } - $child->weight_units = $parent->weight_units; + $child->weight_units = $parent->weight_units; - // Don't update the child label if the user has already modified it. - if ($child->label == $parent->label) { - // This will trigger only at variant creation time - $varlabel = $this->getCombinationLabel($this->fk_product_child); - $child->label = $parent->label.$varlabel;; - } + // Don't update the child label if the user has already modified it. + if ($child->label == $parent->label) { + // This will trigger only at variant creation time + $varlabel = $this->getCombinationLabel($this->fk_product_child); + $child->label = $parent->label.$varlabel;; + } if ($child->update($child->id, $user) > 0) { $new_vat = $parent->tva_tx; @@ -536,9 +536,9 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; $newproduct->ref = $forced_refvar; } } else { - $forced_refvar = false; - $existingProduct = false; - $newproduct = clone $product; + $forced_refvar = false; + $existingProduct = false; + $newproduct = clone $product; } //Final weight impact @@ -599,11 +599,11 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; } if ($forced_refvar === false) { - if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) { + if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) { $newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR.$prodattrval->ref; - } else { + } else { $newproduct->ref .= '_'.$prodattrval->ref; - } + } } //The first one should not contain a linebreak @@ -622,62 +622,62 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; // Now create the product //print 'Create prod '.$newproduct->ref.'
'."\n"; if ($existingProduct === false) { - //To avoid wrong information in price history log - $newproduct->price = 0; - $newproduct->price_ttc = 0; - $newproduct->price_min = 0; - $newproduct->price_min_ttc = 0; + //To avoid wrong information in price history log + $newproduct->price = 0; + $newproduct->price_ttc = 0; + $newproduct->price_min = 0; + $newproduct->price_min_ttc = 0; - // A new variant must use a new barcode (not same product) - $newproduct->barcode = -1; - $result = $newproduct->create($user); + // A new variant must use a new barcode (not same product) + $newproduct->barcode = -1; + $result = $newproduct->create($user); - if ($result < 0) - { - //In case the error is not related with an already existing product - if ($newproduct->error != 'ErrorProductAlreadyExists') { - $this->error[] = $newproduct->error; - $this->errors = $newproduct->errors; - $db->rollback(); - return -1; - } + if ($result < 0) + { + //In case the error is not related with an already existing product + if ($newproduct->error != 'ErrorProductAlreadyExists') { + $this->error[] = $newproduct->error; + $this->errors = $newproduct->errors; + $db->rollback(); + return -1; + } - /** - * If there is an existing combination, then we update the prices and weight - * Otherwise, we try adding a random number to the ref - */ + /** + * If there is an existing combination, then we update the prices and weight + * Otherwise, we try adding a random number to the ref + */ - if ($newcomb->fk_product_child) { - $res = $newproduct->fetch($existingCombination->fk_product_child); - } else { - $orig_prod_ref = $newproduct->ref; - $i = 1; + if ($newcomb->fk_product_child) { + $res = $newproduct->fetch($existingCombination->fk_product_child); + } else { + $orig_prod_ref = $newproduct->ref; + $i = 1; - do { - $newproduct->ref = $orig_prod_ref.$i; - $res = $newproduct->create($user); + do { + $newproduct->ref = $orig_prod_ref.$i; + $res = $newproduct->create($user); - if ($newproduct->error != 'ErrorProductAlreadyExists') { - $this->errors[] = $newproduct->error; - break; - } + if ($newproduct->error != 'ErrorProductAlreadyExists') { + $this->errors[] = $newproduct->error; + break; + } - $i++; - } while ($res < 0); - } + $i++; + } while ($res < 0); + } - if ($res < 0) { - $db->rollback(); - return -1; - } - } + if ($res < 0) { + $db->rollback(); + return -1; + } + } } else { - $result = $newproduct->update($newproduct->id, $user); - if ($result < 0) - { - $db->rollback(); - return -1; - } + $result = $newproduct->update($newproduct->id, $user); + if ($result < 0) + { + $db->rollback(); + return -1; + } } $newcomb->fk_product_child = $newproduct->id; @@ -692,14 +692,14 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; return $newproduct->id; } - /** - * Copies all product combinations from the origin product to the destination product - * + /** + * Copies all product combinations from the origin product to the destination product + * * @param User $user Object user - * @param int $origProductId Origin product id - * @param Product $destProduct Destination product - * @return int >0 OK <0 KO - */ + * @param int $origProductId Origin product id + * @param Product $destProduct Destination product + * @return int >0 OK <0 KO + */ public function copyAll(User $user, $origProductId, Product $destProduct) { require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination2ValuePair.class.php'; @@ -721,7 +721,7 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; $variations[$tmp_pc2v->fk_prod_attr] = $tmp_pc2v->fk_prod_attr_val; } - if ($this->createProductCombination( + if ($this->createProductCombination( $user, $destProduct, $variations, @@ -729,7 +729,7 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; $combination->variation_price_percentage, $combination->variation_price, $combination->variation_weight - ) < 0) + ) < 0) { return -1; }