Fix: Removed useless duplicate properties.

This commit is contained in:
Laurent Destailleur 2011-06-06 11:37:59 +00:00
parent 3e7d6ae893
commit 747c6ddc3d
7 changed files with 119 additions and 119 deletions

View File

@ -58,7 +58,7 @@ class ActionComm extends CommonObject
var $durationp = -1; var $durationp = -1;
//var $date; // Date action realise debut (datea) // deprecated //var $date; // Date action realise debut (datea) // deprecated
//var $dateend; // Date action realise fin (datea2) // deprecated //var $dateend; // Date action realise fin (datea2) // deprecated
//var $durationa = -1; // deprecated //var $durationa = -1; // Duration // deprecated
var $priority; var $priority;
var $fulldayevent = 0; // 1=Event on full day var $fulldayevent = 0; // 1=Event on full day
var $punctual = 1; var $punctual = 1;
@ -74,40 +74,29 @@ class ActionComm extends CommonObject
var $note; var $note;
var $percentage; var $percentage;
// Properties for links to other tables // Properties for links to other objects
var $fk_element; var $fk_element; // Id of record
var $elementtype; var $elementtype; // Type of record. This if property ->element of object linked to.
// Ical // Ical
var $icalname; var $icalname;
var $icalcolor; var $icalcolor;
/** /**
* \brief Constructeur * Constructor
* \param db Handler d'acces base de donnee * @param db Database handler
*/ */
function ActionComm($db) function ActionComm($db)
{ {
$this->db = $db; $this->db = $db;
/*
$this->societe = new Societe($db);
$this->author = new User($db);
$this->usermod = new User($db);
$this->usertodo = new User($db);
$this->userdone = new User($db);
if (class_exists("Contact"))
{
$this->contact = new Contact($db);
}
*/
} }
/** /**
* Add an action into database * Add an action/event into database
* @param user auteur de la creation de l'action * @param user Object user making action
* @param notrigger 1 ne declenche pas les triggers, 0 sinon * @param notrigger 1 = disable triggers, 0 = enable triggers
* @return int id de l'action creee, < 0 if KO * @return int Id of created event, < 0 if KO
*/ */
function add($user,$notrigger=0) function add($user,$notrigger=0)
{ {
@ -130,6 +119,9 @@ class ActionComm extends CommonObject
if ($this->datep && $this->datef && $this->datep > $this->datef) $this->datef=$this->datep; if ($this->datep && $this->datef && $this->datep > $this->datef) $this->datef=$this->datep;
if ($this->date && $this->dateend && $this->date > $this->dateend) $this->dateend=$this->date; if ($this->date && $this->dateend && $this->date > $this->dateend) $this->dateend=$this->date;
if ($this->fk_project < 0) $this->fk_project = 0; if ($this->fk_project < 0) $this->fk_project = 0;
if ($this->elementtype=='facture') $this->elementtype='invoice';
if ($this->elementtype=='commande') $this->elementtype='order';
if ($this->elementtype=='contrat') $this->elementtype='contract';
if (! $this->type_id && $this->type_code) if (! $this->type_id && $this->type_code)
{ {
@ -297,39 +289,16 @@ class ActionComm extends CommonObject
$this->societe->id = $obj->fk_soc; $this->societe->id = $obj->fk_soc;
$this->contact->id = $obj->fk_contact; $this->contact->id = $obj->fk_contact;
$this->fk_project = $obj->fk_project; $this->fk_project = $obj->fk_project;
$this->fk_element = $obj->fk_element; $this->fk_element = $obj->fk_element;
$this->elementtype = $obj->elementtype; $this->elementtype = $obj->elementtype;
/*
$this->fk_facture = $obj->fk_facture;
if ($this->fk_facture)
{
$this->objet_url = img_object($langs->trans("ShowBill"),'bill').' '.'<a href="'. DOL_URL_ROOT . '/compta/facture.php?facid='.$this->fk_facture.'">'.$langs->trans("Bill").'</a>';
$this->objet_url_type = 'facture';
}
$this->fk_propal = $obj->propalrowid;
if ($this->fk_propal)
{
$this->objet_url = img_object($langs->trans("ShowPropal"),'propal').' '.'<a href="'. DOL_URL_ROOT . '/comm/propal.php?id='.$this->fk_propal.'">'.$langs->trans("Propal").'</a>';
$this->objet_url_type = 'propal';
}
$this->fk_commande = $obj->fk_commande;
if ($this->fk_commande)
{
$this->objet_url = img_object($langs->trans("ShowOrder"),'order').' '.'<a href="'. DOL_URL_ROOT . '/commande/fiche.php?id='.$this->fk_commande.'">'.$langs->trans("Order").'</a>';
$this->objet_url_type = 'order';
}
*/
} }
$this->db->free($resql); $this->db->free($resql);
return 1; return 1;
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->lasterror();
return -1; return -1;
} }
} }
@ -350,7 +319,7 @@ class ActionComm extends CommonObject
} }
else else
{ {
$this->error=$this->db->error()." sql=".$sql; $this->error=$this->db->lasterror()." sql=".$sql;
return -1; return -1;
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* *
@ -27,6 +27,7 @@
require("../../main.inc.php"); require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/compta/tva/class/tva.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/tva/class/tva.class.php");
require_once(DOL_DOCUMENT_ROOT."/compta/deplacement/class/deplacement.class.php");
$langs->load("companies"); $langs->load("companies");
$langs->load("users"); $langs->load("users");
@ -38,8 +39,14 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'deplacement','',''); $result = restrictedArea($user, 'deplacement','','');
/*
* View
*/
llxHeader(); llxHeader();
$tripandexpense_static=new Deplacement($db);
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
@ -76,12 +83,13 @@ if ($resql)
$i = 0; $i = 0;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Ref"),"index.php","d.rowid","","&socid=$socid",'',$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"),"index.php","d.type","","&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"),"index.php","d.dated","","&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"),"index.php","s.nom","","&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"),"index.php","u.name","","&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"),"index.php","d.km","","&socid=$socid",'align="right"',$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 "</tr>\n"; print "</tr>\n";
$var=true; $var=true;
@ -101,6 +109,8 @@ if ($resql)
else print '<td>&nbsp;</td>'; else print '<td>&nbsp;</td>';
print '<td align="left"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowUser"),"user").' '.$objp->firstname.' '.$objp->name.'</a></td>'; print '<td align="left"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowUser"),"user").' '.$objp->firstname.' '.$objp->name.'</a></td>';
print '<td align="right">'.$objp->km.'</td>'; print '<td align="right">'.$objp->km.'</td>';
print '<td align="right">'.$tripandexpense_static->getLibStatut(5).'</td>';
print "</tr>\n"; print "</tr>\n";
$i++; $i++;

View File

@ -1407,7 +1407,7 @@ class CommonObject
function callHooks($arraytype) function callHooks($arraytype)
{ {
global $conf; global $conf;
if (! is_array($arraytype)) $arraytype=array($arraytype); if (! is_array($arraytype)) $arraytype=array($arraytype);
foreach($conf->hooks_modules as $module => $hooks) foreach($conf->hooks_modules as $module => $hooks)
@ -1422,23 +1422,23 @@ class CommonObject
$actionfile = 'actions_'.$module.'.class.php'; $actionfile = 'actions_'.$module.'.class.php';
$daofile = 'dao_'.$module.'.class.php'; $daofile = 'dao_'.$module.'.class.php';
$pathroot = ''; $pathroot = '';
// Include actions class (controller) // Include actions class (controller)
dol_include_once($path.$actionfile); dol_include_once($path.$actionfile);
// Include dataservice class (model) // Include dataservice class (model)
dol_include_once($path.$daofile); dol_include_once($path.$daofile);
// Instantiate actions class (controller) // Instantiate actions class (controller)
$controlclassname = 'Actions'.ucfirst($module); $controlclassname = 'Actions'.ucfirst($module);
$objModule = new $controlclassname($this->db); $objModule = new $controlclassname($this->db);
$this->hooks[$type][$objModule->module_number] = $objModule; $this->hooks[$type][$objModule->module_number] = $objModule;
// Instantiate dataservice class (model) // Instantiate dataservice class (model)
$modelclassname = 'Dao'.ucfirst($module); $modelclassname = 'Dao'.ucfirst($module);
$this->hooks[$type][$objModule->module_number]->object = new $modelclassname($this->db); $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 // TODO: All functions here must be redesigned and moved as they are not business functions but output functions
/** /**
* *
* Enter description here ... * Enter description here ...
* @param unknown_type $objectid * @param unknown_type $objectid
* @param unknown_type $objecttype * @param unknown_type $objecttype
@ -1475,7 +1475,7 @@ class CommonObject
function getElementUrl($objectid,$objecttype,$withpicto=0,$option='') function getElementUrl($objectid,$objecttype,$withpicto=0,$option='')
{ {
global $conf; global $conf;
// Parse element/subelement (ex: project_task) // Parse element/subelement (ex: project_task)
$module = $element = $subelement = $objecttype; $module = $element = $subelement = $objecttype;
if (preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs)) if (preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs))
@ -1483,31 +1483,35 @@ class CommonObject
$module = $element = $regs[1]; $module = $element = $regs[1];
$subelement = $regs[2]; $subelement = $regs[2];
} }
$classpath = $element.'/class'; $classpath = $element.'/class';
// To work with non standard path // 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 == 'propal') { $classpath = 'comm/propal/class'; }
if ($objecttype == 'shipping') { $classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon'; } if ($objecttype == 'shipping') { $classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon'; }
if ($objecttype == 'delivery') { $classpath = 'livraison/class'; $subelement = 'livraison'; $module = 'livraison_bon'; } if ($objecttype == 'delivery') { $classpath = 'livraison/class'; $subelement = 'livraison'; $module = 'livraison_bon'; }
if ($objecttype == 'invoice_supplier') { $classpath = 'fourn/class'; } if ($objecttype == 'invoice_supplier') { $classpath = 'fourn/class'; }
if ($objecttype == 'order_supplier') { $classpath = 'fourn/class'; } if ($objecttype == 'order_supplier') { $classpath = 'fourn/class'; }
if ($objecttype == 'contract') { $classpath = 'contrat/class'; $module='contrat'; $subelement='contrat'; }
$classfile = strtolower($subelement); $classname = ucfirst($subelement);
print "objecttype=".$objecttype." module=".$module." subelement=".$subelement;
$classfile = strtolower($subelement); $classname = ucfirst($subelement);
if ($objecttype == 'invoice_supplier') { $classfile = 'fournisseur.facture'; $classname='FactureFournisseur'; } if ($objecttype == 'invoice_supplier') { $classfile = 'fournisseur.facture'; $classname='FactureFournisseur'; }
if ($objecttype == 'order_supplier') { $classfile = 'fournisseur.commande'; $classname='CommandeFournisseur'; } if ($objecttype == 'order_supplier') { $classfile = 'fournisseur.commande'; $classname='CommandeFournisseur'; }
if ($conf->$module->enabled) if ($conf->$module->enabled)
{ {
dol_include_once('/'.$classpath.'/'.$classfile.'.class.php'); dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
$object = new $classname($this->db); $object = new $classname($this->db);
$ret=$object->fetch($objectid); $ret=$object->fetch($objectid);
if ($ret > 0) return $object->getNomUrl($withpicto,$option); if ($ret > 0) return $object->getNomUrl($withpicto,$option);
} }
} }
/* This is to show linked object block */ /* This is to show linked object block */
/** /**

View File

@ -523,7 +523,7 @@ if ($_POST['action'] == 'send' && ! $_POST['cancel'] && (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('FICHINTER_SENTBYMAIL',$fichinter,$user,$langs,$conf); $result=$interface->run_triggers('FICHEINTER_SENTBYMAIL',$fichinter,$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

View File

@ -133,8 +133,6 @@ class InterfaceActionsAuto
$object->sendtoid=0; $object->sendtoid=0;
$object->socid=$object->id; $object->socid=$object->id;
$object->fk_element=0;
$object->elementtype='';
$ok=1; $ok=1;
} }
elseif ($action == 'CONTRACT_VALIDATE') elseif ($action == 'CONTRACT_VALIDATE')
@ -149,7 +147,7 @@ class InterfaceActionsAuto
$object->actionmsg=$langs->transnoentities("ContractValidatedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("ContractValidatedInDolibarr",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1; $ok=1;
} }
elseif ($action == 'PROPAL_VALIDATE') elseif ($action == 'PROPAL_VALIDATE')
@ -180,8 +178,9 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
} }
$object->sendtoid=0; // Parameters $object->sendtoid defined by caller
$ok=1; //$object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'PROPAL_CLOSE_SIGNED') elseif ($action == 'PROPAL_CLOSE_SIGNED')
{ {
@ -239,10 +238,9 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
} }
$object->sendtoid=0; // Parameters $object->sendtoid defined by caller
//$object->sendtoid=0;
$ok=1; $ok=1;
// Parameters $object->xxx defined by caller
} }
elseif ($action == 'BILL_VALIDATE') elseif ($action == 'BILL_VALIDATE')
{ {
@ -274,9 +272,9 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
} }
// Parameters $object->sendtoid defined by caller
//$object->sendtoid=0;
$ok=1; $ok=1;
// Parameters $object->xxx defined by caller
} }
elseif ($action == 'BILL_PAYED') elseif ($action == 'BILL_PAYED')
{ {
@ -290,7 +288,7 @@ class InterfaceActionsAuto
$object->actionmsg=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1; $ok=1;
} }
elseif ($action == 'BILL_CANCEL') elseif ($action == 'BILL_CANCEL')
@ -305,7 +303,7 @@ class InterfaceActionsAuto
$object->actionmsg=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1; $ok=1;
} }
elseif ($action == 'FICHEINTER_VALIDATE') elseif ($action == 'FICHEINTER_VALIDATE')
@ -320,10 +318,28 @@ class InterfaceActionsAuto
$object->actionmsg=$langs->transnoentities("InterventionValidatedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("InterventionValidatedInDolibarr",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$object->fk_element=0;
$object->elementtype='';
$ok=1; $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); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
@ -338,9 +354,9 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
} }
// Parameters $object->sendtoid defined by caller
//$object->sendtoid=0;
$ok=1; $ok=1;
// Parameters $object->xxx defined by caller
} }
elseif ($action == 'ORDER_SUPPLIER_VALIDATE') elseif ($action == 'ORDER_SUPPLIER_VALIDATE')
{ {
@ -353,8 +369,8 @@ class InterfaceActionsAuto
$object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1; $ok=1;
} }
elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL')
{ {
@ -372,7 +388,8 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
} }
$object->sendtoid=0; // Parameters $object->sendotid defined by caller
//$object->sendtoid=0;
$ok=1; $ok=1;
} }
elseif ($action == 'BILL_SUPPLIER_VALIDATE') elseif ($action == 'BILL_SUPPLIER_VALIDATE')
@ -387,8 +404,8 @@ class InterfaceActionsAuto
$object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1; $ok=1;
} }
elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL') elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL')
{ {
@ -406,7 +423,8 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
} }
$object->sendtoid=0; // Parameters $object->sendtoid defined by caller
//$object->sendtoid=0;
$ok=1; $ok=1;
} }
elseif ($action == 'BILL_SUPPLIER_PAYED') elseif ($action == 'BILL_SUPPLIER_PAYED')
@ -456,8 +474,6 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$object->fk_element=0;
$object->elementtype='';
$ok=1; $ok=1;
} }
elseif ($action == 'MEMBER_SUBSCRIPTION') elseif ($action == 'MEMBER_SUBSCRIPTION')
@ -477,8 +493,6 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$object->fk_element=0;
$object->elementtype='';
$ok=1; $ok=1;
} }
elseif ($action == 'MEMBER_MODIFY') elseif ($action == 'MEMBER_MODIFY')
@ -500,8 +514,6 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$object->fk_element=0;
$object->elementtype='';
$ok=1; $ok=1;
} }
elseif ($action == 'MEMBER_DELETE') elseif ($action == 'MEMBER_DELETE')
@ -519,8 +531,6 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$object->fk_element=0;
$object->elementtype='';
$ok=1; $ok=1;
} }
@ -556,8 +566,8 @@ class InterfaceActionsAuto
//$actioncomm->usertodo = $user; // User affected to action //$actioncomm->usertodo = $user; // User affected to action
$actioncomm->userdone = $user; // User doing action $actioncomm->userdone = $user; // User doing action
$actioncomm->fk_element = $object->fk_element; $actioncomm->fk_element = $object->id;
$actioncomm->elementtype = $object->elementtype; $actioncomm->elementtype = $object->element;
$ret=$actioncomm->add($user); // User qui saisit l'action $ret=$actioncomm->add($user); // User qui saisit l'action
if ($ret > 0) if ($ret > 0)

View File

@ -10,7 +10,7 @@
-- To change type of field: ALTER TABLE llx_table MODIFY name varchar(60); -- 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'; 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; 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 -- 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 (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); 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';

View File

@ -315,7 +315,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0)
{ {
migrate_directories($db,$langs,$conf,'/rss','/externalrss'); migrate_directories($db,$langs,$conf,'/rss','/externalrss');
migrate_actioncomm_element($db,$langs,$conf); migrate_actioncomm_element($db,$langs,$conf);
// Reload modules // Reload modules
@ -3090,15 +3090,15 @@ function migrate_actioncomm_element($db,$langs,$conf)
print '<br>'; print '<br>';
print '<b>'.$langs->trans('MigrationActioncommElement')."</b><br>\n"; print '<b>'.$langs->trans('MigrationActioncommElement')."</b><br>\n";
$elements = array( 'propal' => 'propalrowid', $elements = array( 'propal' => 'propalrowid',
'commande' => 'fk_commande', 'order' => 'fk_commande',
'facture' => 'fk_facture', 'invoice' => 'fk_facture',
'contrat' => 'fk_contract', 'contract' => 'fk_contract',
'order_supplier' => 'fk_supplier_order', 'order_supplier' => 'fk_supplier_order',
'invoice_supplier' => 'fk_supplier_invoice' 'invoice_supplier' => 'fk_supplier_invoice'
); );
foreach($elements as $type => $field) foreach($elements as $type => $field)
{ {
$result = $db->DDLDescTable(MAIN_DB_PREFIX."actioncomm",$field); $result = $db->DDLDescTable(MAIN_DB_PREFIX."actioncomm",$field);
@ -3106,24 +3106,25 @@ function migrate_actioncomm_element($db,$langs,$conf)
if ($obj) if ($obj)
{ {
dolibarr_install_syslog("upgrade2::migrate_actioncomm_element field=".$field); dolibarr_install_syslog("upgrade2::migrate_actioncomm_element field=".$field);
$db->begin(); $db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm SET "; $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm SET ";
$sql.= "fk_element = ".$field.", elementtype = '".$type."'"; $sql.= "fk_element = ".$field.", elementtype = '".$type."'";
$sql.= " WHERE ".$field." IS NOT NULL"; $sql.= " WHERE ".$field." IS NOT NULL";
$sql.= " AND fk_element IS NULL"; $sql.= " AND fk_element IS NULL";
$sql.= " AND elementtype IS NULL"; $sql.= " AND elementtype IS NULL";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$db->commit(); $db->commit();
// DDL commands must not be inside a transaction // DDL commands must not be inside a transaction
$sqlDrop = "ALTER TABLE ".MAIN_DB_PREFIX."actioncomm DROP COLUMN ".$field; // We will drop at next version because a migrate should be runnable several times if it fails.
$db->query($sqlDrop); //$sqlDrop = "ALTER TABLE ".MAIN_DB_PREFIX."actioncomm DROP COLUMN ".$field;
print ". "; //$db->query($sqlDrop);
//print ". ";
} }
else else
{ {