Debug v16

This commit is contained in:
Laurent Destailleur 2022-06-21 02:15:22 +02:00
parent 60a3d13cb9
commit 7d3938c796
3 changed files with 24 additions and 18 deletions

View File

@ -1415,7 +1415,7 @@ if ($action == 'create') {
}
$arrayothercontracts = $object->getListOfContracts('others');
$arrayothercontracts = $object->getListOfContracts('others'); // array or -1 if technical error
/*
* Lines of contracts
@ -1544,9 +1544,9 @@ if ($action == 'create') {
print '<td class="right nowraponall">'.price($objp->pa_ht).'</td>';
}
// Icon move, update et delete (statut contrat 0=brouillon,1=valide,2=ferme)
// Icon move, update et delete (status contract 0=draft,1=validated,2=closed)
print '<td class="nowraponall right">';
if ($user->rights->contrat->creer && count($arrayothercontracts) && ($object->statut >= 0)) {
if ($user->rights->contrat->creer && is_array($arrayothercontracts) && count($arrayothercontracts) && ($object->statut >= 0)) {
print '<!-- link to move service line into another contract -->';
print '<a class="reposition marginrightonly" style="padding-left: 5px;" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=move&token='.newToken().'&rowid='.$objp->rowid.'">';
print img_picto($langs->trans("MoveToAnotherContract"), 'uparrow');

View File

@ -2126,7 +2126,7 @@ class Contrat extends CommonObject
}
/**
* Return list of other contracts for same company than current contract
* Return list of other contracts for the same company than current contract
*
* @param string $option 'all' or 'others'
* @param array $status sort contracts having these status
@ -2138,7 +2138,7 @@ class Contrat extends CommonObject
{
$tab = array();
$sql = "SELECT c.rowid, c.ref";
$sql = "SELECT c.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c";
if (!empty($product_categories)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON cd.fk_contrat = c.rowid";
@ -2159,12 +2159,12 @@ class Contrat extends CommonObject
$obj = $this->db->fetch_object($resql);
$contrat = new Contrat($this->db);
$contrat->fetch($obj->rowid);
$tab[] = $contrat;
$tab[$contrat->id] = $contrat;
$i++;
}
return $tab;
} else {
$this->error = $this->db->error();
$this->error = $this->db->lasterror();
return -1;
}
}

View File

@ -4901,9 +4901,11 @@ class Form
* @param int|string $height Force height of box (0 = auto)
* @param int $width Force width of box ('999' or '90%'). Ignored and forced to 90% on smartphones.
* @param int $disableformtag 1=Disable form tag. Can be used if we are already inside a <form> section.
* @param string $labelbuttonyes Label for Yes
* @param string $labelbuttonno Label for No
* @return string HTML ajax code if a confirm ajax popup is required, Pure HTML code if it's an html form
*/
public function formconfirm($page, $title, $question, $action, $formquestion = '', $selectedchoice = '', $useajax = 0, $height = 0, $width = 500, $disableformtag = 0)
public function formconfirm($page, $title, $question, $action, $formquestion = '', $selectedchoice = '', $useajax = 0, $height = 0, $width = 500, $disableformtag = 0, $labelbuttonyes = 'Yes', $labelbuttonno = 'No')
{
global $langs, $conf;
@ -5012,7 +5014,7 @@ class Form
$more .= ' checked="checked"';
}
$more .= ' /> ';
$more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'">'.$selval.'</label>';
$more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>';
$more .= '</div></div>'."\n";
$i++;
}
@ -5118,6 +5120,7 @@ class Form
$(this).parent().find("button.ui-button:eq(2)").focus();
},';
}
$formconfirm .= '
resizable: false,
height: "'.$height.'",
@ -5125,7 +5128,7 @@ class Form
modal: true,
closeOnEscape: false,
buttons: {
"'.dol_escape_js($langs->transnoentities("Yes")).'": function() {
"'.dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() {
var options = "&token='.urlencode(newToken()).'";
var inputok = '.json_encode($inputok).'; /* List of fields into form */
var pageyes = "'.dol_escape_js(!empty($pageyes) ? $pageyes : '').'";
@ -5148,7 +5151,7 @@ class Form
if (pageyes.length > 0) { location.href = urljump; }
$(this).dialog("close");
},
"'.dol_escape_js($langs->transnoentities("No")).'": function() {
"'.dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() {
var options = "&token='.urlencode(newToken()).'";
var inputko = '.json_encode($inputko).'; /* List of fields into form */
var pageno="'.dol_escape_js(!empty($pageno) ? $pageno : '').'";
@ -5213,7 +5216,7 @@ class Form
$formconfirm .= '<tr class="valid">';
$formconfirm .= '<td class="valid">'.$question.'</td>';
$formconfirm .= '<td class="valid center">';
$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly');
$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno);
$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">';
$formconfirm .= '</td>';
$formconfirm .= '</tr>'."\n";
@ -8844,9 +8847,11 @@ class Form
* @param int $useempty 1=Add empty line
* @param int $addjscombo 1=Add js beautifier on combo box
* @param string $morecss More CSS
* @return string See option
* @param string $labelyes Label for Yes
* @param string $labelno Label for No
* @return string See option
*/
public function selectyesno($htmlname, $value = '', $option = 0, $disabled = false, $useempty = 0, $addjscombo = 0, $morecss = '')
public function selectyesno($htmlname, $value = '', $option = 0, $disabled = false, $useempty = 0, $addjscombo = 0, $morecss = '', $labelyes = 'Yes', $labelno = 'No')
{
global $langs;
@ -8857,6 +8862,7 @@ class Form
$no = "0";
}
$disabled = ($disabled ? ' disabled' : '');
$resultyesno = '<select class="flat width75'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";
@ -8864,12 +8870,12 @@ class Form
$resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'>&nbsp;</option>'."\n";
}
if (("$value" == 'yes') || ($value == 1)) {
$resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans("Yes").'</option>'."\n";
$resultyesno .= '<option value="'.$no.'">'.$langs->trans("No").'</option>'."\n";
$resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n";
$resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n";
} else {
$selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected');
$resultyesno .= '<option value="'.$yes.'">'.$langs->trans("Yes").'</option>'."\n";
$resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans("No").'</option>'."\n";
$resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n";
$resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n";
}
$resultyesno .= '</select>'."\n";