Add mass action proposal closed
This commit is contained in:
parent
5d1e54c6fd
commit
aaf68b904e
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2015-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2015-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -973,7 +974,41 @@ if (! $error && $massaction == 'validate' && $permtocreate)
|
|||||||
//var_dump($listofobjectthirdparties);exit;
|
//var_dump($listofobjectthirdparties);exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Closed records
|
||||||
|
if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permtoclose) {
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
$objecttmp = new $objectclass($db);
|
||||||
|
$nbok = 0;
|
||||||
|
foreach ($toselect as $toselectid) {
|
||||||
|
$result = $objecttmp->fetch($toselectid);
|
||||||
|
if ($result > 0) {
|
||||||
|
$result = $objecttmp->cloture($user, 3);
|
||||||
|
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("RecordsModified", $nbok), null, 'mesgs');
|
||||||
|
else
|
||||||
|
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$db->rollback();
|
||||||
|
}
|
||||||
|
}
|
||||||
// Delete record from mass action (massaction = 'delete' for direct delete, action/confirm='delete'/'yes' with a confirmation step before)
|
// Delete record from mass action (massaction = 'delete' for direct delete, action/confirm='delete'/'yes' with a confirmation step before)
|
||||||
if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm == 'yes')) && $permtodelete)
|
if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm == 'yes')) && $permtodelete)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user