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) {
|
||||
$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
|
||||
$extrafieldKeyToUpdate = 'code_tva_achat'; // TODO A FAIRE coté formulaire : ajouter le select de l'extrafield a utiliser
|
||||
$nbok = 0;
|
||||
$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
|
||||
foreach ($toselect as $toselectid) {
|
||||
/** @var CommonObject $objecttmp */
|
||||
$objecttmp = new $objectclass($db);
|
||||
$objecttmp = new $objectclass($db); // to avoid ghost data
|
||||
$result = $objecttmp->fetch($toselectid);
|
||||
if ($result>0) {
|
||||
// Fill array 'array_options' with data from add form
|
||||
$e = new ExtraFields($db);
|
||||
$ret = $e->setOptionalsFromPost(null, $objecttmp, $extrafieldKeyToUpdate);
|
||||
|
||||
if ($ret > 0) {
|
||||
$objecttmp->insertExtraFields(); // TODO gérer l'erreur
|
||||
} else {
|
||||
|
||||
@ -212,7 +212,6 @@ if ($massaction == 'presend') {
|
||||
}
|
||||
|
||||
if ($massaction == 'edit_extrafields') {
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$elementtype = 'product';
|
||||
/** @var CommonObject $objecttmp */
|
||||
@ -225,6 +224,11 @@ if ($massaction == 'edit_extrafields') {
|
||||
if (!empty($extrafields_list)) {
|
||||
$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(
|
||||
'type' => 'other',
|
||||
'value' => $object->showOptionals($extrafields, 'create')
|
||||
|
||||
@ -740,7 +740,7 @@ if ($resql) {
|
||||
$arrayofmassactions['switchonpurchasestatus'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SwitchOnPurchaseStatus");
|
||||
$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();
|
||||
}
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user