-
Notifications
You must be signed in to change notification settings - Fork 15
add a simpler message return for the action tests #2068
Copy link
Copy link
Open
Labels
Milestone
Description
consider the method expense:checkRecordAllowsDelete() when reporting it returns each fail reason whcih can be useful, but perhaps add an option at the bottom where the messaage
also add a silent switch + see how I did the others
This expense cannot be deleted
Obviously control this by a function variable
change all of the checkers to match this format, where appropriate.
SEE those switch statements where I handle messages so they are only pushed at the end. this will allow me to have simple and all messages returned
eg
look at the test in the function variable
public function checkRecordCanBeCreated($client_id = null, $invoice_id = null, $supplier_id = null, $expense_id = null, $silent = \CMSApplication::$simpleMessages ? true : $silent) {eg
checkRecordCanBeCreated($client_id = null, $invoice_id = null, $supplier_id = null, $expense_id = null, $silent = false, $simpleMessage = \CMSApplication::$simpleMessages) {
// If simple messaging is on, make sure silent is on
$silent = \CMSApplication::$simpleMessages ? true : $silent;
// Test function
$this->app->system->variables->systemMessagesWrite('danger', _gettext("The client is not active so you cannot create a credit note against it.", $silent));
// Silent Message
if( \CMSApplication::$simpleMessages){
$this->app->system->variables->systemMessagesWrite('danger', _gettext("You cannot create a credit note against this client.", $silent));
}
}
NB: I do not have to declare it as a variable in the function list.
Reactions are currently unavailable