2
0
forked from Wavyzz/dolibarr

Merge remote-tracking branch 'upstream/develop' into GenericFunctionsFunctionCallArgumentSpacing

This commit is contained in:
Frédéric FRANCE
2019-02-10 11:08:59 +01:00
35 changed files with 168 additions and 181 deletions

View File

@@ -265,8 +265,14 @@ if (in_array(
//dol_syslog("Call method ".$method." of class ".get_class($actionclassinstance).", module=".$module.", hooktype=".$hooktype, LOG_DEBUG);
$resaction = $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
if (! empty($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
if (! empty($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray=array_merge($this->resArray, $actionclassinstance->results);
if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints;
if (is_numeric($resaction) && $resaction < 0)
{
$error++;
$this->error=$actionclassinstance->error; $this->errors=array_merge($this->errors, (array) $actionclassinstance->errors);
dol_syslog("Error on hook module=".$module.", method ".$method.", class ".get_class($actionclassinstance).", hooktype=".$hooktype.(empty($this->error)?'':" ".$this->error).(empty($this->errors)?'':" ".join(",", $this->errors)), LOG_ERR);
}
// TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string but an int. you must use $actionclassinstance->resprints to return a string
if (! is_array($resaction) && ! is_numeric($resaction))
{

View File

@@ -3014,6 +3014,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
elseif ($pictowithoutext == 'edit') {
$fakey = 'fa-pencil';
$facolor = '#444';
if (! empty($conf->global->MAIN_USE_FONT_AWESOME_5)) $fakey = 'fa-pencil-alt';
}
elseif ($pictowithoutext == 'filter') {
$fakey = 'fa-'.$pictowithoutext;

View File

@@ -188,6 +188,11 @@ class CommActionRapport
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -253,6 +253,11 @@ class pdf_ban extends ModeleBankAccountDoc
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -398,6 +398,11 @@ class pdf_sepamandate extends ModeleBankAccountDoc
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -193,6 +193,11 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -626,6 +626,11 @@ class pdf_einstein extends ModelePDFCommandes
$parameters=array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -691,6 +691,11 @@ class pdf_eratosthene extends ModelePDFCommandes
$parameters=array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -475,6 +475,11 @@ class pdf_strato extends ModelePDFContract
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -422,6 +422,11 @@ class pdf_merou extends ModelePdfExpedition
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -638,6 +638,11 @@ class pdf_rouget extends ModelePdfExpedition
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -510,6 +510,11 @@ class pdf_standard extends ModeleExpenseReport
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -755,6 +755,11 @@ class pdf_crabe extends ModelePDFFactures
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -824,6 +824,11 @@ class pdf_sponge extends ModelePDFFactures
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -458,6 +458,11 @@ class pdf_soleil extends ModelePDFFicheinter
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -613,6 +613,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -568,6 +568,11 @@ class pdf_standard extends ModelePDFProduct
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -494,6 +494,11 @@ class pdf_baleine extends ModelePDFProjects
$parameters=array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -646,6 +646,11 @@ class pdf_beluga extends ModelePDFProjects
$parameters=array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -425,6 +425,11 @@ class pdf_timespent extends ModelePDFProjects
$parameters=array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -811,6 +811,11 @@ class pdf_azur extends ModelePDFPropales
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -852,6 +852,11 @@ class pdf_cyan extends ModelePDFPropales
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -326,6 +326,11 @@ class pdf_paiement
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -568,6 +568,11 @@ class pdf_squille extends ModelePdfReception
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -804,6 +804,11 @@ class pdf_standard extends ModelePDFStock
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -783,6 +783,11 @@ class pdf_stdmovement extends ModelePDFMovement
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -584,6 +584,11 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -681,6 +681,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -491,6 +491,11 @@ class pdf_standard extends ModelePDFSuppliersPayments
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -678,6 +678,11 @@ class pdf_aurore extends ModelePDFSupplierProposal
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -319,34 +319,6 @@ class ActionsDatapolicy
return $ret;
}
/**
* Execute action
*
* @param array $parameters Array of parameters
* @param Object $pdfhandler PDF builder handler
* @param string $action 'add', 'update', 'view'
* @return int <0 if KO,
* =0 if OK but we want to process standard actions too,
* >0 if OK and we want to replace standard actions.
*/
function afterPDFCreation($parameters, &$pdfhandler, &$action)
{
global $conf, $user, $langs;
global $hookmanager;
$outputlangs = $langs;
$ret = 0;
$deltemp = array();
dol_syslog(get_class($this) . '::executeHooks action=' . $action);
/* print_r($parameters); print_r($object); echo "action: " . $action; */
if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2'
}
return $ret;
}
/**
* addMoreActionsButtons

View File

@@ -888,8 +888,8 @@ Permission63001=Read resources
Permission63002=Create/modify resources
Permission63003=Delete resources
Permission63004=Link resources to agenda events
DictionaryCompanyType=Third-Party Types
DictionaryCompanyJuridicalType=Third-Party Legal Entities
DictionaryCompanyType=Third-party types
DictionaryCompanyJuridicalType=Third-party legal entities
DictionaryProspectLevel=Prospect potential
DictionaryCanton=States/Provinces
DictionaryRegion=Regions

View File

@@ -29,17 +29,17 @@ AliasNameShort=Alias Name
Companies=Companies
CountryIsInEEC=Country is inside the European Economic Community
PriceFormatInCurrentLanguage=Price format in current language
ThirdPartyName=Third-Party Name
ThirdPartyEmail=Third-party Email
ThirdParty=Third Party
ThirdParties=Third Parties
ThirdPartyName=Third-party name
ThirdPartyEmail=Third-party email
ThirdParty=Third-party
ThirdParties=Third-parties
ThirdPartyProspects=Prospects
ThirdPartyProspectsStats=Prospects
ThirdPartyCustomers=Customers
ThirdPartyCustomersStats=Customers
ThirdPartyCustomersWithIdProf12=Customers with %s or %s
ThirdPartySuppliers=Vendors
ThirdPartyType=Third-Party Type
ThirdPartyType=Third-party type
Individual=Private individual
ToCreateContactWithSameName=Will automatically create a contact/address with same information as the third party under the third party. In most cases, even if your third party is a physical person, creating a third party alone is enough.
ParentCompany=Parent company
@@ -80,7 +80,7 @@ DefaultLang=Language default
VATIsUsed=Sales tax used
VATIsUsedWhenSelling=This defines if this third party includes a sale tax or not when it makes an invoice to its own customers
VATIsNotUsed=Sales tax is not used
CopyAddressFromSoc=Copy address from Third-Party details
CopyAddressFromSoc=Copy address from third-party details
ThirdpartyNotCustomerNotSupplierSoNoRef=Third party neither customer nor vendor, no available referring objects
ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts=Third party neither customer nor vendor, discounts are not available
PaymentBankAccount=Payment bank account
@@ -259,8 +259,8 @@ ProfId1DZ=RC
ProfId2DZ=Art.
ProfId3DZ=NIF
ProfId4DZ=NIS
VATIntra=Intra-Community VAT ID
VATIntraShort=EU VAT ID
VATIntra=VAT ID
VATIntraShort=VAT ID
VATIntraSyntaxIsValid=Syntax is valid
VATReturn=VAT return
ProspectCustomer=Prospect / Customer
@@ -388,12 +388,12 @@ ExportCardToFormat=Export card to format
ContactNotLinkedToCompany=Contact not linked to any third party
DolibarrLogin=Dolibarr login
NoDolibarrAccess=No Dolibarr access
ExportDataset_company_1=Third Parties (companies/foundations/physical people) and their properties
ExportDataset_company_1=Third-parties (companies/foundations/physical people) and their properties
ExportDataset_company_2=Contacts and their properties
ImportDataset_company_1=Third Parties and their properties
ImportDataset_company_2=Third-Parties additional contacts/addresses and attributes
ImportDataset_company_3=Third-Parties Bank accounts
ImportDataset_company_4=Third-Parties Sales representatives (assign sales representatives/users to companies)
ImportDataset_company_1=Third-parties and their properties
ImportDataset_company_2=Third-parties additional contacts/addresses and attributes
ImportDataset_company_3=Third-parties Bank accounts
ImportDataset_company_4=Third-parties Sales representatives (assign sales representatives/users to companies)
PriceLevel=Price Level
PriceLevelLabels=Price Level Labels
DeliveryAddress=Delivery address

View File

@@ -3,9 +3,9 @@ WarehouseCard=Warehouse card
Warehouse=Warehouse
Warehouses=Warehouses
ParentWarehouse=Parent warehouse
NewWarehouse=New Warehouse / Stock Location
NewWarehouse=New warehouse / Stock Location
WarehouseEdit=Modify warehouse
MenuNewWarehouse=New Warehouse
MenuNewWarehouse=New warehouse
WarehouseSource=Source warehouse
WarehouseSourceNotDefined=No warehouse defined,
AddWarehouse=Create warehouse

View File

@@ -61,38 +61,6 @@ class ActionsTakePos
$this->db = $db;
}
/**
* Overloading the doActions function : replacing the parent's function with the one below
*
* @param array() $parameters Hook metadatas (context, etc...)
* @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
* @param string $action Current action (if set). Generally create or edit or null
* @param HookManager $hookmanager Hook manager propagated to allow calling another hook
* @return int < 0 on error, 0 on success, 1 to replace standard code
*/
public function doActions($parameters, &$object, &$action, $hookmanager)
{
global $conf, $user, $langs;
$error = 0; // Error counter
/* print_r($parameters); print_r($object); echo "action: " . $action; */
if (in_array($parameters['currentcontext'], array('somecontext1','somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2'
{
// Do what you want here...
// You can for example call global vars like $fieldstosearchall to overwrite them, or update database depending on $action and $_POST values.
}
if (! $error) {
$this->results = array('myreturn' => 999);
$this->resprints = 'A text to show';
return 0; // or return 1 to replace standard code
} else {
$this->errors[] = 'Error message';
return -1;
}
}
/**
* Overloading the doActions function : replacing the parent's function with the one below
@@ -107,113 +75,13 @@ class ActionsTakePos
{
global $conf, $user, $langs;
$error = 0; // Error counter
/* print_r($parameters); print_r($object); echo "action: " . $action; */
if (in_array($parameters['currentcontext'], array('invoicecard'))) // do something only for the context 'somecontext1' or 'somecontext2'
{
$receipt_url=DOL_URL_ROOT."/takepos/receipt.php";
print '<div class="inline-block divButAction"><a target="_blank" class="butAction" href="' . $receipt_url . '?facid=' . $object->id.'">' . $langs->trans('Ticket') .'</a></div>';
$this->resprints = '<div class="inline-block divButAction"><a target="_blank" class="butAction" href="' . $receipt_url . '?facid=' . $object->id.'">' . $langs->trans('Ticket') .'</a></div>';
}
if (! $error) {
$this->results = array('myreturn' => 999);
$this->resprints = 'A text to show';
return 0; // or return 1 to replace standard code
} else {
$this->errors[] = 'Error message';
return -1;
}
}
/**
* Overloading the addMoreMassActions function : replacing the parent's function with the one below
*
* @param array() $parameters Hook metadatas (context, etc...)
* @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
* @param string $action Current action (if set). Generally create or edit or null
* @param HookManager $hookmanager Hook manager propagated to allow calling another hook
* @return int < 0 on error, 0 on success, 1 to replace standard code
*/
public function addMoreMassActions($parameters, &$object, &$action, $hookmanager)
{
global $conf, $user, $langs;
$error = 0; // Error counter
/* print_r($parameters); print_r($object); echo "action: " . $action; */
if (in_array($parameters['currentcontext'], array('somecontext1','somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2'
{
$this->resprints = '<option value="0"'.($disabled?' disabled="disabled"':'').'>'.$langs->trans("TakePosMassAction").'</option>';
}
if (! $error) {
return 0; // or return 1 to replace standard code
} else {
$this->errors[] = 'Error message';
return -1;
}
}
/**
* Execute action
*
* @param array $parameters Array of parameters
* @param Object $object Object output on PDF
* @param string $action 'add', 'update', 'view'
* @return int <0 if KO,
* =0 if OK but we want to process standard actions too,
* >0 if OK and we want to replace standard actions.
*/
function beforePDFCreation($parameters, &$object, &$action)
{
global $langs,$conf;
global $hookmanager;
$outputlangs=$langs;
$ret=0; $deltemp=array();
dol_syslog(get_class($this).'::executeHooks action='.$action);
/* print_r($parameters); print_r($object); echo "action: " . $action; */
if (in_array($parameters['currentcontext'], array('somecontext1','somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2'
{
}
return $ret;
}
/**
* Execute action
*
* @param array $parameters Array of parameters
* @param Object $pdfhandler PDF builder handler
* @param string $action 'add', 'update', 'view'
* @return int <0 if KO,
* =0 if OK but we want to process standard actions too,
* >0 if OK and we want to replace standard actions.
*/
function afterPDFCreation($parameters, &$pdfhandler, &$action)
{
global $langs,$conf;
global $hookmanager;
$outputlangs=$langs;
$ret=0; $deltemp=array();
dol_syslog(get_class($this).'::executeHooks action='.$action);
/* print_r($parameters); print_r($object); echo "action: " . $action; */
if (in_array($parameters['currentcontext'], array('somecontext1','somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2'
{
}
return $ret;
}
}