Merge pull request #313 from lrq3000/develophooks

A lot of hooks and triggers implemented + custom substitution function for lines in ODT
This commit is contained in:
Regis Houssin 2012-08-16 08:15:19 -07:00
commit b3d09478ca
25 changed files with 313 additions and 37 deletions

View File

@ -62,6 +62,11 @@ $actioncomm = new ActionComm($db);
$contact = new Contact($db);
//var_dump($_POST);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('actioncard'));
/*
* Action creation de l'action
@ -566,6 +571,10 @@ if ($action == 'create')
$doleditor->Create();
print '</td></tr>';
// Other attributes
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$actioncomm,$action); // Note that $action and $object may have been modified by hook
print '</table>';
print '<center><br>';
@ -944,6 +953,10 @@ if ($id)
print dol_htmlentitiesbr($act->note);
print '</td></tr>';
// Other attributes
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
print '</table>';
}

View File

@ -122,6 +122,16 @@ class Deplacement extends CommonObject
if ($result)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."deplacement");
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('DEPLACEMENT_CREATE',$this,$user,$langs,$conf);
if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers
$result=$this->update($user);
if ($result > 0)
{

View File

@ -48,6 +48,11 @@ $mesg = '';
$object = new Deplacement($db);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('tripsandexpensescard'));
/*
* Actions
@ -317,6 +322,10 @@ if ($action == 'create')
print '</td></tr>';
}
// Other attributes
$parameters=array('colspan' => ' colspan="2"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>';
print '<br><center><input class="button" type="submit" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; ';
@ -408,6 +417,10 @@ else if ($id)
print "</td></tr>";
}
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>';
print '<br><center><input type="submit" class="button" value="'.$langs->trans("Save").'"> &nbsp; ';
@ -508,6 +521,10 @@ else if ($id)
// Statut
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print "</table><br>";
// Notes

View File

@ -352,7 +352,18 @@ class Don extends CommonObject
$result = $this->db->query($sql);
if ($result)
{
return $this->db->last_insert_id(MAIN_DB_PREFIX."don");
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."don");
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('DON_CREATE',$this,$user,$langs,$conf);
if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers
return $this->id;
}
else
{

View File

@ -49,6 +49,11 @@ $donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOS
// Security check
$result = restrictedArea($user, 'don', $id);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('doncard'));
/*
* Actions
@ -321,6 +326,10 @@ if ($action == 'create')
print "</td></tr>\n";
}
// Other attributes
$parameters=array('colspan' => ' colspan="1"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$don,$action); // Note that $action and $object may have been modified by hook
print "</table>\n";
print '<br><center><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
print "</form>\n";
@ -410,6 +419,10 @@ if (! empty($id) && $action == 'edit')
print '</td></tr>';
}
// Other attributes
$parameters=array('colspan' => ' colspan="1"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$don,$action); // Note that $action and $object may have been modified by hook
print "</table>\n";
print '<br><center><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
@ -494,6 +507,10 @@ if (! empty($id) && $action != 'edit')
print "<tr>".'<td>'.$langs->trans("Project").'</td><td>'.$don->projet.'</td></tr>';
}
// Other attributes
$parameters=array('colspan' => ' colspan="1"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$don,$action); // Note that $action and $object may have been modified by hook
print "</table>\n";
print "</form>\n";

View File

@ -60,6 +60,8 @@ class Tva extends CommonObject
function __construct($db)
{
$this->db = $db;
$this->element = 'tva';
$this->table_element = 'tva';
return 1;
}
@ -122,7 +124,7 @@ class Tva extends CommonObject
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
$result=$interface->run_triggers('TVA_CREATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
@ -189,7 +191,7 @@ class Tva extends CommonObject
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
$result=$interface->run_triggers('TVA_MODIFY',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}
@ -289,7 +291,7 @@ class Tva extends CommonObject
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
$result=$interface->run_triggers('TVA_DELETE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
@ -512,6 +514,14 @@ class Tva extends CommonObject
if ($result)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."tva"); // TODO devrait s'appeler paiementtva
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('TVA_ADDPAYMENT',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
if ($this->id > 0)
{
$ok=1;

View File

@ -40,6 +40,11 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', '', '', 'charges');
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('taxvatcard'));
/**
* Action ajout paiement tva
@ -178,6 +183,11 @@ if ($_GET["action"] == 'create')
print "</td>\n";
print "</tr>";
}
// Other attributes
$parameters=array('colspan' => ' colspan="1"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>';
print "<br>";
@ -242,6 +252,10 @@ if ($id)
}
}
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$vatpayment,$action); // Note that $action and $object may have been modified by hook
print '</table>';
print '</div>';

View File

@ -492,6 +492,10 @@ else
}
print '</tr>';
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print "</table><br><br>";
@ -673,6 +677,10 @@ else
else print $langs->trans("NoDolibarrAccess");
print '</td></tr>';
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table><br>';
print '<center>';
@ -858,6 +866,10 @@ else
else print $langs->trans("NoDolibarrAccess");
print '</td></tr>';
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print "</table>";
print "</div>";

View File

@ -58,6 +58,11 @@ $result=restrictedArea($user,'contrat',$id);
$usehm=(! empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:0);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('contractcard'));
$object = new Contrat($db);
@ -633,6 +638,10 @@ if ($action == 'create')
print '</textarea></td></tr>';
}
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print "</table>\n";
print '<br><center><input type="submit" class="button" value="'.$langs->trans("Create").'"></center>';
@ -779,6 +788,10 @@ else
print "</td></tr>";
}
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print "</table>";
if (! empty($object->brouillon) && $user->rights->contrat->creer)

View File

@ -3380,10 +3380,12 @@ function make_substitutions($chaine,$substitutionarray)
* @param array &$substitutionarray Array substitution old value => new value value
* @param Translate $outputlangs If we want substitution from special constants, we provide a language
* @param Object $object If we want substitution from special constants, we provide data in a source object
* @param Object/array $parameters Add more parameters (useful to pass product lines)
* @param string $callfunc What is the name of the custom function that will be called? (default: completesubstitutionarray)
* @return void
* @see make_substitutions
*/
function complete_substitutions_array(&$substitutionarray,$outputlangs,$object='')
function complete_substitutions_array(&$substitutionarray,$outputlangs,$object='',$parameters=null,$callfunc="completesubstitutionarray")
{
global $conf,$user;
@ -3408,8 +3410,8 @@ function complete_substitutions_array(&$substitutionarray,$outputlangs,$object='
dol_syslog("Library functions_".$substitfile['name']." found into ".$dir);
require_once($dir.$substitfile['name']);
$function_name=$module."_completesubstitutionarray";
$function_name($substitutionarray,$outputlangs,$object);
$function_name=$module."_".$callfunc;
$function_name($substitutionarray,$outputlangs,$object,$parameters);
}
}
}

View File

@ -455,6 +455,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
foreach ($object->lines as $line)
{
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
foreach($tmparray as $key => $val)
{
try

View File

@ -465,6 +465,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
foreach ($object->lines as $line)
{
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
foreach($tmparray as $key => $val)
{
try

View File

@ -454,6 +454,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
foreach ($object->lines as $line)
{
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
foreach($tmparray as $key => $val)
{
try

View File

@ -41,7 +41,7 @@
<?php
if (is_object($hookmanager))
{
$parameters=array('fk_parent_line'=>$line->fk_parent_line);
$parameters=array('line'=>$line,'fk_parent_line'=>$line->fk_parent_line,'var'=>$var,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer);
echo $hookmanager->executeHooks('formEditProductOptions',$parameters,$this,$action);
}
@ -75,7 +75,7 @@
</td>
<?php
if (! empty($conf->margin->enabled)) {
if (! empty($conf->margin->enabled)) {
?>
<td align="right"><input type="text" size="5" name="buying_price" value="<?php echo price($line->pa_ht,0,'',0); ?>"></td>
<?php

View File

@ -51,7 +51,7 @@
if (is_object($hookmanager))
{
$fk_parent_line = ($_POST["fk_parent_line"] ? $_POST["fk_parent_line"] : $line->fk_parent_line);
$parameters=array('fk_parent_line'=>$fk_parent_line);
$parameters=array('line'=>$line,'fk_parent_line'=>$fk_parent_line,'var'=>$var,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer);
echo $hookmanager->executeHooks('formEditProductOptions',$parameters,$this,$action);
}
@ -162,4 +162,3 @@ $(document).ready(function() {
</script>
<?php } ?>
<!-- END PHP TEMPLATE predefinedproductline_edit.tpl.php -->

View File

@ -57,6 +57,11 @@ $ref=GETPOST('ref','alpha');
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,$origin,$origin_id);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('expeditioncard'));
$action = GETPOST('action','alpha');
$confirm = GETPOST('confirm','alpha');
@ -317,21 +322,21 @@ else if ($action == 'builddoc') // En get ou en post
}
}
// Delete file in doc form
elseif ($action == 'remove_file')
{
// Delete file in doc form
elseif ($action == 'remove_file')
{
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
$object = new Expedition($db);
if ($object->fetch($id))
{
$object->fetch_thirdparty();
$upload_dir = $conf->expedition->dir_output . "/sending";
$file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
}
$object = new Expedition($db);
if ($object->fetch($id))
{
$object->fetch_thirdparty();
$upload_dir = $conf->expedition->dir_output . "/sending";
$file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
}
}
/*
@ -663,6 +668,10 @@ if ($action == 'create')
print '<input name="tracking_number" size="20" value="'.GETPOST('tracking_number','alpha').'">';
print "</td></tr>\n";
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$expe,$action); // Note that $action and $object may have been modified by hook
print "</table>";
/*
@ -1123,6 +1132,10 @@ else
print $form->editfieldval("TrackingNumber",'trackingnumber',$object->tracking_url,$object,$user->rights->expedition->creer,'string',$object->tracking_number);
print '</td></tr>';
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print "</table>\n";
/*

View File

@ -156,6 +156,9 @@ class Fichinter extends CommonObject
$result=$this->db->query($sql);
if ($result)
{
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."fichinter");
$this->db->commit();
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
@ -165,8 +168,6 @@ class Fichinter extends CommonObject
}
// Fin appel triggers
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."fichinter");
$this->db->commit();
return $this->id;
}
else

View File

@ -59,6 +59,11 @@ $hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($co
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('interventioncard'));
$object = new Fichinter($db);
@ -810,6 +815,10 @@ if ($action == 'create')
print '</td></tr>';
}
// Other attributes
$parameters=array('colspan' => ' colspan="2"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>';
print '<center><br>';
@ -940,6 +949,10 @@ else if ($id > 0 || ! empty($ref))
// Statut
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print "</table><br>";
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))

View File

@ -1011,7 +1011,7 @@ class CommandeFournisseur extends CommonOrder
* @param int $info_bits More information
* @return int <=0 if KO, >0 if OK
*/
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $type=0, $info_bits=0)
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $type=0, $info_bits=0, $notrigger=false)
{
global $langs,$mysoc;
@ -1139,6 +1139,19 @@ class CommandeFournisseur extends CommonOrder
//print $sql;
if ($resql)
{
$this->rowid = $this->db->last_insert_id(MAIN_DB_PREFIX.'commande_fournisseurdet');
if (! $notrigger)
{
global $conf, $langs, $user;
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('LINEORDER_SUPPLIER_CREATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}
$this->update_price();
$this->db->commit();
@ -1584,7 +1597,7 @@ class CommandeFournisseur extends CommonOrder
* @param int $type Type of line (0=product, 1=service)
* @return int < 0 if error, > 0 if ok
*/
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0)
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $notrigger=false)
{
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type");
include_once(DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php');
@ -1660,6 +1673,19 @@ class CommandeFournisseur extends CommonOrder
$result = $this->db->query($sql);
if ($result > 0)
{
$this->rowid = $rowid;
if (! $notrigger)
{
global $conf, $langs, $user;
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('LINEORDER_SUPPLIER_UPDATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}
// Mise a jour info denormalisees au niveau facture
$this->update_price();

View File

@ -976,7 +976,7 @@ class FactureFournisseur extends CommonInvoice
* @param int $rang Position of line
* @return int >0 if OK, <0 if KO
*/
function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1)
function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false)
{
dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type", LOG_DEBUG);
include_once(DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php');
@ -1013,9 +1013,22 @@ class FactureFournisseur extends CommonInvoice
{
$idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det');
$result=$this->updateline($idligne, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product, $price_base_type, $info_bits, $type, $remise_percent);
$result=$this->updateline($idligne, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product, $price_base_type, $info_bits, $type, $remise_percent, true);
if ($result > 0)
{
$this->rowid = $idligne;
if (! $notrigger)
{
global $conf, $langs, $user;
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('LINEBILL_SUPPLIER_CREATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}
$this->db->commit();
return 1;
}
@ -1051,7 +1064,7 @@ class FactureFournisseur extends CommonInvoice
* @param double $remise_percent Pourcentage de remise de la ligne
* @return int <0 if KO, >0 if OK
*/
function updateline($id, $label, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0)
function updateline($id, $label, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0, $notrigger=false)
{
dol_syslog(get_class($this)."::updateline $id,$label,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent", LOG_DEBUG);
include_once(DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php');
@ -1117,6 +1130,19 @@ class FactureFournisseur extends CommonInvoice
$resql=$this->db->query($sql);
if ($resql)
{
$this->rowid = $id;
if (! $notrigger)
{
global $conf, $langs, $user;
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('LINEBILL_SUPPLIER_UPDATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}
// Update total price into invoice record
$result=$this->update_price();

View File

@ -1186,6 +1186,10 @@ if ($id > 0 || ! empty($ref))
print '</tr>';
}
// Other attributes
$parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
// Ligne de 3 colonnes
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
print '<td align="right"><b>'.price($object->total_ht).'</b></td>';
@ -1382,6 +1386,12 @@ if ($id > 0 || ! empty($ref))
if ($conf->product->enabled && $conf->service->enabled) print '<br>';
}
if (is_object($hookmanager))
{
$parameters=array('fk_parent_line'=>$line->fk_parent_line, 'line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i);
echo $hookmanager->executeHooks('formEditProductOptions',$parameters,$object,$action);
}
// Description - Editor wysiwyg
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$nbrows=ROWS_2;
@ -1438,6 +1448,12 @@ if ($id > 0 || ! empty($ref))
if ($forceall || ($conf->product->enabled && $conf->service->enabled)
|| (empty($conf->product->enabled) && empty($conf->service->enabled))) print '<br>';
if (is_object($hookmanager))
{
$parameters=array();
echo $hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
}
$nbrows=ROWS_2;
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
$doleditor = new DolEditor('dp_desc', GETPOST('dp_desc'), '', 100, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, $nbrows, 70);

View File

@ -473,7 +473,7 @@ elseif ($action == 'addline')
// cas special pour lequel on a les meme reference que le fournisseur
// $label = '['.$product->ref.'] - '. $product->libelle;
$label = $product->description;
$label.= $product->description && $_POST['np_desc'] ? "\n" : "";
$label.= $product->description && $_POST['np_desc'] ? "\n" : "";
$label.= $_POST['np_desc'];
$tvatx=get_default_tva($object->thirdparty, $mysoc, $product->id, $_POST['idprodfournprice']);
@ -1169,6 +1169,11 @@ if ($action == 'create')
}
}
}
// Other options
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
// Bouton "Create Draft"
print "</table>\n";
@ -1510,6 +1515,10 @@ else
print '</tr>';
}
// Other options
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table><br>';
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
@ -1602,6 +1611,12 @@ else
|| (empty($conf->product->enabled) && empty($conf->service->enabled))) print '<br>';
}
if (is_object($hookmanager))
{
$parameters=array('fk_parent_line'=>$line->fk_parent_line, 'line'=>$object->lines[$i],'var'=>$var,'num'=>$num,'i'=>$i);
echo $hookmanager->executeHooks('formEditProductOptions',$parameters,$object,$action);
}
// Description - Editor wysiwyg
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$nbrows=ROWS_2;
@ -1732,6 +1747,12 @@ else
if ($forceall || ($conf->product->enabled && $conf->service->enabled)
|| (empty($conf->product->enabled) && empty($conf->service->enabled))) print '<br>';
if (is_object($hookmanager))
{
$parameters=array();
echo $hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
}
// Editor wysiwyg
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$nbrows=ROWS_2;
@ -1786,7 +1807,7 @@ else
print '<td colspan="4">';
$form->select_produits_fournisseurs($object->socid,'','idprodfournprice');
if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) print '<br>';
if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) print '<br>';
if (is_object($hookmanager))
{
@ -1794,9 +1815,9 @@ else
echo $hookmanager->executeHooks('formCreateProductSupplierOptions',$parameters,$object,$action);
}
$nbrows=ROWS_2;
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
$doleditor = new DolEditor('np_desc', GETPOST('np_desc'), '', 100, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, $nbrows, 70);
$nbrows=ROWS_2;
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
$doleditor = new DolEditor('np_desc', GETPOST('np_desc'), '', 100, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, $nbrows, 70);
$doleditor->Create();
print '</td>';
@ -2014,4 +2035,4 @@ else
// End of page
llxFooter();
$db->close();
?>
?>

View File

@ -49,6 +49,11 @@ $socid=0;
if ($user->societe_id > 0) $socid=$user->societe_id;
$result = restrictedArea($user, 'projet', $id);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('projectcard'));
$object = new Project($db);
$object->fetch($id,$ref);
if ($object->id > 0)
@ -396,6 +401,10 @@ if ($action == 'create' && $user->rights->projet->creer)
print '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'">'.$_POST["description"].'</textarea>';
print '</td></tr>';
// Other options
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>';
print '<br><center>';
@ -527,6 +536,10 @@ else
print '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'">'.$object->description.'</textarea>';
print '</td></tr>';
// Other options
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>';
print '<div align="center"><br>';
@ -585,6 +598,10 @@ else
print nl2br($object->description);
print '</td></tr>';
// Other options
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>';
}

View File

@ -54,6 +54,11 @@ $socid=0;
if ($user->societe_id > 0) $socid = $user->societe_id;
$result = restrictedArea($user, 'projet', $id);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('projecttaskcard'));
$progress=GETPOST('progress', 'int');
$label=GETPOST('label', 'alpha');
$description=GETPOST('description');
@ -277,6 +282,10 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->socie
print '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'">'.$description.'</textarea>';
print '</td></tr>';
// Other options
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>';
print '<div align="center"><br>';

View File

@ -41,6 +41,11 @@ $socid=0;
if ($user->societe_id > 0) $socid = $user->societe_id;
if (! $user->rights->projet->lire) accessforbidden();
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('projecttaskcard'));
$object = new Task($db);
$projectstatic = new Project($db);
@ -281,6 +286,10 @@ if ($id > 0 || ! empty($ref))
print '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'">'.$object->description.'</textarea>';
print '</td></tr>';
// Other options
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>';
print '<center><br>';
@ -357,6 +366,10 @@ if ($id > 0 || ! empty($ref))
print nl2br($object->description);
print '</td></tr>';
// Other options
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>';
}