-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New : Mass action for closing cash controls #31704
Open
bafbes
wants to merge
1
commit into
Dolibarr:develop
Choose a base branch
from
bafbes:abb2001-2
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<?php | ||
/* Copyright (C) 2007-2017 Laurent Destailleur <[email protected]> | ||
* Copyright (C) 2024 Abbes Bahfir <[email protected]> | ||
* 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 '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
* Copyright (C) 2019 Ferran Marcet <[email protected]> | ||
* Copyright (C) 2019-2024 Frédéric France <[email protected]> | ||
* Copyright (C) 2024 MDW <[email protected]> | ||
* Copyright (C) 2024 Abbes Bahfir <[email protected]> | ||
* | ||
* 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) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ | |
/* Copyright (C) 2013 Cédric Salvador <[email protected]> | ||
* Copyright (C) 2013-2014 Laurent Destailleur <[email protected]> | ||
* Copyright (C) 2015 Marcos García <[email protected]> | ||
* Copyright (C) 2024 MDW <[email protected]> | ||
* Copyright (C) 2024 MDW <[email protected]> | ||
* Copyright (C) 2024 Abbes Bahfir <[email protected]> | ||
* | ||
* 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) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you need to add a mass action that is specific to a page/object, you must add it into the file compta/cashcontrol/cashcontrol_list.php
You can add this test just before the include of the generic mass action