From ca6a973d9614076a51e977bd69e0ab6789e673c9 Mon Sep 17 00:00:00 2001 From: lalaina rasamoelina Date: Tue, 27 Aug 2013 15:51:06 +0200 Subject: [PATCH 01/37] T940-develop: creating a bouton which permit to create an event in the propal,and command . If we create an event in the propal, then the events will be attached in the propal and if it's for command,it will be attached in the command --- htdocs/comm/action/fiche.php | 15 +++++++++++++-- htdocs/comm/propal.php | 10 ++++++++-- htdocs/commande/fiche.php | 8 ++++++-- htdocs/core/class/commonobject.class.php | 1 + 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 81a635e4d9f..74e1b302ccc 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -51,6 +51,8 @@ $action=GETPOST('action','alpha'); $cancel=GETPOST('cancel','alpha'); $backtopage=GETPOST('backtopage','alpha'); $contactid=GETPOST('contactid','int'); +$origin=GETPOST('origin','alpha'); +$originid=GETPOST('originid','int'); // Security check $socid = GETPOST('socid','int'); @@ -142,6 +144,8 @@ if ($action == 'add_action') $actioncomm->location = GETPOST("location"); $actioncomm->transparency = (GETPOST("transparency")=='on'?1:0); $actioncomm->label = trim(GETPOST('label')); + $actioncomm->fk_element = GETPOST("fk_element"); + $actioncomm->elementtype = GETPOST("elementtype"); if (! GETPOST('label')) { if (GETPOST('actioncode') == 'AC_RDV' && $contact->getFullName($langs)) @@ -327,7 +331,8 @@ if ($action == 'update') $actioncomm->fk_project = $_POST["projectid"]; $actioncomm->note = $_POST["note"]; $actioncomm->pnote = $_POST["note"]; - + $actioncomm->fk_element = $_POST["fk_element"]; + $actioncomm->elementtype = $_POST["elementtype"]; if (! $datef && $percentage == 100) { $error=$langs->trans("ErrorFieldRequired",$langs->trans("DateEnd")); @@ -476,7 +481,7 @@ if ($action == 'create') // Full day print ''.$langs->trans("EventOnFullDay").''; - + // Date start $datep=$actioncomm->datep; if (GETPOST('datep','int',1)) $datep=dol_stringtotime(GETPOST('datep','int',1),0); @@ -593,6 +598,11 @@ if ($action == 'create') } print ''; } + if(!empty($origin) && !empty($originid)) + { + print ''; + print ''; + } if (GETPOST("datep") && preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$/',GETPOST("datep"),$reg)) { @@ -610,6 +620,7 @@ if ($action == 'create') $doleditor=new DolEditor('note',(GETPOST('note')?GETPOST('note'):$actioncomm->note),'',240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_7,90); $doleditor->Create(); print ''; + // Other attributes $parameters=array(); diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 235e6e7ef9b..8883f5e641f 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1646,8 +1646,9 @@ else if ($absolute_discount) { if ($object->statut > 0) - { + { print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)); + } else { @@ -2096,7 +2097,12 @@ else if (count($object->lines) > 0) print '
'.$langs->trans('Validate').'
'; //else print ''.$langs->trans('Validate').''; } - + //Creer un evenement + if ($conf->agenda->enabled) + { + print ''.$langs->trans("AddAction").''; + + } // Edit if ($object->statut == 1 && $user->rights->propal->creer) { diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 8f710dadca4..57f38468f0a 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -2381,13 +2381,17 @@ else { print '
'.$langs->trans('Validate').'
'; } - // Edit if ($object->statut == 1 && $user->rights->commande->creer) { print '
'.$langs->trans('Modify').'
'; } - + //Creer un evenement + if ($conf->agenda->enabled) + { + print ''.$langs->trans("AddAction").''; + + } // Send if ($object->statut > 0) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 9fb99f69173..2ebe933f285 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2584,6 +2584,7 @@ abstract class CommonObject } } + /* This is to show add lines */ From bb8f8332f99de2bbdf3a46eda7e6ec36897349e0 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Tue, 3 Sep 2013 11:12:29 +0200 Subject: [PATCH 02/37] Update modProjet.class.php enhance export feature with left join and projet_task_time data --- htdocs/core/modules/modProjet.class.php | 36 ++++++++++++++----------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 7b9ec52aef6..e8dee7fbc8a 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -177,26 +177,30 @@ class modProjet extends DolibarrModules $this->export_label[$r]='ProjectsAndTasksLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r]=array(array("projet","export")); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country', - 's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode', - 'p.rowid'=>"ProjectId",'p.ref'=>"ProjectRef",'p.datec'=>"DateCreation",'p.dateo'=>"DateDebutProjet",'p.datee'=>"DateFinProjet",'p.fk_statut'=>'ProjectStatus','p.description'=>"projectNote", - 'pt.rowid'=>'RefTask','pt.dateo'=>"TaskDateo",'pt.datee'=>"TaskDatee",'pt.duration_effective'=>"DurationEffective",'pt.planned_workload'=>"DurationPlanned",'pt.progress'=>"Progress",'pt.description'=>"TaskDesc"); + 's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode', + 'p.rowid'=>"ProjectId",'p.ref'=>"ProjectRef",'p.datec'=>"DateCreation",'p.dateo'=>"DateDebutProjet",'p.datee'=>"DateFinProjet",'p.fk_statut'=>'ProjectStatus','p.description'=>"projectNote", + 'pt.rowid'=>'RefTask','pt.dateo'=>"TaskDateo",'pt.datee'=>"TaskDatee",'pt.duration_effective'=>"DurationEffective",'pt.planned_workload'=>"DurationPlanned",'pt.progress'=>"Progress",'pt.description'=>"TaskDesc", + 'ptt.task_date'=>'TaskTimeDate','ptt.task_duration'=>"TimesSpent",'ptt.fk_user'=>"TaskTimeUser",'ptt.note'=>"TaskTimeNote"); - //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_pays:libelle', - $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_pays:libelle', - 's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text', - 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','p.description'=>"Text", - 'pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Duree",'pt.progress'=>"Number",'pt.description'=>"Text"); - - $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company', - 's.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company', - 'f.rowid'=>"project",'f.ref'=>"project",'f.datec'=>"project",'f.duree'=>"project",'f.fk_statut'=>"project",'f.description'=>"project", - 'pt.rowid'=>'task','pt.dateo'=>"task",'pt.datee'=>"task",'pt.duration_effective'=>"task",'pt.planned_workload'=>"task",'pt.progress'=>"task",'pt.description'=>"task"); + $this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_pays:libelle', + 's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text', + 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','p.description'=>"Text", + 'pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Number",'pt.progress'=>"Number",'pt.description'=>"Text", + 'ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:Name",'ptt.note'=>"Text"); + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company', + 's.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company', + 'f.rowid'=>"project",'f.ref'=>"project",'f.datec'=>"project",'f.duree'=>"project",'f.fk_statut'=>"project",'f.description'=>"project", + 'pt.rowid'=>'task','pt.dateo'=>"task",'pt.datee'=>"task",'pt.duration_effective'=>"task",'pt.planned_workload'=>"task",'pt.progress'=>"task",'pt.description'=>"task", + 'ptt.task_date'=>'task_time','ptt.task_duration'=>"task_time",'ptt.fk_user'=>"task_time",'ptt.note'=>"task_time"); + $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'projet as p, '.MAIN_DB_PREFIX.'projet_task as pt, '.MAIN_DB_PREFIX.'societe as s)'; - $this->export_sql_end[$r] .=' WHERE p.fk_soc = s.rowid AND p.rowid = pt.fk_projet '; + $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'projet as p, '.MAIN_DB_PREFIX.'societe as s)'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON (p.rowid = pt.fk_projet)"; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON (pt.rowid = ptt.fk_task)"; + $this->export_sql_end[$r] .=' WHERE p.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' AND p.entity = '.$conf->entity; - $r++; + } From 5e9cb8a1d42aabfe229ee601ef446582549687c5 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Sat, 14 Sep 2013 10:45:41 +0200 Subject: [PATCH 03/37] Update modProjet.class.php add export_dependencies_array --- htdocs/core/modules/modProjet.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index e8dee7fbc8a..584a8e3494f 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -176,6 +176,8 @@ class modProjet extends DolibarrModules $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='ProjectsAndTasksLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r]=array(array("projet","export")); + $this->export_dependencies_array[$r]=array('task_time'=>'ppt.rowid'); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country', 's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode', 'p.rowid'=>"ProjectId",'p.ref'=>"ProjectRef",'p.datec'=>"DateCreation",'p.dateo'=>"DateDebutProjet",'p.datee'=>"DateFinProjet",'p.fk_statut'=>'ProjectStatus','p.description'=>"projectNote", @@ -194,6 +196,7 @@ class modProjet extends DolibarrModules 'pt.rowid'=>'task','pt.dateo'=>"task",'pt.datee'=>"task",'pt.duration_effective'=>"task",'pt.planned_workload'=>"task",'pt.progress'=>"task",'pt.description'=>"task", 'ptt.task_date'=>'task_time','ptt.task_duration'=>"task_time",'ptt.fk_user'=>"task_time",'ptt.note'=>"task_time"); + $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'projet as p, '.MAIN_DB_PREFIX.'societe as s)'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON (p.rowid = pt.fk_projet)"; From a100faa4b13a168a4c5375040236714e220e2a65 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Sun, 15 Sep 2013 18:33:20 +0200 Subject: [PATCH 04/37] ability to copy contact address to clipboard --- htdocs/core/lib/company.lib.php | 59 ++++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 2bd863b263f..6b39670fb77 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -4,6 +4,7 @@ * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Christophe Battarel * * 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 @@ -555,6 +556,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays, p.poste, p.phone, p.phone_mobile, p.fax, p.email, p.statut "; + $sql .= ", p.address, p.zip, p.town"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " WHERE p.fk_soc = ".$object->id; $sql .= " ORDER by p.datec"; @@ -582,17 +584,17 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''.$obj->poste.''; - $country_code = getCountry($obj->fk_pays, 2); + $country_code = getCountry($obj->fk_pays, 'all'); // Lien click to dial print ''; - print dol_print_phone($obj->phone,$country_code,$obj->rowid,$object->id,'AC_TEL'); + print dol_print_phone($obj->phone,$country_code['code'],$obj->rowid,$object->id,'AC_TEL'); print ''; print ''; - print dol_print_phone($obj->phone_mobile,$country_code,$obj->rowid,$object->id,'AC_TEL'); + print dol_print_phone($obj->phone_mobile,$country_code['code'],$obj->rowid,$object->id,'AC_TEL'); print ''; print ''; - print dol_print_phone($obj->fax,$country_code,$obj->rowid,$object->id,'AC_FAX'); + print dol_print_phone($obj->fax,$country_code['code'],$obj->rowid,$object->id,'AC_FAX'); print ''; print ''; print dol_print_email($obj->email,$obj->rowid,$object->id,'AC_EMAIL'); @@ -600,6 +602,42 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') if ($obj->statut==0) print ''.$langs->trans('Disabled').' '.img_picto($langs->trans('StatusContactDraftShort'),'statut0').''; elseif ($obj->statut==1) print ''.$langs->trans('Enabled').' '.img_picto($langs->trans('StatusContactValidatedShort'),'statut1').''; + + // copy in clipboard + $coords = ''; + if (!empty($object->name)) + $coords .= addslashes($object->name)."
"; + if (!empty($obj->civilite)) + $coords .= addslashes($obj->civilite).' '; + if (!empty($obj->firstname)) + $coords .= addslashes($obj->firstname).' '; + if (!empty($obj->name)) + $coords .= addslashes($obj->name); + $coords .= "
"; + if (!empty($obj->address)) + { + $coords .= addslashes(dol_nl2br($obj->address,1,true))."
"; + if (!empty($obj->cp)) + $coords .= addslashes($obj->zip).' '; + if (!empty($obj->ville)) + $coords .= addslashes($obj->town); + if (!empty($obj->pays)) + $coords .= "
".addslashes($country_code['label']); + } + elseif (!empty($object->address)) + { + $coords .= addslashes(dol_nl2br($object->address,1,true))."
"; + if (!empty($object->zip)) + $coords .= addslashes($object->zip).' '; + if (!empty($object->town)) + $coords .= addslashes($object->town); + if (!empty($object->country)) + $coords .= "
".addslashes($object->country); + } + print ''; + print img_picto($langs->trans("Address"), 'object_address.png'); + print ''; + if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { print ''; @@ -638,6 +676,19 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print "\n\n"; print "
\n"; +?> + + + function copyToClipboard (text) { + text = text.replace(/
/g,"\n"); + var newElem = "

Ctrl+C pour copier dans le presse-papier"; + $("#dialog").html(newElem); + $( "#dialog" ).dialog(); + $("#coords").select(); + } + '; return $i; } From 33fbee51bdf06beffbe962691e8a31badc0aadcc Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Sun, 15 Sep 2013 19:09:22 +0200 Subject: [PATCH 05/37] ability to copy contact address to clipboard --- htdocs/core/lib/company.lib.php | 20 +++++++++++++------- htdocs/langs/en_US/main.lang | 1 + htdocs/langs/fr_FR/main.lang | 1 + 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 6b39670fb77..ffb8cb68618 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -537,7 +537,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print "\n".''."\n"; - $colspan=6; + $colspan=8; print ''; print ''; print ''; @@ -552,11 +552,16 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $colspan++; print ''; } + if ($user->rights->societe->contact->creer) + { + $colspan++; + print ''; + } print ""; $sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays, p.poste, p.phone, p.phone_mobile, p.fax, p.email, p.statut "; - $sql .= ", p.address, p.zip, p.town"; + $sql .= ", p.civilite, p.address, p.zip, p.town"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " WHERE p.fk_soc = ".$object->id; $sql .= " ORDER by p.datec"; @@ -611,8 +616,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $coords .= addslashes($obj->civilite).' '; if (!empty($obj->firstname)) $coords .= addslashes($obj->firstname).' '; - if (!empty($obj->name)) - $coords .= addslashes($obj->name); + if (!empty($obj->lastname)) + $coords .= addslashes($obj->lastname); $coords .= "
"; if (!empty($obj->address)) { @@ -634,7 +639,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') if (!empty($object->country)) $coords .= "
".addslashes($object->country); } - print ''; @@ -677,16 +682,17 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print "
\n"; ?> -'; // Country @@ -510,9 +510,9 @@ else // Zip / Town print ''; // Country diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 6d30e8e760c..c1d9609a6c4 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -133,7 +133,7 @@ abstract class ActionsCardCommon $this->object->zip = $_POST["zipcode"]; $this->object->town = $_POST["town"]; $this->object->country_id = $_POST["country_id"]; - $this->object->state_id = $_POST["departement_id"]; + $this->object->state_id = $_POST["state_id"]; $this->object->tel = $_POST["tel"]; $this->object->fax = $_POST["fax"]; $this->object->email = trim($_POST["email"]); @@ -483,10 +483,10 @@ abstract class ActionsCardCommon } // Zip - $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6); + $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip,'zipcode',array('town','selectcountry_id','state_id'),6); // Town - $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town,'town',array('zipcode','selectcountry_id','departement_id')); + $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town,'town',array('zipcode','selectcountry_id','state_id')); // Country $this->object->country_id = ($this->object->country_id ? $this->object->country_id : $mysoc->country_id); @@ -670,7 +670,7 @@ abstract class ActionsCardCommon $this->object->zip = $_POST["zipcode"]; $this->object->town = $_POST["town"]; $this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id; - $this->object->state_id = $_POST["departement_id"]; + $this->object->state_id = $_POST["state_id"]; $this->object->tel = $_POST["tel"]; $this->object->fax = $_POST["fax"]; $this->object->email = $_POST["email"]; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index bd1fae497f2..49b42decef4 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -54,10 +54,9 @@ class Societe extends CommonObject var $town; var $status; // 0=activity ceased, 1= in activity - var $state_id; + var $state_id; // Id of department var $state_code; var $state; - var $departement_id; // deprecated var $departement_code; // deprecated var $departement; // deprecated diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 8682058091d..9c11be40764 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -129,7 +129,7 @@ if (empty($reshook)) $object->zip = GETPOST('zipcode'); $object->town = GETPOST('town'); $object->country_id = GETPOST('country_id'); - $object->state_id = GETPOST('departement_id'); + $object->state_id = GETPOST('state_id'); $object->phone = GETPOST('phone'); $object->fax = GETPOST('fax'); $object->email = GETPOST('email'); @@ -588,7 +588,7 @@ else $object->address = GETPOST('address'); $object->zip = GETPOST('zipcode'); $object->town = GETPOST('town'); - $object->state_id = GETPOST('departement_id'); + $object->state_id = GETPOST('state_id'); $object->phone = GETPOST('phone'); $object->fax = GETPOST('fax'); $object->email = GETPOST('email'); @@ -812,9 +812,9 @@ else // Zip / Town print ''; // Country @@ -827,7 +827,7 @@ else if (empty($conf->global->SOCIETE_DISABLE_STATE)) { print ''; } @@ -1069,7 +1069,7 @@ else $object->zip = GETPOST('zipcode'); $object->town = GETPOST('town'); $object->country_id = GETPOST('country_id')?GETPOST('country_id'):$mysoc->country_id; - $object->state_id = GETPOST('departement_id'); + $object->state_id = GETPOST('state_id'); $object->phone = GETPOST('phone'); $object->fax = GETPOST('fax'); $object->email = GETPOST('email'); @@ -1230,9 +1230,9 @@ else // Zip / Town print ''; // Country diff --git a/test/selenium/test_thirdparty.xml b/test/selenium/test_thirdparty.xml index 704796cd4c2..47a9b8091a9 100644 --- a/test/selenium/test_thirdparty.xml +++ b/test/selenium/test_thirdparty.xml @@ -38,7 +38,7 @@ - + From 00cb2aa26cd5a073ce67520bbe32d1d8c12de8c5 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Mon, 23 Sep 2013 10:55:44 +0200 Subject: [PATCH 08/37] Fix : wrong var used in bank account class --- htdocs/compta/bank/class/account.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 17796b6b35f..5a71d365ed1 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1296,7 +1296,7 @@ class AccountLine extends CommonObject // No error check. Can fail if category already affected } - $bankline->rappro=1; + $this->rappro=1; $this->db->commit(); return 1; From 5341811ec0bae0092e4d36800c0782698baf849d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Sep 2013 12:31:10 +0200 Subject: [PATCH 09/37] Fix: Clean awful code --- htdocs/compta/facture.php | 115 +++++++++++++++++-------------------- htdocs/societe/societe.php | 4 +- 2 files changed, 56 insertions(+), 63 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index e2da54015cc..31c69d93295 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1588,6 +1588,15 @@ else if ($action == 'down' && $user->rights->facture->creer) exit; } +// Link invoice to order +if (GETPOST('linkedOrder')) +{ + $object->fetch($id); + $object->fetch_thirdparty(); + $result=$object->add_object_linked('commande',GETPOST('linkedOrder')); +} + + /* * Add file in email form */ @@ -1960,6 +1969,16 @@ $now=dol_now(); llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes'); +print ' + +'; + /********************************************************************* * @@ -3727,74 +3746,64 @@ else if ($id > 0 || ! empty($ref)) // Linked object block $somethingshown=$object->showLinkedObjectBlock(); - if (empty($somethingshown) && $object->statut > 0) { + print '
'.$langs->trans('LinkedOrder').''; - print ''.$langs->trans('LinkedOrder').''; - - print '
'.$langs->trans("Name").''.$langs->trans("Poste").'  
'; + print ''; print img_picto($langs->trans("Address"), 'object_address.png'); print '
'.$langs->trans('Zip').''; - print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6); + print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6); print ''.$langs->trans('Town').''; - print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','departement_id')); + print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id')); print '
'.$langs->trans('Zip').''; - print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6); + print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6); print ''.$langs->trans('Town').''; - print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','departement_id')); + print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id')); print '
'.$langs->trans('Zip').''; - print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6); + print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6); print ''.$langs->trans('Town').''; - print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','departement_id')); + print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id')); print '
'.$langs->trans('State').''; - if ($object->country_id) print $formcompany->select_state($object->state_id,$object->country_code,'departement_id'); + if ($object->country_id) print $formcompany->select_state($object->state_id,$object->country_code,'state_id'); else print $countrynotdefined; print '
'.$langs->trans('Zip').''; - print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6); + print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6); print ''.$langs->trans('Town').''; - print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','departement_id')); + print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id')); print '
selectdepartement_idstate_id label=01 - Ain
'; - print ''; - print ''; - print ''; - print ''; - print ' - '; - print ''; + print ''; + print '
'.$langs->trans("Ref").''.$langs->trans("RefCustomer").''.$langs->trans("AmountHTShort").''.$langs->trans("Company").'
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; while ($i < $num) { - $objp = $db->fetch_object($result); + $objp = $db->fetch_object($resqlorderlist); if ($objp->socid == $soc->id) { - $var=!$var; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } - + $var=!$var; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + $i++; - } + } print '
'.$langs->trans("Ref").''.$langs->trans("RefCustomer").''.$langs->trans("AmountHTShort").''.$langs->trans("Company").'
'; - print ''; - print ''.$objp->ref.''.$objp->ref_client.''.price($objp->total_ht).''.$objp->name.'
'; + print ''; + print ''.$objp->ref.''.$objp->ref_client.''.price($objp->total_ht).''.$objp->name.'
'; - print '
'; - print '
'; - - + print '
'; print ''; + $db->free($resqlorderlist); } - else + else { dol_print_error($db); } - $result=$object->add_object_linked('commande',$_POST['linkedOrder']); - if($result>0) - { - echo ''; + + print ''; } - } - - print ''; - } + // Link for paypal payment if (! empty($conf->paypal->enabled) && $object->statut != 0) { @@ -3946,20 +3955,4 @@ dol_htmloutput_mesg('',$mesgs); llxFooter(); $db->close(); -?> - - +?> \ No newline at end of file diff --git a/htdocs/societe/societe.php b/htdocs/societe/societe.php index 7840f5e7d9e..28a3c5c2885 100644 --- a/htdocs/societe/societe.php +++ b/htdocs/societe/societe.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Marcos García * Copyright (C) 2013 Raphaël Doursenaud @@ -22,7 +22,7 @@ /** * \file htdocs/societe/societe.php * \ingroup societe - * \brief Page to show a third party + * \brief Page to show list of third parties */ require_once '../main.inc.php'; From cb04b05e851c5b409099ab9f7c2da0ad82279b28 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Sep 2013 13:17:31 +0200 Subject: [PATCH 10/37] New: Can send an email from thirdparty card. --- ChangeLog | 1 + htdocs/core/actions_sendmails.inc.php | 240 ++++++++++++++++++++++ htdocs/core/admin_extrafields.inc.php | 2 +- htdocs/core/class/html.formmail.class.php | 2 +- htdocs/langs/fr_FR/mails.lang | 2 +- htdocs/societe/soc.php | 164 +++++++++++---- 6 files changed, 372 insertions(+), 39 deletions(-) create mode 100644 htdocs/core/actions_sendmails.inc.php diff --git a/ChangeLog b/ChangeLog index b6de1a1d94f..d685811b926 100644 --- a/ChangeLog +++ b/ChangeLog @@ -56,6 +56,7 @@ For users: - New: [ task #1060 ] Register fields localtax(1|2)_type into details tables. - New: [ task #923 ] Localtax support for ODT templates. - New: [ task #90 ] Barcode search. +- New: Can send an email from thirdparty card. For translators: - Qual: Normalized sort order of all languages files with english reference files. diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php new file mode 100644 index 00000000000..2b34e1e4b18 --- /dev/null +++ b/htdocs/core/actions_sendmails.inc.php @@ -0,0 +1,240 @@ + + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/core/actions_sendmails.inc.php + * \brief Code for actions on sending mails from object page + */ + + +// TODO Include this include file into all class objects + +// $id must be defined +// $actiontypecode must be defined + + +/* + * Add file in email form + */ +if (GETPOST('addfile')) +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + // Set tmp user directory + $vardir=$conf->user->dir_output."/".$user->id; + $upload_dir_tmp = $vardir.'/temp'; + + dol_add_file_process($upload_dir_tmp,0,0); + $action='presend'; +} + +/* + * Remove file in email form + */ +if (! empty($_POST['removedfile'])) +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + // Set tmp user directory + $vardir=$conf->user->dir_output."/".$user->id; + $upload_dir_tmp = $vardir.'/temp'; + + // TODO Delete only files that was uploaded from email form + dol_remove_file_process($_POST['removedfile'],0); + $action='presend'; +} + +/* + * Send mail + */ +if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel']) +{ + $langs->load('mails'); + + $subject='';$actionmsg='';$actionmsg2=''; + + $result=$object->fetch($id); + + if (method_exists($object,"fetch_thirdparty") && $object->element != 'societe') + { + $result=$object->fetch_thirdparty(); + $thirdparty=$object->thirdparty; + } + else if ($object->element == 'societe') + { + $thirdparty=$object; + } + else dol_print_error('','Use actions_sendmails.in.php for a type that is not supported'); + + if ($result > 0) + { + if ($_POST['sendto']) + { + // Recipient is provided into free text + $sendto = $_POST['sendto']; + $sendtoid = 0; + } + elseif ($_POST['receiver'] != '-1') + { + // Recipient was provided from combo list + if ($_POST['receiver'] == 'thirdparty') // Id of third party + { + $sendto = $thirdparty->email; + $sendtoid = 0; + } + else // Id du contact + { + $sendto = $thirdparty->contact_get_property($_POST['receiver'],'email'); + $sendtoid = $_POST['receiver']; + } + } + + if (dol_strlen($sendto)) + { + $langs->load("commercial"); + + $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; + $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; + $message = $_POST['message']; + $sendtocc = $_POST['sendtocc']; + $deliveryreceipt = $_POST['deliveryreceipt']; + + if ($action == 'send') + { + if (dol_strlen($_POST['subject'])) $subject = $_POST['subject']; + $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; + if ($message) + { + $actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; + $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; + $actionmsg.=$message; + } + //$actionmsg2=$langs->transnoentities('Action'.$actiontypecode); + } + if ($action == 'relance') + { + if (dol_strlen($_POST['subject'])) $subject = $_POST['subject']; + $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; + if ($message) { + $actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; + $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; + $actionmsg.=$message; + } + //$actionmsg2=$langs->transnoentities('Action'.$actiontypecode); + } + + // Create form object + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + + $attachedfiles=$formmail->get_attached_files(); + $filepath = $attachedfiles['paths']; + $filename = $attachedfiles['names']; + $mimetype = $attachedfiles['mimes']; + + // Send mail + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1); + if ($mailfile->error) + { + $mesgs[]='
'.$mailfile->error.'
'; + } + else + { + $result=$mailfile->sendfile(); + if ($result) + { + $error=0; + + // Initialisation donnees + $object->sendtoid = $sendtoid; + $object->actiontypecode = $actiontypecode; + $object->actionmsg = $actionmsg; // Long text + $object->actionmsg2 = $actionmsg2; // Short text + $object->fk_element = $object->id; + $object->elementtype = $object->element; + + // Appel des triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($db); + $result=$interface->run_triggers('THIRDPARTY_EMAILSENT',$object,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; + } + // Fin appel triggers + + if ($error) + { + dol_print_error($db); + } + else + { + // Redirect here + // This avoid sending mail twice if going out and then back to page + $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); + setEventMessage($mesg); + header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id); + exit; + } + } + else + { + $langs->load("other"); + $mesg='
'; + if ($mailfile->error) + { + $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); + $mesg.='
'.$mailfile->error; + } + else + { + $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; + } + $mesg.='
'; + + setEventMessage($mesg,'warnings'); + $action = 'presend'; + } + } + /* } + else + { + $langs->load("other"); + $mesgs[]='
'.$langs->trans('ErrorMailRecipientIsEmpty').'
'; + dol_syslog('Recipient email is empty'); + }*/ + } + else + { + $langs->load("errors"); + setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("MailTo")),'warnings'); + dol_syslog('Try to send email with no recipiend defined', LOG_WARNING); + $action = 'presend'; + } + } + else + { + $langs->load("other"); + setEventMessage($langs->trans('ErrorFailedToReadEntity',$object->element),'errors'); + dol_syslog('Failed to read data of object id='.$object->id.' element='.$object->element); + $action = 'presend'; + } + +} + +?> \ No newline at end of file diff --git a/htdocs/core/admin_extrafields.inc.php b/htdocs/core/admin_extrafields.inc.php index 0b608a1e736..d95e1e5394d 100644 --- a/htdocs/core/admin_extrafields.inc.php +++ b/htdocs/core/admin_extrafields.inc.php @@ -306,4 +306,4 @@ if ($action == 'delete') } } -?> +?> \ No newline at end of file diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 802cb61ba53..159f85218de 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -493,7 +493,7 @@ class FormMail } else { - $out.= 'withtopic) .'" />'; + $out.= 'withtopic)?'':$this->withtopic)) .'" />'; } $out.= "\n"; } diff --git a/htdocs/langs/fr_FR/mails.lang b/htdocs/langs/fr_FR/mails.lang index c92b0de4148..78f3a35875b 100644 --- a/htdocs/langs/fr_FR/mails.lang +++ b/htdocs/langs/fr_FR/mails.lang @@ -105,7 +105,7 @@ NbOfCompaniesContacts=Contacts/adresses uniques MailNoChangePossible=Destinataires d'un emailing validé non modifiables SearchAMailing=Rechercher un emailing SendMailing=Envoi emailing -SendMail=Envoi email +SendMail=Envoyer email SentBy=Envoyé par MailingNeedCommand=Pour des raisons de sécurité, il est recommandé de faire les envois d'un mailing de masse depuis la ligne de commande. Si en avez, demandez à votre administrateur de serveurs de lancer la commande suivante pour envoyer le mailing à tous les destinataires : MailingNeedCommand2=Vous pouvez toutefois quand même les envoyer par l'interface écran en ajoutant le paramètre MAILING_LIMIT_SENDBYWEB avec la valeur du nombre max de mails envoyés par session d'envoi. Pour cela, aller dans Accueil - Configuration - Divers. diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 9c11be40764..bdd86576cc7 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -450,6 +450,10 @@ if (empty($reshook)) $result = $object->set_parent(GETPOST('editparentcompany','int')); } + $id=$socid; + $actiontypecode='AC_OTH_AUTO'; + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; + /* * Generate document */ @@ -1771,6 +1775,8 @@ else */ print '
'."\n"; + print ''; + if ($user->rights->societe->creer) { print ''."\n"; @@ -1790,51 +1796,137 @@ else print '
'."\n"; - if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC)) - { - print '
'; - //print '
'; - print ''; // ancre + + if ($action == 'presend') + { + /* + * Affiche formulaire mail + */ - /* - * Documents generes - */ - $filedir=$conf->societe->multidir_output[$object->entity].'/'.$object->id; - $urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id; - $genallowed=$user->rights->societe->creer; - $delallowed=$user->rights->societe->supprimer; + // By default if $action=='presend' + $titreform='SendEMail'; + $topicmail=''; + $action='send'; + $modelmail='thirdparty'; - $var=true; + print '
'; + print_titre($langs->trans($titreform)); - $somethingshown=$formfile->show_documents('company',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang); + // Cree l'objet formulaire mail + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + $formmail->fromtype = 'user'; + $formmail->fromid = $user->id; + $formmail->fromname = $user->getFullName($langs); + $formmail->frommail = $user->email; + $formmail->withfrom=1; + $formmail->withtopic=1; + $liste=array(); + foreach ($object->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; + $formmail->withto=GETPOST('sendto')?GETPOST('sendto'):$liste; + $formmail->withtocc=$liste; + $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; + $formmail->withfile=2; + $formmail->withbody=1; + $formmail->withdeliveryreceipt=1; + $formmail->withcancel=1; + // Tableau des substitutions + $formmail->substit['__SIGNATURE__']=$user->signature; + $formmail->substit['__PERSONALIZED__']=''; + $formmail->substit['__CONTACTCIVNAME__']=''; - print '
'; + //Find the good contact adress + /* + $custcontact=''; + $contactarr=array(); + $contactarr=$object->liste_contact(-1,'external'); + + if (is_array($contactarr) && count($contactarr)>0) + { + foreach($contactarr as $contact) + { + if ($contact['libelle']==$langs->trans('TypeContact_facture_external_BILLING')) { + + require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; + + $contactstatic=new Contact($db); + $contactstatic->fetch($contact['id']); + $custcontact=$contactstatic->getFullName($langs,1); + } + } + + if (!empty($custcontact)) { + $formmail->substit['__CONTACTCIVNAME__']=$custcontact; + } + }*/ - print '
'; + // Tableau des parametres complementaires du post + $formmail->param['action']=$action; + $formmail->param['models']=$modelmail; + $formmail->param['socid']=$object->id; + $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?socid='.$object->id; - print '
'; - } + // Init list of files + if (GETPOST("mode")=='init') + { + $formmail->clear_attached_files(); + $formmail->add_attached_files($file,basename($file),dol_mimetype($file)); + } - print '

'; + $formmail->show_form(); - // Subsidiaries list - $result=show_subsidiaries($conf,$langs,$db,$object); - - // Contacts list - if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) - { - $result=show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); - } - - // Addresses list - if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)) - { - $result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); - } - - // Projects list - $result=show_projects($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); + print '
'; + } + else + { + + if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC)) + { + print '
'; + //print ''; + // if credit note, dont allow to modify margin + if ($line->subprice < 0) + echo ''; + else + echo ''; $coldisplay++; } elseif (! empty($conf->global->DISPLAY_MARK_RATES)) { $mark_rate = (isset($_POST["markRate"])?$_POST["markRate"]:price($line->marque_tx)); - echo ''; + // if credit note, dont allow to modify margin + if ($line->subprice < 0) + echo ''; + else + echo ''; $coldisplay++; } } diff --git a/htdocs/margin/lib/margins.lib.php b/htdocs/margin/lib/margins.lib.php index c5237d219c5..bfa5d530e29 100644 --- a/htdocs/margin/lib/margins.lib.php +++ b/htdocs/margin/lib/margins.lib.php @@ -117,12 +117,18 @@ function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localta // calcul pu_ht remisés $tabprice=calcul_price_total(1, $pvht, $remise_percent, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 'HT', 0, 0); // FIXME Parameter type is missing, i put 0 to avoid blocking error $pu_ht_remise = $tabprice[0]; + // calcul marge + if ($pu_ht_remise < 0) + $marge = -1 * (abs($pu_ht_remise) - $paht_ret); + else + $marge = $pu_ht_remise - $paht_ret; + // calcul taux marge if ($paht_ret != 0) - $marge_tx_ret = round((100 * ($pu_ht_remise - $paht_ret)) / $paht_ret, 3); + $marge_tx_ret = round((100 * $marge) / $paht_ret, 3); // calcul taux marque if ($pu_ht_remise != 0) - $marque_tx_ret = round((100 * ($pu_ht_remise - $paht_ret)) / $pu_ht_remise, 3); + $marque_tx_ret = round((100 * $marge) / $pu_ht_remise, 3); return array($paht_ret, $marge_tx_ret, $marque_tx_ret); } From 3378855694840055eebe8dc7e615d16e1f34a225 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Sep 2013 18:06:07 +0200 Subject: [PATCH 23/37] New: Can cancel holidays that were previously validated --- ChangeLog | 1 + htdocs/exports/export.php | 4 +- htdocs/holiday/class/holiday.class.php | 24 +++-- htdocs/holiday/fiche.php | 130 +++++++++++++++++-------- htdocs/langs/en_US/holiday.lang | 1 + htdocs/langs/fr_FR/holiday.lang | 1 + htdocs/theme/eldy/style.css.php | 1 + 7 files changed, 111 insertions(+), 51 deletions(-) diff --git a/ChangeLog b/ChangeLog index d685811b926..1fe09d88ccf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -57,6 +57,7 @@ For users: - New: [ task #923 ] Localtax support for ODT templates. - New: [ task #90 ] Barcode search. - New: Can send an email from thirdparty card. +- New: Can cancel holidays that were previously validated. For translators: - Qual: Normalized sort order of all languages files with english reference files. diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index c152895c0d7..aefe5490802 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -506,9 +506,9 @@ if ($step == 2 && $datatoexport) print ''; print ''; print ''; print ''; print ''; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index f8e444470c3..dc949344ee6 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -47,7 +47,7 @@ class Holiday extends CommonObject var $date_debut=''; var $date_fin=''; var $halfday=''; - var $statut=''; + var $statut=''; // 1=draft, 2=validated, 3=approved var $fk_validator; var $date_valid=''; var $fk_user_valid; @@ -871,7 +871,7 @@ class Holiday extends CommonObject * * @param int $userID Id of user * @param int $nbHoliday Nb of days - * @return void + * @return int 0=Nothing done, 1=OK, -1=KO */ function updateSoldeCP($userID='',$nbHoliday='') { @@ -907,7 +907,7 @@ class Holiday extends CommonObject $i = 0; - while($i < $nbUser) + while ($i < $nbUser) { $now_holiday = $this->getCPforUser($users[$i]['rowid']); $new_solde = $now_holiday + $this->getConfCP('nbHolidayEveryMonth'); @@ -922,11 +922,18 @@ class Holiday extends CommonObject $sql2.= " nb_holiday = nb_holiday + ".$nb_holiday; dol_syslog(get_class($this).'::updateSoldeCP sql='.$sql2); - $this->db->query($sql2); + $result= $this->db->query($sql2); + + if ($result) return 1; + else return -1; } - } else { + + return 0; + } + else + { // Mise à jour pour un utilisateur - $nbHoliday = number_format($nbHoliday,2,'.',''); + $nbHoliday = price2num($nbHoliday,2); // Mise à jour pour un utilisateur $sql = "UPDATE ".MAIN_DB_PREFIX."holiday_users SET"; @@ -934,7 +941,10 @@ class Holiday extends CommonObject $sql.= " WHERE fk_user = '".$userID."'"; dol_syslog(get_class($this).'::updateSoldeCP sql='.$sql); - $this->db->query($sql); + $result = $this->db->query($sql); + + if ($result) return 1; + else return -1; } } diff --git a/htdocs/holiday/fiche.php b/htdocs/holiday/fiche.php index 8176a80938c..01c2e1fb5a1 100644 --- a/htdocs/holiday/fiche.php +++ b/htdocs/holiday/fiche.php @@ -1,8 +1,8 @@ - * Copyright (C) 2012 Laurent Destailleur - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013 Juanjo Menent +/* Copyright (C) 2011 Dimitri Mouillard + * Copyright (C) 2012-2013 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2013 Juanjo Menent * * 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 @@ -46,9 +46,9 @@ $user_id = $user->id; $now=dol_now(); -/******************************************************************* +/* * Actions -********************************************************************/ + */ // Si création de la demande if ($action == 'create') @@ -232,27 +232,41 @@ if ($action == 'update') } // Si suppression de la demande -if ($action == 'confirm_delete' && $_GET['confirm'] == 'yes') +if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes') { if($user->rights->holiday->delete) { + $error=0; + + $db->begin(); + $cp = new Holiday($db); $cp->fetch($id); // Si c'est bien un brouillon - if ($cp->statut == 1) + if ($cp->statut == 1 || $cp->statut == 3) { // Si l'utilisateur à le droit de lire cette demande, il peut la supprimer if ($user->id == $cp->fk_user || $user->rights->holiday->lire_tous) { - $cp->delete($id); - header('Location: index.php'); - exit; + $result=$cp->delete($id); } - else { + else + { $error = $langs->trans('ErrorCantDeleteCP'); } } + + if (! $error) + { + $db->commit(); + header('Location: index.php'); + exit; + } + else + { + $db->rollback(); + } } } @@ -315,9 +329,9 @@ if ($action == 'confirm_send') } // Si l'option pour avertir le valideur en cas de solde inférieur à la demande - if($cp->getConfCP('AlertValidatorSolde')) + if ($cp->getConfCP('AlertValidatorSolde')) { - $nbopenedday=num_open_day($cp->date_debut,$cp->date_fin,0,1); + $nbopenedday=num_open_day($cp->date_debut,$cp->date_fin,0,1,$cp->halfday); if ($nbopenedday > $cp->getCPforUser($cp->fk_user)) { $message.= "\n"; @@ -361,9 +375,8 @@ if($action == 'confirm_valid') $cp->fetch($id); // Si statut en attente de validation et valideur = utilisateur - if($cp->statut == 2 && $user->id == $cp->fk_validator) + if ($cp->statut == 2 && $user->id == $cp->fk_validator) { - $cp->date_valid = dol_now(); $cp->fk_user_valid = $user->id; $cp->statut = 3; @@ -371,13 +384,13 @@ if($action == 'confirm_valid') $verif = $cp->update($user->id); // Si pas d'erreur SQL on redirige vers la fiche de la demande - if($verif > 0) { - - // Retrait du nombre de jours prit - $nbJour = $nbopenedday=num_open_day($cp->date_debut,$cp->date_fin,0,1); + if ($verif > 0) + { + // Calculcate number of days consummed + $nbopenedday=num_open_day($cp->date_debut,$cp->date_fin,0,1); $soldeActuel = $cp->getCpforUser($cp->fk_user); - $newSolde = $soldeActuel - ($nbJour*$cp->getConfCP('nbHolidayDeducted')); + $newSolde = $soldeActuel - ($nbopenedday * $cp->getConfCP('nbHolidayDeducted')); // On ajoute la modification dans le LOG $cp->addLogCP($user->id, $cp->fk_user, $langs->transnoentitiesnoconv("Holidays"), $newSolde); @@ -441,13 +454,13 @@ if($action == 'confirm_valid') if ($action == 'confirm_refuse') { - if(!empty($_POST['detail_refuse'])) + if (!empty($_POST['detail_refuse'])) { $cp = new Holiday($db); $cp->fetch($_GET['id']); // Si statut en attente de validation et valideur = utilisateur - if($cp->statut == 2 && $user->id == $cp->fk_validator) + if ($cp->statut == 2 && $user->id == $cp->fk_validator) { $cp->date_refuse = date('Y-m-d H:i:s', time()); $cp->fk_user_refuse = $user->id; @@ -457,8 +470,8 @@ if ($action == 'confirm_refuse') $verif = $cp->update($user->id); // Si pas d'erreur SQL on redirige vers la fiche de la demande - if($verif > 0) { - + if ($verif > 0) + { // To $destinataire = new User($db); $destinataire->fetch($cp->fk_user); @@ -525,16 +538,48 @@ if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes') $cp->fetch($_GET['id']); // Si statut en attente de validation et valideur = utilisateur - if ($cp->statut == 2 && ($user->id == $cp->fk_validator || $user->id == $cp->fk_user)) + if (($cp->statut == 2 || $cp->statut == 3) && ($user->id == $cp->fk_validator || $user->id == $cp->fk_user)) { + $db->begin(); + + $oldstatus = $cp->statut; $cp->date_cancel = dol_now(); $cp->fk_user_cancel = $user->id; $cp->statut = 4; - $verif = $cp->update($user->id); + $result = $cp->update($user->id); + if ($result >= 0 && $oldstatus == 3) // holiday was already validated, status 3, so we must increase back sold + { + // Calculcate number of days consummed + $nbopenedday=num_open_day($cp->date_debut,$cp->date_fin,0,1,$cp->halfday); + + $soldeActuel = $cp->getCpforUser($cp->fk_user); + $newSolde = $soldeActuel + ($nbopenedday * $cp->getConfCP('nbHolidayDeducted')); + + // On ajoute la modification dans le LOG + $result1=$cp->addLogCP($user->id, $cp->fk_user, $langs->transnoentitiesnoconv("HolidaysCancelation"), $newSolde); + + // Mise à jour du solde + $result2=$cp->updateSoldeCP($cp->fk_user, $newSolde); + + if ($result1 < 0 || $result2 < 0) + { + $error = $langs->trans('ErrorCantDeleteCP'); + } + } + + if (! $error) + { + $db->commit(); + } + else + { + $db->rollback(); + } + // Si pas d'erreur SQL on redirige vers la fiche de la demande - if($verif > 0) + if (! $error && $result > 0) { // To $destinataire = new User($db); @@ -829,11 +874,11 @@ else if($user->id == $cp->fk_user || $user->rights->holiday->lire_tous) { - if ($action == 'delete' && $cp->statut == 1) { + if ($action == 'delete') + { if($user->rights->holiday->delete) { print $form->formconfirm("fiche.php?id=".$id,$langs->trans("TitleDeleteCP"),$langs->trans("ConfirmDeleteCP"),"confirm_delete", '', 0, 1); - if ($ret == 'html') print '
'; } } @@ -841,29 +886,25 @@ else if ($action == 'sendToValidate' && $cp->statut == 1 && $user->id == $cp->fk_user) { print $form->formconfirm("fiche.php?id=".$id,$langs->trans("TitleToValidCP"),$langs->trans("ConfirmToValidCP"),"confirm_send", '', 1, 1); - if ($ret == 'html') print '
'; } // Si validation de la demande - if ($action == 'valid' && $cp->statut == 2 && $user->id == $cp->fk_validator) + if ($action == 'valid') { print $form->formconfirm("fiche.php?id=".$id,$langs->trans("TitleValidCP"),$langs->trans("ConfirmValidCP"),"confirm_valid", '', 1, 1); - if ($ret == 'html') print '
'; } // Si refus de la demande - if ($action == 'refuse' && $cp->statut == 2 && $user->id == $cp->fk_validator) + if ($action == 'refuse') { $array_input = array(array('type'=>"text",'label'=> $langs->trans('DetailRefusCP'),'name'=>"detail_refuse",'size'=>"50",'value'=>"")); print $form->formconfirm("fiche.php?id=".$id."&action=confirm_refuse", $langs->trans("TitleRefuseCP"), $langs->trans('ConfirmRefuseCP'), "confirm_refuse", $array_input, 1, 0); - if ($ret == 'html') print '
'; } // Si annulation de la demande - if ($action == 'cancel' && $cp->statut == 2 && ($user->id == $cp->fk_validator || $user->id == $cp->fk_user)) + if ($action == 'cancel') { print $form->formconfirm("fiche.php?id=".$id,$langs->trans("TitleCancelCP"),$langs->trans("ConfirmCancelCP"),"confirm_cancel", '', 1, 1); - if ($ret == 'html') print '
'; } $head=holiday_prepare_head($cp); @@ -893,7 +934,8 @@ else $starthalfday=($cp->halfday == -1 || $cp->halfday == 2)?'afternoon':'morning'; $endhalfday=($cp->halfday == 1 || $cp->halfday == 2)?'morning':'afternoon'; - if(!$edit) { + if(!$edit) + { print '
'; print ''; print ''; print ''; - } else { + } + else + { print ''; print ''; print ''; print ''; - } else { + } + else + { print ''; print ''; print '\n"; print '
'; + print ''; // ancre + + /* + * Documents generes + */ + $filedir=$conf->societe->multidir_output[$object->entity].'/'.$object->id; + $urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id; + $genallowed=$user->rights->societe->creer; + $delallowed=$user->rights->societe->supprimer; + + $var=true; + + $somethingshown=$formfile->show_documents('company',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang); + + print '
'; + + + print '
'; + + print '
'; + } + + print '

'; + + // Subsidiaries list + $result=show_subsidiaries($conf,$langs,$db,$object); + + // Contacts list + if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) + { + $result=show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); + } + + // Addresses list + if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)) + { + $result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); + } + + // Projects list + $result=show_projects($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); + } } } From 3fde695c94c67d870a87891e69f4c10fefd3a5ca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Sep 2013 13:22:28 +0200 Subject: [PATCH 11/37] Qual: Uniformise name of include files we use to share common code found into Actions area of pages (controllers). --- htdocs/adherents/admin/adherent_extrafields.php | 2 +- htdocs/adherents/admin/adherent_type_extrafields.php | 2 +- htdocs/admin/agenda_extrafields.php | 2 +- htdocs/admin/order_extrafields.php | 2 +- htdocs/admin/orderdet_extrafields.php | 2 +- htdocs/admin/supplierinvoice_extrafields.php | 2 +- htdocs/admin/supplierorder_extrafields.php | 2 +- htdocs/comm/admin/propal_extrafields.php | 2 +- htdocs/comm/admin/propaldet_extrafields.php | 2 +- htdocs/compta/facture/admin/facture_cust_extrafields.php | 2 +- htdocs/compta/facture/admin/facturedet_cust_extrafields.php | 2 +- htdocs/contrat/admin/contract_extrafields.php | 2 +- .../{admin_extrafields.inc.php => actions_extrafields.inc.php} | 2 +- htdocs/fichinter/admin/fichinter_extrafields.php | 2 +- htdocs/product/admin/product_extrafields.php | 2 +- htdocs/projet/admin/project_extrafields.php | 2 +- htdocs/projet/admin/project_task_extrafields.php | 2 +- htdocs/societe/admin/contact_extrafields.php | 2 +- htdocs/societe/admin/societe_extrafields.php | 2 +- htdocs/user/admin/user_extrafields.php | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) rename htdocs/core/{admin_extrafields.inc.php => actions_extrafields.inc.php} (99%) diff --git a/htdocs/adherents/admin/adherent_extrafields.php b/htdocs/adherents/admin/adherent_extrafields.php index 34420ee0121..25139697955 100644 --- a/htdocs/adherents/admin/adherent_extrafields.php +++ b/htdocs/adherents/admin/adherent_extrafields.php @@ -50,7 +50,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/adherents/admin/adherent_type_extrafields.php b/htdocs/adherents/admin/adherent_type_extrafields.php index ce2787752a7..5fdd9ff2a39 100644 --- a/htdocs/adherents/admin/adherent_type_extrafields.php +++ b/htdocs/adherents/admin/adherent_type_extrafields.php @@ -51,7 +51,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/admin/agenda_extrafields.php b/htdocs/admin/agenda_extrafields.php index a7763893bb5..64f793cc761 100644 --- a/htdocs/admin/agenda_extrafields.php +++ b/htdocs/admin/agenda_extrafields.php @@ -56,7 +56,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/admin/order_extrafields.php b/htdocs/admin/order_extrafields.php index 7e748cdbc4a..88e3705c4e7 100644 --- a/htdocs/admin/order_extrafields.php +++ b/htdocs/admin/order_extrafields.php @@ -57,7 +57,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/admin/orderdet_extrafields.php b/htdocs/admin/orderdet_extrafields.php index 64eeb2f4b52..23e6166d1a4 100644 --- a/htdocs/admin/orderdet_extrafields.php +++ b/htdocs/admin/orderdet_extrafields.php @@ -58,7 +58,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/admin/supplierinvoice_extrafields.php b/htdocs/admin/supplierinvoice_extrafields.php index 8f9865981f5..02bedad307d 100644 --- a/htdocs/admin/supplierinvoice_extrafields.php +++ b/htdocs/admin/supplierinvoice_extrafields.php @@ -58,7 +58,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/admin/supplierorder_extrafields.php b/htdocs/admin/supplierorder_extrafields.php index 9aa7770f820..fea9656f146 100644 --- a/htdocs/admin/supplierorder_extrafields.php +++ b/htdocs/admin/supplierorder_extrafields.php @@ -57,7 +57,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/comm/admin/propal_extrafields.php b/htdocs/comm/admin/propal_extrafields.php index 28534e08140..75e994d281a 100644 --- a/htdocs/comm/admin/propal_extrafields.php +++ b/htdocs/comm/admin/propal_extrafields.php @@ -51,7 +51,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/comm/admin/propaldet_extrafields.php b/htdocs/comm/admin/propaldet_extrafields.php index 79509cc6593..f4a5226e1f0 100644 --- a/htdocs/comm/admin/propaldet_extrafields.php +++ b/htdocs/comm/admin/propaldet_extrafields.php @@ -59,7 +59,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/compta/facture/admin/facture_cust_extrafields.php b/htdocs/compta/facture/admin/facture_cust_extrafields.php index 8d6fb63cf80..a44d67d87a9 100644 --- a/htdocs/compta/facture/admin/facture_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facture_cust_extrafields.php @@ -52,7 +52,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/compta/facture/admin/facturedet_cust_extrafields.php b/htdocs/compta/facture/admin/facturedet_cust_extrafields.php index 6ec01f0ed6d..a0c560d52cb 100644 --- a/htdocs/compta/facture/admin/facturedet_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facturedet_cust_extrafields.php @@ -53,7 +53,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/contrat/admin/contract_extrafields.php b/htdocs/contrat/admin/contract_extrafields.php index 22b07448462..c50872beee4 100644 --- a/htdocs/contrat/admin/contract_extrafields.php +++ b/htdocs/contrat/admin/contract_extrafields.php @@ -54,7 +54,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/core/admin_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php similarity index 99% rename from htdocs/core/admin_extrafields.inc.php rename to htdocs/core/actions_extrafields.inc.php index d95e1e5394d..4861ee6b856 100644 --- a/htdocs/core/admin_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/core/admin_extrafields.inc.php + * \file htdocs/core/actions_extrafields.inc.php * \brief Code for actions on extrafields admin pages */ diff --git a/htdocs/fichinter/admin/fichinter_extrafields.php b/htdocs/fichinter/admin/fichinter_extrafields.php index c094e97666a..f503e9a184e 100644 --- a/htdocs/fichinter/admin/fichinter_extrafields.php +++ b/htdocs/fichinter/admin/fichinter_extrafields.php @@ -53,7 +53,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/product/admin/product_extrafields.php b/htdocs/product/admin/product_extrafields.php index 98b85746051..3f4ff84655e 100644 --- a/htdocs/product/admin/product_extrafields.php +++ b/htdocs/product/admin/product_extrafields.php @@ -52,7 +52,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/projet/admin/project_extrafields.php b/htdocs/projet/admin/project_extrafields.php index a23da939757..8f4b6a6ce36 100644 --- a/htdocs/projet/admin/project_extrafields.php +++ b/htdocs/projet/admin/project_extrafields.php @@ -51,7 +51,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/projet/admin/project_task_extrafields.php b/htdocs/projet/admin/project_task_extrafields.php index f212c1acfd4..782ae78d787 100644 --- a/htdocs/projet/admin/project_task_extrafields.php +++ b/htdocs/projet/admin/project_task_extrafields.php @@ -51,7 +51,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/societe/admin/contact_extrafields.php b/htdocs/societe/admin/contact_extrafields.php index 36adc4f38b2..6cb54ee1449 100644 --- a/htdocs/societe/admin/contact_extrafields.php +++ b/htdocs/societe/admin/contact_extrafields.php @@ -50,7 +50,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/societe/admin/societe_extrafields.php b/htdocs/societe/admin/societe_extrafields.php index 15ccdac8ef7..11a284dabef 100644 --- a/htdocs/societe/admin/societe_extrafields.php +++ b/htdocs/societe/admin/societe_extrafields.php @@ -51,7 +51,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/user/admin/user_extrafields.php b/htdocs/user/admin/user_extrafields.php index 83878126858..ce372d25d4b 100644 --- a/htdocs/user/admin/user_extrafields.php +++ b/htdocs/user/admin/user_extrafields.php @@ -50,7 +50,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; From 9189bdfa01c23330f9d0f2f30d376d4daba38df3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Sep 2013 13:28:26 +0200 Subject: [PATCH 12/37] Fix: bad translation --- htdocs/societe/soc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index bdd86576cc7..31ab62639f1 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1804,7 +1804,7 @@ else */ // By default if $action=='presend' - $titreform='SendEMail'; + $titreform='SendMail'; $topicmail=''; $action='send'; $modelmail='thirdparty'; From 6b2966794a1821edb332d036bd42808c8fb672c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Sep 2013 14:35:22 +0200 Subject: [PATCH 13/37] Do not show free text for thirdparty email send form --- htdocs/core/class/html.formmail.class.php | 4 ++-- htdocs/societe/soc.php | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 159f85218de..e5dc008fc2e 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -46,8 +46,8 @@ class FormMail var $withsubstit; // Show substitution array var $withfrom; - var $withto; - var $withtofree; + var $withto; // Show recipient emails + var $withtofree; // Show free text for recipient emails var $withtocc; var $withtoccc; var $withtopic; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 31ab62639f1..837cb98d579 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -450,10 +450,13 @@ if (empty($reshook)) $result = $object->set_parent(GETPOST('editparentcompany','int')); } + + // Actions to send emails $id=$socid; $actiontypecode='AC_OTH_AUTO'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; + /* * Generate document */ @@ -1824,6 +1827,7 @@ else $liste=array(); foreach ($object->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; $formmail->withto=GETPOST('sendto')?GETPOST('sendto'):$liste; + $formmail->withtofree=0; $formmail->withtocc=$liste; $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; $formmail->withfile=2; From 890c96355ded604a97e3a74920abd79d1c85a09e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Sep 2013 19:53:21 +0200 Subject: [PATCH 14/37] Check parameter to make bug detection seasier --- htdocs/core/lib/security.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index e19ed1eb7fa..58bd4371b4c 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -215,7 +215,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature { foreach($feature2 as $subfeature) { - if (empty($user->rights->$feature->$subfeature->creer) + if (empty($user->rights->$feature->$subfeature->creer) && empty($user->rights->$feature->$subfeature->write) && empty($user->rights->$feature->$subfeature->create)) $createok=0; else { $createok=1; break; } // For bypass the second test if the first is ok @@ -411,7 +411,8 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature // If external user: Check permission for external users if ($user->societe_id > 0) { - $sql = "SELECT dbt.".$dbt_keyfield; + if (empty($dbt_keyfield)) dol_print_error('','Param dbt_keyfield is required but not defined'); + $sql = "SELECT dbt.".$dbt_keyfield; $sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql.= " WHERE dbt.rowid = ".$objectid; $sql.= " AND dbt.".$dbt_keyfield." = ".$user->societe_id; @@ -419,6 +420,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature // If internal user: Check permission for internal users that are restricted on their objects else if (! empty($conf->societe->enabled) && ($user->rights->societe->lire && ! $user->rights->societe->client->voir)) { + if (empty($dbt_keyfield)) dol_print_error('','Param dbt_keyfield is required but not defined'); $sql = "SELECT sc.fk_soc"; $sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; From 94f28a93de60eeaaa2d590105ec7f62732b52658 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Sep 2013 19:53:55 +0200 Subject: [PATCH 15/37] Fix: Bad parameters --- htdocs/comm/action/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 81723b8283d..a1915d29540 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -56,7 +56,7 @@ $contactid=GETPOST('contactid','int'); $socid = GETPOST('socid','int'); $id = GETPOST('id','int'); if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', '', 'id'); +$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', 'fk_soc', 'id'); if ($user->societe_id && $socid) $result = restrictedArea($user,'societe',$socid); $error=GETPOST("error"); From bdafcb680f869deadcec9ea1d43407a47e612204 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Sep 2013 21:07:13 +0200 Subject: [PATCH 16/37] Fix: Bad parameters Conflicts: htdocs/comm/action/fiche.php --- htdocs/comm/action/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index a813a34135a..0101042fd74 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -53,7 +53,7 @@ $contactid=GETPOST('contactid','int'); $socid = GETPOST('socid','int'); $id = GETPOST('id','int'); if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', '', 'id'); +$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', 'fk_soc', 'id'); $error=GETPOST("error"); $mesg=''; From 06f36fbfabb44992e8187efa8a2e84bc4d1f3443 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Sep 2013 10:59:15 +0200 Subject: [PATCH 17/37] Fix: Bad permission check --- htdocs/core/boxes/box_members.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index fdb6db8c7f5..f14e70cc38d 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -79,7 +79,7 @@ class box_members extends ModeleBoxes $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedMembers",$max)); - if ($user->rights->societe->lire) + if ($user->rights->adherent->lire) { $sql = "SELECT a.rowid, a.lastname, a.firstname, a.societe as company, a.fk_soc,"; $sql.= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,"; From a674af5bcd071b8f8e2c1b4d9a024478ebb31c37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Sep 2013 11:11:59 +0200 Subject: [PATCH 18/37] Fix: Permission check on event tabs --- htdocs/comm/action/contact.php | 11 ++++++----- htdocs/comm/action/document.php | 6 +++--- htdocs/comm/action/info.php | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/action/contact.php b/htdocs/comm/action/contact.php index 87a13f28c55..619b6cf6b09 100644 --- a/htdocs/comm/action/contact.php +++ b/htdocs/comm/action/contact.php @@ -43,23 +43,24 @@ $confirm = GETPOST('confirm'); $lineid = GETPOST('lineid','int'); // Security check +$socid = GETPOST('socid','int'); +if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id > 0) { unset($_GET["action"]); $action=''; - $socid = $user->societe_id; } +$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions&allactions', 'fk_soc', 'id'); + $object = new ActionComm($db); + /* * Actions */ -/* - * Ajout d'un nouveau contact - */ - +// Add new nouveau contact if ($action == 'addcontact') { $result = $object->fetch($id); diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 7ad74302655..ea5c7c4735b 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -44,14 +44,14 @@ $objectid = GETPOST('id','int'); $action=GETPOST('action','alpha'); // Security check +$socid = GETPOST('socid','int'); +if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id > 0) { unset($_GET["action"]); $action=''; - $socid = $user->societe_id; } - -$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions&allactions', '', 'id'); +$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions&allactions', 'fk_soc', 'id'); $act = new ActionComm($db); diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index 66dc178d4b8..de41dc04483 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -40,7 +40,7 @@ if ($user->societe_id > 0) $socid = $user->societe_id; } -$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', '', 'id'); +$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', 'fk_soc', 'id'); /* From d978d64d5906116d957af65dad64e0c0149f319d Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Tue, 24 Sep 2013 14:19:52 +0200 Subject: [PATCH 19/37] Update commonobject.class.php just the active type of contact --- htdocs/core/class/commonobject.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 6d89e18c77d..c2a8a052df1 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -461,6 +461,7 @@ abstract class CommonObject $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql.= " WHERE tc.element='".$this->element."'"; + $sql.= " AND tc.active=1"; // only the active type if (! empty($source)) $sql.= " AND tc.source='".$source."'"; $sql.= " ORDER by tc.".$order; From af06f53eafc7c1a14ba9ec0aa3683bcc21aecb35 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 24 Sep 2013 15:56:27 +0200 Subject: [PATCH 20/37] clean changelog --- ChangeLog | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2bebd7a45f1..3bbd3412f22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -53,19 +53,6 @@ For users: - New : User permissions on margin module - New : Add ref supplier into muscadet model - New : Add ability to copy contact address to clipboard -======= -- New: [ task #1005 ] Adapting to Spanish legislation bill numbering. -- New: [ task #1011 ] Now supplier order and invoice deal with payment terms and mode. -- New: [ task #1014 ] Add option to recursivly add parent category. -- New: [ task #1016 ] Can define a specific numbering for deposits. -- New: [ task #918 ] Stock replenishment. -- Fix: [ bug #992 ] Proforma invoices don't have a separated numeric count. -- New: Add pdf link into supplier invoice list and supplier order list. -- New: Genrate auto the PDF for supplier invoice. -- New: Add category into filter webservice thirdparty method getListOfThirdParties. -- New: Allow to define margin or mark rate during quoting, ordering, invoicing. -- New: User permissions on margin module. -- New: Add ref supplier into muscadet model. - New: Can use tag {mm} before {yy} even when there is a reset into numbering masks. - New: [ task #1060 ] Register fields localtax(1|2)_type into details tables. - New: [ task #923 ] Localtax support for ODT templates. From f13b9cec29d983d61b6af020993ad2e799db0ac4 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 24 Sep 2013 15:59:30 +0200 Subject: [PATCH 21/37] escape dialog title --- htdocs/core/lib/company.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 2e1f0a8f1c0..5d57abe119c 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -692,7 +692,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print "
\n"; ?> -
%'.$margin_rate.'%%%'.$mark_rate.'%%'.$langs->trans("Entities").''.$langs->trans("ExportableFields").''; - print ''.$langs->trans("All").""; + print ''.$langs->trans("All").""; print '/'; - print ''.$langs->trans("None").""; + print ''.$langs->trans("None").""; print ''.$langs->trans("ExportedFields").'
'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')'.dol_print_date($cp->date_debut,'day'); @@ -901,7 +943,9 @@ else print $langs->trans($listhalfday[$starthalfday]); print '
'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')'; @@ -921,7 +965,9 @@ else print $langs->trans($listhalfday[$endhalfday]); print '
'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')'; @@ -1053,7 +1099,7 @@ else { print ''.$langs->trans("Validate").''; } - if($user->rights->holiday->delete && $cp->statut == 1) + if ($user->rights->holiday->delete && $cp->statut == 1) // If draft { print ''.$langs->trans("DeleteCP").''; } @@ -1064,7 +1110,7 @@ else print ''.$langs->trans("ActionRefuseCP").''; } - if (($user->id == $cp->fk_validator || $user->id == $cp->fk_user) && $cp->statut == 2) + if (($user->id == $cp->fk_validator || $user->id == $cp->fk_user) && ($cp->statut == 2 || $cp->statut == 3)) // Status validated or approved { if (($cp->date_debut > dol_now()) || $user->admin) print ''.$langs->trans("ActionCancelCP").''; else print ''.$langs->trans("ActionCancelCP").''; diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 73398da233b..83f06495ffb 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -89,6 +89,7 @@ FirstDayOfHoliday=First day of holiday LastDayOfHoliday=Last day of holiday HolidaysMonthlyUpdate=Monthly update ManualUpdate=Manual update +HolidaysCancelation=Holidays cancelation ## Configuration du Module ## ConfCP=Configuration of holidays module diff --git a/htdocs/langs/fr_FR/holiday.lang b/htdocs/langs/fr_FR/holiday.lang index f690a9c764c..b6569ee5f4d 100644 --- a/htdocs/langs/fr_FR/holiday.lang +++ b/htdocs/langs/fr_FR/holiday.lang @@ -89,6 +89,7 @@ FirstDayOfHoliday=Premier jour de congés LastDayOfHoliday=Dernier jour de congés HolidaysMonthlyUpdate=Mise à jour mensuelle ManualUpdate=Mise à jour manuelle +HolidaysCancelation=Annulation de congès ## Configuration du Module ## ConfCP=Configuration du module Congés diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index c01d2995db5..1af76aed9b5 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1759,6 +1759,7 @@ tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste } .liste_titre td a { text-shadow: none !important; + color: #; } div.liste_titre { padding-left: 3px; From a3e74afb02b4b4fefdeeea891435e98b09a109c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Sep 2013 20:14:42 +0200 Subject: [PATCH 24/37] Fix: varchar 256 --- htdocs/install/mysql/migration/3.3.0-3.4.0.sql | 4 ++-- htdocs/install/mysql/tables/llx_c_shipment_mode.sql | 2 +- htdocs/install/mysql/tables/llx_printer_ipp.sql | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index 6d3ace638d0..6bae41c0799 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -102,7 +102,7 @@ ALTER TABLE llx_expedition DROP FOREIGN KEY fk_expedition_fk_shipping_method; ALTER TABLE llx_expedition DROP INDEX idx_expedition_fk_expedition_methode; ALTER TABLE llx_expedition CHANGE COLUMN fk_expedition_methode fk_shipping_method integer; -ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(256) NOT NULL DEFAULT '' AFTER description; +ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(255) NOT NULL DEFAULT '' AFTER description; --ALTER TABLE llx_c_shipment_mode DROP COLUMN CASCADE; --ALTER TABLE llx_c_shipment_mode ADD COLUMN rowid INTEGER AUTO_INCREMENT PRIMARY KEY; @@ -249,7 +249,7 @@ CREATE TABLE llx_printer_ipp datec datetime, printer_name text NOT NULL, printer_location text NOT NULL, - printer_uri varchar(256) NOT NULL, + printer_uri varchar(255) NOT NULL, copy integer NOT NULL DEFAULT '1', module varchar(16) NOT NULL, login varchar(32) NOT NULL diff --git a/htdocs/install/mysql/tables/llx_c_shipment_mode.sql b/htdocs/install/mysql/tables/llx_c_shipment_mode.sql index 37d2d5f85c1..b94936c7461 100644 --- a/htdocs/install/mysql/tables/llx_c_shipment_mode.sql +++ b/htdocs/install/mysql/tables/llx_c_shipment_mode.sql @@ -23,7 +23,7 @@ create table llx_c_shipment_mode code varchar(30) NOT NULL, libelle varchar(50) NOT NULL, description text, - tracking varchar(256) NOT NULL, + tracking varchar(255) NOT NULL, active tinyint DEFAULT 0, module varchar(32) NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_printer_ipp.sql b/htdocs/install/mysql/tables/llx_printer_ipp.sql index 19aa1c4d127..a19e05587d6 100644 --- a/htdocs/install/mysql/tables/llx_printer_ipp.sql +++ b/htdocs/install/mysql/tables/llx_printer_ipp.sql @@ -23,7 +23,7 @@ CREATE TABLE llx_printer_ipp datec datetime, printer_name text NOT NULL, printer_location text NOT NULL, - printer_uri varchar(256) NOT NULL, + printer_uri varchar(255) NOT NULL, copy integer NOT NULL DEFAULT '1', module varchar(16) NOT NULL, login varchar(32) NOT NULL From b400803a2a3fbe8d9e88b244df9251a7e450ec53 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Wed, 25 Sep 2013 10:15:32 +0200 Subject: [PATCH 25/37] Update commonobject.class.php add complementary param --- htdocs/core/class/commonobject.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c2a8a052df1..7eae4f9faed 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -453,7 +453,7 @@ abstract class CommonObject * @param string $option 0=Return array id->label, 1=Return array code->label * @return array Array list of type of contacts (id->label if option=0, code->label if option=1) */ - function liste_type_contact($source='internal', $order='code', $option=0) + function liste_type_contact($source='internal', $order='code', $option=0, $activeonly=0) { global $langs; @@ -461,7 +461,9 @@ abstract class CommonObject $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql.= " WHERE tc.element='".$this->element."'"; - $sql.= " AND tc.active=1"; // only the active type + if ($activeonly == 1) + $sql.= " AND tc.active=1"; // only the active type + if (! empty($source)) $sql.= " AND tc.source='".$source."'"; $sql.= " ORDER by tc.".$order; From f88470d3b8f96633e05c8b7ed19ea5432ff44ece Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Wed, 25 Sep 2013 10:17:27 +0200 Subject: [PATCH 26/37] Update html.formcompany.class.php use paramter to select only active type of contact --- htdocs/core/class/html.formcompany.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 97a0c9e9f26..a6210be79c6 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -627,7 +627,7 @@ class FormCompany { if (is_object($object) && method_exists($object, 'liste_type_contact')) { - $lesTypes = $object->liste_type_contact($source, $order); + $lesTypes = $object->liste_type_contact($source, $order, 0, 1); print '
'.$module->nom."'; @@ -276,8 +276,8 @@ foreach ($dirmodels as $reldir) // Show example of numbering module print ''; $tmp=$module->getExample(); - if (preg_match('/^Error/',$tmp)) { - $langs->load("errors"); print '
'.$langs->trans($tmp).'
'; + if (preg_match('/^Error/',$tmp)) { + $langs->load("errors"); print '
'.$langs->trans($tmp).'
'; } elseif ($tmp=='NotConfigured') print $langs->trans($tmp); else print $tmp; diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 96e84af3d58..56602508777 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -192,7 +192,7 @@ $h++; if (! empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) { $head[$h][0] = DOL_URL_ROOT."/admin/expedition.php"; - $head[$h][1] = $langs->trans("Sending"); + $head[$h][1] = $langs->trans("Shipment"); $h++; } @@ -207,7 +207,7 @@ dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup")); /* * Livraison numbering model */ - + print_titre($langs->trans("DeliveryOrderNumberingModules")); print ''; @@ -240,13 +240,13 @@ foreach ($dirmodels as $reldir) require_once $dir.$file.'.php'; $module = new $file; - + if ($module->isEnabled()) { // Show modules according to features level if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; - + $var=!$var; print '
'.$module->nom."\n"; print $module->info(); @@ -255,8 +255,8 @@ foreach ($dirmodels as $reldir) // Show example of numbering module print ''; $tmp=$module->getExample(); - if (preg_match('/^Error/',$tmp)) { - $langs->load("errors"); print '
'.$langs->trans($tmp).'
'; + if (preg_match('/^Error/',$tmp)) { + $langs->load("errors"); print '
'.$langs->trans($tmp).'
'; } elseif ($tmp=='NotConfigured') print $langs->trans($tmp); else print $tmp; @@ -315,7 +315,7 @@ print '
'; print '
'; print_titre($langs->trans("DeliveryOrderModel")); -// Defini tableau def de modele +// Defini tableau def de modele $type="delivery"; $def = array(); diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 25fa766aa3d..216887139d4 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -52,7 +52,7 @@ function commande_prepare_head($object) || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire)) { $head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id; - if ($conf->expedition_bon->enabled) $text=$langs->trans("Sendings"); + if ($conf->expedition_bon->enabled) $text=$langs->trans("Shipment"); if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text.='/'; if ($conf->livraison_bon->enabled) $text.=$langs->trans("Receivings"); $head[$h][1] = $text; @@ -93,7 +93,7 @@ function commande_prepare_head($object) $head[$h][2] = 'note'; $h++; } - + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir,'files')); @@ -137,7 +137,7 @@ function order_admin_prepare_head($object) $head[$h][1] = $langs->trans("ExtraFields"); $head[$h][2] = 'attributes'; $h++; - + $head[$h][0] = DOL_URL_ROOT.'/admin/orderdet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][2] = 'attributeslines'; diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index 34ab3bb5355..435567bebae 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -48,7 +48,7 @@ function propal_prepare_head($object) { $langs->load("sendings"); $head[$h][0] = DOL_URL_ROOT.'/expedition/propal.php?id='.$object->id; - if ($conf->expedition_bon->enabled) $text=$langs->trans("Sendings"); + if ($conf->expedition_bon->enabled) $text=$langs->trans("Shipment"); if ($conf->livraison_bon->enabled) $text.='/'.$langs->trans("Receivings"); $head[$h][1] = $text; $head[$h][2] = 'shipping'; @@ -135,7 +135,7 @@ function propal_admin_prepare_head($object) $head[$h][1] = $langs->trans("ExtraFields"); $head[$h][2] = 'attributes'; $h++; - + $head[$h][0] = DOL_URL_ROOT.'/comm/admin/propaldet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][2] = 'attributeslines'; diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 614ccbcc0c1..dc189262bb2 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -172,10 +172,10 @@ class pdf_merou extends ModelePdfExpedition if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); - $pdf->SetSubject($outputlangs->transnoentities("Sending")); + $pdf->SetSubject($outputlangs->transnoentities("Shipment")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Sending")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Shipment")); if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index a541b7b2b1e..4394c3200f5 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -157,10 +157,10 @@ class pdf_rouget extends ModelePdfExpedition if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); - $pdf->SetSubject($outputlangs->transnoentities("Sending")); + $pdf->SetSubject($outputlangs->transnoentities("Shipment")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Sending")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Shipment")); if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right diff --git a/htdocs/core/modules/expedition/mod_expedition_ribera.php b/htdocs/core/modules/expedition/mod_expedition_ribera.php index ddbc494622c..f40d3d361a0 100644 --- a/htdocs/core/modules/expedition/mod_expedition_ribera.php +++ b/htdocs/core/modules/expedition/mod_expedition_ribera.php @@ -53,10 +53,10 @@ class mod_expedition_ribera extends ModelNumRefExpedition $texte.= ''; $texte.= ''; - $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Sending"),$langs->transnoentities("Sending")); + $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Shipment"),$langs->transnoentities("Shipment")); $tooltip.=$langs->trans("GenericMaskCodes2"); $tooltip.=$langs->trans("GenericMaskCodes3"); - $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Sending"),$langs->transnoentities("Sending")); + $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Shipment"),$langs->transnoentities("Shipment")); $tooltip.=$langs->trans("GenericMaskCodes5"); $texte.= ''; diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index bd396f0e8f5..ef5faa79e3b 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -153,7 +153,7 @@ if ($id > 0 || ! empty($ref)) $langs->trans("OrderCard"); $head = shipping_prepare_head($object); - dol_fiche_head($head, 'contact', $langs->trans("Sending"), 0, 'sending'); + dol_fiche_head($head, 'contact', $langs->trans("Shipment"), 0, 'sending'); /* diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index f0d6e5fd8bd..000bd9a5b81 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -87,7 +87,7 @@ if ($id > 0 || ! empty($ref)) if ($action == 'add') { $error=0; - + $object = new Expedition($db); $db->begin(); @@ -517,7 +517,7 @@ else if ($action == 'classifybilled') * View */ -llxHeader('',$langs->trans('Sending'),'Expedition'); +llxHeader('',$langs->trans('Shipment'),'Expedition'); $form = new Form($db); $formfile = new FormFile($db); @@ -916,7 +916,7 @@ else $soc->fetch($object->socid); $head=shipping_prepare_head($object); - dol_fiche_head($head, 'shipping', $langs->trans("Sending"), 0, 'sending'); + dol_fiche_head($head, 'shipping', $langs->trans("Shipment"), 0, 'sending'); dol_htmloutput_mesg($mesg); @@ -926,7 +926,7 @@ else if ($action == 'delete') { print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('DeleteSending'),$langs->trans("ConfirmDeleteSending",$object->ref),'confirm_delete','',0,1); - + } /* @@ -955,7 +955,7 @@ else } print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('ValidateSending'),$text,'confirm_valid','',0,1); - + } /* * Confirmation de l'annulation @@ -963,7 +963,7 @@ else if ($action == 'annuler') { print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('CancelSending'),$langs->trans("ConfirmCancelSending",$object->ref),'confirm_cancel','',0,1); - + } // Calculate true totalWeight and totalVolume for all products diff --git a/htdocs/expedition/index.php b/htdocs/expedition/index.php index 94dd06c5b73..33082aa9193 100644 --- a/htdocs/expedition/index.php +++ b/htdocs/expedition/index.php @@ -39,7 +39,7 @@ $companystatic=new Societe($db); $shipment=new Expedition($db); $helpurl='EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones'; -llxHeader('',$langs->trans("Sendings"),$helpurl); +llxHeader('',$langs->trans("Shipment"),$helpurl); print_fiche_titre($langs->trans("SendingsArea")); diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index 2fcd18fef13..d0300dad278 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -88,7 +88,7 @@ if ($id > 0 || ! empty($ref)) $soc->fetch($object->socid); $head=shipping_prepare_head($object); - dol_fiche_head($head, 'note', $langs->trans("Sending"), 0, 'sending'); + dol_fiche_head($head, 'note', $langs->trans("Shipment"), 0, 'sending'); print '
'.$langs->trans("Mask").':
'; diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 661883a3f12..2ef1b49e152 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -56,8 +56,6 @@ DraftOrWaitingShipped=Draft or validated not yet shipped MenuOrdersToBill=Orders delivered MenuOrdersToBill2=Orders to bill SearchOrder=Search order -Sending=Sending -Sendings=Sendings ShipProduct=Ship product Discount=Discount CreateOrder=Create Order diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index 2b7c7f98140..609066453ab 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -3,6 +3,7 @@ CHARSET=UTF-8 RefSending=Ref. shipment Sending=Shipment Sendings=Shipments +Shipment=Shipment Shipments=Shipments Receivings=Receivings SendingsArea=Shipments area diff --git a/htdocs/langs/fr_FR/orders.lang b/htdocs/langs/fr_FR/orders.lang index 79796a0a907..644075e9a6b 100644 --- a/htdocs/langs/fr_FR/orders.lang +++ b/htdocs/langs/fr_FR/orders.lang @@ -56,8 +56,6 @@ DraftOrWaitingShipped=Brouillon ou validée pas encore expédiée MenuOrdersToBill=Commandes délivrées MenuOrdersToBill2=Commandes à facturer SearchOrder=Rechercher une commande -Sending=Expédition -Sendings=Expéditions ShipProduct=Expédier produit Discount=Remise CreateOrder=Créer Commande diff --git a/htdocs/langs/fr_FR/sendings.lang b/htdocs/langs/fr_FR/sendings.lang index a4ddaafef01..3d8088624c6 100644 --- a/htdocs/langs/fr_FR/sendings.lang +++ b/htdocs/langs/fr_FR/sendings.lang @@ -3,6 +3,7 @@ CHARSET=UTF-8 RefSending=Réf. expédition Sending=Expédition Sendings=Expéditions +Shipment=Expédition Shipments=Expéditions Receivings=Réceptions SendingsArea=Espace expéditions diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php index 44c0bc91166..9fdb13ffe40 100644 --- a/htdocs/livraison/fiche.php +++ b/htdocs/livraison/fiche.php @@ -479,7 +479,7 @@ else $soc->fetch($delivery->socid); $head=delivery_prepare_head($delivery); - dol_fiche_head($head, 'delivery', $langs->trans("Sending"), 0, 'sending'); + dol_fiche_head($head, 'delivery', $langs->trans("Shipment"), 0, 'sending'); /* * Confirmation de la suppression @@ -489,7 +489,7 @@ else { $expedition_id = $_GET["expid"]; print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$delivery->id.'&expid='.$expedition_id,$langs->trans("DeleteDeliveryReceipt"),$langs->trans("DeleteDeliveryReceiptConfirm",$delivery->ref),'confirm_delete','','',1); - + } /* @@ -499,7 +499,7 @@ else if ($action == 'valid') { print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$delivery->id,$langs->trans("ValidateDeliveryReceipt"),$langs->trans("ValidateDeliveryReceiptConfirm",$delivery->ref),'confirm_valid','','',1); - + } From 065c87d81cb9cae0edb82d277636d9cdd861db17 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Sep 2013 19:58:22 +0200 Subject: [PATCH 31/37] Qual: uniformize code: property ->tel on objects is now ->phone everywhere --- ChangeLog | 2 ++ htdocs/adherents/class/adherent.class.php | 2 +- htdocs/categories/categorie.php | 6 +++--- htdocs/comm/action/document.php | 2 +- htdocs/comm/action/fiche.php | 2 +- htdocs/comm/fiche.php | 2 +- htdocs/contact/fiche.php | 14 +++++++------- htdocs/contact/vcard.php | 2 +- htdocs/core/lib/pdf.lib.php | 12 ++++++------ htdocs/fourn/fiche.php | 2 +- htdocs/public/paypal/newpayment.php | 8 ++++---- htdocs/societe/agenda.php | 2 +- .../societe/canvas/actions_card_common.class.php | 6 +++--- htdocs/societe/class/societe.class.php | 8 +------- htdocs/societe/commerciaux.php | 2 +- htdocs/societe/localtaxes.php | 2 +- htdocs/webservices/server_thirdparty.php | 2 +- 17 files changed, 36 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index d5a0533b2de..b10bbf34439 100644 --- a/ChangeLog +++ b/ChangeLog @@ -112,6 +112,8 @@ parameter. All methods addline in this case were modified to remove this paramet 4) Method ->classer_facturee() is deprecated. It must be replace with ->classifyBilled(). +5) Property ->tel on objects is now ->phone + ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 2dae974d9c1..255eb1533d9 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -564,7 +564,7 @@ class Adherent extends CommonObject $lthirdparty->zip=$this->zip; $lthirdparty->town=$this->town; $lthirdparty->email=$this->email; - $lthirdparty->tel=$this->phone; + $lthirdparty->phone=$this->phone; $lthirdparty->state_id=$this->state_id; $lthirdparty->country_id=$this->country_id; $lthirdparty->country_id=$this->country_id; diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index 0eba0baa68c..4fef3184c20 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -199,11 +199,11 @@ if (empty($reshook)) } else { - if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') + if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { setEventMessage($langs->trans("ObjectAlreadyLinkedToCategory"),'warnings'); } - else + else { setEventMessage($cat->error,'errors'); setEventMessage($cat->errors,'errors'); @@ -305,7 +305,7 @@ if ($socid) print ''; // Phone - print ''; + print ''; print ''; // Assujeti a TVA ou pas diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index b42a66dd212..3b655f726f7 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -208,7 +208,7 @@ if ($act->id > 0) { if ($act->societe->fetch($act->societe->id)) { - print "
".dol_print_phone($act->societe->tel); + print "
".dol_print_phone($act->societe->phone); } } print ''; diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index a1915d29540..16d37e9c453 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -971,7 +971,7 @@ if ($id > 0) { if ($act->societe->fetch($act->societe->id)) { - print "
".dol_print_phone($act->societe->tel); + print "
".dol_print_phone($act->societe->phone); } } print ''; diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 9021ad0acaf..1189b77ec57 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -254,7 +254,7 @@ if ($id > 0) print ''; // Phone - print ''; + print ''; // Fax print ''; diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index e044676a3bf..d00d789475e 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -130,7 +130,7 @@ if (empty($reshook)) $error=$object->error; $errors=$object->errors; } } - + /* * Confirmation desactivation @@ -152,7 +152,7 @@ if (empty($reshook)) $object->setstatus(1); header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); exit; - + } // Add contact if ($action == 'add' && $user->rights->societe->contact->creer) @@ -344,7 +344,7 @@ else if ($action == 'delete') { print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1); - + } } @@ -499,7 +499,7 @@ else } // Phone / Fax - if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->phone_pro)) == 0) $object->phone_pro = $objsoc->tel; // Predefined with third party + if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->phone_pro)) == 0) $object->phone_pro = $objsoc->phone; // Predefined with third party print ''; print ''; @@ -735,7 +735,7 @@ else print ''; - + // Statut print ''; print ''; - print ''; + print ''; print ''; print ''; // Phone / Fax - print ''; + print ''; print ''; diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 31e3f58ffce..152a28053fa 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -312,7 +312,7 @@ function getThirdParty($authentication,$id='',$ref='',$ref_ext='') 'country_id' => $thirdparty->country_id, 'country_code' => $thirdparty->country_code, 'country' => $thirdparty->country, - 'phone' => $thirdparty->tel, + 'phone' => $thirdparty->phone, 'fax' => $thirdparty->fax, 'email' => $thirdparty->email, 'url' => $thirdparty->url, From 692ca4473dae12ea8eee104ccfb82119344802c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Sep 2013 20:04:30 +0200 Subject: [PATCH 32/37] Qual: uniformize code: property ->tel on objects is now ->phone everywhere --- test/phpunit/SocieteTest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php index 487f25c8ec9..4c512279476 100755 --- a/test/phpunit/SocieteTest.php +++ b/test/phpunit/SocieteTest.php @@ -197,7 +197,7 @@ class SocieteTest extends PHPUnit_Framework_TestCase $localobject->town='New town'; $localobject->country_id=2; $localobject->status=0; - $localobject->tel='New tel'; + $localobject->phone='New tel'; $localobject->fax='New fax'; $localobject->email='newemail@newemail.com'; $localobject->url='New url'; @@ -205,15 +205,15 @@ class SocieteTest extends PHPUnit_Framework_TestCase $localobject->idprof2='new idprof2'; $localobject->idprof3='new idprof3'; $localobject->idprof4='new idprof4'; - + $result=$localobject->update($localobject->id,$user); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0); - + $result=$localobject->update_note($localobject->note_private,'_private'); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0, 'Holiday::update_note_private error'); - + $result=$localobject->update_note_public($localobject->note_public); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0, 'Holiday::update_note_public error'); @@ -232,7 +232,7 @@ class SocieteTest extends PHPUnit_Framework_TestCase $this->assertEquals($localobject->country_id, $newobject->country_id); $this->assertEquals('BE', $newobject->country_code); $this->assertEquals($localobject->status, $newobject->status); - $this->assertEquals($localobject->tel, $newobject->tel); + $this->assertEquals($localobject->phone, $newobject->phone); $this->assertEquals($localobject->fax, $newobject->fax); $this->assertEquals($localobject->email, $newobject->email); $this->assertEquals($localobject->url, $newobject->url); From 5ea7c349562f9393813ba6c16c523e15cfcab8c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Sep 2013 21:26:06 +0200 Subject: [PATCH 33/37] Fix: Opening agenda for a specific day Fix: No picto of thirdparty of contact if link is broken --- htdocs/comm/action/fiche.php | 4 +++- htdocs/comm/action/index.php | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 16d37e9c453..f33be20ba62 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -77,8 +77,10 @@ $hookmanager->initHooks(array('actioncard')); /* - * Action creation de l'action + * Actions */ + +// Add action if ($action == 'add_action') { $error=0; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 7facb9b5459..5e38198ab60 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -84,7 +84,7 @@ $type=GETPOST("type"); $maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=="0"?'':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':'')); -if (GETPOST('viewcal')) { +if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week') { $action='show_month'; $day=''; } // View by month if (GETPOST('viewweek')) { @@ -1140,7 +1140,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $cachethirdparties[$event->societe->id]=$thirdparty; } else $thirdparty=$cachethirdparties[$event->societe->id]; - $linerelatedto.=$thirdparty->getNomUrl(1,'',$length); + if (! empty($thirdparty->id)) $linerelatedto.=$thirdparty->getNomUrl(1,'',$length); } if (! empty($event->contact->id) && $event->contact->id > 0) { @@ -1152,7 +1152,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } else $contact=$cachecontacts[$event->contact->id]; if ($linerelatedto) $linerelatedto.=' / '; - $linerelatedto.=$contact->getNomUrl(1,'',$length); + if (! empty($contact->id)) $linerelatedto.=$contact->getNomUrl(1,'',$length); } if ($linerelatedto) print '
'.$linerelatedto; } From db7bcfd748962eda0ac348fdc642e4e33f1d3813 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Sep 2013 21:36:40 +0200 Subject: [PATCH 34/37] Fix: Sending email from thirdparty must add event into agenda if option is on. --- htdocs/core/actions_sendmails.inc.php | 33 +++++------- htdocs/core/modules/modAgenda.class.php | 7 +-- ...terface_50_modAgenda_ActionsAuto.class.php | 16 +++++- .../mysql/data/llx_c_action_trigger.sql | 1 + .../install/mysql/migration/3.4.0-3.5.0.sql | 3 ++ htdocs/langs/fr_FR/agenda.lang | 2 +- htdocs/societe/soc.php | 50 +++++++++++-------- 7 files changed, 66 insertions(+), 46 deletions(-) diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 2b34e1e4b18..f13113487c1 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -69,15 +69,18 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $subject='';$actionmsg='';$actionmsg2=''; $result=$object->fetch($id); - + + $sendtosocid=0; if (method_exists($object,"fetch_thirdparty") && $object->element != 'societe') { $result=$object->fetch_thirdparty(); $thirdparty=$object->thirdparty; + $sendtosocid=$thirdparty->id; } else if ($object->element == 'societe') { - $thirdparty=$object; + $thirdparty=$object; + $sendtosocid=$thirdparty->id; } else dol_print_error('','Use actions_sendmails.in.php for a type that is not supported'); @@ -114,28 +117,17 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $sendtocc = $_POST['sendtocc']; $deliveryreceipt = $_POST['deliveryreceipt']; - if ($action == 'send') + if ($action == 'send' || $action == 'relance') { if (dol_strlen($_POST['subject'])) $subject = $_POST['subject']; - $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; + $actionmsg2=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; if ($message) { + $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; $actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; $actionmsg.=$message; } - //$actionmsg2=$langs->transnoentities('Action'.$actiontypecode); - } - if ($action == 'relance') - { - if (dol_strlen($_POST['subject'])) $subject = $_POST['subject']; - $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; - if ($message) { - $actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; - $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; - $actionmsg.=$message; - } - //$actionmsg2=$langs->transnoentities('Action'.$actiontypecode); } // Create form object @@ -162,7 +154,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $error=0; // Initialisation donnees - $object->sendtoid = $sendtoid; + $object->socid = $sendtosocid; // To link to a company + $object->sendtoid = $sendtoid; // To link to a contact/address $object->actiontypecode = $actiontypecode; $object->actionmsg = $actionmsg; // Long text $object->actionmsg2 = $actionmsg2; // Short text @@ -172,7 +165,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($db); - $result=$interface->run_triggers('THIRDPARTY_EMAILSENT',$object,$user,$langs,$conf); + $result=$interface->run_triggers('COMPANY_SENTBYMAIL',$object,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } @@ -188,7 +181,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO // This avoid sending mail twice if going out and then back to page $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); setEventMessage($mesg); - header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id); + header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id); exit; } } @@ -206,7 +199,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; } $mesg.=''; - + setEventMessage($mesg,'warnings'); $action = 'presend'; } diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 7b3b73c22f5..1c22c61f3db 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -44,7 +44,7 @@ class modAgenda extends DolibarrModules function __construct($db) { global $conf; - + $this->db = $db; $this->numero = 2400; @@ -74,6 +74,7 @@ class modAgenda extends DolibarrModules // Constantes //----------- $this->const = array(); + $this->const[15] = array("MAIN_AGENDA_ACTIONAUTO_COMPANY_SENTBYMAIL","chaine","1"); $this->const[0] = array("MAIN_AGENDA_ACTIONAUTO_COMPANY_CREATE","chaine","1"); $this->const[1] = array("MAIN_AGENDA_ACTIONAUTO_CONTRACT_VALIDATE","chaine","1"); $this->const[2] = array("MAIN_AGENDA_ACTIONAUTO_PROPAL_VALIDATE","chaine","1"); @@ -166,7 +167,7 @@ class modAgenda extends DolibarrModules $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'export'; - + // Main menu entries $this->menu = array(); // List of menus to add $r=0; @@ -376,7 +377,7 @@ class modAgenda extends DolibarrModules 'a.datea'=>'Date','a.datea2'=>'Date','a.percent'=>'Numeric','a.fk_user_author'=>'List:user:name','a.fk_user_action'=>'List:user:name', 'a.fk_user_done'=>"List:user:name","a.priority"=>"Numeric","a.fulldayevent"=>"Boolean","a.location"=>"Text", "a.fk_soc"=>"List:Societe:nom","a.fk_contact"=>"List:socpeople:name","a.fk_action"=>"List:c_actioncomm:libelle:code"); - + $this->export_entities_array[$r]=array('a.id'=>'action','a.label'=>'action','a.datep'=>'action','a.datep2'=>'action', 'a.datea'=>'action','a.datea2'=>'action','a.percent'=>'action','a.fk_user_author'=>'action','a.fk_user_action'=>'action', 'a.fk_user_done'=>"action","a.priority"=>"action","a.fulldayevent"=>"action","a.location"=>"action", diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 623f1340b5b..b089b5487a7 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -140,6 +140,20 @@ class InterfaceActionsAuto $object->socid=$object->id; $ok=1; } + elseif ($action == 'COMPANY_SENTBYMAIL') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("orders"); + $langs->load("agenda"); + + if (empty($object->actiontypecode)) $object->actiontypecode='AC_OTH_AUTO'; + if (empty($object->actionmsg2)) dol_syslog('Trigger called with property actionmsg2 on object not defined', LOG_ERR); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + // Parameters $object->sendtoid defined by caller + //$object->sendtoid=0; + $ok=1; + } elseif ($action == 'CONTRACT_VALIDATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); @@ -625,7 +639,7 @@ class InterfaceActionsAuto $error ="Failed to insert event : ".$actioncomm->error." ".join(',',$actioncomm->errors); $this->error=$error; $this->errors=$actioncomm->errors; - + dol_syslog("interface_modAgenda_ActionsAuto.class.php: ".$this->error, LOG_ERR); return -1; } diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index 9f7bf87229c..cd7f1fc285d 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -37,6 +37,7 @@ insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) 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',13); insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (5,'ORDER_VALIDATE','Customer order validate','Executed when a customer order is validated','commande',4); insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (6,'PROPAL_VALIDATE','Customer proposal validated','Executed when a commercial proposal is validated','propal',2); +insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (9,'COMPANY_SENTBYMAIL','Mails sent from third party card','Executed when you send email from third party card','societe',1); insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (10,'COMPANY_CREATE','Third party created','Executed when a third party is created','societe',1); insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (11,'CONTRACT_VALIDATE','Contract validated','Executed when a contract is validated','contrat',18); insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (12,'PROPAL_SENTBYMAIL','Commercial proposal sent by mail','Executed when a commercial proposal is sent by mail','propal',3); diff --git a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql index 60aacc47626..6fa35fa552c 100755 --- a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql +++ b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql @@ -298,3 +298,6 @@ ALTER TABLE llx_facture_fourn ADD fk_mode_reglement integer NULL AFTER fk_cond_r ALTER TABLE llx_facture_fourn MODIFY COLUMN fk_mode_reglement integer NULL; ALTER TABLE llx_facture_fourn MODIFY COLUMN fk_cond_reglement integer NULL; + +insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (9,'COMPANY_SENTBYMAIL','Mails sent from third party card','Executed when you send email from third party card','societe',1); + diff --git a/htdocs/langs/fr_FR/agenda.lang b/htdocs/langs/fr_FR/agenda.lang index b70c1797892..8efdd8e3624 100644 --- a/htdocs/langs/fr_FR/agenda.lang +++ b/htdocs/langs/fr_FR/agenda.lang @@ -37,7 +37,7 @@ AutoActions= Alimentation automatique AgendaAutoActionDesc= Définissez dans cet onglet les événements pour lesquels Dolibarr créera automatiquement une action dans l'agenda. Si aucune case n'est cochée (par défaut), seules les actions manuelles seront incluses dans l'agenda. AgendaSetupOtherDesc= Cette page permet de configurer quelques options permettant d'exporter une vue de votre agenda Dolibarr vers un calendrier externe (Thunderbird, Google calendar, …) AgendaExtSitesDesc=Cette page permet d'ajouter des sources de calendriers externes pour les visualiser au sein de l'agenda Dolibarr. -ActionsEvents= Événements pour lesquels Dolibarr doit créer une action dans l'agenda en automatique. +ActionsEvents= Événements pour lesquels Dolibarr doit insérer un évènement dans l'agenda en automatique. PropalValidatedInDolibarr= Proposition %s validée InvoiceValidatedInDolibarr= Facture %s validée InvoiceBackToDraftInDolibarr=Facture %s repassée en brouillon diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 837cb98d579..7d7e1d910ee 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -450,13 +450,14 @@ if (empty($reshook)) $result = $object->set_parent(GETPOST('editparentcompany','int')); } - + // Actions to send emails $id=$socid; $actiontypecode='AC_OTH_AUTO'; + $paramname='socid'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; - - + + /* * Generate document */ @@ -1778,8 +1779,15 @@ else */ print '
'."\n"; - print ''; - + if (! empty($object->email)) + { + print ''; + } + else + { + print ''; + } + if ($user->rights->societe->creer) { print ''."\n"; @@ -1799,7 +1807,7 @@ else print '
'."\n"; - + if ($action == 'presend') { /* @@ -1845,9 +1853,9 @@ else $contactarr=array(); $contactarr=$object->liste_contact(-1,'external'); - if (is_array($contactarr) && count($contactarr)>0) + if (is_array($contactarr) && count($contactarr)>0) { - foreach($contactarr as $contact) + foreach($contactarr as $contact) { if ($contact['libelle']==$langs->trans('TypeContact_facture_external_BILLING')) { @@ -1884,13 +1892,13 @@ else } else { - + if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC)) { print '
'; //print '
'.$langs->trans('Phone').''.dol_print_phone($soc->tel,$soc->country_code,0,$soc->id,'AC_TEL').'
'.$langs->trans('Phone').''.dol_print_phone($soc->phone,$soc->country_code,0,$soc->id,'AC_TEL').''.$langs->trans('Fax').''.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').'
'.$langs->trans("Web").''.dol_print_url($object->url,'_blank').'
'.$langs->trans('Phone').''.dol_print_phone($object->tel,$object->country_code,0,$object->id,'AC_TEL').'
'.$langs->trans('Phone').''.dol_print_phone($object->phone,$object->country_code,0,$object->id,'AC_TEL').''.$langs->trans('Fax').''.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').'
'.$langs->trans("PhonePro").'phone_pro).'">'.$langs->trans("PhonePerso").'phone_perso).'">
'.$langs->trans("Status").''; @@ -840,7 +840,7 @@ else else $text.=$langs->trans("UserWillBeInternalUser"); } print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("CreateDolibarrLogin"),$text,"confirm_create_user",$formquestion,'yes'); - + } print ''; @@ -945,7 +945,7 @@ else print ''; - + // Statut print ''; print ''; // Phone - print ''; + print ''; // Fax print ''; diff --git a/htdocs/public/paypal/newpayment.php b/htdocs/public/paypal/newpayment.php index 85cae53fa2c..81c362633ed 100644 --- a/htdocs/public/paypal/newpayment.php +++ b/htdocs/public/paypal/newpayment.php @@ -476,7 +476,7 @@ if (GETPOST("source") == 'order' && $valid) $shipToCountryCode=$order->thirdparty->country_code; $shipToZip=$order->thirdparty->zip; $shipToStreet2=''; - $phoneNum=$order->thirdparty->tel; + $phoneNum=$order->thirdparty->phone; if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip) { print ''."\n"; @@ -583,7 +583,7 @@ if (GETPOST("source") == 'invoice' && $valid) $shipToCountryCode=$invoice->thirdparty->country_code; $shipToZip=$invoice->thirdparty->zip; $shipToStreet2=''; - $phoneNum=$invoice->thirdparty->tel; + $phoneNum=$invoice->thirdparty->phone; if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip) { print ''."\n"; @@ -778,7 +778,7 @@ if (GETPOST("source") == 'contractline' && $valid) $shipToCountryCode=$contract->thirdparty->country_code; $shipToZip=$contract->thirdparty->zip; $shipToStreet2=''; - $phoneNum=$contract->thirdparty->tel; + $phoneNum=$contract->thirdparty->phone; if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip) { print ''."\n"; @@ -908,7 +908,7 @@ if (GETPOST("source") == 'membersubscription' && $valid) $shipToCountryCode=$member->country_code; $shipToZip=$member->zip; $shipToStreet2=''; - $phoneNum=$member->tel; + $phoneNum=$member->phone; if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip) { print ''."\n"; diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 6c1387bc35b..ec258dda9d8 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -142,7 +142,7 @@ if ($socid) print ''; // Phone / Fax - print ''; + print ''; print ''; print '
'.$langs->trans("Note").''; print nl2br($object->note); print '
'.$langs->trans("Status").''; diff --git a/htdocs/contact/vcard.php b/htdocs/contact/vcard.php index 48189eb60f6..76d73133e0f 100644 --- a/htdocs/contact/vcard.php +++ b/htdocs/contact/vcard.php @@ -70,7 +70,7 @@ $v->setTitle($contact->poste); if ($company->id) { $v->setURL($company->url, "WORK"); - if (! $contact->phone_pro) $v->setPhoneNumber($company->tel, "WORK;VOICE"); + if (! $contact->phone_pro) $v->setPhoneNumber($company->phone, "WORK;VOICE"); if (! $contact->fax) $v->setPhoneNumber($company->fax, "WORK;FAX"); if (! $contact->zip) $v->setAddress("", "", $company->address, $company->town, "", $company->zip, $company->country_code, "WORK;POSTAL"); if ($company->email != $contact->email) $v->setEmail($company->email,'internet'); diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 5d0facb4bdb..cffa4ff6a6d 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -312,7 +312,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS)) { // Tel - if ($sourcecompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($sourcecompany->tel); + if ($sourcecompany->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($sourcecompany->phone); // Fax if ($sourcecompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($sourcecompany->fax); // EMail @@ -345,7 +345,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS)) { // Tel - if ($targetcontact->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcontact->tel); + if ($targetcontact->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcontact->phone); // Fax if ($targetcontact->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax); // EMail @@ -363,7 +363,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS)) { // Tel - if ($targetcompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcompany->tel); + if ($targetcompany->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcompany->phone); // Fax if ($targetcompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax); // EMail @@ -459,7 +459,7 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text) elseif ($unit=='in') $k=72; $savx=$pdf->getX(); $savy=$pdf->getY(); - + $watermark_angle=atan($h/$w)/2; $watermark_x_pos=0; $watermark_y_pos=$h/3; @@ -1031,7 +1031,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl $libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice; } } - + // Add an additional description for the category products if (! empty($conf->global->CATEGORY_ADD_DESC_INTO_DOC) && $idprod && ! empty($conf->categorie->enabled)) { @@ -1047,7 +1047,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl $libelleproduitservice.='__N__'.$desccateg; } } - + if (! empty($object->lines[$i]->date_start) || ! empty($object->lines[$i]->date_end)) { $format='day'; diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index 2dfe52cf5df..27beceeb979 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -155,7 +155,7 @@ if ($object->fetch($id)) print '
'.$langs->trans("Web").''.dol_print_url($object->url).'
'.$langs->trans("Phone").''.dol_print_phone($object->tel,$object->country_code,0,$object->id,'AC_TEL').'
'.$langs->trans("Phone").''.dol_print_phone($object->phone,$object->country_code,0,$object->id,'AC_TEL').''.$langs->trans("Fax").''.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').'
'.$langs->trans('Phone').''.dol_print_phone($soc->tel,$soc->country_code,0,$soc->id,'AC_TEL').'
'.$langs->trans('Phone').''.dol_print_phone($soc->phone,$soc->country_code,0,$soc->id,'AC_TEL').''.$langs->trans('Fax').''.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').'
'; diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index c1d9609a6c4..f58d2522079 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -134,7 +134,7 @@ abstract class ActionsCardCommon $this->object->town = $_POST["town"]; $this->object->country_id = $_POST["country_id"]; $this->object->state_id = $_POST["state_id"]; - $this->object->tel = $_POST["tel"]; + $this->object->phone = $_POST["tel"]; $this->object->fax = $_POST["fax"]; $this->object->email = trim($_POST["email"]); $this->object->url = $_POST["url"]; @@ -555,7 +555,7 @@ abstract class ActionsCardCommon if ($this->object->isInEEC()) $this->tpl['country'] = $form->textwithpicto(($img?$img.' ':'').$this->object->country,$langs->trans("CountryIsInEEC"),1,0); $this->tpl['country'] = ($img?$img.' ':'').$this->object->country; - $this->tpl['phone'] = dol_print_phone($this->object->tel,$this->object->country_code,0,$this->object->id,'AC_TEL'); + $this->tpl['phone'] = dol_print_phone($this->object->phone,$this->object->country_code,0,$this->object->id,'AC_TEL'); $this->tpl['fax'] = dol_print_phone($this->object->fax,$this->object->country_code,0,$this->object->id,'AC_FAX'); $this->tpl['email'] = dol_print_email($this->object->email,0,$this->object->id,'AC_EMAIL'); $this->tpl['url'] = dol_print_url($this->object->url); @@ -671,7 +671,7 @@ abstract class ActionsCardCommon $this->object->town = $_POST["town"]; $this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id; $this->object->state_id = $_POST["state_id"]; - $this->object->tel = $_POST["tel"]; + $this->object->phone = $_POST["tel"]; $this->object->fax = $_POST["fax"]; $this->object->email = $_POST["email"]; $this->object->url = $_POST["url"]; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 861ad5c9ef8..c77deb37421 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -403,10 +403,9 @@ class Societe extends CommonObject $this->town = $this->town?trim($this->town):trim($this->town); $this->state_id = trim($this->state_id); $this->country_id = ($this->country_id > 0)?$this->country_id:$this->country_id; - $this->phone = trim($this->phone?$this->phone:$this->tel); + $this->phone = trim($this->phone); $this->phone = preg_replace("/\s/","",$this->phone); $this->phone = preg_replace("/\./","",$this->phone); - $this->tel = $this->phone; // TODO obsolete $this->fax = trim($this->fax); $this->fax = preg_replace("/\s/","",$this->fax); $this->fax = preg_replace("/\./","",$this->fax); @@ -779,7 +778,6 @@ class Societe extends CommonObject $this->email = $obj->email; $this->url = $obj->url; - $this->tel = $obj->phone; // TODO obsolete $this->phone = $obj->phone; $this->fax = $obj->fax; @@ -1567,8 +1565,6 @@ class Societe extends CommonObject { global $langs; - if (empty($this->phone) && ! empty($this->tel)) $this->phone=$this->tel; - $contact_phone = $this->contact_property_array('mobile'); if ($this->phone) { @@ -2409,7 +2405,6 @@ class Societe extends CommonObject $this->town=$member->town; $this->country_code=$member->country_code; $this->country_id=$member->country_id; - $this->tel=$member->phone; // deprecated $this->phone=$member->phone; // Prof phone $this->email=$member->email; @@ -2497,7 +2492,6 @@ class Societe extends CommonObject $this->country=$country_label; if (is_object($langs)) $this->country=($langs->trans('Country'.$country_code)!='Country'.$country_code)?$langs->trans('Country'.$country_code):$country_label; - $this->tel=empty($conf->global->MAIN_INFO_SOCIETE_TEL)?'':$conf->global->MAIN_INFO_SOCIETE_TEL; // TODO deprecated $this->phone=empty($conf->global->MAIN_INFO_SOCIETE_TEL)?'':$conf->global->MAIN_INFO_SOCIETE_TEL; $this->fax=empty($conf->global->MAIN_INFO_SOCIETE_FAX)?'':$conf->global->MAIN_INFO_SOCIETE_FAX; $this->url=empty($conf->global->MAIN_INFO_SOCIETE_WEB)?'':$conf->global->MAIN_INFO_SOCIETE_WEB; diff --git a/htdocs/societe/commerciaux.php b/htdocs/societe/commerciaux.php index d638db9d191..4e970dffc17 100644 --- a/htdocs/societe/commerciaux.php +++ b/htdocs/societe/commerciaux.php @@ -151,7 +151,7 @@ if ($_GET["socid"]) print '
'.$langs->trans('Country').''.$soc->country.'
'.$langs->trans('Phone').''.dol_print_phone($soc->tel,$soc->country_code,0,$soc->id,'AC_TEL').'
'.$langs->trans('Phone').''.dol_print_phone($soc->phone,$soc->country_code,0,$soc->id,'AC_TEL').''.$langs->trans('Fax').''.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').'
'.$langs->trans('Web').''; diff --git a/htdocs/societe/localtaxes.php b/htdocs/societe/localtaxes.php index 80378bf65a6..68a2957eeb8 100644 --- a/htdocs/societe/localtaxes.php +++ b/htdocs/societe/localtaxes.php @@ -137,7 +137,7 @@ if ($socid) print '
'.$langs->trans('Phone').''.dol_print_phone($soc->tel,$soc->country_code,0,$soc->id,'AC_TEL').'
'.$langs->trans('Phone').''.dol_print_phone($soc->phone,$soc->country_code,0,$soc->id,'AC_TEL').''.$langs->trans('Fax').''.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').'
'; + $parameters=array(); + $reshook=$hookmanager->executeHooks('printObjectLine',$parameters,$objp,$action); // Note that $action and $object may have been modified by hook print "\n"; @@ -713,6 +720,10 @@ if (! GETPOST('action')) print '\n"; print '\n"; print ''; + + $parameters=array(); + $reshook=$hookmanager->executeHooks('printObjectLine',$parameters,$objp,$action); // Note that $action and $object may have been modified by hook + print ''; $i++; } diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 000bd9a5b81..c586329d4c9 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -61,9 +61,6 @@ $socid=''; if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user, $origin, $origin_id); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('expeditioncard')); - $action = GETPOST('action','alpha'); $confirm = GETPOST('confirm','alpha'); @@ -73,6 +70,11 @@ $hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty( $hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); $object = new Expedition($db); +// Load object +if ($id > 0 || ! empty($ref)) +{ + $ret=$object->fetch($id, $ref); +} // Load object if ($id > 0 || ! empty($ref)) @@ -80,9 +82,14 @@ if ($id > 0 || ! empty($ref)) $ret=$object->fetch($id, $ref); } +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('expeditioncard')); + /* * Actions */ +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($action == 'add') {
'; print ''; // ancre - + /* * Documents generes */ @@ -1898,36 +1906,36 @@ else $urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id; $genallowed=$user->rights->societe->creer; $delallowed=$user->rights->societe->supprimer; - + $var=true; - + $somethingshown=$formfile->show_documents('company',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang); - + print '
'; - - + + print '
'; - + print '
'; } - + print '

'; - + // Subsidiaries list $result=show_subsidiaries($conf,$langs,$db,$object); - + // Contacts list if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { $result=show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); } - + // Addresses list if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)) { $result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); } - + // Projects list $result=show_projects($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); } From 8e72727163204ed5be5a2ca1b3ddb96b0ed73289 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Sep 2013 14:06:15 +0200 Subject: [PATCH 35/37] Add hidden option MAIN_ADD_EVENT_ON_ELEMENT_CARD because the new feature to have a button to create an event is not a "workflow" action so should not appears with action buttons but somewhere else on page. --- htdocs/comm/propal.php | 5 ++--- htdocs/commande/fiche.php | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 9bbd98beaf7..f6d082c763d 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -2106,11 +2106,10 @@ else if (count($object->lines) > 0) print ''; //else print ''.$langs->trans('Validate').''; } - //Creer un evenement - if ($conf->agenda->enabled) + // Create event + if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page. { print ''.$langs->trans("AddAction").''; - } // Edit if ($object->statut == 1 && $user->rights->propal->creer) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 2ab659ed022..3016f5ac191 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -2391,11 +2391,10 @@ else { print ''; } - //Creer un evenement - if ($conf->agenda->enabled) + // Create event + if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page. { print ''.$langs->trans("AddAction").''; - } // Send if ($object->statut > 0) From 470ccba80af9dd97746f8f2416f1e5b1c13ae771 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Sep 2013 15:41:04 +0200 Subject: [PATCH 36/37] Qual: Fix two awful code with hardcoded values. This remove also 2 TODO. --- htdocs/core/lib/functions.lib.php | 8 ++++---- htdocs/societe/canvas/actions_card_common.class.php | 2 +- htdocs/societe/soc.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7b21c9ca20c..0012a4c5bd8 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4092,14 +4092,14 @@ function dol_osencode($str) /** - * Return an id or code from a code or id. Store Code-Id in a cache. + * Return an id or code from a code or id. Store also Code-Id into a cache for next use. * * @param DoliDB $db Database handler * @param string $key Code to get Id * @param string $tablename Table name without prefix * @param string $fieldkey Field for code * @param string $fieldid Field for id - * @return int Id of code + * @return int <0 if KO, Id of code if OK * @see getLabelFromKey */ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id') @@ -4118,7 +4118,7 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id') $sql = "SELECT ".$fieldid." as id"; $sql.= " FROM ".MAIN_DB_PREFIX.$tablename; $sql.= " WHERE ".$fieldkey." = '".$key."'"; - dol_syslog('dol_getIdFromCode sql='.$sql,LOG_DEBUG); + dol_syslog('dol_getIdFromCode sql='.$sql, LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -4130,7 +4130,7 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id') } else { - dol_syslog("dol_getIdFromCode error=".$db->lasterror(),LOG_ERR); + dol_syslog("dol_getIdFromCode error=".$db->lasterror(), LOG_ERR); return -1; } } diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index f58d2522079..89776835e2a 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -160,7 +160,7 @@ abstract class ActionsCardCommon $this->object->effectif_id = $_POST["effectif_id"]; if (GETPOST("private") == 1) { - $this->object->typent_id = 8; // TODO predict another method if the field "special" change of rowid + $this->object->typent_id = dol_getIdFromCode($db,'TE_PRIVATE','c_typent'); } else { diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 7d7e1d910ee..c3bfb832f61 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -158,7 +158,7 @@ if (empty($reshook)) $object->effectif_id = GETPOST('effectif_id'); if (GETPOST("private") == 1) { - $object->typent_id = 8; // TODO predict another method if the field "special" change of rowid + $object->typent_id = dol_getIdFromCode($db,'TE_PRIVATE','c_typent'); } else { From 4a20a2952173210500b2431f5bea8421a0f1bfdd Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 27 Sep 2013 11:00:25 +0200 Subject: [PATCH 37/37] Add hook on paiementcard + fix hook on expedition --- htdocs/compta/paiement.php | 11 +++++++++++ htdocs/expedition/fiche.php | 13 ++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 26d61d35919..6faeb1fa951 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -57,7 +57,12 @@ if ($user->societe_id > 0) $socid = $user->societe_id; } +// Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array +$hookmanager = new HookManager($db); +$hookmanager->initHooks(array('paiementcard')); +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks /* * Action add_paiement et confirm_paiement @@ -579,6 +584,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } print '
'.dol_print_date($db->jdate($objp->dp))."'.$objp->paiement_type.' '.$objp->num_paiement."'.price($objp->amount).'