-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NEW add remove confirmation for purchase order
- Loading branch information
Showing
6 changed files
with
153 additions
and
14 deletions.
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
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,7 +1,8 @@ | ||
<?php | ||
/* Copyright (C) 2018-2021 ksar <[email protected]> | ||
* Copyright (C) 2020-2020 akene <[email protected]> | ||
* Copyright (C) 2021-2021 Erik van Berkum <[email protected]> | ||
/* Copyright (C) 2018-2023 ksar <[email protected]> | ||
* Copyright (C) 2020-2020 akene <[email protected]> | ||
* Copyright (C) 2021-2021 Erik van Berkum <[email protected]> | ||
* Copyright (C) 2023 Regis Houssin <[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 | ||
|
@@ -85,6 +86,16 @@ | |
setdraft confirm_setdraft DraftMO $_SERVER["PHP_SELF"] . '?id=' . $object->id | ||
reopen confirm_reopen ReopenMO $_SERVER["PHP_SELF"] . '?id=' . $object->id | ||
deleteline confirm_deleteline DeleteMOine $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $parameters['lineid'] | ||
fourn\commande\card ordersuppliercard, globalcard | ||
delete confirm_delete DeleteOrder $_SERVER["PHP_SELF"].'?id='.$object->id | ||
clone confirm_clone WARNING, need to select a third party, not possible to cancel | ||
valid confirm_valid ValidateOrder $_SERVER["PHP_SELF"].'?id='.$object->id | ||
approve confirm_approve ApproveThisOrder $_SERVER['PHP_SELF']."?id=".$object->id WARNING, if stock enabled, warehouse to be selected, not possible to cancel | ||
approve2 confirm_approve2 ApproveThisOrder $_SERVER['PHP_SELF']."?id=".$object->id WARNING, if stock enabled, warehouse to be selected, not possible to cancel | ||
refuse confirm_refuse DenyingThisOrder $_SERVER['PHP_SELF']."?id=$object->id" WARNING, need to indicate the Reason, Reason will be blank | ||
cancel confirm_cancel Cancel $_SERVER['PHP_SELF']."?id=$object->id" WARNING, need to indicate the Reason, Reason will be blank | ||
commande confirm_commande WARNING, a lot of things to send by POST, not possible to cancel | ||
ask_deleteline confirm_deleteline DeleteProductLine $_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid | ||
*/ | ||
|
@@ -197,7 +208,7 @@ public function formConfirm($parameters, &$object, &$action, $hookmanager) | |
$qualified_for_stock_change=$object->hasProductsOrServices(1); | ||
} | ||
|
||
if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) | ||
if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) | ||
{ | ||
require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; | ||
$warehouse = new Entrepot($this->db); | ||
|
@@ -426,7 +437,8 @@ public function formConfirm($parameters, &$object, &$action, $hookmanager) | |
|
||
// BOM | ||
if (strpos($parameters['context'], 'bomcard') !== false){ | ||
dol_syslog(get_class($this).'::Context = bomcard', LOG_DEBUG, 1 , '', ''); | ||
|
||
dol_syslog(get_class($this).'::Context = bomcard', LOG_DEBUG, 1 , '', ''); | ||
|
||
//Bom Delete | ||
if (($action == 'delete') && ($user->rights->removeconf->delete_bom)){ | ||
|
@@ -481,7 +493,8 @@ public function formConfirm($parameters, &$object, &$action, $hookmanager) | |
|
||
// MO | ||
if (strpos($parameters['context'], 'mocard') !== false){ | ||
dol_syslog(get_class($this).'::Context = mocard', LOG_DEBUG, 1 , '', ''); | ||
|
||
dol_syslog(get_class($this).'::Context = mocard', LOG_DEBUG, 1 , '', ''); | ||
|
||
//MO Delete | ||
if (($action == 'delete') && ($user->rights->removeconf->delete_mo)){ | ||
|
@@ -527,6 +540,75 @@ public function formConfirm($parameters, &$object, &$action, $hookmanager) | |
} | ||
} | ||
|
||
// Purchase order | ||
if (strpos($parameters['context'], 'ordersuppliercard') !== false){ | ||
|
||
dol_syslog(get_class($this).'::Context = ordersuppliercard', LOG_DEBUG, 1 , '', ''); | ||
|
||
// Purchase order Delete | ||
if (($action == 'delete') && ($user->rights->removeconf->delete_purchase_order)){ | ||
$this->results = true; | ||
$page = $_SERVER["PHP_SELF"] . '?id=' . $object->id; | ||
$action_confirm = 'confirm_delete'; | ||
dol_syslog(get_class($this).'::action = delete', LOG_DEBUG, 1 , '', ''); | ||
} | ||
// Purchase order validate and approve | ||
if (($action == 'valid') && ($user->rights->removeconf->validate_purchase_order)){ | ||
$this->results = true; | ||
$page = $_SERVER["PHP_SELF"] . '?id=' . $object->id; | ||
$action_confirm = 'confirm_valid'; | ||
dol_syslog(get_class($this).'::action = valid', LOG_DEBUG, 1 , '', ''); | ||
} | ||
// Purchase order approve | ||
if (($action == 'approve' || $action == 'approve2') && ($user->rights->removeconf->approve_purchase_order)){ | ||
$qualified_for_stock_change = 0; | ||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { | ||
$qualified_for_stock_change=$object->hasProductsOrServices(2); | ||
}else{ | ||
$qualified_for_stock_change=$object->hasProductsOrServices(1); | ||
} | ||
|
||
if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $qualified_for_stock_change) | ||
{ | ||
require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; | ||
$warehouse = new Entrepot($this->db); | ||
$warehouse_array = $warehouse->list_array(); | ||
if (count($warehouse_array) == 1) { | ||
$page = $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&idwarehouse=' . key($warehouse_array); | ||
$this->results = true; | ||
$action_confirm = "confirm_".$action; | ||
dol_syslog(get_class($this).'::action = '.$action, LOG_DEBUG, 1 , '', ''); | ||
} | ||
}else{ | ||
$page = $_SERVER["PHP_SELF"] . '?id=' . $object->id ; | ||
$this->results = true; | ||
$action_confirm = "confirm_".$action; | ||
dol_syslog(get_class($this).'::action = '.$action, LOG_DEBUG, 1 , '', ''); | ||
} | ||
} | ||
// Purchase order refuse | ||
if (($action == 'refuse') && ($user->rights->removeconf->refuse_purchase_order)){ | ||
$this->results = true; | ||
$page = $_SERVER["PHP_SELF"] . '?id=' . $object->id; | ||
$action_confirm = 'confirm_refuse'; | ||
dol_syslog(get_class($this).'::action = refuse', LOG_DEBUG, 1 , '', ''); | ||
} | ||
// Purchase order cancel | ||
if (($action == 'cancel') && ($user->rights->removeconf->cancel_purchase_order)){ | ||
$this->results = true; | ||
$page = $_SERVER["PHP_SELF"] . '?id=' . $object->id; | ||
$action_confirm = 'confirm_cancel'; | ||
dol_syslog(get_class($this).'::action = cancel', LOG_DEBUG, 1 , '', ''); | ||
} | ||
// Purchase order delete line | ||
if (($action == 'ask_deleteline') && ($user->rights->removeconf->delete_purchase_order_line)){ | ||
$this->results = true; | ||
$page = $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $parameters['lineid']; | ||
$action_confirm = 'confirm_deleteline'; | ||
dol_syslog(get_class($this).'::action = deleteline', LOG_DEBUG, 1 , '', ''); | ||
} | ||
} | ||
|
||
if (! $error) { | ||
if ($this->results == true){ | ||
$pageyes=$page.(preg_match('/\?/',$page)?'&':'?').'action='.$action_confirm.'&confirm=yes'; | ||
|
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,6 +1,6 @@ | ||
<?php | ||
/* Copyright (C) 2004-2018 Laurent Destailleur <[email protected]> | ||
* Copyright (C) 2018-2021 ksar <[email protected]> | ||
* Copyright (C) 2018-2023 ksar <[email protected]> | ||
* Copyright (C) 2020-2020 akene <[email protected]> | ||
* Copyright (C) 2021-2021 Erik van Berkum <[email protected]> | ||
* | ||
|
@@ -67,7 +67,7 @@ public function __construct($db) | |
$this->editor_url = 'https://github.com/ksar-ksar/'; | ||
|
||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' | ||
$this->version = '2.1.0'; | ||
$this->version = '2.2.0'; | ||
|
||
// Url to the file with your last number version of this module | ||
$this->url_last_version = 'https://raw.githubusercontent.com/ksar-ksar/Dolibarr_removeconf/master/version.txt'; | ||
|
@@ -92,7 +92,7 @@ public function __construct($db) | |
$this->requiredby = array(); // List of module ids to disable if this one is disabled | ||
$this->conflictwith = array(); // List of module class names as string this module is in conflict with | ||
$this->langfiles = array("removeconf@removeconf"); | ||
$this->phpmin = array(5,3); // Minimum version of PHP required by module | ||
$this->phpmin = array(5,4); // Minimum version of PHP required by module | ||
$this->need_dolibarr_version = array(9,0); // Minimum version of Dolibarr required by module | ||
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) | ||
$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) | ||
|
@@ -384,6 +384,49 @@ public function __construct($db) | |
$this->rights[$r][3] = 0; | ||
$this->rights[$r][4] = 'delete_mo_line'; | ||
$this->rights[$r][5] = ''; | ||
$r++; | ||
$this->rights[$r][0] = 20730038; | ||
$this->rights[$r][1] = 'Delete purchase order without confirmation'; | ||
$this->rights[$r][2] = 'r'; | ||
$this->rights[$r][3] = 0; | ||
$this->rights[$r][4] = 'delete_purchase_order'; | ||
$this->rights[$r][5] = ''; | ||
$r++; | ||
$this->rights[$r][0] = 20730039; | ||
$this->rights[$r][1] = 'Validate and approve purchase order without confirmation'; | ||
$this->rights[$r][2] = 'r'; | ||
$this->rights[$r][3] = 0; | ||
$this->rights[$r][4] = 'validate_purchase_order'; | ||
$this->rights[$r][5] = ''; | ||
$r++; | ||
$this->rights[$r][0] = 20730040; | ||
$this->rights[$r][1] = 'Approve purchase order without confirmation'; | ||
$this->rights[$r][2] = 'r'; | ||
$this->rights[$r][3] = 0; | ||
$this->rights[$r][4] = 'approve_purchase_order'; | ||
$this->rights[$r][5] = ''; | ||
$r++; | ||
$this->rights[$r][0] = 20730041; | ||
$this->rights[$r][1] = 'Refuse purchase order without confirmation'; | ||
$this->rights[$r][2] = 'r'; | ||
$this->rights[$r][3] = 0; | ||
$this->rights[$r][4] = 'refuse_purchase_order'; | ||
$this->rights[$r][5] = ''; | ||
$r++; | ||
$this->rights[$r][0] = 20730042; | ||
$this->rights[$r][1] = 'Cancel purchase order without confirmation'; | ||
$this->rights[$r][2] = 'r'; | ||
$this->rights[$r][3] = 0; | ||
$this->rights[$r][4] = 'cancel_purchase_order'; | ||
$this->rights[$r][5] = ''; | ||
$r++; | ||
$this->rights[$r][0] = 20730043; | ||
$this->rights[$r][1] = 'Delete a purchase order line without confirmation'; | ||
$this->rights[$r][2] = 'r'; | ||
$this->rights[$r][3] = 0; | ||
$this->rights[$r][4] = 'delete_purchase_order_line'; | ||
$this->rights[$r][5] = ''; | ||
$r++; | ||
|
||
// Main menu entries | ||
$this->menu = array(); // List of menus to add | ||
|
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
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 +1 @@ | ||
2.1.0 | ||
2.2.0 |