Fix debug v17

This commit is contained in:
Laurent Destailleur 2022-12-08 18:57:58 +01:00
parent 5f3e231d13
commit e1e9ff8cda
10 changed files with 22 additions and 38 deletions

View File

@ -518,7 +518,7 @@ print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("AllowOnlineSign").'</td>';
print '<td class="center">';
if ($conf->global->CONTRACT_ALLOW_ONLINESIGN) {
if (getDolGlobalString('CONTRACT_ALLOW_ONLINESIGN')) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=allowonlinesign&token='.newToken().'&value=0">';
print img_picto($langs->trans("Activited"), 'switch_on');
print '</a>';

View File

@ -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++;
}

View File

@ -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;

View File

@ -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 '<br><!-- Link to sign -->';
require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';

View File

@ -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;

View File

@ -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;

View File

@ -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");

View File

@ -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');

View File

@ -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);

View File

@ -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 ? '<b>' . $line->product_ref . '</b> - ' . $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);