';
print "";
- print_liste_field_titre($langs->trans("Ref"),"index.php","d.rowid","","&socid=$socid",'',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Type"),"index.php","d.type","","&socid=$socid",'',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Date"),"index.php","d.dated","","&socid=$socid",'',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","&socid=$socid",'',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Person"),"index.php","u.name","","&socid=$socid",'',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("FeesKilometersOrAmout"),"index.php","d.km","","&socid=$socid",'align="right"',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","","&socid=$socid",'',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"d.type","","&socid=$socid",'',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"d.dated","","&socid=$socid",'',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&socid=$socid",'',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"u.name","","&socid=$socid",'',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("FeesKilometersOrAmout"),$_SERVER["PHP_SELF"],"d.km","","&socid=$socid",'align="right"',$sortfield,$sortorder);
+ print_liste_field_titre('',$_SERVER["PHP_SELF"]);
print "
\n";
$var=true;
@@ -101,6 +109,8 @@ if ($resql)
else print ' | ';
print ''.img_object($langs->trans("ShowUser"),"user").' '.$objp->firstname.' '.$objp->name.' | ';
print ''.$objp->km.' | ';
+
+ print ''.$tripandexpense_static->getLibStatut(5).' | ';
print "\n";
$i++;
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index c022daa6438..da60280be3e 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -1407,7 +1407,7 @@ class CommonObject
function callHooks($arraytype)
{
global $conf;
-
+
if (! is_array($arraytype)) $arraytype=array($arraytype);
foreach($conf->hooks_modules as $module => $hooks)
@@ -1422,23 +1422,23 @@ class CommonObject
$actionfile = 'actions_'.$module.'.class.php';
$daofile = 'dao_'.$module.'.class.php';
$pathroot = '';
-
+
// Include actions class (controller)
dol_include_once($path.$actionfile);
-
+
// Include dataservice class (model)
dol_include_once($path.$daofile);
-
+
// Instantiate actions class (controller)
$controlclassname = 'Actions'.ucfirst($module);
$objModule = new $controlclassname($this->db);
$this->hooks[$type][$objModule->module_number] = $objModule;
-
+
// Instantiate dataservice class (model)
$modelclassname = 'Dao'.ucfirst($module);
$this->hooks[$type][$objModule->module_number]->object = new $modelclassname($this->db);
}
- }
+ }
}
}
}
@@ -1465,7 +1465,7 @@ class CommonObject
// TODO: All functions here must be redesigned and moved as they are not business functions but output functions
/**
- *
+ *
* Enter description here ...
* @param unknown_type $objectid
* @param unknown_type $objecttype
@@ -1475,7 +1475,7 @@ class CommonObject
function getElementUrl($objectid,$objecttype,$withpicto=0,$option='')
{
global $conf;
-
+
// Parse element/subelement (ex: project_task)
$module = $element = $subelement = $objecttype;
if (preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs))
@@ -1483,31 +1483,35 @@ class CommonObject
$module = $element = $regs[1];
$subelement = $regs[2];
}
-
+
$classpath = $element.'/class';
-
+
// To work with non standard path
- if ($objecttype == 'facture') { $classpath = 'compta/facture/class'; }
+ if ($objecttype == 'facture' || $objecttype == 'invoice') { $classpath = 'compta/facture/class'; $module='facture'; $subelement='facture'; }
+ if ($objecttype == 'commande' || $objecttype == 'order') { $classpath = 'commande/class'; $module='commande'; $subelement='commande'; }
if ($objecttype == 'propal') { $classpath = 'comm/propal/class'; }
if ($objecttype == 'shipping') { $classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon'; }
if ($objecttype == 'delivery') { $classpath = 'livraison/class'; $subelement = 'livraison'; $module = 'livraison_bon'; }
if ($objecttype == 'invoice_supplier') { $classpath = 'fourn/class'; }
if ($objecttype == 'order_supplier') { $classpath = 'fourn/class'; }
-
- $classfile = strtolower($subelement); $classname = ucfirst($subelement);
+ if ($objecttype == 'contract') { $classpath = 'contrat/class'; $module='contrat'; $subelement='contrat'; }
+
+ print "objecttype=".$objecttype." module=".$module." subelement=".$subelement;
+
+ $classfile = strtolower($subelement); $classname = ucfirst($subelement);
if ($objecttype == 'invoice_supplier') { $classfile = 'fournisseur.facture'; $classname='FactureFournisseur'; }
if ($objecttype == 'order_supplier') { $classfile = 'fournisseur.commande'; $classname='CommandeFournisseur'; }
-
+
if ($conf->$module->enabled)
{
dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
-
+
$object = new $classname($this->db);
$ret=$object->fetch($objectid);
if ($ret > 0) return $object->getNomUrl($withpicto,$option);
}
}
-
+
/* This is to show linked object block */
/**
diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php
index 4f97a98a626..9e11f15fd91 100644
--- a/htdocs/fichinter/fiche.php
+++ b/htdocs/fichinter/fiche.php
@@ -523,7 +523,7 @@ if ($_POST['action'] == 'send' && ! $_POST['cancel'] && (empty($conf->global->MA
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db);
- $result=$interface->run_triggers('FICHINTER_SENTBYMAIL',$fichinter,$user,$langs,$conf);
+ $result=$interface->run_triggers('FICHEINTER_SENTBYMAIL',$fichinter,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
diff --git a/htdocs/includes/triggers/interface_modAgenda_ActionsAuto.class.php b/htdocs/includes/triggers/interface_modAgenda_ActionsAuto.class.php
index 9339e5573ca..a3a4b1b8756 100644
--- a/htdocs/includes/triggers/interface_modAgenda_ActionsAuto.class.php
+++ b/htdocs/includes/triggers/interface_modAgenda_ActionsAuto.class.php
@@ -133,8 +133,6 @@ class InterfaceActionsAuto
$object->sendtoid=0;
$object->socid=$object->id;
- $object->fk_element=0;
- $object->elementtype='';
$ok=1;
}
elseif ($action == 'CONTRACT_VALIDATE')
@@ -149,7 +147,7 @@ class InterfaceActionsAuto
$object->actionmsg=$langs->transnoentities("ContractValidatedInDolibarr",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
- $object->sendtoid=0;
+ $object->sendtoid=0;
$ok=1;
}
elseif ($action == 'PROPAL_VALIDATE')
@@ -180,8 +178,9 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
}
- $object->sendtoid=0;
- $ok=1;
+ // Parameters $object->sendtoid defined by caller
+ //$object->sendtoid=0;
+ $ok=1;
}
elseif ($action == 'PROPAL_CLOSE_SIGNED')
{
@@ -239,10 +238,9 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
}
- $object->sendtoid=0;
+ // Parameters $object->sendtoid defined by caller
+ //$object->sendtoid=0;
$ok=1;
-
- // Parameters $object->xxx defined by caller
}
elseif ($action == 'BILL_VALIDATE')
{
@@ -274,9 +272,9 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
}
+ // Parameters $object->sendtoid defined by caller
+ //$object->sendtoid=0;
$ok=1;
-
- // Parameters $object->xxx defined by caller
}
elseif ($action == 'BILL_PAYED')
{
@@ -290,7 +288,7 @@ class InterfaceActionsAuto
$object->actionmsg=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
- $object->sendtoid=0;
+ $object->sendtoid=0;
$ok=1;
}
elseif ($action == 'BILL_CANCEL')
@@ -305,7 +303,7 @@ class InterfaceActionsAuto
$object->actionmsg=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
- $object->sendtoid=0;
+ $object->sendtoid=0;
$ok=1;
}
elseif ($action == 'FICHEINTER_VALIDATE')
@@ -320,10 +318,28 @@ class InterfaceActionsAuto
$object->actionmsg=$langs->transnoentities("InterventionValidatedInDolibarr",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
- $object->sendtoid=0;
+ $object->sendtoid=0;
+ $object->fk_element=0;
+ $object->elementtype='';
$ok=1;
}
- elseif ($action == 'SHIPPING_SENTBYMAIL')
+ elseif ($action == 'FICHEINTER_SENTBYMAIL')
+ {
+ dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
+ $langs->load("other");
+ $langs->load("interventions");
+ $langs->load("agenda");
+
+ $object->actiontypecode='AC_OTH';
+ if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionValidatedInDolibarr",$object->ref);
+ $object->actionmsg=$langs->transnoentities("InterventionValidatedInDolibarr",$object->ref);
+ $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
+
+ // Parameters $object->sendotid defined by caller
+ //$object->sendtoid=0;
+ $ok=1;
+ }
+ elseif ($action == 'SHIPPING_SENTBYMAIL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
@@ -338,9 +354,9 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
}
+ // Parameters $object->sendtoid defined by caller
+ //$object->sendtoid=0;
$ok=1;
-
- // Parameters $object->xxx defined by caller
}
elseif ($action == 'ORDER_SUPPLIER_VALIDATE')
{
@@ -353,8 +369,8 @@ class InterfaceActionsAuto
$object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
- $object->sendtoid=0;
- $ok=1;
+ $object->sendtoid=0;
+ $ok=1;
}
elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL')
{
@@ -372,7 +388,8 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
}
- $object->sendtoid=0;
+ // Parameters $object->sendotid defined by caller
+ //$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'BILL_SUPPLIER_VALIDATE')
@@ -387,8 +404,8 @@ class InterfaceActionsAuto
$object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
- $object->sendtoid=0;
- $ok=1;
+ $object->sendtoid=0;
+ $ok=1;
}
elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL')
{
@@ -406,7 +423,8 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
}
- $object->sendtoid=0;
+ // Parameters $object->sendtoid defined by caller
+ //$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'BILL_SUPPLIER_PAYED')
@@ -456,8 +474,6 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
- $object->fk_element=0;
- $object->elementtype='';
$ok=1;
}
elseif ($action == 'MEMBER_SUBSCRIPTION')
@@ -477,8 +493,6 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
- $object->fk_element=0;
- $object->elementtype='';
$ok=1;
}
elseif ($action == 'MEMBER_MODIFY')
@@ -500,8 +514,6 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
- $object->fk_element=0;
- $object->elementtype='';
$ok=1;
}
elseif ($action == 'MEMBER_DELETE')
@@ -519,8 +531,6 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
- $object->fk_element=0;
- $object->elementtype='';
$ok=1;
}
@@ -556,8 +566,8 @@ class InterfaceActionsAuto
//$actioncomm->usertodo = $user; // User affected to action
$actioncomm->userdone = $user; // User doing action
- $actioncomm->fk_element = $object->fk_element;
- $actioncomm->elementtype = $object->elementtype;
+ $actioncomm->fk_element = $object->id;
+ $actioncomm->elementtype = $object->element;
$ret=$actioncomm->add($user); // User qui saisit l'action
if ($ret > 0)
diff --git a/htdocs/install/mysql/migration/3.0.0-3.1.0.sql b/htdocs/install/mysql/migration/3.0.0-3.1.0.sql
index a4424c040aa..64de2c47506 100755
--- a/htdocs/install/mysql/migration/3.0.0-3.1.0.sql
+++ b/htdocs/install/mysql/migration/3.0.0-3.1.0.sql
@@ -10,7 +10,7 @@
-- To change type of field: ALTER TABLE llx_table MODIFY name varchar(60);
--
--- Fix correupted data
+-- Fix corrupted data
update llx_deplacement set dated='2010-01-01' where dated < '2000-01-01';
RENAME TABLE llx_c_methode_commande_fournisseur TO llx_c_input_method;
@@ -361,3 +361,9 @@ INSERT INTO llx_c_currencies ( code, code_iso, active, label ) VALUES ( 'LH', 'H
-- ISV (VAT) Honduras
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (1141,114, '0','0','No ISV',1);
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (1142,114, '12','0','ISV 12%',1);
+
+
+update llx_actioncomm set elementtype='invoice' where elementtype='facture';
+update llx_actioncomm set elementtype='order' where elementtype='commande';
+update llx_actioncomm set elementtype='contract' where elementtype='contrat';
+
diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php
index a3763d60a99..9fa2e1bc089 100644
--- a/htdocs/install/upgrade2.php
+++ b/htdocs/install/upgrade2.php
@@ -315,7 +315,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0)
{
migrate_directories($db,$langs,$conf,'/rss','/externalrss');
-
+
migrate_actioncomm_element($db,$langs,$conf);
// Reload modules
@@ -3090,15 +3090,15 @@ function migrate_actioncomm_element($db,$langs,$conf)
print '
';
print ''.$langs->trans('MigrationActioncommElement')."
\n";
-
+
$elements = array( 'propal' => 'propalrowid',
- 'commande' => 'fk_commande',
- 'facture' => 'fk_facture',
- 'contrat' => 'fk_contract',
+ 'order' => 'fk_commande',
+ 'invoice' => 'fk_facture',
+ 'contract' => 'fk_contract',
'order_supplier' => 'fk_supplier_order',
'invoice_supplier' => 'fk_supplier_invoice'
);
-
+
foreach($elements as $type => $field)
{
$result = $db->DDLDescTable(MAIN_DB_PREFIX."actioncomm",$field);
@@ -3106,24 +3106,25 @@ function migrate_actioncomm_element($db,$langs,$conf)
if ($obj)
{
dolibarr_install_syslog("upgrade2::migrate_actioncomm_element field=".$field);
-
+
$db->begin();
-
+
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm SET ";
$sql.= "fk_element = ".$field.", elementtype = '".$type."'";
$sql.= " WHERE ".$field." IS NOT NULL";
$sql.= " AND fk_element IS NULL";
$sql.= " AND elementtype IS NULL";
-
+
$resql = $db->query($sql);
if ($resql)
{
$db->commit();
-
+
// DDL commands must not be inside a transaction
- $sqlDrop = "ALTER TABLE ".MAIN_DB_PREFIX."actioncomm DROP COLUMN ".$field;
- $db->query($sqlDrop);
- print ". ";
+ // We will drop at next version because a migrate should be runnable several times if it fails.
+ //$sqlDrop = "ALTER TABLE ".MAIN_DB_PREFIX."actioncomm DROP COLUMN ".$field;
+ //$db->query($sqlDrop);
+ //print ". ";
}
else
{