本文整理匯總了PHP中Facture::callHooks方法的典型用法代碼示例。如果您正苦於以下問題:PHP Facture::callHooks方法的具體用法?PHP Facture::callHooks怎麽用?PHP Facture::callHooks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Facture
的用法示例。
在下文中一共展示了Facture::callHooks方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createFromClone
/**
* Load an object from its id and create a new one in database
* @param fromid Id of object to clone
* @param invertdetail Reverse sign of amounts for lines
* @return int New id of clone
*/
function createFromClone($fromid, $invertdetail = 0)
{
global $conf, $user, $langs;
$error = 0;
// Load source object
$objFrom = new Facture($this->db);
$objFrom->fetch($fromid);
// Load new object
$object = new Facture($this->db);
$object->fetch($fromid);
// Instantiate hooks of thirdparty module
if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules)) {
$object->callHooks('invoicecard');
}
$this->db->begin();
$object->id = 0;
$object->statut = 0;
// Clear fields
$object->user_author = $user->id;
$object->user_valid = '';
$object->fk_facture_source = 0;
$object->date_creation = '';
$object->date_validation = '';
$object->ref_client = '';
$object->close_code = '';
$object->close_note = '';
$object->products = $object->lines;
// Tant que products encore utilise
// Loop on each line of new invoice
foreach ($object->lines as $i => $line) {
if (($object->lines[$i]->info_bits & 0x2) == 0x2) {
unset($object->lines[$i]);
unset($object->products[$i]);
// Tant que products encore utilise
}
}
// Create clone
$result = $object->create($user);
// Other options
if ($result < 0) {
$this->error = $object->error;
$error++;
}
if (!$error) {
// Hook for external modules
if (!empty($object->hooks)) {
foreach ($object->hooks as $hook) {
if (!empty($hook['modules'])) {
foreach ($hook['modules'] as $module) {
if (method_exists($module, 'createfrom')) {
$result = $module->createfrom($objFrom, $result, $object->element);
if ($result < 0) {
$error++;
}
}
}
}
}
}
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php";
$interface = new Interfaces($this->db);
$result = $interface->run_triggers('BILL_CLONE', $object, $user, $langs, $conf);
if ($result < 0) {
$error++;
$this->errors = $interface->errors;
}
// Fin appel triggers
}
// End
if (!$error) {
$this->db->commit();
return $object->id;
} else {
$this->db->rollback();
return -1;
}
}
示例2: isset
// Security check
$fieldid = isset($_GET["ref"])?'facnumber':'rowid';
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid);
// Nombre de ligne pour choix de produit/service predefinis
$NBLINES=4;
$usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
$object=new Facture($db);
// Instantiate hooks of thirdparty module
if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
{
$object->callHooks('invoicecard');
}
/******************************************************************************/
/* Actions */
/******************************************************************************/
// Hook of actions
if (! empty($object->hooks))
{
foreach($object->hooks as $hook)
{
if (! empty($hook['modules']))
{
示例3: Facture
/*
* Create mode
*/
if ($_GET["action"] == 'create')
{
print_fiche_titre($langs->trans("CreateRepeatableInvoice"));
if ($mesg) print $mesg.'<br>';
$facture = new Facture($db); // Source invoice
$product_static=new Product($db);
// Instantiate hooks of thirdparty module
if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
{
$facture->callHooks('invoicecard');
}
if ($facture->fetch($_GET["facid"]) > 0)
{
print '<form action="fiche-rec.php" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="facid" value="'.$facture->id.'">';
print '<table class="border" width="100%">';
$facture->fetch_thirdparty();
print '<tr><td>'.$langs->trans("Customer").'</td><td>'.$facture->client->getNomUrl(1).'</td>';
print '<td>';