Merge remote-tracking branch 'origin/3.3' into develop
Conflicts: COPYRIGHT
This commit is contained in:
commit
4fe1ba33f9
@ -58,6 +58,7 @@ Copyright (C) 2012
|
|||||||
- Florian Henry <florian.henry@open-concept.pro>
|
- Florian Henry <florian.henry@open-concept.pro>
|
||||||
- Jean-François Ferry <jfefe@aternatik.fr>
|
- Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
- Maxime Kohlhaas <mko@atm-consulting.fr>
|
- Maxime Kohlhaas <mko@atm-consulting.fr>
|
||||||
|
- Nicolas Péré <nicolas@amarok2.net>
|
||||||
|
|
||||||
Copyright (C) 2011
|
Copyright (C) 2011
|
||||||
- Laurent Destailleur <eldy@users.sourceforge.net>
|
- Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
|||||||
@ -101,6 +101,9 @@ For developers:
|
|||||||
- New: Add PRODUCT_PRICE_MODIFY trigger.
|
- New: Add PRODUCT_PRICE_MODIFY trigger.
|
||||||
- New: Created function to retrieve total amount of discount of an invoice/proposal...
|
- New: Created function to retrieve total amount of discount of an invoice/proposal...
|
||||||
- New: We can use a dynamic value ($conf->global->XXX for example) into titles of menus.
|
- New: We can use a dynamic value ($conf->global->XXX for example) into titles of menus.
|
||||||
|
- Qual: Renamed SUPPLIER_INVOICE_BUILDDOC trigger to BILL_SUPPLIER_BUILDDOC
|
||||||
|
- Qual: Renamed INVOICE_SUPPLIER_DELETE trigger to BILL_SUPPLIER_DELETE
|
||||||
|
- Qual: Renamed SUPLLIER_ORDER_BUILDDOC trigger to ORDER_SUPPLIER_BUILDDOC
|
||||||
|
|
||||||
For translators:
|
For translators:
|
||||||
- New: Update language files (de, tr, pt, ca, es, en, fr).
|
- New: Update language files (de, tr, pt, ca, es, en, fr).
|
||||||
|
|||||||
@ -198,199 +198,209 @@ else if ($action == 'add' && $user->rights->commande->creer)
|
|||||||
$datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
$datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||||
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'),GETPOST('liv_day'),GETPOST('liv_year'));
|
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'),GETPOST('liv_day'),GETPOST('liv_year'));
|
||||||
|
|
||||||
$object->socid=$socid;
|
if ($datecommande == '')
|
||||||
$object->fetch_thirdparty();
|
|
||||||
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
$object->date_commande = $datecommande;
|
|
||||||
$object->note = GETPOST('note');
|
|
||||||
$object->note_public = GETPOST('note_public');
|
|
||||||
$object->source = GETPOST('source_id');
|
|
||||||
$object->fk_project = GETPOST('projectid');
|
|
||||||
$object->ref_client = GETPOST('ref_client');
|
|
||||||
$object->modelpdf = GETPOST('model');
|
|
||||||
$object->cond_reglement_id = GETPOST('cond_reglement_id');
|
|
||||||
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
|
||||||
$object->availability_id = GETPOST('availability_id');
|
|
||||||
$object->demand_reason_id = GETPOST('demand_reason_id');
|
|
||||||
$object->date_livraison = $datelivraison;
|
|
||||||
$object->fk_delivery_address = GETPOST('fk_address');
|
|
||||||
$object->contactid = GETPOST('contactidp');
|
|
||||||
|
|
||||||
// If creation from another object of another module (Example: origin=propal, originid=1)
|
|
||||||
if (! empty($origin) && ! empty($originid))
|
|
||||||
{
|
{
|
||||||
// Parse element/subelement (ex: project_task)
|
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Date')).'</div>';
|
||||||
$element = $subelement = $origin;
|
$action='create';
|
||||||
if (preg_match('/^([^_]+)_([^_]+)/i',$origin,$regs))
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$object->socid=$socid;
|
||||||
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
$object->date_commande = $datecommande;
|
||||||
|
$object->note = GETPOST('note');
|
||||||
|
$object->note_public = GETPOST('note_public');
|
||||||
|
$object->source = GETPOST('source_id');
|
||||||
|
$object->fk_project = GETPOST('projectid');
|
||||||
|
$object->ref_client = GETPOST('ref_client');
|
||||||
|
$object->modelpdf = GETPOST('model');
|
||||||
|
$object->cond_reglement_id = GETPOST('cond_reglement_id');
|
||||||
|
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
||||||
|
$object->availability_id = GETPOST('availability_id');
|
||||||
|
$object->demand_reason_id = GETPOST('demand_reason_id');
|
||||||
|
$object->date_livraison = $datelivraison;
|
||||||
|
$object->fk_delivery_address = GETPOST('fk_address');
|
||||||
|
$object->contactid = GETPOST('contactidp');
|
||||||
|
|
||||||
|
// If creation from another object of another module (Example: origin=propal, originid=1)
|
||||||
|
if (! empty($origin) && ! empty($originid))
|
||||||
{
|
{
|
||||||
$element = $regs[1];
|
// Parse element/subelement (ex: project_task)
|
||||||
$subelement = $regs[2];
|
$element = $subelement = $origin;
|
||||||
}
|
if (preg_match('/^([^_]+)_([^_]+)/i',$origin,$regs))
|
||||||
|
|
||||||
// For compatibility
|
|
||||||
if ($element == 'order') {
|
|
||||||
$element = $subelement = 'commande';
|
|
||||||
}
|
|
||||||
if ($element == 'propal') {
|
|
||||||
$element = 'comm/propal'; $subelement = 'propal';
|
|
||||||
}
|
|
||||||
if ($element == 'contract') {
|
|
||||||
$element = $subelement = 'contrat';
|
|
||||||
}
|
|
||||||
|
|
||||||
$object->origin = $origin;
|
|
||||||
$object->origin_id = $originid;
|
|
||||||
|
|
||||||
// Possibility to add external linked objects with hooks
|
|
||||||
$object->linked_objects[$object->origin] = $object->origin_id;
|
|
||||||
$other_linked_objects=GETPOST('other_linked_objects','array');
|
|
||||||
if (! empty($other_linked_objects))
|
|
||||||
{
|
|
||||||
$object->linked_objects = array_merge($object->linked_objects, $other_linked_objects);
|
|
||||||
}
|
|
||||||
|
|
||||||
$object_id = $object->create($user);
|
|
||||||
|
|
||||||
if ($object_id > 0)
|
|
||||||
{
|
|
||||||
dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
|
|
||||||
|
|
||||||
$classname = ucfirst($subelement);
|
|
||||||
$srcobject = new $classname($db);
|
|
||||||
|
|
||||||
dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines");
|
|
||||||
$result=$srcobject->fetch($object->origin_id);
|
|
||||||
if ($result > 0)
|
|
||||||
{
|
{
|
||||||
$lines = $srcobject->lines;
|
$element = $regs[1];
|
||||||
if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines();
|
$subelement = $regs[2];
|
||||||
|
}
|
||||||
$fk_parent_line=0;
|
|
||||||
$num=count($lines);
|
// For compatibility
|
||||||
|
if ($element == 'order') {
|
||||||
for ($i=0;$i<$num;$i++)
|
$element = $subelement = 'commande';
|
||||||
|
}
|
||||||
|
if ($element == 'propal') {
|
||||||
|
$element = 'comm/propal'; $subelement = 'propal';
|
||||||
|
}
|
||||||
|
if ($element == 'contract') {
|
||||||
|
$element = $subelement = 'contrat';
|
||||||
|
}
|
||||||
|
|
||||||
|
$object->origin = $origin;
|
||||||
|
$object->origin_id = $originid;
|
||||||
|
|
||||||
|
// Possibility to add external linked objects with hooks
|
||||||
|
$object->linked_objects[$object->origin] = $object->origin_id;
|
||||||
|
$other_linked_objects=GETPOST('other_linked_objects','array');
|
||||||
|
if (! empty($other_linked_objects))
|
||||||
|
{
|
||||||
|
$object->linked_objects = array_merge($object->linked_objects, $other_linked_objects);
|
||||||
|
}
|
||||||
|
|
||||||
|
$object_id = $object->create($user);
|
||||||
|
|
||||||
|
if ($object_id > 0)
|
||||||
|
{
|
||||||
|
dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
|
||||||
|
|
||||||
|
$classname = ucfirst($subelement);
|
||||||
|
$srcobject = new $classname($db);
|
||||||
|
|
||||||
|
dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines");
|
||||||
|
$result=$srcobject->fetch($object->origin_id);
|
||||||
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$label=(! empty($lines[$i]->label)?$lines[$i]->label:'');
|
$lines = $srcobject->lines;
|
||||||
$desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);
|
if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines();
|
||||||
$product_type=(! empty($lines[$i]->product_type)?$lines[$i]->product_type:0);
|
|
||||||
|
$fk_parent_line=0;
|
||||||
// Dates
|
$num=count($lines);
|
||||||
// TODO mutualiser
|
|
||||||
$date_start=$lines[$i]->date_debut_prevue;
|
for ($i=0;$i<$num;$i++)
|
||||||
if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel;
|
|
||||||
if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start;
|
|
||||||
$date_end=$lines[$i]->date_fin_prevue;
|
|
||||||
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
|
|
||||||
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
|
|
||||||
|
|
||||||
// Reset fk_parent_line for no child products and special product
|
|
||||||
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
|
|
||||||
$fk_parent_line = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $object->addline(
|
|
||||||
$object_id,
|
|
||||||
$desc,
|
|
||||||
$lines[$i]->subprice,
|
|
||||||
$lines[$i]->qty,
|
|
||||||
$lines[$i]->tva_tx,
|
|
||||||
$lines[$i]->localtax1_tx,
|
|
||||||
$lines[$i]->localtax2_tx,
|
|
||||||
$lines[$i]->fk_product,
|
|
||||||
$lines[$i]->remise_percent,
|
|
||||||
$lines[$i]->info_bits,
|
|
||||||
$lines[$i]->fk_remise_except,
|
|
||||||
'HT',
|
|
||||||
0,
|
|
||||||
$datestart,
|
|
||||||
$dateend,
|
|
||||||
$product_type,
|
|
||||||
$lines[$i]->rang,
|
|
||||||
$lines[$i]->special_code,
|
|
||||||
$fk_parent_line,
|
|
||||||
$lines[$i]->fk_fournprice,
|
|
||||||
$lines[$i]->pa_ht,
|
|
||||||
$label
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
{
|
||||||
$error++;
|
$label=(! empty($lines[$i]->label)?$lines[$i]->label:'');
|
||||||
break;
|
$desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);
|
||||||
}
|
$product_type=(! empty($lines[$i]->product_type)?$lines[$i]->product_type:0);
|
||||||
|
|
||||||
// Defined the new fk_parent_line
|
// Dates
|
||||||
if ($result > 0 && $lines[$i]->product_type == 9) {
|
// TODO mutualiser
|
||||||
$fk_parent_line = $result;
|
$date_start=$lines[$i]->date_debut_prevue;
|
||||||
|
if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel;
|
||||||
|
if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start;
|
||||||
|
$date_end=$lines[$i]->date_fin_prevue;
|
||||||
|
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
|
||||||
|
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
|
||||||
|
|
||||||
|
// Reset fk_parent_line for no child products and special product
|
||||||
|
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
|
||||||
|
$fk_parent_line = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $object->addline(
|
||||||
|
$object_id,
|
||||||
|
$desc,
|
||||||
|
$lines[$i]->subprice,
|
||||||
|
$lines[$i]->qty,
|
||||||
|
$lines[$i]->tva_tx,
|
||||||
|
$lines[$i]->localtax1_tx,
|
||||||
|
$lines[$i]->localtax2_tx,
|
||||||
|
$lines[$i]->fk_product,
|
||||||
|
$lines[$i]->remise_percent,
|
||||||
|
$lines[$i]->info_bits,
|
||||||
|
$lines[$i]->fk_remise_except,
|
||||||
|
'HT',
|
||||||
|
0,
|
||||||
|
$datestart,
|
||||||
|
$dateend,
|
||||||
|
$product_type,
|
||||||
|
$lines[$i]->rang,
|
||||||
|
$lines[$i]->special_code,
|
||||||
|
$fk_parent_line,
|
||||||
|
$lines[$i]->fk_fournprice,
|
||||||
|
$lines[$i]->pa_ht,
|
||||||
|
$label
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Defined the new fk_parent_line
|
||||||
|
if ($result > 0 && $lines[$i]->product_type == 9) {
|
||||||
|
$fk_parent_line = $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hooks
|
||||||
|
$parameters=array('objFrom'=>$srcobject);
|
||||||
|
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
|
if ($reshook < 0) $error++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg=$srcobject->error;
|
||||||
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hooks
|
|
||||||
$parameters=array('objFrom'=>$srcobject);
|
|
||||||
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
|
||||||
if ($reshook < 0) $error++;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg=$srcobject->error;
|
$mesg=$object->error;
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg=$object->error;
|
$object_id = $object->create($user);
|
||||||
$error++;
|
|
||||||
}
|
// If some invoice's lines already known
|
||||||
}
|
$NBLINES=8;
|
||||||
else
|
for ($i = 1 ; $i <= $NBLINES ; $i++)
|
||||||
{
|
|
||||||
$object_id = $object->create($user);
|
|
||||||
|
|
||||||
// If some invoice's lines already known
|
|
||||||
$NBLINES=8;
|
|
||||||
for ($i = 1 ; $i <= $NBLINES ; $i++)
|
|
||||||
{
|
|
||||||
if ($_POST['idprod'.$i])
|
|
||||||
{
|
{
|
||||||
$xid = 'idprod'.$i;
|
if ($_POST['idprod'.$i])
|
||||||
$xqty = 'qty'.$i;
|
{
|
||||||
$xremise = 'remise_percent'.$i;
|
$xid = 'idprod'.$i;
|
||||||
$object->add_product($_POST[$xid],$_POST[$xqty],$_POST[$xremise]);
|
$xqty = 'qty'.$i;
|
||||||
|
$xremise = 'remise_percent'.$i;
|
||||||
|
$object->add_product($_POST[$xid],$_POST[$xqty],$_POST[$xremise]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Insert default contacts if defined
|
||||||
// Insert default contacts if defined
|
if ($object_id > 0)
|
||||||
if ($object_id > 0)
|
|
||||||
{
|
|
||||||
if (GETPOST('contactidp'))
|
|
||||||
{
|
{
|
||||||
$result=$object->add_contact(GETPOST('contactidp'),'CUSTOMER','external');
|
if (GETPOST('contactidp'))
|
||||||
if ($result < 0)
|
|
||||||
{
|
{
|
||||||
$mesg = '<div class="error">'.$langs->trans("ErrorFailedToAddContact").'</div>';
|
$result=$object->add_contact(GETPOST('contactidp'),'CUSTOMER','external');
|
||||||
$error++;
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$mesg = '<div class="error">'.$langs->trans("ErrorFailedToAddContact").'</div>';
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$id = $object_id;
|
||||||
|
$action = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// End of object creation, we show it
|
||||||
|
if ($object_id > 0 && ! $error)
|
||||||
|
{
|
||||||
|
$db->commit();
|
||||||
|
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object_id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
$action='create';
|
||||||
|
if (! $mesg) $mesg='<div class="error">'.$object->error.'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = $object_id;
|
|
||||||
$action = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// End of object creation, we show it
|
|
||||||
if ($object_id > 0 && ! $error)
|
|
||||||
{
|
|
||||||
$db->commit();
|
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object_id);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
$action='create';
|
|
||||||
if (! $mesg) $mesg='<div class="error">'.$object->error.'</div>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -227,7 +227,7 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $
|
|||||||
// 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($db);
|
$interface=new Interfaces($db);
|
||||||
$result=$interface->run_triggers('FICHEINTER_BUILDDOC',$object,$user,$langs,$conf);
|
$result=$interface->run_triggers('FICHINTER_BUILDDOC',$object,$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
|
||||||
|
|
||||||
@ -247,4 +247,4 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -311,7 +311,7 @@ class InterfaceActionsAuto
|
|||||||
$object->sendtoid=0;
|
$object->sendtoid=0;
|
||||||
$ok=1;
|
$ok=1;
|
||||||
}
|
}
|
||||||
elseif ($action == 'FICHEINTER_VALIDATE')
|
elseif ($action == 'FICHINTER_VALIDATE')
|
||||||
{
|
{
|
||||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
@ -328,7 +328,7 @@ class InterfaceActionsAuto
|
|||||||
$object->elementtype='';
|
$object->elementtype='';
|
||||||
$ok=1;
|
$ok=1;
|
||||||
}
|
}
|
||||||
elseif ($action == 'FICHEINTER_SENTBYMAIL')
|
elseif ($action == 'FICHINTER_SENTBYMAIL')
|
||||||
{
|
{
|
||||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
|
|||||||
@ -29,8 +29,14 @@
|
|||||||
class InterfaceNotification
|
class InterfaceNotification
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
var $listofmanagedevents=array('BILL_VALIDATE','ORDER_VALIDATE','PROPAL_VALIDATE',
|
var $listofmanagedevents=array(
|
||||||
'FICHEINTER_VALIDATE','ORDER_SUPPLIER_APPROVE','ORDER_SUPPLIER_REFUSE');
|
'BILL_VALIDATE',
|
||||||
|
'ORDER_VALIDATE',
|
||||||
|
'PROPAL_VALIDATE',
|
||||||
|
'FICHINTER_VALIDATE',
|
||||||
|
'ORDER_SUPPLIER_APPROVE',
|
||||||
|
'ORDER_SUPPLIER_REFUSE'
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -146,7 +152,7 @@ class InterfaceNotification
|
|||||||
$notify->send($action, $object->socid, $mesg, 'propal', $object->id, $filepdf);
|
$notify->send($action, $object->socid, $mesg, 'propal', $object->id, $filepdf);
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif ($action == 'FICHEINTER_VALIDATE')
|
elseif ($action == 'FICHINTER_VALIDATE')
|
||||||
{
|
{
|
||||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
|
||||||
|
|||||||
@ -164,18 +164,27 @@ class Fichinter extends CommonObject
|
|||||||
if (! $ret) dol_print_error($this->db);
|
if (! $ret) dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
$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);
|
||||||
$result=$interface->run_triggers('FICHEINTER_CREATE',$this,$user,$langs,$conf);
|
$result=$interface->run_triggers('FICHINTER_CREATE',$this,$user,$langs,$conf);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++; $this->errors=$interface->errors;
|
$error++; $this->errors=$interface->errors;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// Fin appel triggers
|
||||||
|
|
||||||
return $this->id;
|
if (! $error)
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
$this->error=join(',',$this->errors);
|
||||||
|
dol_syslog(get_class($this)."::create ".$this->error,LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -213,7 +222,7 @@ class Fichinter 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('FICHEINTER_MODIFY',$this,$user,$langs,$conf);
|
$result=$interface->run_triggers('FICHINTER_MODIFY',$this,$user,$langs,$conf);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++; $this->errors=$interface->errors;
|
$error++; $this->errors=$interface->errors;
|
||||||
}
|
}
|
||||||
@ -357,14 +366,14 @@ class Fichinter extends CommonObject
|
|||||||
$sql.= " AND entity = ".$conf->entity;
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
$sql.= " AND fk_statut = 0";
|
$sql.= " AND fk_statut = 0";
|
||||||
|
|
||||||
dol_syslog("Fichinter::setValid sql=".$sql);
|
dol_syslog(get_class($this)."::setValid sql=".$sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
// 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('FICHEINTER_VALIDATE',$this,$user,$langs,$conf);
|
$result=$interface->run_triggers('FICHINTER_VALIDATE',$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
|
||||||
|
|
||||||
@ -377,7 +386,7 @@ class Fichinter extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
$this->error=join(',',$this->errors);
|
$this->error=join(',',$this->errors);
|
||||||
dol_syslog("Fichinter::setValid ".$this->error,LOG_ERR);
|
dol_syslog(get_class($this)."::setValid ".$this->error,LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -385,7 +394,7 @@ class Fichinter extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
dol_syslog("Fichinter::setValid ".$this->error,LOG_ERR);
|
dol_syslog(get_class($this)."::setValid ".$this->error,LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -675,7 +684,7 @@ class Fichinter 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('FICHEINTER_DELETE',$this,$user,$langs,$conf);
|
$result=$interface->run_triggers('FICHINTER_DELETE',$this,$user,$langs,$conf);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++; $this->errors=$interface->errors;
|
$error++; $this->errors=$interface->errors;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -719,7 +719,7 @@ if ($action == 'send' && ! GETPOST('cancel','alpha') && (empty($conf->global->MA
|
|||||||
// 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($db);
|
$interface=new Interfaces($db);
|
||||||
$result=$interface->run_triggers('FICHEINTER_SENTBYMAIL',$object,$user,$langs,$conf);
|
$result=$interface->run_triggers('FICHINTER_SENTBYMAIL',$object,$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
|
||||||
|
|
||||||
@ -1387,7 +1387,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
else print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateBill").'</a>';
|
else print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateBill").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->FICHEINTER_CLASSIFY_BILLED))
|
if (! empty($conf->global->FICHINTER_CLASSIFY_BILLED))
|
||||||
{
|
{
|
||||||
if ($object->statut != 2)
|
if ($object->statut != 2)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -181,4 +181,4 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -175,4 +175,4 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -230,6 +230,13 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
|
|||||||
$datefacture=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
|
$datefacture=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
|
||||||
$datedue=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
|
$datedue=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
|
||||||
|
|
||||||
|
if (GETPOST('socid','int')<1)
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')).'</div>';
|
||||||
|
$action='create';
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
if ($datefacture == '')
|
if ($datefacture == '')
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')).'</div>';
|
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')).'</div>';
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
-- List of all managed triggered events (used for trigger agenda and for notification)
|
-- List of all managed triggered events (used for trigger agenda and for notification)
|
||||||
--
|
--
|
||||||
delete from llx_c_action_trigger;
|
delete from llx_c_action_trigger;
|
||||||
insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (1,'FICHEINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',18);
|
insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (1,'FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',18);
|
||||||
insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (2,'BILL_VALIDATE','Customer invoice validated','Executed when a customer invoice is approved','facture',6);
|
insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (2,'BILL_VALIDATE','Customer invoice validated','Executed when a customer invoice is approved','facture',6);
|
||||||
insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (3,'ORDER_SUPPLIER_APPROVE','Supplier order request approved','Executed when a supplier order is approved','order_supplier',11);
|
insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (3,'ORDER_SUPPLIER_APPROVE','Supplier order request approved','Executed when a supplier order is approved','order_supplier',11);
|
||||||
insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (4,'ORDER_SUPPLIER_REFUSE','Supplier order request refused','Executed when a supplier order is refused','order_supplier',12);
|
insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (4,'ORDER_SUPPLIER_REFUSE','Supplier order request refused','Executed when a supplier order is refused','order_supplier',12);
|
||||||
|
|||||||
@ -905,3 +905,5 @@ ALTER TABLE llx_element_lock ADD COLUMN sessionid varchar(255) AFTER datem;
|
|||||||
ALTER TABLE llx_element_lock MODIFY COLUMN elementtype varchar(32) NOT NULL;
|
ALTER TABLE llx_element_lock MODIFY COLUMN elementtype varchar(32) NOT NULL;
|
||||||
ALTER TABLE llx_element_lock DROP COLUMN fk_user_modif;
|
ALTER TABLE llx_element_lock DROP COLUMN fk_user_modif;
|
||||||
ALTER TABLE llx_element_lock DROP COLUMN status;
|
ALTER TABLE llx_element_lock DROP COLUMN status;
|
||||||
|
|
||||||
|
DELETE FROM llx_c_action_trigger WHERE elementtype='withdraw';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user