fix for the supplier code
This commit is contained in:
parent
c8440a6283
commit
a3628954b2
@ -255,6 +255,7 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
// Getting the thirdparty or creating it
|
// Getting the thirdparty or creating it
|
||||||
$thirdparty = new Societe($db);
|
$thirdparty = new Societe($db);
|
||||||
$resultfetchthirdparty = $thirdparty->fetch('', $societe);
|
$resultfetchthirdparty = $thirdparty->fetch('', $societe);
|
||||||
|
|
||||||
if ($resultfetchthirdparty<=0) {
|
if ($resultfetchthirdparty<=0) {
|
||||||
// Need to create a new one (not found or multiple with the same name)
|
// Need to create a new one (not found or multiple with the same name)
|
||||||
$thirdparty->name = $societe;
|
$thirdparty->name = $societe;
|
||||||
@ -331,16 +332,15 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
$resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH);
|
$resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($resultcategory<0) {
|
if ($resultcategory<=0) {
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg .= $category->error;
|
$errmsg .= $category->error;
|
||||||
} else {
|
} else {
|
||||||
$resultsetcategory = $thirdparty->setCategoriesCommon(array($category->id), CATEGORIE::TYPE_CUSTOMER, false);
|
$resultsetcategory = $thirdparty->setCategoriesCommon(array($category->id), CATEGORIE::TYPE_CUSTOMER, false);
|
||||||
if ($resultsetcategory <=0) {
|
if ($resultsetcategory < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg .= $thirdparty->error;
|
$errmsg .= $thirdparty->error;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
$thirdparty->fournisseur = 1;
|
$thirdparty->fournisseur = 1;
|
||||||
|
|
||||||
// Load object modCodeFournisseur
|
// Load object modCodeFournisseur
|
||||||
@ -357,11 +357,16 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
}
|
}
|
||||||
$modCodeFournisseur = new $module;
|
$modCodeFournisseur = new $module;
|
||||||
if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
|
if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
|
||||||
$tmpcode = $modCodeFournisseur->getNextValue($thirdparty, 0);
|
$tmpcode = $modCodeFournisseur->getNextValue($thirdparty, 1);
|
||||||
}
|
}
|
||||||
$thirdparty->code_fournisseur = $tmpcode;
|
$thirdparty->code_fournisseur = $tmpcode;
|
||||||
|
|
||||||
$res = $thirdparty->update(0);
|
$res = $thirdparty->update(0, $user, 1, 1, 1);
|
||||||
|
|
||||||
|
if ($res <= 0) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2468,6 +2468,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
if ($tmpcheck != 0 && $tmpcheck != -5) {
|
if ($tmpcheck != 0 && $tmpcheck != -5) {
|
||||||
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
||||||
}
|
}
|
||||||
|
var_dump($tmpcheck);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user