Clean code
This commit is contained in:
parent
ed0e6753e3
commit
4e5ed08ff8
@ -29,6 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||||
|
|
||||||
|
$error=0;
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
@ -67,11 +69,11 @@ if ($action == 'add')
|
|||||||
if ($res == 0) {
|
if ($res == 0) {
|
||||||
} else {
|
} else {
|
||||||
if ($res == - 3) {
|
if ($res == - 3) {
|
||||||
$_error = 1;
|
$error = 1;
|
||||||
$action = "create";
|
$action = "create";
|
||||||
}
|
}
|
||||||
if ($res == - 4) {
|
if ($res == - 4) {
|
||||||
$_error = 2;
|
$error = 2;
|
||||||
$action = "create";
|
$action = "create";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,7 +42,7 @@ $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSe
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="fieldrequired" width="20%"><?php echo $langs->trans("Ref"); ?></td>
|
<td class="fieldrequired" width="20%"><?php echo $langs->trans("Ref"); ?></td>
|
||||||
<td><input name="ref" size="40" maxlength="32" value="<?php echo $object->ref; ?>">
|
<td><input name="ref" size="40" maxlength="32" value="<?php echo $object->ref; ?>">
|
||||||
<?php if ($_error == 1) echo $langs->trans("RefAlreadyExists"); ?>
|
<?php if ($refalreadyexists == 1) echo $langs->trans("RefAlreadyExists"); ?>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@ -40,7 +40,7 @@ $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSe
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="fieldrequired" width="20%"><?php echo $langs->trans("Ref"); ?></td>
|
<td class="fieldrequired" width="20%"><?php echo $langs->trans("Ref"); ?></td>
|
||||||
<td><input name="ref" size="40" maxlength="32" value="<?php echo $object->ref; ?>">
|
<td><input name="ref" size="40" maxlength="32" value="<?php echo $object->ref; ?>">
|
||||||
<?php if ($_error == 1) echo $langs->trans("RefAlreadyExists"); ?>
|
<?php if ($refalreadyexists == 1) echo $langs->trans("RefAlreadyExists"); ?>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@ -53,7 +53,9 @@ if (! empty($conf->stock->enabled)) $langs->load("stocks");
|
|||||||
if (! empty($conf->facture->enabled)) $langs->load("bills");
|
if (! empty($conf->facture->enabled)) $langs->load("bills");
|
||||||
if (! empty($conf->productbatch->enabled)) $langs->load("productbatch");
|
if (! empty($conf->productbatch->enabled)) $langs->load("productbatch");
|
||||||
|
|
||||||
$mesg=''; $error=0; $errors=array(); $_error=0;
|
$mesg=''; $error=0; $errors=array();
|
||||||
|
|
||||||
|
$refalreadyexists=0;
|
||||||
|
|
||||||
$id=GETPOST('id', 'int');
|
$id=GETPOST('id', 'int');
|
||||||
$ref=GETPOST('ref', 'alpha');
|
$ref=GETPOST('ref', 'alpha');
|
||||||
@ -468,7 +470,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|
||||||
$_error++;
|
$refalreadyexists++;
|
||||||
$action = "";
|
$action = "";
|
||||||
|
|
||||||
$mesg=$langs->trans("ErrorProductAlreadyExists",$object->ref);
|
$mesg=$langs->trans("ErrorProductAlreadyExists",$object->ref);
|
||||||
@ -477,7 +479,7 @@ if (empty($reshook))
|
|||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
if (count($object->errors))
|
if (count($object->errors))
|
||||||
{
|
{
|
||||||
@ -816,7 +818,7 @@ else
|
|||||||
$tmpcode='';
|
$tmpcode='';
|
||||||
if (! empty($modCodeProduct->code_auto)) $tmpcode=$modCodeProduct->getNextValue($object,$type);
|
if (! empty($modCodeProduct->code_auto)) $tmpcode=$modCodeProduct->getNextValue($object,$type);
|
||||||
print '<td class="fieldrequired" width="20%">'.$langs->trans("Ref").'</td><td colspan="3"><input name="ref" size="32" maxlength="128" value="'.dol_escape_htmltag(GETPOST('ref')?GETPOST('ref'):$tmpcode).'">';
|
print '<td class="fieldrequired" width="20%">'.$langs->trans("Ref").'</td><td colspan="3"><input name="ref" size="32" maxlength="128" value="'.dol_escape_htmltag(GETPOST('ref')?GETPOST('ref'):$tmpcode).'">';
|
||||||
if ($_error)
|
if ($refalreadyexists)
|
||||||
{
|
{
|
||||||
print $langs->trans("RefAlreadyExists");
|
print $langs->trans("RefAlreadyExists");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,7 +43,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
$langs->load("products");
|
$langs->load("products");
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
|
|
||||||
$mesg=''; $error=0; $errors=array(); $_error=0;
|
$mesg=''; $error=0; $errors=array();
|
||||||
|
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$ref = GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user