diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 4c9e9cfe29ba9..7aed7b4f20000 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Abbes Bahfir * Copyright (C) ---Put here your own copyright and developer email--- * * This program is free software; you can redistribute it and/or modify @@ -380,6 +381,8 @@ if (!empty($permissiontodelete)) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } +if (!empty($permissiontoadd)) $arrayofmassactions['preclose'] = img_picto('', 'close', 'class="pictofixedwidth"').$langs->trans("Close"); + $massactionbutton = $form->selectMassAction('', $arrayofmassactions); print '
'."\n"; diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 2bd039d4fb3ad..f1f946d93b6bf 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -5,6 +5,7 @@ * Copyright (C) 2019 Ferran Marcet * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2024 MDW + * Copyright (C) 2024 Abbes Bahfir * * 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 @@ -1133,6 +1134,30 @@ //var_dump($listofobjectthirdparties);exit; } +// close cashpoint from mass action +if (!$error && $objectclass=='CashControl' && ($massaction == 'close' || ($action == 'close' && $confirm == 'yes')) && $permissiontoadd) { + $objecttmp = new $objectclass($db); + $db->begin(); + $unique_arr = array_unique($toselect); + foreach ($unique_arr as $toselectid) { + $result = $objecttmp->fetch($toselectid); + if ($result > 0) { + $objecttmp->cash = price2num(GETPOST('cash_amount', 'alpha')); + $objecttmp->card = price2num(GETPOST('card_amount', 'alpha')); + $objecttmp->cheque = price2num(GETPOST('cheque_amount', 'alpha')); + + $result = $objecttmp->valid($user); + } + if ($result <= 0) { + setEventMessages($langs->trans("CashpointAlreadyClosed",$objecttmp->id), null, 'errors'); + $db->rollback(); + } else { + setEventMessages($langs->trans("CashFenceDone"), null); + $db->commit(); + } + } +} + // Generate document foreach object according to model linked to object // @todo : propose model selection if (!$error && $massaction == 'generate_doc' && $permissiontoread) { diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 33bcaf006a977..be7d6e72f5ee1 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -2,7 +2,8 @@ /* Copyright (C) 2013 Cédric Salvador * Copyright (C) 2013-2014 Laurent Destailleur * Copyright (C) 2015 Marcos García - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Abbes Bahfir * * 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 @@ -47,6 +48,10 @@ print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeletion"), $langs->trans("ConfirmMassDeletionQuestion", count($toselect)), "delete", null, '', 0, 200, 500, 1); } +if ($massaction == 'preclose') { + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassClosing"), $langs->trans("ConfirmMassClosingQuestion", count($toselect)), "close", null, '', 0, 200, 500, 1); +} + if ($massaction == 'preclonetasks') { $selected = ''; foreach (GETPOST('toselect') as $tmpselected) { diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index cac1174e1edd6..25b5212a6fc33 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -195,3 +195,6 @@ SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation=SEPA fi SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp=Yes = Store 'Payment Type' in 'Credit Transfer' section of SEPA file

When generating a SEPA XML file for Credit transfers, the section "PaymentTypeInformation" can now be placed inside the "CreditTransferTransactionInformation" section (instead of "Payment" section). We strongly recommend to keep this unchecked to place PaymentTypeInformation at Payment level, as all banks will not necessarily accept it at CreditTransferTransactionInformation level. Contact your bank before placing PaymentTypeInformation at CreditTransferTransactionInformation level. ToCreateRelatedRecordIntoBank=To create missing related bank record XNewLinesConciliated=%s new line(s) conciliated +ConfirmMassClosing= Mass Closing Confirm +ConfirmMassClosingQuestion = Are you sure you want to close the selected %s record(s)? +CashpointAlreadyClosed = Cash control %s is already closed diff --git a/htdocs/langs/fr_FR/banks.lang b/htdocs/langs/fr_FR/banks.lang index 2b045e646b07e..99e9a1fcaf1d6 100644 --- a/htdocs/langs/fr_FR/banks.lang +++ b/htdocs/langs/fr_FR/banks.lang @@ -195,3 +195,6 @@ SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation=Variant SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp=Oui = Stocker le « Type de paiement » dans la section « Virement de crédit » du fichier SEPA

Lors de la génération d'un fichier XML SEPA pour les virements, la section "PaymentTypeInformation" peut désormais être placée dans la section "CreditTransferTransactionInformation" (au lieu de la section "Payment"). Nous vous recommandons fortement de laisser cette case décochée pour placer PaymentTypeInformation au niveau Payment, car toutes les banques ne l'accepteront pas nécessairement au niveau CreditTransferTransactionInformation. Contactez votre banque avant de placer PaymentTypeInformation au niveau CreditTransferTransactionInformation. ToCreateRelatedRecordIntoBank=Pour créer un enregistrement bancaire associé manquant XNewLinesConciliated=%s nouvelle(s) ligne(s) rapprochée(s) +ConfirmMassClosing= Confirmation de la clôture de masse +ConfirmMassClosingQuestion = Etes-vous sûr de vouloir clôturer le(s) %s enregistrement(s) sélectionné(s)? +CashpointAlreadyClosed= Le contrôle de caisse %s est déja clôturé