Fix: avoid warning
This commit is contained in:
parent
f2bfaa729a
commit
dce5a3e708
@ -37,14 +37,15 @@ $langs->load("companies");
|
|||||||
$langs->load("products");
|
$langs->load("products");
|
||||||
$langs->load("members");
|
$langs->load("members");
|
||||||
|
|
||||||
if (!$user->admin)
|
if (! $user->admin) accessforbidden();
|
||||||
accessforbidden();
|
|
||||||
|
$action = GETPOST('action','alpha');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (isset($_POST["action"]) && $_POST["action"] == 'update')
|
if ($action == 'update')
|
||||||
{
|
{
|
||||||
dolibarr_set_const($db, "MAIN_PDF_FORMAT", $_POST["MAIN_PDF_FORMAT"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_PDF_FORMAT", $_POST["MAIN_PDF_FORMAT"],'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
@ -75,8 +76,9 @@ print_fiche_titre($langs->trans("PDF"),'','setup');
|
|||||||
print $langs->trans("PDFDesc")."<br>\n";
|
print $langs->trans("PDFDesc")."<br>\n";
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
|
$noCountryCode = (empty($mysoc->country_code) ? true : false);
|
||||||
|
|
||||||
if (isset($_GET["action"]) && $_GET["action"] == 'edit') // Edit
|
if ($action == 'edit') // Edit
|
||||||
{
|
{
|
||||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
@ -113,34 +115,62 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit') // Edit
|
|||||||
|
|
||||||
// Show prof id 1 in address into pdf
|
// Show prof id 1 in address into pdf
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
$pid1=$langs->transcountry("ProfId1",$mysoc->pays_code);
|
if (! $noCountryCode)
|
||||||
if ($pid1 == '-') $pid1=$langs->transcountry("ProfId1");
|
{
|
||||||
|
$pid1=$langs->transcountry("ProfId1",$mysoc->country_code);
|
||||||
|
if ($pid1 == '-') $pid1=$langs->transcountry("ProfId1");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$pid1 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
|
||||||
|
}
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid1.'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid1.'</td><td>';
|
||||||
print $form->selectyesno('MAIN_PROFID1_IN_ADDRESS',isset($conf->global->MAIN_PROFID1_IN_ADDRESS)?$conf->global->MAIN_PROFID1_IN_ADDRESS:0,1);
|
print $form->selectyesno('MAIN_PROFID1_IN_ADDRESS',isset($conf->global->MAIN_PROFID1_IN_ADDRESS)?$conf->global->MAIN_PROFID1_IN_ADDRESS:0,1,$noCountryCode);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Show prof id 2 in address into pdf
|
// Show prof id 2 in address into pdf
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
$pid2=$langs->transcountry("ProfId2",$mysoc->pays_code);
|
if (! $noCountryCode)
|
||||||
if ($pid2 == '-') $pid2=$langs->transcountry("ProfId2");
|
{
|
||||||
|
$pid2=$langs->transcountry("ProfId2",$mysoc->country_code);
|
||||||
|
if ($pid2 == '-') $pid2=$langs->transcountry("ProfId2");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$pid2 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
|
||||||
|
}
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid2.'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid2.'</td><td>';
|
||||||
print $form->selectyesno('MAIN_PROFID2_IN_ADDRESS',isset($conf->global->MAIN_PROFID2_IN_ADDRESS)?$conf->global->MAIN_PROFID2_IN_ADDRESS:0,1);
|
print $form->selectyesno('MAIN_PROFID2_IN_ADDRESS',isset($conf->global->MAIN_PROFID2_IN_ADDRESS)?$conf->global->MAIN_PROFID2_IN_ADDRESS:0,1,$noCountryCode);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Show prof id 3 in address into pdf
|
// Show prof id 3 in address into pdf
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
$pid3=$langs->transcountry("ProfId3",$mysoc->pays_code);
|
if (! $noCountryCode)
|
||||||
if ($pid3 == '-') $pid3=$langs->transcountry("ProfId3");
|
{
|
||||||
|
$pid3=$langs->transcountry("ProfId3",$mysoc->country_code);
|
||||||
|
if ($pid3 == '-') $pid3=$langs->transcountry("ProfId3");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$pid3 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
|
||||||
|
}
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid3.'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid3.'</td><td>';
|
||||||
print $form->selectyesno('MAIN_PROFID3_IN_ADDRESS',isset($conf->global->MAIN_PROFID3_IN_ADDRESS)?$conf->global->MAIN_PROFID3_IN_ADDRESS:0,1);
|
print $form->selectyesno('MAIN_PROFID3_IN_ADDRESS',isset($conf->global->MAIN_PROFID3_IN_ADDRESS)?$conf->global->MAIN_PROFID3_IN_ADDRESS:0,1,$noCountryCode);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Show prof id 4 in address into pdf
|
// Show prof id 4 in address into pdf
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
$pid4=$langs->transcountry("ProfId4",$mysoc->pays_code);
|
if (! $noCountryCode)
|
||||||
if ($pid4 == '-') $pid4=$langs->transcountry("ProfId4");
|
{
|
||||||
|
$pid4=$langs->transcountry("ProfId4",$mysoc->country_code);
|
||||||
|
if ($pid4 == '-') $pid4=$langs->transcountry("ProfId4");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$pid4 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
|
||||||
|
}
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid4.'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid4.'</td><td>';
|
||||||
print $form->selectyesno('MAIN_PROFID4_IN_ADDRESS',isset($conf->global->MAIN_PROFID4_IN_ADDRESS)?$conf->global->MAIN_PROFID4_IN_ADDRESS:0,1);
|
print $form->selectyesno('MAIN_PROFID4_IN_ADDRESS',isset($conf->global->MAIN_PROFID4_IN_ADDRESS)?$conf->global->MAIN_PROFID4_IN_ADDRESS:0,1,$noCountryCode);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -207,32 +237,60 @@ else // Show
|
|||||||
|
|
||||||
// Show prof id 1 in address into pdf
|
// Show prof id 1 in address into pdf
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
$pid1=$langs->transcountry("ProfId1",$mysoc->pays_code);
|
if (! $noCountryCode)
|
||||||
if ($pid1 == '-') $pid1=$langs->transcountry("ProfId1");
|
{
|
||||||
|
$pid1=$langs->transcountry("ProfId1",$mysoc->country_code);
|
||||||
|
if ($pid1 == '-') $pid1=$langs->transcountry("ProfId1");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$pid1 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
|
||||||
|
}
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid1.'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid1.'</td><td>';
|
||||||
print yn($conf->global->MAIN_PROFID1_IN_ADDRESS,1);
|
print yn($conf->global->MAIN_PROFID1_IN_ADDRESS,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Show prof id 2 in address into pdf
|
// Show prof id 2 in address into pdf
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
$pid2=$langs->transcountry("ProfId2",$mysoc->pays_code);
|
if (! $noCountryCode)
|
||||||
if ($pid2 == '-') $pid2=$langs->transcountry("ProfId2");
|
{
|
||||||
|
$pid2=$langs->transcountry("ProfId2",$mysoc->country_code);
|
||||||
|
if ($pid2 == '-') $pid2=$langs->transcountry("ProfId2");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$pid2 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
|
||||||
|
}
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid2.'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid2.'</td><td>';
|
||||||
print yn($conf->global->MAIN_PROFID2_IN_ADDRESS,1);
|
print yn($conf->global->MAIN_PROFID2_IN_ADDRESS,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Show prof id 3 in address into pdf
|
// Show prof id 3 in address into pdf
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
$pid3=$langs->transcountry("ProfId3",$mysoc->pays_code);
|
if (! $noCountryCode)
|
||||||
if ($pid3 == '-') $pid3=$langs->transcountry("ProfId3");
|
{
|
||||||
|
$pid3=$langs->transcountry("ProfId3",$mysoc->country_code);
|
||||||
|
if ($pid3 == '-') $pid3=$langs->transcountry("ProfId3");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$pid3 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
|
||||||
|
}
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid3.'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid3.'</td><td>';
|
||||||
print yn($conf->global->MAIN_PROFID3_IN_ADDRESS,1);
|
print yn($conf->global->MAIN_PROFID3_IN_ADDRESS,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Show prof id 4 in address into pdf
|
// Show prof id 4 in address into pdf
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
$pid4=$langs->transcountry("ProfId4",$mysoc->pays_code);
|
if (! $noCountryCode)
|
||||||
if ($pid4 == '-') $pid4=$langs->transcountry("ProfId4");
|
{
|
||||||
|
$pid4=$langs->transcountry("ProfId4",$mysoc->country_code);
|
||||||
|
if ($pid4 == '-') $pid4=$langs->transcountry("ProfId4");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$pid4 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
|
||||||
|
}
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid4.'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid4.'</td><td>';
|
||||||
print yn($conf->global->MAIN_PROFID4_IN_ADDRESS,1);
|
print yn($conf->global->MAIN_PROFID4_IN_ADDRESS,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|||||||
@ -3528,14 +3528,15 @@ class Form
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an html string with a select combo box to choose yes or no
|
* Return an html string with a select combo box to choose yes or no
|
||||||
*
|
*
|
||||||
* @param name Name of html select field
|
* @param string $name Name of html select field
|
||||||
* @param value Pre-selected value
|
* @param string $value Pre-selected value
|
||||||
* @param option 0 return yes/no, 1 return 1/0
|
* @param int $option 0 return yes/no, 1 return 1/0
|
||||||
* @return int or string See option
|
* @param bool $disabled true or false
|
||||||
|
* @return mixed See option
|
||||||
*/
|
*/
|
||||||
function selectyesno($htmlname,$value='',$option=0)
|
function selectyesno($htmlname,$value='',$option=0,$disabled=false)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
@ -3547,7 +3548,9 @@ class Form
|
|||||||
$no="0";
|
$no="0";
|
||||||
}
|
}
|
||||||
|
|
||||||
$resultyesno = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">'."\n";
|
$disabled = ($disabled ? ' disabled="disabled"' : '');
|
||||||
|
|
||||||
|
$resultyesno = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";
|
||||||
if (("$value" == 'yes') || ($value == 1))
|
if (("$value" == 'yes') || ($value == 1))
|
||||||
{
|
{
|
||||||
$resultyesno .= '<option value="'.$yes.'" selected="selected">'.$langs->trans("Yes").'</option>'."\n";
|
$resultyesno .= '<option value="'.$yes.'" selected="selected">'.$langs->trans("Yes").'</option>'."\n";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user