diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 55271091db1..48247bf0b8e 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -518,7 +518,7 @@ print ''; print ''; print ''.$langs->trans("AllowOnlineSign").''; print ''; -if ($conf->global->CONTRACT_ALLOW_ONLINESIGN) { +if (getDolGlobalString('CONTRACT_ALLOW_ONLINESIGN')) { print ''; print img_picto($langs->trans("Activited"), 'switch_on'); print ''; diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index aad41d10ec9..64a37dcbed4 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -142,7 +142,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -$parameters = array('socid' => $socid); +$parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -800,8 +800,10 @@ if (empty($reshook)) { $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); + $typeinvoice = Facture::TYPE_STANDARD; + // Check price is not lower than minimum (check is done only for standard or replacement invoices) - if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - $remise_percent / 100) < price2num($price_min)))) { + if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($typeinvoice == Facture::TYPE_STANDARD || $typeinvoice == Facture::TYPE_REPLACEMENT) && $price_min && ((float) price2num($pu_ht) * (1 - (float) $remise_percent / 100) < (float) price2num($price_min)))) { setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); $error++; } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 272ff800977..540722e8c49 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1772,6 +1772,7 @@ if ($resql) { $totalarray = array(); $totalarray['nbfield'] = 0; $totalarray['val'] = array(); + $totalarray['val']['f.total_tva'] = 0; $totalarray['val']['f.total_ht'] = 0; $totalarray['val']['f.total_ttc'] = 0; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 73eaa702af7..7aad6ca9c54 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -669,6 +669,7 @@ if (empty($reshook)) { } } elseif ($action == 'updateline' && $user->rights->contrat->creer && !GETPOST('cancel', 'alpha')) { $error = 0; + $predef = ''; if (!empty($date_start_update) && !empty($date_end_update) && $date_start_update > $date_end_update) { setEventMessages($langs->trans("Error").': '.$langs->trans("DateStartPlanned").' > '.$langs->trans("DateEndPlanned"), null, 'errors'); @@ -744,7 +745,7 @@ if (empty($reshook)) { $objectline->date_end = $date_end_update; $objectline->date_end_real = $date_end_real_update; $objectline->fk_user_cloture = $user->id; - $objectline->fk_fournprice = $fk_fournprice; + //$objectline->fk_fournprice = $fk_fournprice; $objectline->pa_ht = $pa_ht; $objectline->rang = $objectline->rang; @@ -1634,9 +1635,9 @@ if ($action == 'create') { if ($objp->subprice >= 0) { $colspan = 6; - if ($conf->margin->enabled && $conf->global->PRODUCT_USE_UNITS) { + if ($conf->margin->enabled && getDolGlobalString('PRODUCT_USE_UNITS')) { $colspan = 8; - } elseif ($conf->margin->enabled || $conf->global->PRODUCT_USE_UNITS) { + } elseif ($conf->margin->enabled || getDolGlobalString('PRODUCT_USE_UNITS')) { $colspan = 7; } @@ -2204,7 +2205,7 @@ if ($action == 'create') { $delallowed = $user->rights->contrat->creer; - print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, ($object->model_pdf ? $object->model_pdf : $conf->global->CONTRACT_ADDON_PDF), 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang, '', $object); + print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, ($object->model_pdf ? $object->model_pdf : getDolGlobalString('CONTRACT_ADDON_PDF')), 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang, '', $object); // Show links to link elements @@ -2212,7 +2213,7 @@ if ($action == 'create') { $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); // Show online signature link - if ($object->statut != Contrat::STATUS_DRAFT && $conf->global->CONTRACT_ALLOW_ONLINESIGN) { + if ($object->statut != Contrat::STATUS_DRAFT && getDolGlobalString('CONTRACT_ALLOW_ONLINESIGN')) { print '
'; require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 7d43da46b37..23d022a4c25 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2865,23 +2865,6 @@ class ContratLigne extends CommonObjectLine public $date_start_real; // date start real public $date_end; // date end planned public $date_end_real; // date end real - // For backward compatibility - /** - * @deprecated Use date_start - */ - //public $date_ouverture_prevue; // date start planned - /** - * @deprecated Use date_start_real - */ - //public $date_ouverture; // date start real - /** - * @deprecated Use date_end - */ - //public $date_fin_validite; // date end planned - /** - * @deprecated Use date_end_real - */ - //public $date_cloture; // date end real public $tva_tx; public $vat_src_code; @@ -3303,15 +3286,11 @@ class ContratLigne extends CommonObjectLine $this->date_end_real = $this->date_end_real; } - - // Check parameters - // Put here code to add control on parameters values - // Calcul du total TTC et de la TVA pour la ligne a partir de // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $localtaxes_type = getLocalTaxesFromRate($this->txtva, 0, $this->societe, $mysoc); + $localtaxes_type = getLocalTaxesFromRate($this->txtva, 0, $this->thirdparty, $mysoc); $tabprice = calcul_price_total($this->qty, $this->price_ht, $this->remise_percent, $this->tva_tx, $this->localtax1_tx, $this->localtax2_tx, 0, 'HT', 0, 1, $mysoc, $localtaxes_type); $this->total_ht = $tabprice[0]; @@ -3645,6 +3624,7 @@ class ContratLigne extends CommonObjectLine // Update object $this->date_cloture = $date_end_real; + $this->date_end_real = $date_end_real; $this->fk_user_cloture = $user->id; $this->commentaire = $comment; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 95601354578..e4152d31189 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1976,7 +1976,7 @@ class ExtraFields $expand_display = false; if (is_array($extrafield_param_list) && count($extrafield_param_list) > 0) { $extrafield_collapse_display_value = intval($extrafield_param_list[0]); - $expand_display = ((isset($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) || GETPOST('ignorecollapsesetup', 'int')) ? ($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key] ? true : false) : ($extrafield_collapse_display_value == 2 ? false : true)); + $expand_display = ((isset($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) || GETPOST('ignorecollapsesetup', 'int')) ? (empty($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) ? false : true) : ($extrafield_collapse_display_value == 2 ? false : true)); } if ($mode == 'create') { $extrafield_collapse_display_value = 0; diff --git a/htdocs/core/lib/contract.lib.php b/htdocs/core/lib/contract.lib.php index 390de71fca8..64040757397 100644 --- a/htdocs/core/lib/contract.lib.php +++ b/htdocs/core/lib/contract.lib.php @@ -88,7 +88,7 @@ function contract_prepare_head(Contrat $object) $h++; $head[$h][0] = DOL_URL_ROOT.'/contrat/agenda.php?id='.$object->id; - $head[$h][1] .= $langs->trans("Events"); + $head[$h][1] = $langs->trans("Events"); if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { $head[$h][1] .= '/'; $head[$h][1] .= $langs->trans("Agenda"); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 11ac2edba61..776633960e6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7801,11 +7801,11 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $dateplannedstart = ''; $datenextexpiration = ''; foreach ($object->lines as $line) { - if ($line->date_ouverture_prevue > $dateplannedstart) { - $dateplannedstart = $line->date_ouverture_prevue; + if ($line->date_start > $dateplannedstart) { + $dateplannedstart = $line->date_start; } - if ($line->statut == 4 && $line->date_fin_prevue && (!$datenextexpiration || $line->date_fin_prevue < $datenextexpiration)) { - $datenextexpiration = $line->date_fin_prevue; + if ($line->statut == 4 && $line->date_end && (!$datenextexpiration || $line->date_end < $datenextexpiration)) { + $datenextexpiration = $line->date_end; } } $substitutionarray['__CONTRACT_HIGHEST_PLANNED_START_DATE__'] = dol_print_date($dateplannedstart, 'dayrfc'); diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 6ef9463971b..7d99a021f69 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -99,7 +99,7 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l $langs->load($extrafields->attributes[$object->table_element]['langfile'][$tmpkeyextra]); } if ($action == 'edit_extras') { - $value = (GETPOSTISSET("options_".$tmpkeyextra) ? GETPOST("options_".$tmpkeyextra) : $object->array_options["options_".$tmpkeyextra]); + $value = (GETPOSTISSET("options_".$tmpkeyextra) ? GETPOST("options_".$tmpkeyextra) : (isset($object->array_options["options_".$tmpkeyextra]) ? $object->array_options["options_".$tmpkeyextra] : '')); } else { $value = (isset($object->array_options["options_".$tmpkeyextra]) ? $object->array_options["options_".$tmpkeyextra] : ''); //var_dump($tmpkeyextra.' - '.$value); diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index d1f99fc4ab0..6be323a1a7a 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1550,7 +1550,7 @@ if ($placeid > 0) { $tooltiptext .= $line->desc; } } - if ($conf->global->TAKEPOS_SHOW_PRODUCT_REFERENCE == 1) { + if (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 1) { $htmlforlines .= $form->textwithpicto($line->product_label ? '' . $line->product_ref . ' - ' . $line->product_label : dolGetFirstLineOfText($line->desc, 1), $tooltiptext); } else { $htmlforlines .= $form->textwithpicto($line->product_label ? $line->product_label : ($line->product_ref ? $line->product_ref : dolGetFirstLineOfText($line->desc, 1)), $tooltiptext);