From 1260a9fd7c789ea8e66a77a05860b2a2f3c674b6 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Tue, 30 Jul 2013 17:04:09 +0200 Subject: [PATCH 1/7] Complete categorie contact --- htdocs/categories/viewcat.php | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 3cdb5d516f1..dbe83945832 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -125,6 +125,7 @@ if ($type == 0) $title=$langs->trans("ProductsCategoryShort"); elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort"); elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort"); elseif ($type == 3) $title=$langs->trans("MembersCategoryShort"); +elseif ($type == 3) $title=$langs->trans("ContactCategoryShort"); else $title=$langs->trans("Category"); $head = categories_prepare_head($object,$type); @@ -444,6 +445,58 @@ if ($object->type == 3) } } +if($object->type == 4) +{ + $contacts = $object->get_type("socpeople","Contact",'contact',"socpeople"); + if ($contacts < 0) + { + dol_print_error(); + } + else + { + print "
"; + print ''."\n"; + print '\n"; + + if (count($contacts) > 0) + { + $i = 0; + $var=true; + foreach ($contacts as $key => $contact) + { + $i++; + $var=!$var; + print "\t\n"; + print '\n"; + // Link to delete from category + print ''; + print "\n"; + } + } + else + { + print ""; + } + print "
'.$langs->trans("Contact")."
'; + print $contact->getNomUrl(1,'category'); + print "'; + $typeid=$object->type; + $permission=0; + if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer); + if ($typeid == 1) $permission=$user->rights->societe->creer; + if ($typeid == 2) $permission=$user->rights->societe->creer; + if ($typeid == 3) $permission=$user->rights->adherent->creer; + if ($typeid == 4) $permission=$user->rights->contact->creer; + if ($permission) + { + print ""; + print img_delete($langs->trans("DeleteFromCat")).' '; + print $langs->trans("DeleteFromCat").""; + } + print '
".$langs->trans("ThisCategoryHasNoCustomer")."
\n"; + } +} + llxFooter(); $db->close(); From 44b3ebbeb4c9881dda8847114a52543987b29ffa Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Tue, 30 Jul 2013 17:11:42 +0200 Subject: [PATCH 2/7] Contniue categorie on contact --- htdocs/categories/class/categorie.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index ee4ff76a008..1e48d484406 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; /** From eeb8ef57c9bfa20fe5f7f4d28e06be5d44e6eddb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Jul 2013 17:22:52 +0200 Subject: [PATCH 3/7] Fix: grip and close for title must differ from grip and close used for other styles. --- htdocs/core/boxes/modules_boxes.php | 6 +++--- htdocs/theme/amarok/img/close_title.png | Bin 0 -> 343 bytes htdocs/theme/amarok/img/grip_title.png | Bin 0 -> 140 bytes htdocs/theme/auguria/img/close_title.png | Bin 0 -> 353 bytes htdocs/theme/auguria/img/grip_title.png | Bin 0 -> 177 bytes htdocs/theme/bureau2crea/img/close_title.png | Bin 0 -> 353 bytes htdocs/theme/bureau2crea/img/grip_title.png | Bin 0 -> 177 bytes htdocs/theme/cameleo/img/close_title.png | Bin 0 -> 343 bytes htdocs/theme/cameleo/img/grip_title.png | Bin 0 -> 140 bytes htdocs/theme/eldy/img/close_title.png | Bin 0 -> 353 bytes htdocs/theme/eldy/img/grip_title.png | Bin 0 -> 177 bytes 11 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 htdocs/theme/amarok/img/close_title.png create mode 100644 htdocs/theme/amarok/img/grip_title.png create mode 100644 htdocs/theme/auguria/img/close_title.png create mode 100644 htdocs/theme/auguria/img/grip_title.png create mode 100644 htdocs/theme/bureau2crea/img/close_title.png create mode 100644 htdocs/theme/bureau2crea/img/grip_title.png create mode 100644 htdocs/theme/cameleo/img/close_title.png create mode 100644 htdocs/theme/cameleo/img/grip_title.png create mode 100644 htdocs/theme/eldy/img/close_title.png create mode 100644 htdocs/theme/eldy/img/grip_title.png diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 2d83e26a870..b556e86c871 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -166,8 +166,8 @@ class ModeleBoxes // Can't be abtract as it is instanciated to build "empty" { print ''; // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object - print img_picto($langs->trans("MoveBox",$this->box_id),'grip','class="boxhandle hideonsmartphone" style="cursor:move;"'); - print img_picto($langs->trans("Close",$this->box_id),'close','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"'); + print img_picto($langs->trans("MoveBox",$this->box_id),'grip_title','class="boxhandle hideonsmartphone" style="cursor:move;"'); + print img_picto($langs->trans("Close",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"'); $label=$head['text']; if (! empty($head['graph'])) $label.=' ('.$langs->trans("Graph").')'; print ''; @@ -242,7 +242,7 @@ class ModeleBoxes // Can't be abtract as it is instanciated to build "empty" else print $text2withnotags; // show text with html cleaning if (! empty($textnoformat)) print "\n".$textnoformat."\n"; - + print ""; } diff --git a/htdocs/theme/amarok/img/close_title.png b/htdocs/theme/amarok/img/close_title.png new file mode 100644 index 0000000000000000000000000000000000000000..aacac9fc4237261adb5bb78013b618a4cce24a7c GIT binary patch literal 343 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xa#^NA%Cx&(BWL^R}Y)RhkE)4%c zaKYZ?lYt_f1s;*b3=G`DAk4@xYmNj^kiEpy*OmPavmmcF^TQtIIH1sVPZ!4!jq_6{ z1!f&F;BlERv|QvrE0^uFn4?x4y1DMRvcB4q-ESKKCp@fDsc?_P1QEX`Td ze5Gtc`r_M$Df17l{WH5-JujR=duhqE-Ahh)GrxE^dumXc=Y3}*`GT^vI+&QF~b zn03T}$7TN9B_jV>xon@s9JLC27knpm^X_;3dpa)ot~?NNLM}5c;MLybv_I-9hHGDU zscg&r{o$9;xp&{yKQM@S?w+|cB)gV9?Sc2Dmnz2E4(#hBcUY{L9Vx%%td7@xS z52SZIzhLn5NS%bqtfdii_~&1mp`*z=;kh!`g=fue>K09Gsp(f3K6MJNpXaqCs=>^J zt!m=84zWgEDZv-ErtF`&Hl&xY-c$5me7m&6s;zx`{GQY8#S)g}ue@gExvM?N^58v{ s*t0pF`<@sVd_MlBy0VAGhwmBtl#MNAeedOG0zJ#%>FVdQ&MBb@0KmY98vpGT^vI+&QF~b zn03T}$7TN9B_jV>xon@s9JLC27knpm^X_;3dpa)ot~?NNLM}5c;MLybv_I-9hHGDU zscg&r{o$9;xp&{yKQM@S?w+|cB)gV9?Sc2Dmnz2E4(#hBcUY{L9Vx%%td7@xS z52SZIzhLn5NS%bqtfdii_~&1mp`*z=;kh!`g=fue>K09Gsp(f3K6MJNpXaqCs=>^J zt!m=84zWgEDZv-ErtF`&Hl&xY-c$5me7m&6s;zx`{GQY8#S)g}ue@gExvM?N^58v{ s*t0pF`<@sVd_MlBy0VAGhwmBtl#MNAeedOG0zJ#%>FVdQ&MBb@0KmY98vp4y1DMRvcB4q-ESKKCp@fDsc?_P1QEX`Td ze5Gtc`r_M$Df17l{WH5-JujR=duhqE-Ahh)GrxE^dumXc=Y3}*`GT^vI+&QF~b zn03T}$7TN9B_jV>xon@s9JLC27knpm^X_;3dpa)ot~?NNLM}5c;MLybv_I-9hHGDU zscg&r{o$9;xp&{yKQM@S?w+|cB)gV9?Sc2Dmnz2E4(#hBcUY{L9Vx%%td7@xS z52SZIzhLn5NS%bqtfdii_~&1mp`*z=;kh!`g=fue>K09Gsp(f3K6MJNpXaqCs=>^J zt!m=84zWgEDZv-ErtF`&Hl&xY-c$5me7m&6s;zx`{GQY8#S)g}ue@gExvM?N^58v{ s*t0pF`<@sVd_MlBy0VAGhwmBtl#MNAeedOG0zJ#%>FVdQ&MBb@0KmY98vp Date: Tue, 30 Jul 2013 17:24:27 +0200 Subject: [PATCH 4/7] Finnalise categorie contact --- htdocs/categories/class/categorie.class.php | 11 +++++++++++ htdocs/categories/index.php | 1 + htdocs/categories/photos.php | 1 + htdocs/categories/viewcat.php | 7 ++++--- htdocs/langs/en_US/categories.lang | 2 ++ htdocs/langs/fr_FR/categories.lang | 2 ++ 6 files changed, 21 insertions(+), 3 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 1e48d484406..5224fa2d72e 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -334,6 +334,17 @@ class Categorie $error++; } } + if (! $error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_contact"; + $sql .= " WHERE fk_categorie = ".$this->id; + if (!$this->db->query($sql)) + { + $this->error=$this->db->lasterror(); + dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR); + $error++; + } + } // Delete category if (! $error) diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index bd293f9febb..0e512cdfcf7 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -50,6 +50,7 @@ if ($type == 0) $title=$langs->trans("ProductsCategoriesArea"); elseif ($type == 1) $title=$langs->trans("SuppliersCategoriesArea"); elseif ($type == 2) $title=$langs->trans("CustomersCategoriesArea"); elseif ($type == 3) $title=$langs->trans("MembersCategoriesArea"); +elseif ($type == 4) $title=$langs->trans("ContactsCategoriesArea"); else $title=$langs->trans("CategoriesArea"); $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 8a98ff44c01..06345dfb4cb 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -94,6 +94,7 @@ if ($object->id) elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort"); elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort"); elseif ($type == 3) $title=$langs->trans("MembersCategoryShort"); + elseif ($type == 4) $title=$langs->trans("ContactCategoriesShort"); $head = categories_prepare_head($object,$type); dol_fiche_head($head, 'photos', $title, 0, 'category'); diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index dbe83945832..a27d9a1a460 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -125,7 +125,7 @@ if ($type == 0) $title=$langs->trans("ProductsCategoryShort"); elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort"); elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort"); elseif ($type == 3) $title=$langs->trans("MembersCategoryShort"); -elseif ($type == 3) $title=$langs->trans("ContactCategoryShort"); +elseif ($type == 4) $title=$langs->trans("ContactCategoriesShort"); else $title=$langs->trans("Category"); $head = categories_prepare_head($object,$type); @@ -445,6 +445,7 @@ if ($object->type == 3) } } +//Categorie contact if($object->type == 4) { $contacts = $object->get_type("socpeople","Contact",'contact',"socpeople"); @@ -478,7 +479,7 @@ if($object->type == 4) if ($typeid == 1) $permission=$user->rights->societe->creer; if ($typeid == 2) $permission=$user->rights->societe->creer; if ($typeid == 3) $permission=$user->rights->adherent->creer; - if ($typeid == 4) $permission=$user->rights->contact->creer; + if ($typeid == 4) $permission=$user->rights->societe->creer; if ($permission) { print ""; @@ -491,7 +492,7 @@ if($object->type == 4) } else { - print "".$langs->trans("ThisCategoryHasNoCustomer").""; + print "".$langs->trans("ThisCategoryHasNoContact").""; } print "\n"; } diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index bddaf125aec..e883ab24ed0 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -17,6 +17,7 @@ SuppliersCategoriesArea=Suppliers categories area CustomersCategoriesArea=Customers categories area ThirdPartyCategoriesArea=Third parties categories area MembersCategoriesArea=Members categories area +ContactsCategoriesArea=Contacts categories area MainCats=Main categories SubCats=Subcategories CatStatistics=Statistics @@ -86,6 +87,7 @@ ThisCategoryHasNoProduct=This category does not contain any product. ThisCategoryHasNoSupplier=This category does not contain any supplier. ThisCategoryHasNoCustomer=This category does not contain any customer. ThisCategoryHasNoMember=This category does not contain any member. +ThisCategoryHasNoContact=This category does not contain any contact. AssignedToCustomer=Assigned to a customer AssignedToTheCustomer=Assigned to the customer InternalCategory=Internal category diff --git a/htdocs/langs/fr_FR/categories.lang b/htdocs/langs/fr_FR/categories.lang index c14906dd2fb..bf0c646c034 100644 --- a/htdocs/langs/fr_FR/categories.lang +++ b/htdocs/langs/fr_FR/categories.lang @@ -17,6 +17,7 @@ SuppliersCategoriesArea=Espace des catégories de tiers fournisseurs CustomersCategoriesArea=Espace des catégories de tiers clients ou prospects ThirdPartyCategoriesArea=Espace des catégories de tiers MembersCategoriesArea=Espace des catégories d'adhérents +ContactsCategoriesArea=Espace des catégories des contacts MainCats=Catégories principales SubCats=Sous-catégories CatStatistics=Statistiques @@ -86,6 +87,7 @@ ThisCategoryHasNoProduct=Cette catégorie ne contient aucun produit. ThisCategoryHasNoSupplier=Cette catégorie ne contient aucun fournisseur. ThisCategoryHasNoCustomer=Cette catégorie ne contient aucun client. ThisCategoryHasNoMember=Cette catégorie ne contient aucun adhérent. +ThisCategoryHasNoContact=Cette catégorie ne contient aucun contact. AssignedToCustomer=Attribuer à un client AssignedToTheCustomer=Attribué au client InternalCategory=Catégorie interne From 3a2f76512bbaf959db8a3cee6ac2e35c991aba41 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Tue, 30 Jul 2013 17:28:08 +0200 Subject: [PATCH 5/7] Category contact again --- htdocs/categories/viewcat.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index a27d9a1a460..da18c5eba76 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -72,25 +72,32 @@ if ($id > 0 && $removeelem > 0) $result = $tmpobject->fetch($removeelem); $elementtype = 'product'; } - if ($type==1 && $user->rights->societe->creer) + else if ($type==1 && $user->rights->societe->creer) { $tmpobject = new Societe($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'fournisseur'; } - if ($type==2 && $user->rights->societe->creer) + else if ($type==2 && $user->rights->societe->creer) { $tmpobject = new Societe($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'societe'; } - if ($type == 3 && $user->rights->adherent->creer) + else if ($type == 3 && $user->rights->adherent->creer) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $tmpobject = new Adherent($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'member'; } + else if ($type == 4 && $user->rights->societe->creer) { + + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; + $tmpobject = new Contact($db); + $result = $tmpobject->fetch($removeelem); + $elementtype = 'contact'; + } $result=$object->del_type($tmpobject,$elementtype); if ($result < 0) dol_print_error('',$object->error); From db8af86111956f90fcdf3bd284ec272fe9a9e0e4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Jul 2013 18:36:13 +0200 Subject: [PATCH 6/7] Fix: W3C --- htdocs/compta/facture/impayees.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index b334053c5b4..5603bd6417d 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -416,6 +416,7 @@ if ($resql) print ''.price($total_paid).''; print ''.price($total_ttc - $total_paid).''; print ' '; + print ' '; print "\n"; } From 75e2350e6a7dc2e8e6f2116e7b21a08037323ed1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Jul 2013 19:08:58 +0200 Subject: [PATCH 7/7] Fix: Mutualizing code fix bug into duplicate code of contact management for project. --- htdocs/core/tpl/contacts.tpl.php | 4 + htdocs/projet/contact.php | 271 +++++-------------------------- 2 files changed, 47 insertions(+), 228 deletions(-) diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index dc97d84e9b6..33b98d56f48 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -14,6 +14,9 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . + * + * This template needs: + * $object */ if (! class_exists('Contact')) { @@ -30,6 +33,7 @@ if ($module == 'propal') { $permission=$user->rights->propale->creer; } elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer; } elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer; } elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer; } +elseif ($module == 'project') { $permission=$user->rights->projet->creer; } elseif (! isset($permission)) { $permission=$user->rights->$module->creer; } // If already defined by caller page $formcompany= new FormCompany($db); diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 2f253112cdf..0674bcaf24b 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -31,17 +31,20 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; $langs->load("projects"); $langs->load("companies"); -$id = GETPOST('id','int'); -$ref= GETPOST('ref','alpha'); +$id = GETPOST('id','int'); +$ref = GETPOST('ref','alpha'); +$lineid = GETPOST('lineid','int'); +$socid = GETPOST('socid','int'); +$action = GETPOST('action','alpha'); -$mine = $_REQUEST['mode']=='mine' ? 1 : 0; +$mine = GETPOST('mode')=='mine' ? 1 : 0; //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects -$project = new Project($db); +$object = new Project($db); if ($ref) { - $project->fetch(0,$ref); - $id=$project->id; + $object->fetch(0,$ref); + $id=$object->id; } // Security check @@ -55,41 +58,42 @@ $result = restrictedArea($user, 'projet', $id); */ // Add new contact -if ($_POST["action"] == 'addcontact' && $user->rights->projet->creer) +if ($action == 'addcontact' && $user->rights->projet->creer) { $result = 0; - $result = $project->fetch($id); + $result = $object->fetch($id); if ($result > 0 && $id > 0) { - $result = $project->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]); + $contactid = (GETPOST('userid') ? GETPOST('userid','int') : GETPOST('contactid','int')); + $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]); } if ($result >= 0) { - header("Location: contact.php?id=".$project->id); + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } else { - if ($project->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') + if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); $mesg = '
'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
'; } else { - $mesg = '
'.$project->error.'
'; + $mesg = '
'.$object->error.'
'; } } } // bascule du statut d'un contact -if ($_GET["action"] == 'swapstatut' && $user->rights->projet->creer) +if ($action == 'swapstatut' && $user->rights->projet->creer) { - if ($project->fetch($id)) + if ($object->fetch($id)) { - $result=$project->swapContactStatus(GETPOST('ligne')); + $result=$object->swapContactStatus(GETPOST('ligne')); } else { @@ -98,14 +102,14 @@ if ($_GET["action"] == 'swapstatut' && $user->rights->projet->creer) } // Efface un contact -if ($_GET["action"] == 'deleteline' && $user->rights->projet->creer) +if (($action == 'deleteline' || $action == 'deletecontact') && $user->rights->projet->creer) { - $project->fetch($id); - $result = $project->delete_contact($_GET["lineid"]); + $object->fetch($id); + $result = $object->delete_contact($_GET["lineid"]); if ($result >= 0) { - header("Location: contact.php?id=".$project->id); + header("Location: contact.php?id=".$object->id); exit; } else @@ -137,18 +141,18 @@ dol_htmloutput_mesg($mesg); if ($id > 0 || ! empty($ref)) { - if ( $project->fetch($id,$ref) > 0) + if ( $object->fetch($id,$ref) > 0) { - if ($project->societe->id > 0) $result=$project->societe->fetch($project->societe->id); + if ($object->societe->id > 0) $result=$object->societe->fetch($object->societe->id); // To verify role of users - //$userAccess = $project->restrictedProjectArea($user,'read'); - $userWrite = $project->restrictedProjectArea($user,'write'); - //$userDelete = $project->restrictedProjectArea($user,'delete'); + //$userAccess = $object->restrictedProjectArea($user,'read'); + $userWrite = $object->restrictedProjectArea($user,'write'); + //$userDelete = $object->restrictedProjectArea($user,'delete'); //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete; - $head = project_prepare_head($project); - dol_fiche_head($head, 'contact', $langs->trans("Project"), 0, ($project->public?'projectpub':'project')); + $head = project_prepare_head($object); + dol_fiche_head($head, 'contact', $langs->trans("Project"), 0, ($object->public?'projectpub':'project')); /* @@ -163,231 +167,42 @@ if ($id > 0 || ! empty($ref)) // Define a complementary filter for search of next/prev ref. if (! $user->rights->projet->all->lire) { - $projectsListId = $project->getProjectsAuthorizedForUser($user,$mine,0); - $project->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")"; + $objectsListId = $object->getProjectsAuthorizedForUser($user,$mine,0); + $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; } - print $form->showrefnav($project, 'ref', $linkback, 1, 'ref', 'ref', ''); + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); print ''; // Label - print ''.$langs->trans("Label").''.$project->title.''; + print ''.$langs->trans("Label").''.$object->title.''; // Customer print "".$langs->trans("Company").""; print ''; - if ($project->societe->id > 0) print $project->societe->getNomUrl(1); + if ($object->societe->id > 0) print $object->societe->getNomUrl(1); else print ' '; print ''; // Visibility print ''.$langs->trans("Visibility").''; - if ($project->public) print $langs->trans('SharedProject'); + if ($object->public) print $langs->trans('SharedProject'); else print $langs->trans('PrivateProject'); print ''; // Statut - print ''.$langs->trans("Status").''.$project->getLibStatut(4).''; + print ''.$langs->trans("Status").''.$object->getLibStatut(4).''; print ""; print ''; - /* - * Lignes de contacts - */ - print '
'; - - /* - * Ajouter une ligne de contact - * Non affiche en mode modification de ligne - */ - if ($_GET["action"] != 'editline') + // Contacts lines (modules that overwrite templates must declare this into descriptor) + $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); + foreach($dirtpls as $reldir) { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - $var = false; - - print ''; - print ''; - print ''; - print ''; - print ''; - - // Ligne ajout pour contact interne - print ""; - - print ''; - - print ''; - - print ''; - print ''; - print ''; - print ''; - - print ''; - - // Line to add external contact. Only if project is linked to a third party. - //if ($project->societe->id) - //{ - print ''; - print ''; - print ''; - print ''; - print ''; - - $var=!$var; - print ""; - - print ''; - - print ''; - - print ''; - print ''; - - print ''; - print ''; - - print ""; - //} - - print ''; - } - - // Liste des contacts lies - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - $companystatic = new Societe($db); - $var = true; - - foreach(array('internal','external') as $source) - { - $tab = $project->liste_contact(-1,$source); - $num=count($tab); - - $i = 0; - while ($i < $num) - { - $var = !$var; - - print ''; - - // Source - print ''; - - // Societe - print ''; - - // Contact - print ''; - - // Type de contact - print ''; - - // Statut - print ''; - - // Icon update et delete - print ''; - - print "\n"; - - $i ++; - } - } - print "
'.$langs->trans("Source").''.$langs->trans("Company").''.$langs->trans("Contacts").''.$langs->trans("ContactType").' 
'; - print img_object('','user').' '.$langs->trans("Users"); - print ''; - print $conf->global->MAIN_INFO_SOCIETE_NOM; - print ''; - // On recupere les id des users deja selectionnes - $form->select_users($user->id,'contactid',0); - print ''; - $formcompany->selectTypeContact($project, '', 'type','internal','rowid'); - print ''; - if ($userWrite > 0 || $user->admin) - { - print ' 0 || $user->admin)) print ' disabled="disabled"'; - print '>'; - } - print '
'; - print img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); - print ''; - $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$project->societe->id; - $selectedCompany = $formcompany->selectCompaniesForNewContact($project, 'id', $selectedCompany, 'newcompany', (empty($project->societe->id)?array():array($project->societe->id))); - print ''; - $nbofcontacts=$form->select_contacts($selectedCompany, '', 'contactid'); - //if ($nbofcontacts == 0) print $langs->trans("NoContactDefined"); - print ''; - $formcompany->selectTypeContact($project, '', 'type','external','rowid'); - print ''; - if ($userWrite > 0 || $user->admin) - { - print ' 0 || $user->admin)) print ' disabled="disabled"'; - print '>'; - } - print '
 
'.$langs->trans("Source").''.$langs->trans("Company").''.$langs->trans("Contacts").''.$langs->trans("ContactType").''.$langs->trans("Status").' 
'; - if ($tab[$i]['source']=='internal') print $langs->trans("User"); - if ($tab[$i]['source']=='external') print $langs->trans("ThirdPartyContact"); - print ''; - if ($tab[$i]['socid'] > 0) - { - $companystatic->fetch($tab[$i]['socid']); - print $companystatic->getNomUrl(1); - } - if ($tab[$i]['socid'] < 0) - { - print $conf->global->MAIN_INFO_SOCIETE_NOM; - } - if (! $tab[$i]['socid']) - { - print ' '; - } - print ''; - if ($tab[$i]['source']=='internal') - { - $userstatic->id=$tab[$i]['id']; - $userstatic->lastname=$tab[$i]['nom']; - $userstatic->firstname=$tab[$i]['firstname']; - print $userstatic->getNomUrl(1); - } - if ($tab[$i]['source']=='external') - { - $contactstatic->id=$tab[$i]['id']; - $contactstatic->lastname=$tab[$i]['nom']; - $contactstatic->firstname=$tab[$i]['firstname']; - print $contactstatic->getNomUrl(1); - } - print ''.$tab[$i]['libelle'].''; - // Activation desativation du contact - if ($project->statut >= 0 && $userWrite > 0) print ''; - print $contactstatic->LibStatut($tab[$i]['status'],3); - if ($project->statut >= 0 && $userWrite > 0) print ''; - print ''; - if ($user->rights->projet->creer && $userWrite > 0) - { - print ' '; - print ''; - print img_delete(); - print ''; - } - print '
"; + $res=@include dol_buildpath($reldir.'/contacts.tpl.php'); + if ($res) break; + } } else {