From f17763f4009aab9047105ad7925d28f0b33f7820 Mon Sep 17 00:00:00 2001 From: Freddi <40861522+FrederikHeinrich@users.noreply.github.com> Date: Wed, 4 Mar 2020 10:02:02 +0100 Subject: [PATCH 1/9] Update fichinter.class.php --- htdocs/fichinter/class/fichinter.class.php | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index f82f91986a0..bca7b65ff2c 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -36,6 +36,37 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; */ class Fichinter extends CommonObject { + class Fichinter extends CommonObject +{ + + public $fields=array( +'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), +'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15), +'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>20), +'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>25), +'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30), +'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), +'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>40, 'index'=>1), +'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>45), +'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>50), +'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>55), +'datei' =>array('type'=>'date', 'label'=>'Datei', 'enabled'=>1, 'visible'=>-1, 'position'=>60), +'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>65), +'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>70), +'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>75), +'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Fk statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500), +'dateo' =>array('type'=>'date', 'label'=>'Dateo', 'enabled'=>1, 'visible'=>-1, 'position'=>85), +'datee' =>array('type'=>'date', 'label'=>'Datee', 'enabled'=>1, 'visible'=>-1, 'position'=>90), +'datet' =>array('type'=>'date', 'label'=>'Datet', 'enabled'=>1, 'visible'=>-1, 'position'=>95), +'duree' =>array('type'=>'double', 'label'=>'Duree', 'enabled'=>1, 'visible'=>-1, 'position'=>100), +'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>105), +'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>110), +'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>115), +'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>120), +'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>125), +'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>130), +'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>135), +); /** * @var string ID to identify managed object */ From 47d632a394bc17abe40a9354c80a531eb910a4cd Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 4 Mar 2020 09:05:20 +0000 Subject: [PATCH 2/9] Fixing style errors. --- htdocs/fichinter/class/fichinter.class.php | 56 +++++++++++----------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index bca7b65ff2c..c130cd0a5d9 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -36,37 +36,37 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; */ class Fichinter extends CommonObject { - class Fichinter extends CommonObject +class Fichinter extends CommonObject { public $fields=array( -'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), -'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15), -'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>20), -'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>25), -'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30), -'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), -'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>40, 'index'=>1), -'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>45), -'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>50), -'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>55), -'datei' =>array('type'=>'date', 'label'=>'Datei', 'enabled'=>1, 'visible'=>-1, 'position'=>60), -'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>65), -'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>70), -'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>75), -'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Fk statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500), -'dateo' =>array('type'=>'date', 'label'=>'Dateo', 'enabled'=>1, 'visible'=>-1, 'position'=>85), -'datee' =>array('type'=>'date', 'label'=>'Datee', 'enabled'=>1, 'visible'=>-1, 'position'=>90), -'datet' =>array('type'=>'date', 'label'=>'Datet', 'enabled'=>1, 'visible'=>-1, 'position'=>95), -'duree' =>array('type'=>'double', 'label'=>'Duree', 'enabled'=>1, 'visible'=>-1, 'position'=>100), -'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>105), -'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>110), -'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>115), -'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>120), -'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>125), -'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>130), -'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>135), -); + 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>20), + 'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>25), + 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30), + 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>40, 'index'=>1), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>45), + 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>50), + 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>55), + 'datei' =>array('type'=>'date', 'label'=>'Datei', 'enabled'=>1, 'visible'=>-1, 'position'=>60), + 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>65), + 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>70), + 'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>75), + 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Fk statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500), + 'dateo' =>array('type'=>'date', 'label'=>'Dateo', 'enabled'=>1, 'visible'=>-1, 'position'=>85), + 'datee' =>array('type'=>'date', 'label'=>'Datee', 'enabled'=>1, 'visible'=>-1, 'position'=>90), + 'datet' =>array('type'=>'date', 'label'=>'Datet', 'enabled'=>1, 'visible'=>-1, 'position'=>95), + 'duree' =>array('type'=>'double', 'label'=>'Duree', 'enabled'=>1, 'visible'=>-1, 'position'=>100), + 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>105), + 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>110), + 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>115), + 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>120), + 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>125), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>130), + 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>135), + ); /** * @var string ID to identify managed object */ From b4ef25df71f299952175c61c8c5292a178cfb770 Mon Sep 17 00:00:00 2001 From: Freddi <40861522+FrederikHeinrich@users.noreply.github.com> Date: Wed, 4 Mar 2020 10:09:48 +0100 Subject: [PATCH 3/9] Update fichinter.class.php --- htdocs/fichinter/class/fichinter.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index c130cd0a5d9..198c58ab4b5 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -36,9 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; */ class Fichinter extends CommonObject { -class Fichinter extends CommonObject -{ - + public $fields=array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15), From e2f749b5eebda94c8cf3962ca6a540cee9f68b7f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 4 Mar 2020 09:10:29 +0000 Subject: [PATCH 4/9] Fixing style errors. --- htdocs/fichinter/class/fichinter.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 198c58ab4b5..a60fa58c505 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; */ class Fichinter extends CommonObject { - + public $fields=array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15), From 96bbba0301d7d6535ca7187775637b7b54058158 Mon Sep 17 00:00:00 2001 From: Freddi <40861522+FrederikHeinrich@users.noreply.github.com> Date: Wed, 4 Mar 2020 10:20:28 +0100 Subject: [PATCH 5/9] Update fichinter.class.php adding ",'showoncombobox'=>1" for a better View --- htdocs/fichinter/class/fichinter.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index a60fa58c505..1ae4364a77d 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -57,7 +57,7 @@ class Fichinter extends CommonObject 'datee' =>array('type'=>'date', 'label'=>'Datee', 'enabled'=>1, 'visible'=>-1, 'position'=>90), 'datet' =>array('type'=>'date', 'label'=>'Datet', 'enabled'=>1, 'visible'=>-1, 'position'=>95), 'duree' =>array('type'=>'double', 'label'=>'Duree', 'enabled'=>1, 'visible'=>-1, 'position'=>100), - 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>105), + 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>105,'showoncombobox'=>1), 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>110), 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>115), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>120), From f823feba520e866cb60362d38bdae6da356626dd Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Wed, 4 Mar 2020 13:31:19 +0100 Subject: [PATCH 6/9] Add sorting for "Contacts of ..." --- htdocs/core/tpl/contacts.tpl.php | 218 ++++++++++++++++++++++--------- 1 file changed, 159 insertions(+), 59 deletions(-) diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index d14503a9039..1b580fe5593 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -28,7 +28,6 @@ if (empty($object) || !is_object($object)) exit; } - require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; @@ -66,8 +65,9 @@ $userstatic = new User($db);
+if ($permission) +{ + ?>
trans("NatureOfContact"); ?>
trans("ThirdParty"); ?>
@@ -153,94 +153,180 @@ if ($permission) { - -
trans("NatureOfContact"); ?>
-
trans("ThirdParty"); ?>
-
trans("Users").'/'.$langs->trans("Contacts"); ?>
-
trans("ContactType"); ?>
-
trans("Status"); ?>
-
 
-
+print "
"; -element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc; +/** +* Prepare list +*/ + +// TODO: replace this with direct SQL string to use $db->sort($sortfield, $sortorder) +$list = array(); +foreach(array('internal', 'external') as $source) +{ + $tmpobject = $object; + + if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) + { + $tmpobject = $objectsrc; + } $tab = $tmpobject->liste_contact(-1, $source); - $num=count($tab); + $num = count($tab); $i = 0; - while ($i < $num) { - ?> + while ($i < $num) + { + $entry = ''; + $entry->id = $tab[$i]['rowid']; + $entry->type = $tab[$i]['libelle']; + + if ($tab[$i]['source'] == 'internal') + { + $entry->nature = $langs->trans("User"); + } + else if ($tab[$i]['source'] == 'external') + { + $entry->nature = $langs->trans("ThirdPartyContact"); + } -
-
- trans("User"); ?> - trans("ThirdPartyContact"); ?> -
-
- 0) { $companystatic->fetch($tab[$i]['socid']); - echo $companystatic->getNomUrl(1); + $entry->thirdparty = $companystatic->getNomUrl(1); } - if ($tab[$i]['socid'] < 0) + else if ($tab[$i]['socid'] < 0) { - echo $conf->global->MAIN_INFO_SOCIETE_NOM; + $entry->thirdparty = $conf->global->MAIN_INFO_SOCIETE_NOM; } - if (! $tab[$i]['socid']) + else if (! $tab[$i]['socid']) { - echo ' '; + $entry->thirdparty = ""; } - ?> -
-
- fetch($tab[$i]['id']); - echo $userstatic->getNomUrl(-1, '', 0, 0, 0, 0, '', 'valignmiddle'); + $entry->contact = $userstatic->getNomUrl(-1, '', 0, 0, 0, 0, '', 'valignmiddle'); } - if ($tab[$i]['source']=='external') + else if ($tab[$i]['source']=='external') { $contactstatic->fetch($tab[$i]['id']); - echo $contactstatic->getNomUrl(1, '', 0, '', 0, 0); + $entry->contact =$contactstatic->getNomUrl(1, '', 0, '', 0, 0); } - ?> -
-
- - -
- \n"; -print "\n"; + +$sortfield = GETPOST("sortfield", "alpha"); +$sortorder = GETPOST("sortorder", 'alpha'); + +if (!$sortfield) $sortfield = "nature"; +if (!$sortorder) $sortorder = "asc"; + +/** + * Re-sort list + */ + +// TODO: switch to $db->sort($sortfield, $sortorder); +if($sortorder == "asc") +{ + if($sortfield == "nature") usort($list, "nature_asc"); + if($sortfield == "thirdparty") usort($list, "thirdparty_asc"); + if($sortfield == "contact") usort($list, "contact_asc"); + if($sortfield == "type") usort($list, "type_asc"); + if($sortfield == "status") usort($list, "status_asc"); +} +else +{ + if($sortfield == "nature") usort($list, "nature_desc"); + if($sortfield == "thirdparty") usort($list, "thirdparty_desc"); + if($sortfield == "contact") usort($list, "contact_desc"); + if($sortfield == "type") usort($list, "type_desc"); + if($sortfield == "status") usort($list, "status_desc"); +} + +$arrayfields = array( + 'rowid' => array('label'=>$langs->trans("Id"), 'checked'=>1), + 'nature' => array('label'=>$langs->trans("NatureOfContact"), 'checked'=>1), + 'thirdparty' => array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), + 'contact' => array('label'=>$langs->trans("Users").'/'.$langs->trans("Contacts"), 'checked'=>1), + 'type' => array('label'=>$langs->trans("ContactType"), 'checked'=>1), + 'status' => array('label'=>$langs->trans("Status"), 'checked'=>1), + 'link' => array('label'=>$langs->trans("Link"), 'checked'=>1), +); + +$param = 'id='.$object->id.'&mainmenu=home'; + +/** + * Show list + */ + +print '
'; +print ''; +print ''; +print ''; +print ''; +print ''; + +print ''; + +print ''; +print ''; + +print ''; +print_liste_field_titre($arrayfields['nature']['label'], $_SERVER["PHP_SELF"], "nature", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre($arrayfields['thirdparty']['label'], $_SERVER["PHP_SELF"], "thirdparty", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre($arrayfields['contact']['label'], $_SERVER["PHP_SELF"], "contact", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], "type", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre($arrayfields['status']['label'], $_SERVER["PHP_SELF"], "statut", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre($arrayfields['link']['label'], $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder, 'center maxwidthsearch '); +print ""; + +foreach($list as $entry) +{ + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + + if ($permission) + { + $href = $_SERVER["PHP_SELF"]; + $href .= "?id=".$object->id; + $href .= "&action=deletecontact"; + $href .= "&lineid=".$entry->id; + + print ""; + } + + print ""; +} + +print "
'.$entry->nature.''.$entry->thirdparty.''.$entry->contact.''.$entry->type.''.$entry->status.'"; + print ""; + print img_picto($langs->trans("Unlink"), "unlink"); + print ""; + print "
"; +print ""; +print "
"; +print ""; + print "\n"; if (is_object($hookmanager)) { $hookmanager->initHooks(array('contacttpl')); @@ -248,3 +334,17 @@ if (is_object($hookmanager)) { $reshook=$hookmanager->executeHooks('formContactTpl', $parameters, $object, $action); } print "\n"; + + +// TODO: Remove this functions after switch to $db->sort($sortfield, $sortorder); +function nature_asc($left, $right) { return $left->nature > $right->nature; } +function thirdparty_asc($left, $right) { return $left->thirdparty > $right->thirdparty; } +function contact_asc($left, $right) { return $left->contact > $right->contact; } +function type_asc($left, $right) { return $left->type > $right->type; } +function status_asc($left, $right) { return $left->status > $right->status; } + +function nature_desc($left, $right) { return $left->nature < $right->nature; } +function thirdparty_desc($left, $right) { return $left->thirdparty < $right->thirdparty; } +function contact_desc($left, $right) { return $left->contact < $right->contact; } +function type_desc($left, $right) { return $left->type < $right->type; } +function status_desc($left, $right) { return $left->status < $right->status; } From 92cc94762391635048d0e5f7e616d9a64569e4e8 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 4 Mar 2020 12:41:52 +0000 Subject: [PATCH 7/9] Fixing style errors. --- htdocs/core/tpl/contacts.tpl.php | 50 ++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 1b580fe5593..b4ada747d2c 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -185,7 +185,7 @@ foreach(array('internal', 'external') as $source) { $entry->nature = $langs->trans("User"); } - else if ($tab[$i]['source'] == 'external') + elseif ($tab[$i]['source'] == 'external') { $entry->nature = $langs->trans("ThirdPartyContact"); } @@ -195,11 +195,11 @@ foreach(array('internal', 'external') as $source) $companystatic->fetch($tab[$i]['socid']); $entry->thirdparty = $companystatic->getNomUrl(1); } - else if ($tab[$i]['socid'] < 0) + elseif ($tab[$i]['socid'] < 0) { $entry->thirdparty = $conf->global->MAIN_INFO_SOCIETE_NOM; } - else if (! $tab[$i]['socid']) + elseif (! $tab[$i]['socid']) { $entry->thirdparty = ""; } @@ -209,7 +209,7 @@ foreach(array('internal', 'external') as $source) $userstatic->fetch($tab[$i]['id']); $entry->contact = $userstatic->getNomUrl(-1, '', 0, 0, 0, 0, '', 'valignmiddle'); } - else if ($tab[$i]['source']=='external') + elseif ($tab[$i]['source']=='external') { $contactstatic->fetch($tab[$i]['id']); $entry->contact =$contactstatic->getNomUrl(1, '', 0, '', 0, 0); @@ -219,7 +219,7 @@ foreach(array('internal', 'external') as $source) { $entry->status = $userstatic->LibStatut($tab[$i]['statuscontact'], 3); } - else if ($tab[$i]['source']=='external') + elseif ($tab[$i]['source']=='external') { $entry->status = $contactstatic->LibStatut($tab[$i]['statuscontact'], 3); } @@ -337,14 +337,34 @@ print "\n"; // TODO: Remove this functions after switch to $db->sort($sortfield, $sortorder); -function nature_asc($left, $right) { return $left->nature > $right->nature; } -function thirdparty_asc($left, $right) { return $left->thirdparty > $right->thirdparty; } -function contact_asc($left, $right) { return $left->contact > $right->contact; } -function type_asc($left, $right) { return $left->type > $right->type; } -function status_asc($left, $right) { return $left->status > $right->status; } +function nature_asc($left, $right) +{ + return $left->nature > $right->nature; } +function thirdparty_asc($left, $right) +{ + return $left->thirdparty > $right->thirdparty; } +function contact_asc($left, $right) +{ + return $left->contact > $right->contact; } +function type_asc($left, $right) +{ + return $left->type > $right->type; } +function status_asc($left, $right) +{ + return $left->status > $right->status; } -function nature_desc($left, $right) { return $left->nature < $right->nature; } -function thirdparty_desc($left, $right) { return $left->thirdparty < $right->thirdparty; } -function contact_desc($left, $right) { return $left->contact < $right->contact; } -function type_desc($left, $right) { return $left->type < $right->type; } -function status_desc($left, $right) { return $left->status < $right->status; } +function nature_desc($left, $right) +{ + return $left->nature < $right->nature; } +function thirdparty_desc($left, $right) +{ + return $left->thirdparty < $right->thirdparty; } +function contact_desc($left, $right) +{ + return $left->contact < $right->contact; } +function type_desc($left, $right) +{ + return $left->type < $right->type; } +function status_desc($left, $right) +{ + return $left->status < $right->status; } From e0525208827f256259642ee5c02ff7f4aa1892e5 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Wed, 4 Mar 2020 14:50:10 +0100 Subject: [PATCH 8/9] fix broken categories on "contacts" tab of project --- htdocs/projet/contact.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 42226f93208..6e4f19b2818 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -19,7 +19,7 @@ /** * \file htdocs/projet/contact.php * \ingroup project - * \brief Onglet de gestion des contacts du projet + * \brief List of all contacts of a project */ require '../main.inc.php'; @@ -27,6 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +if ($conf->categorie->enabled) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; } // Load translation files required by the page $langs->loadLangs(array('projects', 'companies')); From b0f1af8433351c046e26509a5ac9c62d794d2277 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Wed, 4 Mar 2020 15:18:50 +0100 Subject: [PATCH 9/9] add missing translation string "Usage" (projects) --- htdocs/langs/en_US/projects.lang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index d8d113941db..94e440f9ab9 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -257,10 +257,11 @@ InvoiceGeneratedFromTimeSpent=Invoice %s has been generated from time spent on p ProjectBillTimeDescription=Check if you enter timesheet on tasks of project AND you plan to generate invoice(s) from the timesheet to bill the customer of the project (do not check if you plan to create invoice that is not based on entered timesheets). Note: To generate invoice, go on tab 'Time spent' of the project and select lines to include. ProjectFollowOpportunity=Follow opportunity ProjectFollowTasks=Follow tasks +Usage=Usage UsageOpportunity=Usage: Opportunity UsageTasks=Usage: Tasks UsageBillTimeShort=Usage: Bill time InvoiceToUse=Draft invoice to use NewInvoice=New invoice OneLinePerTask=One line per task -OneLinePerPeriod=One line per period \ No newline at end of file +OneLinePerPeriod=One line per period