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); $contact = new Contact($db);
//var_dump($_POST); //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 * Action creation de l'action
@ -566,6 +571,10 @@ if ($action == 'create')
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'; 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 '</table>';
print '<center><br>'; print '<center><br>';
@ -944,6 +953,10 @@ if ($id)
print dol_htmlentitiesbr($act->note); print dol_htmlentitiesbr($act->note);
print '</td></tr>'; 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>'; print '</table>';
} }

View File

@ -122,6 +122,16 @@ class Deplacement extends CommonObject
if ($result) if ($result)
{ {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."deplacement"); $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); $result=$this->update($user);
if ($result > 0) if ($result > 0)
{ {

View File

@ -48,6 +48,11 @@ $mesg = '';
$object = new Deplacement($db); $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 * Actions
@ -317,6 +322,10 @@ if ($action == 'create')
print '</td></tr>'; 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 '</table>';
print '<br><center><input class="button" type="submit" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; '; print '<br><center><input class="button" type="submit" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; ';
@ -408,6 +417,10 @@ else if ($id)
print "</td></tr>"; 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 '</table>';
print '<br><center><input type="submit" class="button" value="'.$langs->trans("Save").'"> &nbsp; '; print '<br><center><input type="submit" class="button" value="'.$langs->trans("Save").'"> &nbsp; ';
@ -508,6 +521,10 @@ else if ($id)
// Statut // Statut
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>'; 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>"; print "</table><br>";
// Notes // Notes

View File

@ -352,7 +352,18 @@ class Don extends CommonObject
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) 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 else
{ {

View File

@ -49,6 +49,11 @@ $donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOS
// Security check // Security check
$result = restrictedArea($user, 'don', $id); $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 * Actions
@ -321,6 +326,10 @@ if ($action == 'create')
print "</td></tr>\n"; 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 "</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 '<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"; print "</form>\n";
@ -410,6 +419,10 @@ if (! empty($id) && $action == 'edit')
print '</td></tr>'; 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 "</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 '<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>'; 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 "</table>\n";
print "</form>\n"; print "</form>\n";

View File

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

View File

@ -40,6 +40,11 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', '', '', 'charges'); $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 * Action ajout paiement tva
@ -178,6 +183,11 @@ if ($_GET["action"] == 'create')
print "</td>\n"; print "</td>\n";
print "</tr>"; 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 '</table>';
print "<br>"; 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 '</table>';
print '</div>'; print '</div>';

View File

@ -492,6 +492,10 @@ else
} }
print '</tr>'; 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>"; print "</table><br><br>";
@ -673,6 +677,10 @@ else
else print $langs->trans("NoDolibarrAccess"); else print $langs->trans("NoDolibarrAccess");
print '</td></tr>'; 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 '</table><br>';
print '<center>'; print '<center>';
@ -858,6 +866,10 @@ else
else print $langs->trans("NoDolibarrAccess"); else print $langs->trans("NoDolibarrAccess");
print '</td></tr>'; 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 "</table>";
print "</div>"; 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); $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); $object = new Contrat($db);
@ -633,6 +638,10 @@ if ($action == 'create')
print '</textarea></td></tr>'; 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 "</table>\n";
print '<br><center><input type="submit" class="button" value="'.$langs->trans("Create").'"></center>'; print '<br><center><input type="submit" class="button" value="'.$langs->trans("Create").'"></center>';
@ -779,6 +788,10 @@ else
print "</td></tr>"; 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 "</table>";
if (! empty($object->brouillon) && $user->rights->contrat->creer) 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 array &$substitutionarray Array substitution old value => new value value
* @param Translate $outputlangs If we want substitution from special constants, we provide a language * @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 $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 * @return void
* @see make_substitutions * @see make_substitutions
*/ */
function complete_substitutions_array(&$substitutionarray,$outputlangs,$object='') function complete_substitutions_array(&$substitutionarray,$outputlangs,$object='',$parameters=null,$callfunc="completesubstitutionarray")
{ {
global $conf,$user; global $conf,$user;
@ -3408,8 +3410,8 @@ function complete_substitutions_array(&$substitutionarray,$outputlangs,$object='
dol_syslog("Library functions_".$substitfile['name']." found into ".$dir); dol_syslog("Library functions_".$substitfile['name']." found into ".$dir);
require_once($dir.$substitfile['name']); require_once($dir.$substitfile['name']);
$function_name=$module."_completesubstitutionarray"; $function_name=$module."_".$callfunc;
$function_name($substitutionarray,$outputlangs,$object); $function_name($substitutionarray,$outputlangs,$object,$parameters);
} }
} }
} }

View File

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

View File

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

View File

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

View File

@ -41,7 +41,7 @@
<?php <?php
if (is_object($hookmanager)) 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); echo $hookmanager->executeHooks('formEditProductOptions',$parameters,$this,$action);
} }

View File

@ -51,7 +51,7 @@
if (is_object($hookmanager)) if (is_object($hookmanager))
{ {
$fk_parent_line = ($_POST["fk_parent_line"] ? $_POST["fk_parent_line"] : $line->fk_parent_line); $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); echo $hookmanager->executeHooks('formEditProductOptions',$parameters,$this,$action);
} }
@ -162,4 +162,3 @@ $(document).ready(function() {
</script> </script>
<?php } ?> <?php } ?>
<!-- END PHP TEMPLATE predefinedproductline_edit.tpl.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; if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,$origin,$origin_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'); $action = GETPOST('action','alpha');
$confirm = GETPOST('confirm','alpha'); $confirm = GETPOST('confirm','alpha');
@ -663,6 +668,10 @@ if ($action == 'create')
print '<input name="tracking_number" size="20" value="'.GETPOST('tracking_number','alpha').'">'; print '<input name="tracking_number" size="20" value="'.GETPOST('tracking_number','alpha').'">';
print "</td></tr>\n"; 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>"; 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 $form->editfieldval("TrackingNumber",'trackingnumber',$object->tracking_url,$object,$user->rights->expedition->creer,'string',$object->tracking_number);
print '</td></tr>'; 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"; print "</table>\n";
/* /*

View File

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

View File

@ -59,6 +59,11 @@ $hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($co
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); $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); $object = new Fichinter($db);
@ -810,6 +815,10 @@ if ($action == 'create')
print '</td></tr>'; 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 '</table>';
print '<center><br>'; print '<center><br>';
@ -940,6 +949,10 @@ else if ($id > 0 || ! empty($ref))
// Statut // Statut
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>'; 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>"; print "</table><br>";
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))

View File

@ -1011,7 +1011,7 @@ class CommandeFournisseur extends CommonOrder
* @param int $info_bits More information * @param int $info_bits More information
* @return int <=0 if KO, >0 if OK * @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; global $langs,$mysoc;
@ -1139,6 +1139,19 @@ class CommandeFournisseur extends CommonOrder
//print $sql; //print $sql;
if ($resql) 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->update_price();
$this->db->commit(); $this->db->commit();
@ -1584,7 +1597,7 @@ class CommandeFournisseur extends CommonOrder
* @param int $type Type of line (0=product, 1=service) * @param int $type Type of line (0=product, 1=service)
* @return int < 0 if error, > 0 if ok * @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"); 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'); include_once(DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php');
@ -1660,6 +1673,19 @@ class CommandeFournisseur extends CommonOrder
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result > 0) 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 // Mise a jour info denormalisees au niveau facture
$this->update_price(); $this->update_price();

View File

@ -976,7 +976,7 @@ class FactureFournisseur extends CommonInvoice
* @param int $rang Position of line * @param int $rang Position of line
* @return int >0 if OK, <0 if KO * @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); 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'); 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'); $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) 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(); $this->db->commit();
return 1; return 1;
} }
@ -1051,7 +1064,7 @@ class FactureFournisseur extends CommonInvoice
* @param double $remise_percent Pourcentage de remise de la ligne * @param double $remise_percent Pourcentage de remise de la ligne
* @return int <0 if KO, >0 if OK * @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); 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'); include_once(DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php');
@ -1117,6 +1130,19 @@ class FactureFournisseur extends CommonInvoice
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) 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 // Update total price into invoice record
$result=$this->update_price(); $result=$this->update_price();

View File

@ -1186,6 +1186,10 @@ if ($id > 0 || ! empty($ref))
print '</tr>'; 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 // Ligne de 3 colonnes
print '<tr><td>'.$langs->trans("AmountHT").'</td>'; print '<tr><td>'.$langs->trans("AmountHT").'</td>';
print '<td align="right"><b>'.price($object->total_ht).'</b></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 ($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 // Description - Editor wysiwyg
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$nbrows=ROWS_2; $nbrows=ROWS_2;
@ -1438,6 +1448,12 @@ if ($id > 0 || ! empty($ref))
if ($forceall || ($conf->product->enabled && $conf->service->enabled) if ($forceall || ($conf->product->enabled && $conf->service->enabled)
|| (empty($conf->product->enabled) && empty($conf->service->enabled))) print '<br>'; || (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; $nbrows=ROWS_2;
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; 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); $doleditor = new DolEditor('dp_desc', GETPOST('dp_desc'), '', 100, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, $nbrows, 70);

View File

@ -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" // Bouton "Create Draft"
print "</table>\n"; print "</table>\n";
@ -1510,6 +1515,10 @@ else
print '</tr>'; 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>'; print '</table><br>';
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
@ -1602,6 +1611,12 @@ else
|| (empty($conf->product->enabled) && empty($conf->service->enabled))) print '<br>'; || (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 // Description - Editor wysiwyg
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$nbrows=ROWS_2; $nbrows=ROWS_2;
@ -1732,6 +1747,12 @@ else
if ($forceall || ($conf->product->enabled && $conf->service->enabled) if ($forceall || ($conf->product->enabled && $conf->service->enabled)
|| (empty($conf->product->enabled) && empty($conf->service->enabled))) print '<br>'; || (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 // Editor wysiwyg
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$nbrows=ROWS_2; $nbrows=ROWS_2;

View File

@ -49,6 +49,11 @@ $socid=0;
if ($user->societe_id > 0) $socid=$user->societe_id; if ($user->societe_id > 0) $socid=$user->societe_id;
$result = restrictedArea($user, 'projet', $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 = new Project($db);
$object->fetch($id,$ref); $object->fetch($id,$ref);
if ($object->id > 0) 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 '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'">'.$_POST["description"].'</textarea>';
print '</td></tr>'; 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 '</table>';
print '<br><center>'; print '<br><center>';
@ -527,6 +536,10 @@ else
print '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'">'.$object->description.'</textarea>'; print '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'">'.$object->description.'</textarea>';
print '</td></tr>'; 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 '</table>';
print '<div align="center"><br>'; print '<div align="center"><br>';
@ -585,6 +598,10 @@ else
print nl2br($object->description); print nl2br($object->description);
print '</td></tr>'; 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 '</table>';
} }

View File

@ -54,6 +54,11 @@ $socid=0;
if ($user->societe_id > 0) $socid = $user->societe_id; if ($user->societe_id > 0) $socid = $user->societe_id;
$result = restrictedArea($user, 'projet', $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'); $progress=GETPOST('progress', 'int');
$label=GETPOST('label', 'alpha'); $label=GETPOST('label', 'alpha');
$description=GETPOST('description'); $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 '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'">'.$description.'</textarea>';
print '</td></tr>'; 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 '</table>';
print '<div align="center"><br>'; print '<div align="center"><br>';

View File

@ -41,6 +41,11 @@ $socid=0;
if ($user->societe_id > 0) $socid = $user->societe_id; if ($user->societe_id > 0) $socid = $user->societe_id;
if (! $user->rights->projet->lire) accessforbidden(); 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); $object = new Task($db);
$projectstatic = new Project($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 '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'">'.$object->description.'</textarea>';
print '</td></tr>'; 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 '</table>';
print '<center><br>'; print '<center><br>';
@ -357,6 +366,10 @@ if ($id > 0 || ! empty($ref))
print nl2br($object->description); print nl2br($object->description);
print '</td></tr>'; 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 '</table>';
} }