end factoring
This commit is contained in:
parent
8b248c75f2
commit
02cf3fa361
@ -1605,20 +1605,22 @@ if (!$error && ($massaction == 'disable' || ($action == 'disable' && $confirm ==
|
|||||||
if (!$error && $action == 'confirm_edit_value_extrafields' && $confirm == 'yes' && $permissiontoadd) {
|
if (!$error && $action == 'confirm_edit_value_extrafields' && $confirm == 'yes' && $permissiontoadd) {
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$nbok = 0;
|
$objecttmp = new $objectclass($db);
|
||||||
|
$e = new ExtraFields($db);// fetch optionals attributes and labels
|
||||||
|
$e->fetch_name_optionals_label($objecttmp->table_element);
|
||||||
|
|
||||||
$extrafieldKeyToUpdate = GETPOST('extrafield-key-yo-update'); // TODO A FAIRE coté formulaire : ajouter le select de l'extrafield a utiliser
|
$nbok = 0;
|
||||||
$extrafieldKeyToUpdate = 'code_tva_achat'; // TODO A FAIRE coté formulaire : ajouter le select de l'extrafield a utiliser
|
$extrafieldKeyToUpdate = GETPOST('extrafield-key-to-update'); // TODO A FAIRE coté formulaire : ajouter le select de l'extrafield a utiliser
|
||||||
|
|
||||||
// TODO vérifier que $extrafieldKeyToUpdate correspond bien a un extrafield
|
// TODO vérifier que $extrafieldKeyToUpdate correspond bien a un extrafield
|
||||||
foreach ($toselect as $toselectid) {
|
foreach ($toselect as $toselectid) {
|
||||||
/** @var CommonObject $objecttmp */
|
/** @var CommonObject $objecttmp */
|
||||||
$objecttmp = new $objectclass($db);
|
$objecttmp = new $objectclass($db); // to avoid ghost data
|
||||||
$result = $objecttmp->fetch($toselectid);
|
$result = $objecttmp->fetch($toselectid);
|
||||||
if ($result>0) {
|
if ($result>0) {
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$e = new ExtraFields($db);
|
|
||||||
$ret = $e->setOptionalsFromPost(null, $objecttmp, $extrafieldKeyToUpdate);
|
$ret = $e->setOptionalsFromPost(null, $objecttmp, $extrafieldKeyToUpdate);
|
||||||
|
|
||||||
if ($ret > 0) {
|
if ($ret > 0) {
|
||||||
$objecttmp->insertExtraFields(); // TODO gérer l'erreur
|
$objecttmp->insertExtraFields(); // TODO gérer l'erreur
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -212,7 +212,6 @@ if ($massaction == 'presend') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($massaction == 'edit_extrafields') {
|
if ($massaction == 'edit_extrafields') {
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
$elementtype = 'product';
|
$elementtype = 'product';
|
||||||
/** @var CommonObject $objecttmp */
|
/** @var CommonObject $objecttmp */
|
||||||
@ -225,6 +224,11 @@ if ($massaction == 'edit_extrafields') {
|
|||||||
if (!empty($extrafields_list)) {
|
if (!empty($extrafields_list)) {
|
||||||
$myParamExtra = $object->showOptionals($extrafields, 'create');
|
$myParamExtra = $object->showOptionals($extrafields, 'create');
|
||||||
|
|
||||||
|
$formquestion[] = array(
|
||||||
|
'type' => 'other',
|
||||||
|
'value' => $form->selectarray('extrafield-key-to-update', $extrafields_list, GETPOST('extrafield-key-to-update'))
|
||||||
|
);
|
||||||
|
|
||||||
$formquestion[] = array(
|
$formquestion[] = array(
|
||||||
'type' => 'other',
|
'type' => 'other',
|
||||||
'value' => $object->showOptionals($extrafields, 'create')
|
'value' => $object->showOptionals($extrafields, 'create')
|
||||||
|
|||||||
@ -740,7 +740,7 @@ if ($resql) {
|
|||||||
$arrayofmassactions['switchonpurchasestatus'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SwitchOnPurchaseStatus");
|
$arrayofmassactions['switchonpurchasestatus'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SwitchOnPurchaseStatus");
|
||||||
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
|
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
|
||||||
}
|
}
|
||||||
if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) {
|
if (in_array($massaction, array('presend', 'predelete','preaffecttag', 'edit_extrafields'))) {
|
||||||
$arrayofmassactions = array();
|
$arrayofmassactions = array();
|
||||||
}
|
}
|
||||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user