Fix: Action "send by email" are correctly stored in agenda.

This commit is contained in:
Laurent Destailleur 2010-09-12 20:27:40 +00:00
parent 8912de7bbc
commit a1df1f5314
8 changed files with 105 additions and 22 deletions

View File

@ -71,6 +71,13 @@ class ActionComm extends CommonObject
var $note; var $note;
var $percentage; var $percentage;
// Properties for links to other tables
var $orderrowid;
var $propalrowid;
var $facid;
var $supplierorderrowid;
var $supplierinvoicerowid;
/** /**
* \brief Constructeur * \brief Constructeur
@ -162,7 +169,11 @@ class ActionComm extends CommonObject
$sql.= "fk_user_action,"; $sql.= "fk_user_action,";
$sql.= "fk_user_done,"; $sql.= "fk_user_done,";
$sql.= "label,percent,priority,location,punctual,"; $sql.= "label,percent,priority,location,punctual,";
$sql.= "fk_facture,propalrowid,fk_commande)"; $sql.= "fk_facture,";
$sql.= "propalrowid,";
$sql.= "fk_commande,";
$sql.= "fk_supplier_invoice,";
$sql.= "fk_supplier_order)";
$sql.= " VALUES ("; $sql.= " VALUES (";
$sql.= "'".$this->db->idate($now)."',"; $sql.= "'".$this->db->idate($now)."',";
$sql.= (strval($this->datep)!=''?"'".$this->db->idate($this->datep)."'":"null").","; $sql.= (strval($this->datep)!=''?"'".$this->db->idate($this->datep)."'":"null").",";
@ -182,7 +193,9 @@ class ActionComm extends CommonObject
$sql.= "'".addslashes($this->label)."','".$this->percentage."','".$this->priority."','".addslashes($this->location)."','".$this->punctual."',"; $sql.= "'".addslashes($this->label)."','".$this->percentage."','".$this->priority."','".addslashes($this->location)."','".$this->punctual."',";
$sql.= ($this->facid?$this->facid:"null").","; $sql.= ($this->facid?$this->facid:"null").",";
$sql.= ($this->propalrowid?$this->propalrowid:"null").","; $sql.= ($this->propalrowid?$this->propalrowid:"null").",";
$sql.= ($this->orderrowid?$this->orderrowid:"null"); $sql.= ($this->orderrowid?$this->orderrowid:"null").",";
$sql.= ($this->supplierinvoicerowid?$this->supplierinvoicerowid:"null").",";
$sql.= ($this->supplierorderrowid?$this->supplierorderrowid:"null");
$sql.= ")"; $sql.= ")";
dol_syslog("ActionComm::add sql=".$sql); dol_syslog("ActionComm::add sql=".$sql);

View File

@ -3011,7 +3011,7 @@ else
} }
// Validate // Validate
if ($object->statut == 0 && $num_lignes > 0 && if ($object->statut == 0 && sizeof($object->lines) > 0 &&
( (
(($object->type == 0 || $object->type == 1 || $object->type == 3 || $object->type == 4) && $object->total_ttc >= 0) (($object->type == 0 || $object->type == 1 || $object->type == 3 || $object->type == 4) && $object->total_ttc >= 0)
|| ($object->type == 2 && $object->total_ttc <= 0)) || ($object->type == 2 && $object->total_ttc <= 0))

View File

@ -171,9 +171,16 @@ class InterfaceActionsAuto
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("propal"); $langs->load("propal");
$langs->load("agenda"); $langs->load("agenda");
$ok=1;
// Parameters $object->xxx defined by caller $object->actiontypecode='AC_EMAIL';
$object->actionmsg2=$langs->transnoentities("ProposalSentByEMail",$object->ref);
$object->actionmsg=$langs->transnoentities("ProposalSentByEMail",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$object->propalrowid=$object->id;
$object->orderrowid=$object->facid=0;
$ok=1;
} }
elseif ($action == 'PROPAL_CLOSE_SIGNED') elseif ($action == 'PROPAL_CLOSE_SIGNED')
{ {
@ -228,7 +235,16 @@ class InterfaceActionsAuto
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("orders"); $langs->load("orders");
$langs->load("agenda"); $langs->load("agenda");
$ok=1;
$object->actiontypecode='AC_EMAIL';
$object->actionmsg2=$langs->transnoentities("OrderSentByEMail",$object->ref);
$object->actionmsg=$langs->transnoentities("OrderSentByEMail",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$object->facid=$object->id;
$object->orderrowid=$object->propalrowid=0;
$ok=1;
// Parameters $object->xxx defined by caller // Parameters $object->xxx defined by caller
} }
@ -255,7 +271,15 @@ class InterfaceActionsAuto
$langs->load("other"); $langs->load("other");
$langs->load("bills"); $langs->load("bills");
$langs->load("agenda"); $langs->load("agenda");
$ok=1;
$object->actiontypecode='AC_EMAIL';
$object->actionmsg2=$langs->transnoentities("InvoiceSentByEMail",$object->ref);
$object->actionmsg=$langs->transnoentities("InvoiceSentByEMail",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->facid=$object->id;
$object->orderrowid=$object->propalrowid=0;
$ok=1;
// Parameters $object->xxx defined by caller // Parameters $object->xxx defined by caller
} }
@ -320,8 +344,8 @@ 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->orderrowid=0; // Supplier order not yet supported $object->supplierorderrowid=$object->id;
$object->propalrowid=$object->facid=0; $object->supplierinvoicerowid=$object->facid=$object->orderrowid=$object->propalrowid=0;
$ok=1; $ok=1;
} }
elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL')
@ -331,9 +355,16 @@ class InterfaceActionsAuto
$langs->load("bills"); $langs->load("bills");
$langs->load("agenda"); $langs->load("agenda");
$langs->load("orders"); $langs->load("orders");
$ok=1;
// Parameters $object->xxx defined by caller $object->actiontypecode='AC_EMAIL';
$object->actionmsg2=$langs->transnoentities("SupplierOrderSentByEMail",$object->ref);
$object->actionmsg=$langs->transnoentities("SupplierOrderSentByEMail",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$object->supplierorderrowid=$object->id;
$object->supplierinvoicerowid=$object->facid=$object->orderrowid=$object->propalrowid=0;
$ok=1;
} }
elseif ($action == 'BILL_SUPPLIER_VALIDATE') elseif ($action == 'BILL_SUPPLIER_VALIDATE')
{ {
@ -348,11 +379,29 @@ 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->facid=0; // Supplier invoice not yet supported $object->supplierinvoicerowid=$object->id;
$object->orderrowid=$object->propalrowid=0; $object->supplierorderrowid=$object->facid=$object->orderrowid=$object->propalrowid=0;
$ok=1; $ok=1;
} }
elseif ($action == 'BILL_SUPPLIER_PAYED') elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("bills");
$langs->load("agenda");
$langs->load("orders");
$object->actiontypecode='AC_EMAIL';
$object->actionmsg2=$langs->transnoentities("SupplierInvoiceSentByEMail",$object->ref);
$object->actionmsg=$langs->transnoentities("SupplierInvoiceSentByEMail",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$object->supplierorderrowid=$object->id;
$object->supplierinvoicerowid=$object->facid=$object->orderrowid=$object->propalrowid=0;
$ok=1;
}
elseif ($action == 'BILL_SUPPLIER_PAYED')
{ {
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");
@ -365,8 +414,8 @@ 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->facid=0; $object->supplierinvoicerowid=$object->id;
$object->orderrowid=$object->propalrowid=0; $object->supplierorderrowid=$object->facid=$object->orderrowid=$object->propalrowid=0;
$ok=1; $ok=1;
} }
elseif ($action == 'BILL_SUPPLIER_CANCELED') elseif ($action == 'BILL_SUPPLIER_CANCELED')
@ -382,8 +431,8 @@ 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->facid=0; $object->supplierinvoicerowid=$object->id;
$object->orderrowid=$object->propalrowid=0; $object->facid=$object->orderrowid=$object->propalrowid=0;
$ok=1; $ok=1;
} }
@ -403,8 +452,7 @@ 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->facid=0; // Supplier invoice not yet supported $object->facid=$object->orderrowid=$object->propalrowid=0;
$object->orderrowid=$object->propalrowid=0;
$ok=1; $ok=1;
} }
elseif ($action == 'MEMBER_SUBSCRIPTION') elseif ($action == 'MEMBER_SUBSCRIPTION')
@ -499,9 +547,13 @@ class InterfaceActionsAuto
$actioncomm->author = $user; // User saving action $actioncomm->author = $user; // User saving action
//$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->facid = $object->facid; $actioncomm->facid = $object->facid;
$actioncomm->orderrowid = $object->orderrowid; $actioncomm->orderrowid = $object->orderrowid;
$actioncomm->propalrowid = $object->propalrowid; $actioncomm->propalrowid = $object->propalrowid;
$actioncomm->supplierinvoicerowid = $object->supplierinvoicerowid;
$actioncomm->supplierorderrowid = $object->supplierorderrowid;
$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

@ -45,6 +45,8 @@ ALTER TABLE llx_societe ADD COLUMN canvas varchar(32) DEFAULT NULL AFTER default
ALTER TABLE llx_cond_reglement RENAME TO llx_c_payment_term; ALTER TABLE llx_cond_reglement RENAME TO llx_c_payment_term;
ALTER TABLE llx_expedition_methode RENAME TO llx_c_shipment_mode; ALTER TABLE llx_expedition_methode RENAME TO llx_c_shipment_mode;
ALTER TABLE llx_facturedet_rec ADD COLUMN special_code integer UNSIGNED DEFAULT 0 AFTER total_ttc; ALTER TABLE llx_facturedet_rec ADD COLUMN special_code integer UNSIGNED DEFAULT 0 AFTER total_ttc;
ALTER TABLE llx_facturedet_rec ADD COLUMN rang integer DEFAULT 0 AFTER special_code; ALTER TABLE llx_facturedet_rec ADD COLUMN rang integer DEFAULT 0 AFTER special_code;
ALTER TABLE llx_actioncomm ADD COLUMN fk_supplier_order integer;
ALTER TABLE llx_actioncomm ADD COLUMN fk_supplier_invoice integer;

View File

@ -23,3 +23,5 @@ ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_datea (datea);
ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_soc (fk_soc); ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_soc (fk_soc);
ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_contact (fk_contact); ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_contact (fk_contact);
ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_facture (fk_facture); ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_facture (fk_facture);
ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_supplier_order (fk_supplier_order);
ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_supplier_invoice (fk_supplier_invoice);

View File

@ -1,6 +1,6 @@
-- ======================================================================== -- ========================================================================
-- Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> -- Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> -- Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
-- --
-- This program is free software; you can redistribute it and/or modify -- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by -- it under the terms of the GNU General Public License as published by
@ -55,6 +55,10 @@ create table llx_actioncomm
propalrowid integer, propalrowid integer,
fk_commande integer, fk_commande integer,
fk_facture integer fk_facture integer
fk_contract integer,
fk_supplier_order integer,
fk_supplier_invoice integer
)type=innodb; )type=innodb;

View File

@ -33,6 +33,11 @@ PropalValidatedInDolibarr= Proposal %s validated
InvoiceValidatedInDolibarr= Invoice %s validated InvoiceValidatedInDolibarr= Invoice %s validated
OrderValidatedInDolibarr= Order %s validated OrderValidatedInDolibarr= Order %s validated
InterventionValidatedInDolibarr=Intervention %s validated InterventionValidatedInDolibarr=Intervention %s validated
ProposalSentByEMail=Commercial proposal %s sent by EMail
OrderSentByEMail=Customer order %s sent by EMail
InvoiceSentByEMail=Customer invoice %s sent by EMail
SupplierOrderSentByEMail=Supplier order %s sent by EMail
SupplierInvoiceSentByEMail=Supplier invoice %s sent by EMail
NewCompanyToDolibarr= Third party created NewCompanyToDolibarr= Third party created
DateActionPlannedStart= Planned start date DateActionPlannedStart= Planned start date
DateActionPlannedEnd= Planned end date DateActionPlannedEnd= Planned end date

View File

@ -33,6 +33,11 @@ PropalValidatedInDolibarr=Proposition %s validée
InvoiceValidatedInDolibarr=Facture %s validée InvoiceValidatedInDolibarr=Facture %s validée
OrderValidatedInDolibarr=Commande %s validée OrderValidatedInDolibarr=Commande %s validée
InterventionValidatedInDolibarr=Intervention %s validée InterventionValidatedInDolibarr=Intervention %s validée
ProposalSentByEMail=Proposition commerciale %s envoyée par EMail
OrderSentByEMail=Commande client %s envoyée par EMail
InvoiceSentByEMail=Facture client %s envoyée par EMail
SupplierOrderSentByEMail=Commande fournisseur %s envoyée par EMail
SupplierInvoiceSentByEMail=Facture fournisseur %s envoyée par EMail
NewCompanyToDolibarr=Tiers créé NewCompanyToDolibarr=Tiers créé
DateActionPlannedStart=Date début réalisation prévue DateActionPlannedStart=Date début réalisation prévue
DateActionPlannedEnd=Date fin réalisation prévue DateActionPlannedEnd=Date fin réalisation prévue