Close #18131 : new massaction for thirdparty
This commit is contained in:
parent
224bbe96c3
commit
35b29481c7
@ -1470,6 +1470,80 @@ if (!$error && ($action == 'affecttag' && $confirm == 'yes') && $permissiontoadd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$error && ($massaction == 'enable' || ($action == 'enable' && $confirm == 'yes')) && $permissiontoadd) {
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
$objecttmp = new $objectclass($db);
|
||||||
|
$nbok = 0;
|
||||||
|
foreach ($toselect as $toselectid) {
|
||||||
|
$result = $objecttmp->fetch($toselectid);
|
||||||
|
if($result>0){
|
||||||
|
if (in_array($objecttmp->element,array('societe'))) {
|
||||||
|
$result =$objecttmp->setStatut(1);
|
||||||
|
}
|
||||||
|
if ($result <= 0) {
|
||||||
|
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||||
|
$error++;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
$nbok++;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||||
|
$error++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
if ($nbok > 1) {
|
||||||
|
setEventMessages($langs->trans("RecordsEnabled", $nbok), null, 'mesgs');
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans("RecordEnabled"), null, 'mesgs');
|
||||||
|
}
|
||||||
|
$db->commit();
|
||||||
|
} else {
|
||||||
|
$db->rollback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error && ($massaction == 'disable' || ($action == 'disable' && $confirm == 'yes')) && $permissiontoadd) {
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
$objecttmp = new $objectclass($db);
|
||||||
|
$nbok = 0;
|
||||||
|
foreach ($toselect as $toselectid) {
|
||||||
|
$result = $objecttmp->fetch($toselectid);
|
||||||
|
if($result>0){
|
||||||
|
if (in_array($objecttmp->element,array('societe'))) {
|
||||||
|
$result =$objecttmp->setStatut(0);
|
||||||
|
}
|
||||||
|
if ($result <= 0) {
|
||||||
|
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||||
|
$error++;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
$nbok++;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||||
|
$error++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
if ($nbok > 1) {
|
||||||
|
setEventMessages($langs->trans("RecordsDisabled", $nbok), null, 'mesgs');
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans("RecordDisabled"), null, 'mesgs');
|
||||||
|
}
|
||||||
|
$db->commit();
|
||||||
|
} else {
|
||||||
|
$db->rollback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$parameters['toselect'] = $toselect;
|
$parameters['toselect'] = $toselect;
|
||||||
$parameters['uploaddir'] = $uploaddir;
|
$parameters['uploaddir'] = $uploaddir;
|
||||||
$parameters['massaction'] = $massaction;
|
$parameters['massaction'] = $massaction;
|
||||||
|
|||||||
@ -194,6 +194,14 @@ if ($massaction == 'presend') {
|
|||||||
|
|
||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($massaction == 'preenable') {
|
||||||
|
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassEnabling"), $langs->trans("ConfirmMassEnablingQuestion", count($toselect)), "enable", null, '', 0, 200, 500, 1);
|
||||||
|
}
|
||||||
|
if ($massaction == 'predisable') {
|
||||||
|
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDisabling"), $langs->trans("ConfirmMassDisablingQuestion", count($toselect)), "disable", null, '', 0, 200, 500, 1);
|
||||||
|
}
|
||||||
|
|
||||||
// Allow Pre-Mass-Action hook (eg for confirmation dialog)
|
// Allow Pre-Mass-Action hook (eg for confirmation dialog)
|
||||||
$parameters = array(
|
$parameters = array(
|
||||||
'toselect' => $toselect,
|
'toselect' => $toselect,
|
||||||
|
|||||||
@ -1137,3 +1137,13 @@ CopiedToClipboard=Copied to clipboard
|
|||||||
InformationOnLinkToContract=This amount is only the total of all the lines of the contract. No notion of time is taken into consideration.
|
InformationOnLinkToContract=This amount is only the total of all the lines of the contract. No notion of time is taken into consideration.
|
||||||
ConfirmCancel=Are you sure you want to cancel
|
ConfirmCancel=Are you sure you want to cancel
|
||||||
EmailMsgID=Email MsgID
|
EmailMsgID=Email MsgID
|
||||||
|
SetToEnabled=Set to enabled
|
||||||
|
SetToDisabled=Set to disabled
|
||||||
|
ConfirmMassEnabling=mass enabling confirmation
|
||||||
|
ConfirmMassEnablingQuestion=Are you sure you want to enable the %s selected record(s)?
|
||||||
|
ConfirmMassDisabling=mass disabling confirmation
|
||||||
|
ConfirmMassDisablingQuestion=Are you sure you want to disable the %s selected record(s)?
|
||||||
|
RecordsEnabled=%s record(s) enabled
|
||||||
|
RecordsDisabled=%s record(s) disabled
|
||||||
|
RecordEnabled=Record enabled
|
||||||
|
RecordDisabled=Record disabled
|
||||||
|
|||||||
@ -1137,3 +1137,13 @@ CopiedToClipboard=Copié dans le presse-papier
|
|||||||
InformationOnLinkToContract=Ce montant n’est que le total de toutes les lignes du contrat. Aucune notion de temps n’est prise en considération.
|
InformationOnLinkToContract=Ce montant n’est que le total de toutes les lignes du contrat. Aucune notion de temps n’est prise en considération.
|
||||||
ConfirmCancel=Êtes-vous sûr de vous annuler
|
ConfirmCancel=Êtes-vous sûr de vous annuler
|
||||||
EmailMsgID=E-mail MsgID
|
EmailMsgID=E-mail MsgID
|
||||||
|
SetToEnabled=Activer
|
||||||
|
SetToDisabled=Désactiver
|
||||||
|
ConfirmMassEnabling=Confirmation d'activation en masse
|
||||||
|
ConfirmMassEnablingQuestion=Êtes-vous sur de vouloir activer les %s enregistrement(s) sélectionné(s) ?
|
||||||
|
ConfirmMassDisabling=Confirmation de desactivation en masse
|
||||||
|
ConfirmMassDisablingQuestion=Êtes-vous sur de vouloir desactiver les %s enregistrement(s) sélectionné(s) ?
|
||||||
|
RecordsEnabled=%s enregistrement(s) activé(s)
|
||||||
|
RecordsDisabled=%s enregistrement(s) désactivé(s)
|
||||||
|
RecordEnabled=Enregistrement activé
|
||||||
|
RecordDisabled=Enregistrement désactivé
|
||||||
|
|||||||
@ -865,7 +865,13 @@ if ($user->rights->societe->supprimer) {
|
|||||||
if ($user->rights->societe->creer) {
|
if ($user->rights->societe->creer) {
|
||||||
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
|
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
|
||||||
}
|
}
|
||||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) {
|
if ($user->rights->societe->creer) {
|
||||||
|
$arrayofmassactions['preenable'] = img_picto('', '', 'class="pictofixedwidth"').$langs->trans("SetToEnabled");
|
||||||
|
}
|
||||||
|
if ($user->rights->societe->creer) {
|
||||||
|
$arrayofmassactions['predisable'] = img_picto('', '', 'class="pictofixedwidth"').$langs->trans("SetToDisabled");
|
||||||
|
}
|
||||||
|
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'preenable', 'preclose'))) {
|
||||||
$arrayofmassactions = array();
|
$arrayofmassactions = array();
|
||||||
}
|
}
|
||||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user