diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 7624d393ed7b8..90708a27b9c3b 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1277,6 +1277,15 @@ } } + $info_bits = 0; + if ($tva_npr) { + $info_bits |= 0x01; + } + + // Local Taxes + $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $tva_npr); + $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $tva_npr); + // Margin $fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); $buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we muste keep this value @@ -1289,7 +1298,7 @@ $pu_equivalent_ttc = $pu_ttc; $currency_tx = $object->multicurrency_tx; - // Check if we have a foreing currency + // Check if we have a foreign currency // If so, we update the pu_equiv as the equivalent price in base currency if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { $pu_equivalent = $pu_ht_devise * $currency_tx; @@ -1298,25 +1307,28 @@ $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx; } - // Local Taxes - $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $tva_npr); - $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $tva_npr); - - $info_bits = 0; - if ($tva_npr) { - $info_bits |= 0x01; - } + // TODO $pu_equivalent or $pu_equivalent_ttc must be calculated from the one not null taking into account all taxes + /* + if ($pu_equivalent) { + $tmp = calcul_price_total(1, $pu_equivalent, 0, $tva_tx, -1, -1, 0, 'HT', $info_bits, $type); + $pu_equivalent_ttc = ... + } else { + $tmp = calcul_price_total(1, $pu_equivalent_ttc, 0, $tva_tx, -1, -1, 0, 'TTC', $info_bits, $type); + $pu_equivalent_ht = ... + } + */ //var_dump(price2num($price_min)); var_dump(price2num($pu_ht)); var_dump($remise_percent); //var_dump(price2num($price_min_ttc)); var_dump(price2num($pu_ttc)); var_dump($remise_percent);exit; + // Check price is not lower than minimum if ($usermustrespectpricemin) { if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - $remise_percent / 100)) < price2num($price_min))) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; } elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc))) { - $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); + $mesg = $langs->trans("CantBeLessThanMinPriceInclTax", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; } @@ -1385,15 +1397,16 @@ } } elseif ($action == 'updateline' && $usercancreate && GETPOST('save')) { // Update a line within proposal + + // Clean parameters + $description = dol_htmlcleanlastbr(GETPOST('product_desc', 'restricthtml')); + // Define info_bits $info_bits = 0; if (preg_match('/\*/', GETPOST('tva_tx'))) { $info_bits |= 0x01; } - // Clean parameters - $description = dol_htmlcleanlastbr(GETPOST('product_desc', 'restricthtml')); - // Define vat_rate $vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); $vat_rate = str_replace('*', '', $vat_rate); @@ -1420,9 +1433,10 @@ // Prepare a price equivalent for minimum price check $pu_equivalent = $pu_ht; $pu_equivalent_ttc = $pu_ttc; + $currency_tx = $object->multicurrency_tx; - // Check if we have a foreing currency + // Check if we have a foreign currency // If so, we update the pu_equiv as the equivalent price in base currency if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { $pu_equivalent = $pu_ht_devise * $currency_tx; @@ -1431,6 +1445,17 @@ $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx; } + // TODO $pu_equivalent or $pu_equivalent_ttc must be calculated from the one not null taking into account all taxes + /* + if ($pu_equivalent) { + $tmp = calcul_price_total(1, $pu_equivalent, 0, $vat_rate, -1, -1, 0, 'HT', $info_bits, $type); + $pu_equivalent_ttc = ... + } else { + $tmp = calcul_price_total(1, $pu_equivalent_ttc, 0, $vat_rate, -1, -1, 0, 'TTC', $info_bits, $type); + $pu_equivalent_ht = ... + } + */ + // Extrafields $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); $array_options = $extrafields->getOptionalsFromPost($object->table_element_line); @@ -1469,6 +1494,7 @@ //var_dump(price2num($price_min)); var_dump(price2num($pu_ht)); var_dump($remise_percent); //var_dump(price2num($price_min_ttc)); var_dump(price2num($pu_ttc)); var_dump($remise_percent);exit; + // Check price is not lower than minimum if ($usermustrespectpricemin) { if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - (float) $remise_percent / 100)) < price2num($price_min))) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); @@ -1476,7 +1502,7 @@ $error++; $action = 'editline'; } elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - (float) $remise_percent / 100)) < price2num($price_min_ttc))) { - $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); + $mesg = $langs->trans("CantBeLessThanMinPriceInclTax", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; $action = 'editline'; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index bbfe0a544bc3e..7ab04fc4fe75a 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -981,6 +981,15 @@ } } + $info_bits = 0; + if ($tva_npr) { + $info_bits |= 0x01; + } + + // Local Taxes + $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty); + $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty); + // Margin $fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); $buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we muste keep this value @@ -988,9 +997,10 @@ // Prepare a price equivalent for minimum price check $pu_equivalent = $pu_ht; $pu_equivalent_ttc = $pu_ttc; + $currency_tx = $object->multicurrency_tx; - // Check if we have a foreing currency + // Check if we have a foreign currency // If so, we update the pu_equiv as the equivalent price in base currency if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { $pu_equivalent = $pu_ht_devise * $currency_tx; @@ -999,24 +1009,27 @@ $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx; } - // Local Taxes - $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty); - $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty); - - $info_bits = 0; - if ($tva_npr) { - $info_bits |= 0x01; + // TODO $pu_equivalent or $pu_equivalent_ttc must be calculated from the one defined + /* + if ($pu_equivalent) { + $tmp = calcul_price_total(1, $pu_equivalent, 0, $tva_tx, -1, -1, 0, 'HT', $info_bits, $type); + $pu_equivalent_ttc = ... + } else { + $tmp = calcul_price_total(1, $pu_equivalent_ttc, 0, $tva_tx, -1, -1, 0, 'TTC', $info_bits, $type); + $pu_equivalent_ht = ... } + */ $desc = dol_htmlcleanlastbr($desc); + // Check price is not lower than minimum if ($usermustrespectpricemin) { if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - $remise_percent / 100)) < price2num($price_min))) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; } elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc))) { - $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); + $mesg = $langs->trans("CantBeLessThanMinPriceInclTax", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; } @@ -1089,10 +1102,20 @@ $date_end = ''; $date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); $date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); + $description = dol_htmlcleanlastbr(GETPOST('product_desc', 'restricthtml')); + + // Define info_bits + $info_bits = 0; + if (preg_match('/\*/', GETPOST('tva_tx'))) { + $info_bits |= 0x01; + } + + // Define vat_rate $vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx', 'alpha') : 0); $vat_rate = str_replace('*', '', $vat_rate); - + $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc); + $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty, $mysoc); $pu_ht = price2num(GETPOST('price_ht'), '', 2); $pu_ttc = price2num(GETPOST('price_ttc'), '', 2); @@ -1104,9 +1127,10 @@ // Prepare a price equivalent for minimum price check $pu_equivalent = $pu_ht; $pu_equivalent_ttc = $pu_ttc; + $currency_tx = $object->multicurrency_tx; - // Check if we have a foreing currency + // Check if we have a foreign currency // If so, we update the pu_equiv as the equivalent price in base currency if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { $pu_equivalent = $pu_ht_devise * $currency_tx; @@ -1115,16 +1139,16 @@ $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx; } - // Define info_bits - $info_bits = 0; - if (preg_match('/\*/', $vat_rate)) { - $info_bits |= 0x01; - } - - // Define vat_rate - $vat_rate = str_replace('*', '', $vat_rate); - $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc); - $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty, $mysoc); + // TODO $pu_equivalent or $pu_equivalent_ttc must be calculated from the one not null taking into account all taxes + /* + if ($pu_equivalent) { + $tmp = calcul_price_total(1, $pu_equivalent, 0, $vat_rate, -1, -1, 0, 'HT', $info_bits, $type); + $pu_equivalent_ttc = ... + } else { + $tmp = calcul_price_total(1, $pu_equivalent_ttc, 0, $vat_rate, -1, -1, 0, 'TTC', $info_bits, $type); + $pu_equivalent_ht = ... + } + */ // Add buying price $fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : ''); @@ -1167,6 +1191,7 @@ $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); + // Check price is not lower than minimum if ($usermustrespectpricemin) { if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - $remise_percent / 100)) < price2num($price_min))) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); @@ -1174,7 +1199,7 @@ $error++; $action = 'editline'; } elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc))) { - $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); + $mesg = $langs->trans("CantBeLessThanMinPriceInclTax", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; $action = 'editline'; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 2a571e355dab8..91864f3e363b0 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2181,6 +2181,7 @@ $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); // Set unit price to use + // TODO We should not have this if (!empty($price_ht) || $price_ht === '0') { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); @@ -2287,29 +2288,55 @@ $type = GETPOST('type'); $fk_unit = GETPOST('units', 'alpha'); - $pu_ht_devise = price2num($price_ht_devise, 'MU'); - $pu_ttc_devise = price2num($price_ttc_devise, 'MU'); - if ($pu_ttc && !$pu_ht) { $price_base_type = 'TTC'; } } - $pu_ht_devise = price2num($price_ht_devise, 'MU'); - - // Margin - $fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); - $buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value + // Define info_bits + $info_bits = 0; + if ($tva_npr) { + $info_bits |= 0x01; + } // Local Taxes $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); - $info_bits = 0; - if ($tva_npr) { - $info_bits |= 0x01; + $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2); + $pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2); + + // Prepare a price equivalent for minimum price check + $pu_equivalent = $pu_ht; + $pu_equivalent_ttc = $pu_ttc; + + $currency_tx = $object->multicurrency_tx; + + // Check if we have a foreign currency + // If so, we update the pu_equiv as the equivalent price in base currency + if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { + $pu_equivalent = $pu_ht_devise * $currency_tx; + } + if ($pu_ttc == '' && $pu_ttc_devise != '' && $currency_tx != '') { + $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx; } + // TODO $pu_equivalent or $pu_equivalent_ttc must be calculated from the one not null taking into account all taxes + /* + if ($pu_equivalent) { + $tmp = calcul_price_total(1, $pu_equivalent, 0, $tva_tx, -1, -1, 0, 'HT', $info_bits, $type); + $pu_equivalent_ttc = ... + } else { + $tmp = calcul_price_total(1, $pu_equivalent_ttc, 0, $tva_tx, -1, -1, 0, 'TTC', $info_bits, $type); + $pu_equivalent_ht = ... + } + */ + + // Margin + $fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); + $buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value + + $price2num_pu_ht = price2num($pu_ht); $price2num_remise_percent = price2num($remise_percent); $price2num_price_min = price2num($price_min); @@ -2329,12 +2356,12 @@ // Check price is not lower than minimum (check is done only for standard or replacement invoices) if ($usermustrespectpricemin && ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT)) { - if ($pu_ht && $price_min && ((price2num($pu_ht) * (1 - $remise_percent / 100)) < price2num($price_min))) { + if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - $remise_percent / 100)) < price2num($price_min))) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; - } elseif ($pu_ttc && $price_min_ttc && ((price2num($pu_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc))) { - $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); + } elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc))) { + $mesg = $langs->trans("CantBeLessThanMinPriceInclTax", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; } @@ -2457,6 +2484,32 @@ $fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : ''); $buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value + // Prepare a price equivalent for minimum price check + $pu_equivalent = $pu_ht; + $pu_equivalent_ttc = $pu_ttc; + + $currency_tx = $object->multicurrency_tx; + + // Check if we have a foreign currency + // If so, we update the pu_equiv as the equivalent price in base currency + if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { + $pu_equivalent = $pu_ht_devise * $currency_tx; + } + if ($pu_ttc == '' && $pu_ttc_devise != '' && $currency_tx != '') { + $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx; + } + + // TODO $pu_equivalent or $pu_equivalent_ttc must be calculated from the one not null taking into account all taxes + /* + if ($pu_equivalent) { + $tmp = calcul_price_total(1, $pu_equivalent, 0, $vat_rate, -1, -1, 0, 'HT', $info_bits, $type); + $pu_equivalent_ttc = ... + } else { + $tmp = calcul_price_total(1, $pu_equivalent_ttc, 0, $vat_rate, -1, -1, 0, 'TTC', $info_bits, $type); + $pu_equivalent_ht = ... + } + */ + // Extrafields $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); $array_options = $extrafields->getOptionalsFromPost($object->table_element_line); @@ -2522,13 +2575,13 @@ // Check price is not lower than minimum (check is done only for standard or replacement invoices) if ($usermustrespectpricemin && ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT)) { - if ($pu_ht && $price_min && (((float) price2num($pu_ht) * (1 - (float) $remise_percent / 100)) < (float) price2num($price_min))) { + if ($pu_equivalent && $price_min && (((float) price2num($pu_equivalent) * (1 - (float) $remise_percent / 100)) < (float) price2num($price_min))) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; $action = 'editline'; - } elseif ($pu_ttc && $price_min_ttc && ((price2num($pu_ttc) * (1 - (float) $remise_percent / 100)) < price2num($price_min_ttc))) { - $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); + } elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - (float) $remise_percent / 100)) < price2num($price_min_ttc))) { + $mesg = $langs->trans("CantBeLessThanMinPriceInclTax", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; $action = 'editline'; diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index abd120ce57305..67e3faf967567 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -86,11 +86,11 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf } $key = 'MAIN_AGENDA_ACTIONAUTO_'.$action; - //var_dump($action.' - '.$conf->global->$key);exit; + //var_dump($action.' - '.$key.' - '.$conf->global->$key);exit; // Do not log events not enabled for this action // GUI allow to set this option only if entry exists into table llx_c_action_trigger - if (empty($conf->global->$key)) { + if (!getDolGlobalString($key)) { return 0; } diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index f74e51d9b6683..fea6f43be081d 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -563,7 +563,7 @@ public function validate($user, $notrigger = 0) if (!$error && !$notrigger) { // Call trigger - $result = $this->call_trigger('EVALUATION_VALIDATE', $user); + $result = $this->call_trigger('HRM_EVALUATION_VALIDATE', $user); if ($result < 0) { $error++; } @@ -665,9 +665,7 @@ public function setDraft($user, $notrigger = 0) return 0; } - - - return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'EVALUATION_UNVALIDATE'); + return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'HRM_EVALUATION_UNVALIDATE'); } /** @@ -684,9 +682,7 @@ public function cancel($user, $notrigger = 0) return 0; } - - - return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'EVALUATION_CANCEL'); + return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'HRM_EVALUATION_CANCEL'); } /** @@ -703,9 +699,7 @@ public function reopen($user, $notrigger = 0) return 0; } - - - return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'EVALUATION_REOPEN'); + return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'HRM_EVALUATION_REOPEN'); } /** diff --git a/htdocs/hrm/class/evaluationdet.class.php b/htdocs/hrm/class/evaluationdet.class.php index 8b1b26b2441d4..ebeab0af4f61d 100644 --- a/htdocs/hrm/class/evaluationdet.class.php +++ b/htdocs/hrm/class/evaluationdet.class.php @@ -542,7 +542,7 @@ public function validate($user, $notrigger = 0) if (!$error && !$notrigger) { // Call trigger - $result = $this->call_trigger('EVALUATIONLINE_VALIDATE', $user); + $result = $this->call_trigger('HRM_EVALUATIONLINE_VALIDATE', $user); if ($result < 0) { $error++; } diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index d54e0c2183fc3..6ba4a536855a0 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -540,7 +540,7 @@ public function validate($user, $notrigger = 0) if (!$error && !$notrigger) { // Call trigger - $result = $this->call_trigger('JOB_VALIDATE', $user); + $result = $this->call_trigger('HRM_JOB_VALIDATE', $user); if ($result < 0) { $error++; } diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index fcf3caa1a7cbf..d6384e05badf3 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -550,7 +550,7 @@ public function validate($user, $notrigger = 0) if (!$error && !$notrigger) { // Call trigger - $result = $this->call_trigger('POSITION_VALIDATE', $user); + $result = $this->call_trigger('HRM_POSITION_VALIDATE', $user); if ($result < 0) { $error++; } diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 08b0b03d6b767..4123cf9bb6591 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -608,7 +608,7 @@ public function validate($user, $notrigger = 0) if (!$error && !$notrigger) { // Call trigger - $result = $this->call_trigger('SKILL_VALIDATE', $user); + $result = $this->call_trigger('HRM_SKILL_VALIDATE', $user); if ($result < 0) { $error++; } diff --git a/htdocs/hrm/class/skilldet.class.php b/htdocs/hrm/class/skilldet.class.php index 5806d6189a3a7..9f19bbf7459f9 100644 --- a/htdocs/hrm/class/skilldet.class.php +++ b/htdocs/hrm/class/skilldet.class.php @@ -531,7 +531,7 @@ public function validate($user, $notrigger = 0) if (!$error && !$notrigger) { // Call trigger - $result = $this->call_trigger('SKILLDET_VALIDATE', $user); + $result = $this->call_trigger('HRM_SKILLDET_VALIDATE', $user); if ($result < 0) { $error++; } diff --git a/htdocs/hrm/class/skillrank.class.php b/htdocs/hrm/class/skillrank.class.php index f6770d4762189..384a95ac1a08f 100644 --- a/htdocs/hrm/class/skillrank.class.php +++ b/htdocs/hrm/class/skillrank.class.php @@ -570,7 +570,7 @@ public function validate($user, $notrigger = 0) if (!$error && !$notrigger) { // Call trigger - $result = $this->call_trigger('SKILLRANK_VALIDATE', $user); + $result = $this->call_trigger('HRM_SKILLRANK_VALIDATE', $user); if ($result < 0) { $error++; } diff --git a/htdocs/hrm/evaluation_card.php b/htdocs/hrm/evaluation_card.php index 3bcbe7d79080f..38725256e6579 100644 --- a/htdocs/hrm/evaluation_card.php +++ b/htdocs/hrm/evaluation_card.php @@ -125,7 +125,7 @@ } } - $triggermodname = 'hrm_EVALUATION_MODIFY'; // Name of trigger action code to execute when we modify record + $triggermodname = 'HRM_EVALUATION_MODIFY'; // Name of trigger action code to execute when we modify record // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; @@ -150,7 +150,7 @@ } // Actions to send emails - $triggersendname = 'hrm_EVALUATION_SENTBYMAIL'; + $triggersendname = 'HRM_EVALUATION_SENTBYMAIL'; $autocopy = 'MAIN_MAIL_AUTOCOPY_EVALUATION_TO'; $trackid = 'evaluation'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; diff --git a/htdocs/hrm/job_card.php b/htdocs/hrm/job_card.php index 7f50ae45f2d7a..89c8c0a2412b7 100644 --- a/htdocs/hrm/job_card.php +++ b/htdocs/hrm/job_card.php @@ -116,7 +116,7 @@ } } - $triggermodname = 'hrm_JOB_MODIFY'; // Name of trigger action code to execute when we modify record + $triggermodname = 'HRM_JOB_MODIFY'; // Name of trigger action code to execute when we modify record // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen @@ -142,7 +142,7 @@ } // Actions to send emails - $triggersendname = 'hrm_JOB_SENTBYMAIL'; + $triggersendname = 'HRM_JOB_SENTBYMAIL'; $autocopy = 'MAIN_MAIL_AUTOCOPY_JOB_TO'; $trackid = 'job' . $object->id; include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php'; diff --git a/htdocs/hrm/position_card.php b/htdocs/hrm/position_card.php index d46548a4693db..15e01079200b2 100644 --- a/htdocs/hrm/position_card.php +++ b/htdocs/hrm/position_card.php @@ -142,7 +142,7 @@ } } - $triggermodname = 'hrm_POSITION_MODIFY'; // Name of trigger action code to execute when we modify record + $triggermodname = 'HRM_POSITION_MODIFY'; // Name of trigger action code to execute when we modify record // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php'; @@ -167,7 +167,7 @@ } // Actions to send emails - $triggersendname = 'hrm_POSITION_SENTBYMAIL'; + $triggersendname = 'HRM_POSITION_SENTBYMAIL'; $autocopy = 'MAIN_MAIL_AUTOCOPY_POSITION_TO'; $trackid = 'position' . $object->id; include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php'; diff --git a/htdocs/hrm/skill_card.php b/htdocs/hrm/skill_card.php index de662255d6f1a..da60233329608 100644 --- a/htdocs/hrm/skill_card.php +++ b/htdocs/hrm/skill_card.php @@ -124,7 +124,7 @@ } } - $triggermodname = 'hrm_SKILL_MODIFY'; // Name of trigger action code to execute when we modify record + $triggermodname = 'HRM_SKILL_MODIFY'; // Name of trigger action code to execute when we modify record // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index a5427b60fe232..958a0c65797e1 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -181,6 +181,13 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_CANCEL','Holiday canceled','Executed when a holiday is canceled','holiday',802); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_DELETE','Holiday deleted','Executed when a holiday is deleted','holiday',804); +-- hrm +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HRM_EVALUATION_CREATE', 'HR Evaluation created', 'Executed when an evaluation is created', 'hrm', 4000); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HRM_EVALUATION_MODIFY', 'HR Evaluation modified', 'Executed when an evaluation is modified', 'hrm', 4001); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HRM_EVALUATION_VALIDATE', 'HR Evaluation validated', 'Executed when an evaluation is validated', 'hrm', 4002); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HRM_EVALUATION_UNVALIDATE', 'HR Evaluation back to draft', 'Executed when an evaluation is back to draft', 'hrm', 4003); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HRM_EVALUATION_DELETE', 'HR Evaluation deleted', 'Executed when an evaluation is dleted', 'hrm', 4005); + -- facture rec insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_CREATE','Template invoices created','Executed when a Template invoices is created','facturerec',900); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_MODIFY','Template invoices update','Executed when a Template invoices is updated','facturerec',901); diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql index 3e44428b2867d..76857a50989d8 100644 --- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -556,3 +556,10 @@ insert into llx_c_holiday_types(code, label, affect, delay, newbymonth, fk_count insert into llx_c_holiday_types(code, label, affect, delay, newbymonth, fk_country, sortorder, active) values ('DIS', 'Άδειες αναπήρων(30 ημέρες με αποδοχές)', 0, 0, 0, 102, 38, 0); insert into llx_c_holiday_types(code, label, affect, delay, newbymonth, fk_country, sortorder, active) values ('SE', 'Άδεια εξετάσεων μαθητών, σπουδαστών, φοιτητών(30 ημέρες χωρίς αποδοχές)', 0, 0, 0, 102, 39, 0); insert into llx_c_holiday_types(code, label, affect, delay, newbymonth, fk_country, sortorder, active) values ('NOT PAID', 'Άδεια άνευ αποδοχών(έως ένα (1) έτος)', 0, 0, 0, 102, 40, 0); + +-- hrm triggers +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HRM_EVALUATION_CREATE', 'HR Evaluation created', 'Executed when an evaluation is created', 'hrm', 4000); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HRM_EVALUATION_MODIFY', 'HR Evaluation modified', 'Executed when an evaluation is modified', 'hrm', 4001); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HRM_EVALUATION_VALIDATE', 'HR Evaluation validated', 'Executed when an evaluation is validated', 'hrm', 4002); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HRM_EVALUATION_UNVALIDATE', 'HR Evaluation back to draft', 'Executed when an evaluation is back to draft', 'hrm', 4003); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HRM_EVALUATION_DELETE', 'HR Evaluation deleted', 'Executed when an evaluation is dleted', 'hrm', 4005); diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index db290a2b9fa98..4d296f0c79da7 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -82,6 +82,7 @@ NewPrice=New price MinPrice=Min. selling price EditSellingPriceLabel=Edit selling price label CantBeLessThanMinPrice=The selling price can't be lower than minimum allowed for this product (%s without tax). This message can also appears if you type a too important discount. +CantBeLessThanMinPriceInclTax=The selling price can't be lower than minimum allowed for this product (%s including taxes). This message can also appears if you type a too important discount. ContractStatusClosed=Closed ErrorProductAlreadyExists=A product with reference %s already exists. ErrorProductBadRefOrLabel=Wrong value for reference or label. diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 6423e66cc1d4a..c9ac61c28d0f7 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -82,6 +82,7 @@ NewPrice=Nouveau prix MinPrice=Prix de vente min. EditSellingPriceLabel=Modifier le libellé du prix de vente CantBeLessThanMinPrice=Le prix de vente ne doit pas être inférieur au minimum pour ce produit (%s HT). Ce message peut aussi être provoqué par une remise trop importante. +CantBeLessThanMinPriceInclTax=Le prix de vente ne doit pas être inférieur au minimum pour ce produit (%s TTC). Ce message peut aussi être provoqué par une remise trop importante. ContractStatusClosed=Clôturé ErrorProductAlreadyExists=Un produit avec la référence %s existe déjà. ErrorProductBadRefOrLabel=La valeur de la référence ou du libellé est incorrecte. diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 50c6227521a91..90ce81b991d20 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -699,7 +699,7 @@ public function setDraft($user, $notrigger = 0) return -1; }*/ - return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'MYOBJECT_UNVALIDATE'); + return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'MYMODULE_MYOBJECT_UNVALIDATE'); } /** @@ -723,7 +723,7 @@ public function cancel($user, $notrigger = 0) return -1; }*/ - return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'MYOBJECT_CANCEL'); + return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'MYMODULE_MYOBJECT_CANCEL'); } /** @@ -747,8 +747,7 @@ public function reopen($user, $notrigger = 0) return -1; }*/ - - return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'MYOBJECT_REOPEN'); + return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'MYMODULE_MYOBJECT_REOPEN'); } /**