Debug v20

This commit is contained in:
Laurent Destailleur 2024-04-23 00:38:56 +02:00
parent 23c1b90d77
commit 2f7e9734bd
11 changed files with 57 additions and 29 deletions

View file

@ -56,8 +56,10 @@ $confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'invoicetemplatelist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used
// Security check
$id = (GETPOSTINT('facid') ? GETPOSTINT('facid') : GETPOSTINT('id'));
$lineid = GETPOSTINT('lineid');
$ref = GETPOST('ref', 'alpha');
@ -130,6 +132,7 @@ $now = dol_now();
$error = 0;
// Security check
$result = restrictedArea($user, 'facture', $object->id, $objecttype);
@ -152,7 +155,28 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
if (GETPOST('cancel', 'alpha')) {
$backurlforlist = DOL_URL_ROOT.'/compta/facture/invoicetemplate_list.php';
if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
$backtopage = $backurlforlist;
} else {
$backtopage = DOL_URL_ROOT.'/compta/facture/invoicetemplate_list.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
}
}
}
// include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
if ($cancel) {
/*var_dump($cancel);var_dump($backtopage);var_dump($backtopageforcancel);exit;*/
if (!empty($backtopageforcancel)) {
header("Location: ".$backtopageforcancel);
exit;
} elseif (!empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
$action = '';
}
@ -323,7 +347,7 @@ if (empty($reshook)) {
} elseif ($action == 'setfrequency' && $user->hasRight('facture', 'creer')) {
// Set frequency and unit frequency
$object->context['actionmsg'] = $langs->trans("FieldXModified", $langs->transnoentitiesnoconv("Frequency"));
$object->setFrequencyAndUnit(GETPOSTINT('frequency'), GETPOSTINT('unit_frequency'));
$object->setFrequencyAndUnit(GETPOSTINT('frequency'), GETPOST('unit_frequency'));
} elseif ($action == 'setdate_when' && $user->hasRight('facture', 'creer')) {
// Set next date of execution
$date = dol_mktime(GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0, GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear'));
@ -1129,32 +1153,32 @@ if ($action == 'create') {
// Frequency + unit
print '<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency'))."</td><td>";
print "<input type='text' name='frequency' value='".GETPOSTINT('frequency')."' size='4' />&nbsp;";
print '<input type="text" class="width50" name="frequency" value="'.GETPOST('frequency', 'int').'">&nbsp;';
print $form->selectarray('unit_frequency', array('d' => $langs->trans('Day'), 'm' => $langs->trans('Month'), 'y' => $langs->trans('Year')), (GETPOST('unit_frequency') ? GETPOST('unit_frequency') : 'm'));
print "</td></tr>";
// Date next run
print "<tr><td>".$langs->trans('NextDateToExecution')."</td><td>";
$date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1);
$date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOSTINT('remonth') ? dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')) : -1);
print $form->selectDate($date_next_execution, '', 1, 1, 0, "add", 1, 1);
print "</td></tr>";
// Number max of generation
print "<tr><td>".$langs->trans("MaxPeriodNumber")."</td><td>";
print '<input type="text" name="nb_gen_max" value="'.GETPOST('nb_gen_max').'" size="5" />';
print '<input type="text" class="width50" name="nb_gen_max" value="'.GETPOSTINT('nb_gen_max').'">';
print "</td></tr>";
// Auto validate the invoice
print "<tr><td>".$langs->trans("StatusOfAutoGeneratedInvoices")."</td><td>";
$select = array('0' => $langs->trans('BillStatusDraft'), '1' => $langs->trans('BillStatusValidated'));
print $form->selectarray('auto_validate', $select, GETPOST('auto_validate'));
print $form->selectarray('auto_validate', $select, GETPOSTINT('auto_validate'));
print "</td></tr>";
// Auto generate document
if (getDolGlobalString('INVOICE_REC_CAN_DISABLE_DOCUMENT_FILE_GENERATION')) {
print "<tr><td>".$langs->trans("StatusOfGeneratedDocuments")."</td><td>";
$select = array('0' => $langs->trans('DoNotGenerateDoc'), '1' => $langs->trans('AutoGenerateDoc'));
print $form->selectarray('generate_pdf', $select, GETPOST('generate_pdf'));
print $form->selectarray('generate_pdf', $select, GETPOSTINT('generate_pdf'));
print "</td></tr>";
} else {
print '<input type="hidden" name="generate_pdf" value="1">';
@ -1544,7 +1568,7 @@ if ($action == 'create') {
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<table class="nobordernopadding">';
print '<tr><td>';
print "<input type='text' name='frequency' value='".$object->frequency."' size='5' />&nbsp;";
print '<input type="text" name="frequency" class="width50 marginrightonly right" value="'.$object->frequency.'">';
print $form->selectarray('unit_frequency', array('d' => $langs->trans('Day'), 'm' => $langs->trans('Month'), 'y' => $langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm'));
print '</td>';
print '<td class="left"><input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans("Modify").'"></td>';

View file

@ -606,19 +606,19 @@ if (!empty($arrayfields['s.nom']['checked'])) {
if (!empty($arrayfields['f.total_ht']['checked'])) {
// Amount net
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).'">';
print '<input class="flat with50" type="text"" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).'">';
print '</td>';
}
if (!empty($arrayfields['f.total_tva']['checked'])) {
// Amount Vat
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).'">';
print '<input class="flat with50" type="text" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).'">';
print '</td>';
}
if (!empty($arrayfields['f.total_ttc']['checked'])) {
// Amount
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).'">';
print '<input class="flat with50" type="text" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).'">';
print '</td>';
}
if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) {

View file

@ -1780,7 +1780,7 @@ if ($action == 'create') {
print '</td>';
// Price
print '<td class="right"><input size="5" type="text" name="elprice" value="'.price($objp->subprice).'"></td>';
print '<td class="right"><input class="width50" type="text" name="elprice" value="'.price($objp->subprice).'"></td>';
// Price multicurrency
/*if (isModEnabled("multicurrency")) {
@ -1805,7 +1805,7 @@ if ($action == 'create') {
if ($objp->fk_product) {
print '<select id="fournprice" name="fournprice"></select>';
}
print '<input id="buying_price" type="text" size="5" name="buying_price" value="'.price($objp->pa_ht, 0, '', 0).'"></td>';
print '<input id="buying_price" type="text" class="width50" name="buying_price" value="'.price($objp->pa_ht, 0, '', 0).'"></td>';
}
print '<td class="center">';
print '<input type="submit" class="button margintoponly marginbottomonly" name="save" value="'.$langs->trans("Modify").'">';

View file

@ -169,7 +169,7 @@ print $formadmin->selectTypeOfFields('type', GETPOST('type', 'alpha'));
?>
</td></tr>
<!-- Size -->
<tr class="extra_size"><td class="fieldrequired"><?php echo $langs->trans("Size"); ?></td><td class="valeur"><input id="size" type="text" name="size" size="5" value="<?php echo(GETPOST('size', 'alpha') ? GETPOST('size', 'alpha') : ''); ?>"></td></tr>
<tr class="extra_size"><td class="fieldrequired"><?php echo $langs->trans("Size"); ?></td><td class="valeur"><input id="size" type="text" name="size" class="width50" value="<?php echo(GETPOST('size', 'alpha') ? GETPOST('size', 'alpha') : ''); ?>"></td></tr>
<!-- Default Value (for select list / radio/ checkbox) -->
<tr id="value_choice">
<td>
@ -191,7 +191,7 @@ print $formadmin->selectTypeOfFields('type', GETPOST('type', 'alpha'));
</td>
</tr>
<!-- Position -->
<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo GETPOSTISSET('pos') ? GETPOSTINT('pos') : 100; ?>"></td></tr>
<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" class="width50" value="<?php echo GETPOSTISSET('pos') ? GETPOSTINT('pos') : 100; ?>"></td></tr>
<!-- Language file -->
<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" id="langfile" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag(GETPOST('langfile', 'alpha')); ?>"></td></tr>
<!-- Computed Value -->

View file

@ -230,7 +230,7 @@ if (in_array($type, array_keys($typewecanchangeinto))) {
</td></tr>
<!-- Size -->
<tr class="extra_size"><td class="fieldrequired"><?php echo $langs->trans("Size"); ?></td><td><input id="size" type="text" name="size" size="5" value="<?php echo $size; ?>"></td></tr>
<tr class="extra_size"><td class="fieldrequired"><?php echo $langs->trans("Size"); ?></td><td><input id="size" type="text" name="size" class="width50" value="<?php echo $size; ?>"></td></tr>
<!-- Value (for some fields like password, select list, radio, ...) -->
<tr id="value_choice">
@ -254,7 +254,7 @@ if (in_array($type, array_keys($typewecanchangeinto))) {
</tr>
<!-- Position -->
<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo dol_escape_htmltag($pos); ?>"></td></tr>
<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" class="width50" value="<?php echo dol_escape_htmltag($pos); ?>"></td></tr>
<!-- Language file -->
<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag($langfile); ?>"></td></tr>
@ -270,7 +270,7 @@ if (in_array($type, array_keys($typewecanchangeinto))) {
</tr>
<!-- Default Value (at sql setup level) -->
<tr class="extra_default_value"><td><?php echo $langs->trans("DefaultValue").' ('.$langs->trans("Database").')'; ?></td><td class="valeur"><input id="default_value" type="text" name="default_value" size="5" value="<?php echo dol_escape_htmltag($default); ?>"></td></tr>
<tr class="extra_default_value"><td><?php echo $langs->trans("DefaultValue").' ('.$langs->trans("Database").')'; ?></td><td class="valeur"><input id="default_value" type="text" name="default_value" class="width50" value="<?php echo dol_escape_htmltag($default); ?>"></td></tr>
<!-- Unique -->
<tr class="extra_unique"><td><?php echo $langs->trans("Unique"); ?></td><td class="valeur"><input id="unique" type="checkbox" name="unique"<?php echo($unique ? ' checked' : ''); ?>></td></tr>

View file

@ -461,21 +461,21 @@ if ($nolinesbefore) {
</td>
<td class="nobottom linecoluht right"><?php $coldisplay++; ?>
<input type="text" size="5" name="price_ht" id="price_ht" class="flat right" value="<?php echo(GETPOSTISSET("price_ht") ? GETPOST("price_ht", 'alpha', 2) : ''); ?>">
<input type="text" name="price_ht" id="price_ht" class="flat right with50" value="<?php echo(GETPOSTISSET("price_ht") ? GETPOST("price_ht", 'alpha', 2) : ''); ?>">
</td>
<?php
if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) {
$coldisplay++; ?>
<td class="nobottom linecoluht_currency right">
<input type="text" size="5" name="multicurrency_price_ht" id="multicurrency_price_ht" class="flat right" value="<?php echo(GETPOSTISSET("multicurrency_price_ht") ? GETPOST("multicurrency_price_ht", 'alpha', 2) : ''); ?>">
<input type="text" name="multicurrency_price_ht" id="multicurrency_price_ht" class="flat right with50" value="<?php echo(GETPOSTISSET("multicurrency_price_ht") ? GETPOST("multicurrency_price_ht", 'alpha', 2) : ''); ?>">
</td>
<?php
}
if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) {
$coldisplay++; ?>
<td class="nobottom linecoluttc right">
<input type="text" size="5" name="price_ttc" id="price_ttc" class="flat right" value="<?php echo(GETPOSTISSET("price_ttc") ? GETPOST("price_ttc", 'alpha', 2) : ''); ?>">
<input type="text" name="price_ttc" id="price_ttc" class="flat right with50" value="<?php echo(GETPOSTISSET("price_ttc") ? GETPOST("price_ttc", 'alpha', 2) : ''); ?>">
</td>
<?php
}

View file

@ -221,7 +221,7 @@ $coldisplay++;
}
$coldisplay++;
print '<td class="right"><input type="text" class="flat right" size="5" id="price_ht" name="price_ht" value="'.(GETPOSTISSET('price_ht') ? GETPOST('price_ht', 'alpha') : (isset($line->pu_ht) ? price($line->pu_ht, 0, '', 0) : price($line->subprice, 0, '', 0))).'"';
print '<td class="right"><input type="text" class="flat right with50" id="price_ht" name="price_ht" value="'.(GETPOSTISSET('price_ht') ? GETPOST('price_ht', 'alpha') : (isset($line->pu_ht) ? price($line->pu_ht, 0, '', 0) : price($line->subprice, 0, '', 0))).'"';
if ($situationinvoicelinewithparent) {
print ' readonly';
}
@ -229,7 +229,7 @@ $coldisplay++;
if (isModEnabled("multicurrency") && $object->multicurrency_code != $conf->currency) {
$coldisplay++;
print '<td class="right"><input rel="'.$object->multicurrency_tx.'" type="text" class="flat right" size="5" id="multicurrency_subprice" name="multicurrency_subprice" value="'.(GETPOSTISSET('multicurrency_subprice') ? GETPOST('multicurrency_subprice', 'alpha') : price($line->multicurrency_subprice)).'" /></td>';
print '<td class="right"><input rel="'.$object->multicurrency_tx.'" type="text" class="flat right with50" id="multicurrency_subprice" name="multicurrency_subprice" value="'.(GETPOSTISSET('multicurrency_subprice') ? GETPOST('multicurrency_subprice', 'alpha') : price($line->multicurrency_subprice)).'" /></td>';
}
if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) {
@ -238,7 +238,7 @@ $coldisplay++;
if (getDolGlobalInt('MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES')) {
$upinctax = price2num($line->total_ttc / (float) $line->qty, 'MU');
}
print '<td class="right"><input type="text" class="flat right" size="5" id="price_ttc" name="price_ttc" value="'.(GETPOSTISSET('price_ttc') ? GETPOST('price_ttc') : (isset($upinctax) ? price($upinctax, 0, '', 0) : '')).'"';
print '<td class="right"><input type="text" class="flat right with50" id="price_ttc" name="price_ttc" value="'.(GETPOSTISSET('price_ttc') ? GETPOST('price_ttc') : (isset($upinctax) ? price($upinctax, 0, '', 0) : '')).'"';
if ($situationinvoicelinewithparent) {
print ' readonly';
}

View file

@ -243,7 +243,7 @@ if ($action == 'add') {
} elseif ($action == 'setfrequency' && $user->hasRight('ficheinter', 'creer')) {
// Set frequency and unit frequency
$object->fetch($id);
$object->setFrequencyAndUnit(GETPOSTINT('frequency'), GETPOSTINT('unit_frequency'));
$object->setFrequencyAndUnit(GETPOST('frequency', 'int'), GETPOST('unit_frequency', 'alpha'));
} elseif ($action == 'setdate_when' && $user->hasRight('ficheinter', 'creer')) {
// Set next date of execution
$object->fetch($id);

View file

@ -307,7 +307,7 @@ if (empty($reshook)) {
$result = $object->setBankAccount(GETPOSTINT('fk_account'));
} elseif ($action == 'setfrequency' && $usercancreate) {
// Set frequency and unit frequency
$object->setFrequencyAndUnit(GETPOSTINT('frequency'), GETPOSTINT('unit_frequency'));
$object->setFrequencyAndUnit(GETPOST('frequency', 'int'), GETPOST('unit_frequency', 'alpha'));
} elseif ($action == 'setdate_when' && $usercancreate) {
// Set next date of execution
$date = dol_mktime(GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0, GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear'));

View file

@ -163,6 +163,8 @@ if (!$permissiontoread) {
accessforbidden();
}
$error = 0;
/*
* Actions
@ -175,8 +177,6 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
$error = 0;
$backurlforlist = dol_buildpath('/mymodule/myobject_list.php', 1);
if (empty($backtopage) || ($cancel && empty($id))) {

View file

@ -6475,6 +6475,10 @@ input.select2-input {
.select2-container .select2-selection--multiple {
min-height: 28px !important;
}
.tableforfield .select2-container .select2-selection--single {
height: 25px;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
margin-top: 5px !important;
border: none;