diff --git a/ChangeLog b/ChangeLog index b379c13036e..06f749cbc34 100644 --- a/ChangeLog +++ b/ChangeLog @@ -112,6 +112,7 @@ NEW: When you create product or service, sell accountancy account by default is NEW: Widget birthdays of the month. NEW: Option in workflow module to set a reception billed on validate supplier bill. NEW: Autocompletion on lists should be available on mobile applications. +NEW: Add mass action to close several members. For Developers: NEW: Module "DebugBar" is available as a stable module. diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 0da7a2b0ea4..bf38b2ca5d8 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -189,6 +189,42 @@ if (empty($reshook)) $search_array_options=array(); } + // Close + if ($massaction == 'close' && $user->rights->adherent->creer) + { + $tmpmember = new Adherent($db); + $error=0; + $nbclose=0; + + $db->begin(); + + foreach($toselect as $idtoclose) + { + $tmpmember->fetch($idtoclose); + $result=$tmpmember->resiliate($user); + + if ($result < 0 && ! count($tmpmember->errors)) + { + setEventMessages($tmpmember->error, $tmpmember->errors, 'errors'); + } + else + { + if ($result > 0) $nbclose++; + } + } + + if (! $error) + { + setEventMessages($langs->trans("XMembersClosed", $nbclose), null, 'mesgs'); + + $db->commit(); + } + else + { + $db->rollback(); + } + } + // Mass actions $objectclass='Adherent'; $objectlabel='Members'; @@ -326,12 +362,11 @@ if ($search_type > 0) } $param=''; -if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; -if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($sall != "") $param.="&sall=".urlencode($sall); if ($statut != "") $param.="&statut=".urlencode($statut); if ($search_ref) $param.="&search_ref=".urlencode($search_ref); -if ($search_nom) $param.="&search_nom=".urlencode($search_nom); if ($search_civility) $param.="&search_civility=".urlencode($search_civility); if ($search_firstname) $param.="&search_firstname=".urlencode($search_firstname); if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname); @@ -358,6 +393,7 @@ $arrayofmassactions = array( //'presend'=>$langs->trans("SendByMail"), //'builddoc'=>$langs->trans("PDFMerge"), ); +if ($user->rights->adherent->creer) $arrayofmassactions['close']=$langs->trans("Resiliate"); if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=''.$langs->trans("Delete"); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); @@ -457,7 +493,7 @@ if (! empty($arrayfields['d.lastname']['checked'])) if (! empty($arrayfields['d.gender']['checked'])) { print '