'. $langs->trans("OppStatus".$this->opp_status_code);
+ $return .= ' ('.round($this->opp_percent).'%) ';
+ $return .= '>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= ''.$this->getLibStatut(5).'
';
diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php
index 30d7ea9dcec..ea2d27936b1 100644
--- a/htdocs/projet/list.php
+++ b/htdocs/projet/list.php
@@ -379,6 +379,7 @@ $companystatic = new Societe($db);
$taskstatic = new Task($db);
$formother = new FormOther($db);
$formproject = new FormProjets($db);
+$userstatic = new User($db);
$help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
$title = $langs->trans("LeadsOrProjects");
@@ -1244,111 +1245,147 @@ if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
}
print ''."\n";
+$totalarray = array();
+$totalarray['nbfield'] = 0;
+
+// Fields title label
+// --------------------------------------------------------------------
print '';
-if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
- print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
+if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.ref']['checked'])) {
print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", "", $param, "", $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.title']['checked'])) {
print_liste_field_titre($arrayfields['p.title']['label'], $_SERVER["PHP_SELF"], "p.title", "", $param, "", $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['s.nom']['checked'])) {
print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['s.name_alias']['checked'])) {
print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], "s.name_alias", "", $param, "", $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['commercial']['checked'])) {
print_liste_field_titre($arrayfields['commercial']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder, 'tdoverflowmax100imp ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.dateo']['checked'])) {
print_liste_field_titre($arrayfields['p.dateo']['label'], $_SERVER["PHP_SELF"], "p.dateo", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.datee']['checked'])) {
print_liste_field_titre($arrayfields['p.datee']['label'], $_SERVER["PHP_SELF"], "p.datee", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.public']['checked'])) {
print_liste_field_titre($arrayfields['p.public']['label'], $_SERVER["PHP_SELF"], "p.public", "", $param, "", $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['c.assigned']['checked'])) {
print_liste_field_titre($arrayfields['c.assigned']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center ', '');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.fk_opp_status']['checked'])) {
print_liste_field_titre($arrayfields['p.fk_opp_status']['label'], $_SERVER["PHP_SELF"], 'p.fk_opp_status', "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.opp_amount']['checked'])) {
print_liste_field_titre($arrayfields['p.opp_amount']['label'], $_SERVER["PHP_SELF"], 'p.opp_amount', "", $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.opp_percent']['checked'])) {
print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER['PHP_SELF'], 'p.opp_percent', "", $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['opp_weighted_amount']['checked'])) {
print_liste_field_titre($arrayfields['opp_weighted_amount']['label'], $_SERVER['PHP_SELF'], 'opp_weighted_amount', '', $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.budget_amount']['checked'])) {
print_liste_field_titre($arrayfields['p.budget_amount']['label'], $_SERVER["PHP_SELF"], 'p.budget_amount', "", $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.usage_opportunity']['checked'])) {
print_liste_field_titre($arrayfields['p.usage_opportunity']['label'], $_SERVER["PHP_SELF"], 'p.usage_opportunity', "", $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.usage_task']['checked'])) {
print_liste_field_titre($arrayfields['p.usage_task']['label'], $_SERVER["PHP_SELF"], 'p.usage_task', "", $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.usage_bill_time']['checked'])) {
print_liste_field_titre($arrayfields['p.usage_bill_time']['label'], $_SERVER["PHP_SELF"], 'p.usage_bill_time', "", $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.usage_organize_event']['checked'])) {
print_liste_field_titre($arrayfields['p.usage_organize_event']['label'], $_SERVER["PHP_SELF"], 'p.usage_organize_event', "", $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.accept_conference_suggestions']['checked'])) {
print_liste_field_titre($arrayfields['p.accept_conference_suggestions']['label'], $_SERVER["PHP_SELF"], 'p.accept_conference_suggestions', "", $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.accept_booth_suggestions']['checked'])) {
print_liste_field_titre($arrayfields['p.accept_booth_suggestions']['label'], $_SERVER["PHP_SELF"], 'p.accept_booth_suggestions', "", $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.price_registration']['checked'])) {
print_liste_field_titre($arrayfields['p.price_registration']['label'], $_SERVER["PHP_SELF"], 'p.price_registration', "", $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.price_booth']['checked'])) {
print_liste_field_titre($arrayfields['p.price_booth']['label'], $_SERVER["PHP_SELF"], 'p.price_booth', "", $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['u.login']['checked'])) {
print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
-$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
-$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
+$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
+$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['p.datec']['checked'])) {
print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.tms']['checked'])) {
print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.email_msgid']['checked'])) {
print_liste_field_titre($arrayfields['p.email_msgid']['label'], $_SERVER["PHP_SELF"], "p.email_msgid", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.import_key']['checked'])) {
print_liste_field_titre($arrayfields['p.import_key']['label'], $_SERVER["PHP_SELF"], "p.import_key", "", $param, '', $sortfield, $sortorder, '');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.fk_statut']['checked'])) {
print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
}
-if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
- print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
+// Action column
+if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
+ $totalarray['nbfield']++;
}
-print " \n";
+print ''."\n";
-$userstatic = new User($db);
$i = 0;
+$savnbfield = $totalarray['nbfield'];
$totalarray = array(
'nbfield' => 0,
- 'val' => array(),
+ 'val' => array()
);
$imaxinloop = ($limit ? min($num, $limit) : $num);
while ($i < $imaxinloop) {
@@ -1358,18 +1395,32 @@ while ($i < $imaxinloop) {
}
$object->id = $obj->id;
- $object->user_author_id = $obj->fk_user_creat;
- $object->public = $obj->public;
$object->ref = $obj->ref;
- $object->datee = $db->jdate($obj->date_end);
+ $object->title = $obj->title;
+ $object->fk_opp_status = $obj->fk_opp_status;
+ $object->user_author_id = $obj->fk_user_creat;
+ $object->date_creation = $db->jdate($obj->date_creation);
+ $object->date_start = $db->jdate($obj->date_start);
+ $object->date_end = $db->jdate($obj->date_end);
$object->statut = $obj->status; // deprecated
$object->status = $obj->status;
$object->public = $obj->public;
+ $object->opp_percent = $obj->opp_percent;
$object->opp_status = $obj->fk_opp_status;
- $object->title = $obj->title;
+ $object->opp_status_code = $obj->opp_status_code;
+ $object->opp_amount = $obj->opp_ammount;
+ $object->opp_weighted_amount = $obj->opp_weighted_amount;
+ $object->budget_amount = $obj->budget_amount;
+ $object->usage_opportunity = $obj->usage_opportunity;
+ $object->usage_task = $obj->usage_task;
+ $object->usage_bill_time = $obj->usage_bill_time;
+ $object->usage_organize_event = $obj->usage_organize_event;
+ $object->email_msgid = $obj->email_msgid;
+ $object->import_key = $obj->import_key;
- $userAccess = $object->restrictedProjectArea($user); // why this ?
- if ($userAccess >= 0) {
+
+ //$userAccess = $object->restrictedProjectArea($user); // disabled, permission on project must be done by the select
+ //if ($userAccess >= 0) {
// Thirdparty
$companystatic->id = $obj->socid;
$companystatic->name = $obj->name;
@@ -1383,462 +1434,459 @@ while ($i < $imaxinloop) {
$companystatic->town = $obj->town;
$companystatic->country_code = $obj->country_code;
- if ($mode == 'kanban') {
- if ($i == 0) {
- print '';
- print '';
- }
- $object->date_start_event = $obj->date_start;
-
- $userstatic->id = $obj->fk_user_creat;
- $object->user_author_id = $userstatic->id;
- //var_dump($object->user_author_id);exit;
- print $object->getKanbanView('');
-
- if ($i == min($num, $limit)-1) {
- print '
';
- print ' ';
- }
- } else {
- print '';
-
- // Action column
- if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
- print '';
- if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
- $selected = 0;
- if (in_array($obj->id, $arrayofselected)) {
- $selected = 1;
- }
- print ' ';
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Project url
- if (!empty($arrayfields['p.ref']['checked'])) {
- print '';
- print $object->getNomUrl(1, (!empty(GETPOST('search_usage_event_organization', 'int'))?'eventorganization':''));
- if ($object->hasDelay()) {
- print img_warning($langs->trans('Late'));
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Title
- if (!empty($arrayfields['p.title']['checked'])) {
- print '';
- print $obj->title;
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Company
- if (!empty($arrayfields['s.nom']['checked'])) {
- print '';
- if ($obj->socid) {
- print $companystatic->getNomUrl(1, '', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
- } else {
- print ' ';
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Alias
- if (!empty($arrayfields['s.name_alias']['checked'])) {
- print '';
- if ($obj->socid) {
- print $companystatic->name_alias;
- } else {
- print ' ';
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Sales Representatives
- if (!empty($arrayfields['commercial']['checked'])) {
- print '';
- if ($obj->socid) {
- $companystatic->id = $obj->socid;
- $companystatic->name = $obj->name;
- $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
- $nbofsalesrepresentative = count($listsalesrepresentatives);
- if ($nbofsalesrepresentative > 6) {
- // We print only number
- print $nbofsalesrepresentative;
- } elseif ($nbofsalesrepresentative > 0) {
- $userstatic = new User($db);
- $j = 0;
- foreach ($listsalesrepresentatives as $val) {
- $userstatic->id = $val['id'];
- $userstatic->lastname = $val['lastname'];
- $userstatic->firstname = $val['firstname'];
- $userstatic->email = $val['email'];
- $userstatic->statut = $val['statut'];
- $userstatic->entity = $val['entity'];
- $userstatic->photo = $val['photo'];
- $userstatic->login = $val['login'];
- $userstatic->office_phone = $val['office_phone'];
- $userstatic->office_fax = $val['office_fax'];
- $userstatic->user_mobile = $val['user_mobile'];
- $userstatic->job = $val['job'];
- $userstatic->gender = $val['gender'];
- print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
- $j++;
- if ($j < $nbofsalesrepresentative) {
- print ' ';
- }
- }
- }
- //else print $langs->trans("NoSalesRepresentativeAffected");
- } else {
- print ' ';
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Date start project
- if (!empty($arrayfields['p.dateo']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_start), 'day');
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Date end project
- if (!empty($arrayfields['p.datee']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_end), 'day');
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Visibility
- if (!empty($arrayfields['p.public']['checked'])) {
- print '';
- if ($obj->public) {
- print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"');
- //print $langs->trans('SharedProject');
- } else {
- print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"');
- //print $langs->trans('PrivateProject');
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Contacts of project
- if (!empty($arrayfields['c.assigned']['checked'])) {
- print '';
- $ifisrt = 1;
- foreach (array('internal', 'external') as $source) {
- $tab = $object->liste_contact(-1, $source, 0, '', 1);
- $numcontact = count($tab);
- if (!empty($numcontact)) {
- foreach ($tab as $contactproject) {
- //var_dump($contacttask);
- if ($source == 'internal') {
- $c = new User($db);
- } else {
- $c = new Contact($db);
- }
- $c->fetch($contactproject['id']);
- if (!empty($c->photo)) {
- if (get_class($c) == 'User') {
- print $c->getNomUrl(-2, '', 0, 0, 24, 1, '', ($ifisrt ? '' : 'notfirst'));
- } else {
- print $c->getNomUrl(-2, '', 0, '', -1, 0, ($ifisrt ? '' : 'notfirst'));
- }
- } else {
- if (get_class($c) == 'User') {
- print $c->getNomUrl(2, '', 0, 0, 24, 1, '', ($ifisrt ? '' : 'notfirst'));
- } else {
- print $c->getNomUrl(2, '', 0, '', -1, 0, ($ifisrt ? '' : 'notfirst'));
- }
- }
- $ifisrt = 0;
- }
- }
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Opp Status
- if (!empty($arrayfields['p.fk_opp_status']['checked'])) {
- print '';
- if ($obj->opp_status_code) {
- print $langs->trans("OppStatus".$obj->opp_status_code);
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Opp Amount
- if (!empty($arrayfields['p.opp_amount']['checked'])) {
- print '';
- //if ($obj->opp_status_code)
- if (strcmp($obj->opp_amount, '')) {
- print ''.price($obj->opp_amount, 1, $langs, 1, -1, -1, '').' ';
- $totalarray['val']['p.opp_amount'] += $obj->opp_amount;
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 'p.opp_amount';
- }
- }
- // Opp percent
- if (!empty($arrayfields['p.opp_percent']['checked'])) {
- print '';
- if ($obj->opp_percent) {
- print price($obj->opp_percent, 1, $langs, 1, 0).'%';
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Opp weighted amount
- if (!empty($arrayfields['opp_weighted_amount']['checked'])) {
- if (!isset($totalarray['val']['opp_weighted_amount'])) {
- $totalarray['val']['opp_weighted_amount'] = 0;
- }
- print '';
- if ($obj->opp_weighted_amount) {
- print ''.price($obj->opp_weighted_amount, 1, $langs, 1, -1, -1, '').' ';
- $totalarray['val']['opp_weighted_amount'] += $obj->opp_weighted_amount;
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 'opp_weighted_amount';
- }
- }
- // Budget
- if (!empty($arrayfields['p.budget_amount']['checked'])) {
- print '';
- if ($obj->budget_amount != '') {
- print ''.price($obj->budget_amount, 1, $langs, 1, -1, -1).' ';
- $totalarray['val']['p.budget_amount'] += $obj->budget_amount;
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 'p.budget_amount';
- }
- }
- // Usage opportunity
- if (!empty($arrayfields['p.usage_opportunity']['checked'])) {
- print '';
- if ($obj->usage_opportunity) {
- print yn($obj->usage_opportunity);
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Usage task
- if (!empty($arrayfields['p.usage_task']['checked'])) {
- print '';
- if ($obj->usage_task) {
- print yn($obj->usage_task);
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Bill time
- if (!empty($arrayfields['p.usage_bill_time']['checked'])) {
- print '';
- if ($obj->usage_bill_time) {
- print yn($obj->usage_bill_time);
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Event Organization
- if (!empty($arrayfields['p.usage_organize_event']['checked'])) {
- print '';
- if ($obj->usage_organize_event) {
- print yn($obj->usage_organize_event);
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Allow unknown people to suggest conferences
- if (!empty($arrayfields['p.accept_conference_suggestions']['checked'])) {
- print '';
- if ($obj->accept_conference_suggestions) {
- print yn($obj->accept_conference_suggestions);
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Allow unknown people to suggest booth
- if (!empty($arrayfields['p.accept_booth_suggestions']['checked'])) {
- print '';
- if ($obj->accept_booth_suggestions) {
- print yn($obj->accept_booth_suggestions);
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Price of registration
- if (!empty($arrayfields['p.price_registration']['checked'])) {
- print '';
- if ($obj->price_registration != '') {
- print ''.price($obj->price_registration, 1, $langs, 1, -1, -1).' ';
- $totalarray['val']['p.price_registration'] += $obj->price_registration;
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 'p.price_registration';
- }
- }
- // Price of booth
- if (!empty($arrayfields['p.price_booth']['checked'])) {
- print '';
- if ($obj->price_booth != '') {
- print ''.price($obj->price_booth, 1, $langs, 1, -1, -1).' ';
- $totalarray['val']['p.price_booth'] += $obj->price_booth;
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 'p.price_booth';
- }
- }
- // Author
- $userstatic->id = $obj->fk_user_creat;
- $userstatic->login = $obj->login;
- $userstatic->lastname = $obj->lastname;
- $userstatic->firstname = $obj->firstname;
- $userstatic->email = $obj->user_email;
- $userstatic->statut = $obj->user_statut;
- $userstatic->entity = $obj->entity;
- $userstatic->photo = $obj->photo;
- $userstatic->office_phone = $obj->office_phone;
- $userstatic->office_fax = $obj->office_fax;
- $userstatic->user_mobile = $obj->user_mobile;
- $userstatic->job = $obj->job;
- $userstatic->gender = $obj->gender;
-
- if (!empty($arrayfields['u.login']['checked'])) {
- print '';
- if ($userstatic->id) {
- print $userstatic->getNomUrl(-1);
- } else {
- print ' ';
- }
- print " \n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Extra fields
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
- // Fields from hook
- $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
- $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
- // Date creation
- if (!empty($arrayfields['p.datec']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Date modification
- if (!empty($arrayfields['p.tms']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Email MsgID
- if (!empty($arrayfields['p.email_msgid']['checked'])) {
- print '';
- print $obj->email_msgid;
- print ' ';
- if (!$i) $totalarray['nbfield']++;
- }
- // Import key
- if (!empty($arrayfields['p.import_key']['checked'])) {
- print ''.dol_escape_htmltag($obj->import_key).' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Status
- if (!empty($arrayfields['p.fk_statut']['checked'])) {
- print ''.$object->getLibStatut(5).' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Action column
- if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
- print '';
- if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
- $selected = 0;
- if (in_array($obj->id, $arrayofselected)) {
- $selected = 1;
- }
- print ' ';
- }
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- print " \n";
+ if ($mode == 'kanban') {
+ if ($i == 0) {
+ print '';
+ print '';
}
+
+ print $object->getKanbanView('');
+
+ if ($i == ($imaxinloop - 1)) {
+ print '
';
+ print ' ';
+ }
+ } else {
+ // Show here line of result
+ $j = 0;
+ print '';
+ // Action column
+ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ print '';
+ if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
+ $selected = 0;
+ if (in_array($object->id, $arrayofselected)) {
+ $selected = 1;
+ }
+ print ' ';
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Project url
+ if (!empty($arrayfields['p.ref']['checked'])) {
+ print '';
+ print $object->getNomUrl(1, (!empty(GETPOST('search_usage_event_organization', 'int'))?'eventorganization':''));
+ if ($object->hasDelay()) {
+ print img_warning($langs->trans('Late'));
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Title
+ if (!empty($arrayfields['p.title']['checked'])) {
+ print '';
+ print dol_escape_htmltag($obj->title);
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Company
+ if (!empty($arrayfields['s.nom']['checked'])) {
+ print '';
+ if ($obj->socid) {
+ print $companystatic->getNomUrl(1, '', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
+ } else {
+ print ' ';
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Alias
+ if (!empty($arrayfields['s.name_alias']['checked'])) {
+ print '';
+ if ($obj->socid) {
+ print $companystatic->name_alias;
+ } else {
+ print ' ';
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Sales Representatives
+ if (!empty($arrayfields['commercial']['checked'])) {
+ print '';
+ if ($obj->socid) {
+ $companystatic->id = $obj->socid;
+ $companystatic->name = $obj->name;
+ $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
+ $nbofsalesrepresentative = count($listsalesrepresentatives);
+ if ($nbofsalesrepresentative > 6) {
+ // We print only number
+ print $nbofsalesrepresentative;
+ } elseif ($nbofsalesrepresentative > 0) {
+ $userstatic = new User($db);
+ $j = 0;
+ foreach ($listsalesrepresentatives as $val) {
+ $userstatic->id = $val['id'];
+ $userstatic->lastname = $val['lastname'];
+ $userstatic->firstname = $val['firstname'];
+ $userstatic->email = $val['email'];
+ $userstatic->statut = $val['statut'];
+ $userstatic->entity = $val['entity'];
+ $userstatic->photo = $val['photo'];
+ $userstatic->login = $val['login'];
+ $userstatic->office_phone = $val['office_phone'];
+ $userstatic->office_fax = $val['office_fax'];
+ $userstatic->user_mobile = $val['user_mobile'];
+ $userstatic->job = $val['job'];
+ $userstatic->gender = $val['gender'];
+ print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
+ $j++;
+ if ($j < $nbofsalesrepresentative) {
+ print ' ';
+ }
+ }
+ }
+ //else print $langs->trans("NoSalesRepresentativeAffected");
+ } else {
+ print ' ';
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Date start project
+ if (!empty($arrayfields['p.dateo']['checked'])) {
+ print '';
+ print dol_print_date($db->jdate($obj->date_start), 'day');
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Date end project
+ if (!empty($arrayfields['p.datee']['checked'])) {
+ print '';
+ print dol_print_date($db->jdate($obj->date_end), 'day');
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Visibility
+ if (!empty($arrayfields['p.public']['checked'])) {
+ print '';
+ if ($obj->public) {
+ print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"');
+ //print $langs->trans('SharedProject');
+ } else {
+ print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"');
+ //print $langs->trans('PrivateProject');
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Contacts of project
+ if (!empty($arrayfields['c.assigned']['checked'])) {
+ print '';
+ $ifisrt = 1;
+ foreach (array('internal', 'external') as $source) {
+ $tab = $object->liste_contact(-1, $source, 0, '', 1);
+ $numcontact = count($tab);
+ if (!empty($numcontact)) {
+ foreach ($tab as $contactproject) {
+ //var_dump($contacttask);
+ if ($source == 'internal') {
+ $c = new User($db);
+ } else {
+ $c = new Contact($db);
+ }
+ $c->fetch($contactproject['id']);
+ if (!empty($c->photo)) {
+ if (get_class($c) == 'User') {
+ print $c->getNomUrl(-2, '', 0, 0, 24, 1, '', ($ifisrt ? '' : 'notfirst'));
+ } else {
+ print $c->getNomUrl(-2, '', 0, '', -1, 0, ($ifisrt ? '' : 'notfirst'));
+ }
+ } else {
+ if (get_class($c) == 'User') {
+ print $c->getNomUrl(2, '', 0, 0, 24, 1, '', ($ifisrt ? '' : 'notfirst'));
+ } else {
+ print $c->getNomUrl(2, '', 0, '', -1, 0, ($ifisrt ? '' : 'notfirst'));
+ }
+ }
+ $ifisrt = 0;
+ }
+ }
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Opp Status
+ if (!empty($arrayfields['p.fk_opp_status']['checked'])) {
+ print '';
+ if ($obj->opp_status_code) {
+ print $langs->trans("OppStatus".$obj->opp_status_code);
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Opp Amount
+ if (!empty($arrayfields['p.opp_amount']['checked'])) {
+ print '';
+ //if ($obj->opp_status_code)
+ if (strcmp($obj->opp_amount, '')) {
+ print ''.price($obj->opp_amount, 1, $langs, 1, -1, -1, '').' ';
+ $totalarray['val']['p.opp_amount'] += $obj->opp_amount;
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'p.opp_amount';
+ }
+ }
+ // Opp percent
+ if (!empty($arrayfields['p.opp_percent']['checked'])) {
+ print '';
+ if ($obj->opp_percent) {
+ print price($obj->opp_percent, 1, $langs, 1, 0).'%';
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Opp weighted amount
+ if (!empty($arrayfields['opp_weighted_amount']['checked'])) {
+ if (!isset($totalarray['val']['opp_weighted_amount'])) {
+ $totalarray['val']['opp_weighted_amount'] = 0;
+ }
+ print '';
+ if ($obj->opp_weighted_amount) {
+ print ''.price($obj->opp_weighted_amount, 1, $langs, 1, -1, -1, '').' ';
+ $totalarray['val']['opp_weighted_amount'] += $obj->opp_weighted_amount;
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'opp_weighted_amount';
+ }
+ }
+ // Budget
+ if (!empty($arrayfields['p.budget_amount']['checked'])) {
+ print '';
+ if ($obj->budget_amount != '') {
+ print ''.price($obj->budget_amount, 1, $langs, 1, -1, -1).' ';
+ $totalarray['val']['p.budget_amount'] += $obj->budget_amount;
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'p.budget_amount';
+ }
+ }
+ // Usage opportunity
+ if (!empty($arrayfields['p.usage_opportunity']['checked'])) {
+ print '';
+ if ($obj->usage_opportunity) {
+ print yn($obj->usage_opportunity);
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Usage task
+ if (!empty($arrayfields['p.usage_task']['checked'])) {
+ print '';
+ if ($obj->usage_task) {
+ print yn($obj->usage_task);
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Bill time
+ if (!empty($arrayfields['p.usage_bill_time']['checked'])) {
+ print '';
+ if ($obj->usage_bill_time) {
+ print yn($obj->usage_bill_time);
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Event Organization
+ if (!empty($arrayfields['p.usage_organize_event']['checked'])) {
+ print '';
+ if ($obj->usage_organize_event) {
+ print yn($obj->usage_organize_event);
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Allow unknown people to suggest conferences
+ if (!empty($arrayfields['p.accept_conference_suggestions']['checked'])) {
+ print '';
+ if ($obj->accept_conference_suggestions) {
+ print yn($obj->accept_conference_suggestions);
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Allow unknown people to suggest booth
+ if (!empty($arrayfields['p.accept_booth_suggestions']['checked'])) {
+ print '';
+ if ($obj->accept_booth_suggestions) {
+ print yn($obj->accept_booth_suggestions);
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Price of registration
+ if (!empty($arrayfields['p.price_registration']['checked'])) {
+ print '';
+ if ($obj->price_registration != '') {
+ print ''.price($obj->price_registration, 1, $langs, 1, -1, -1).' ';
+ $totalarray['val']['p.price_registration'] += $obj->price_registration;
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'p.price_registration';
+ }
+ }
+ // Price of booth
+ if (!empty($arrayfields['p.price_booth']['checked'])) {
+ print '';
+ if ($obj->price_booth != '') {
+ print ''.price($obj->price_booth, 1, $langs, 1, -1, -1).' ';
+ $totalarray['val']['p.price_booth'] += $obj->price_booth;
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'p.price_booth';
+ }
+ }
+ // Author
+ $userstatic->id = $obj->fk_user_creat;
+ $userstatic->login = $obj->login;
+ $userstatic->lastname = $obj->lastname;
+ $userstatic->firstname = $obj->firstname;
+ $userstatic->email = $obj->user_email;
+ $userstatic->statut = $obj->user_statut;
+ $userstatic->entity = $obj->entity;
+ $userstatic->photo = $obj->photo;
+ $userstatic->office_phone = $obj->office_phone;
+ $userstatic->office_fax = $obj->office_fax;
+ $userstatic->user_mobile = $obj->user_mobile;
+ $userstatic->job = $obj->job;
+ $userstatic->gender = $obj->gender;
+
+ if (!empty($arrayfields['u.login']['checked'])) {
+ print '';
+ if ($userstatic->id) {
+ print $userstatic->getNomUrl(-1);
+ } else {
+ print ' ';
+ }
+ print " \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Extra fields
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
+ // Fields from hook
+ $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
+ $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+ print $hookmanager->resPrint;
+ // Date creation
+ if (!empty($arrayfields['p.datec']['checked'])) {
+ print '';
+ print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Date modification
+ if (!empty($arrayfields['p.tms']['checked'])) {
+ print '';
+ print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Email MsgID
+ if (!empty($arrayfields['p.email_msgid']['checked'])) {
+ print '';
+ print $obj->email_msgid;
+ print ' ';
+ if (!$i) $totalarray['nbfield']++;
+ }
+ // Import key
+ if (!empty($arrayfields['p.import_key']['checked'])) {
+ print ''.dol_escape_htmltag($obj->import_key).' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Status
+ if (!empty($arrayfields['p.fk_statut']['checked'])) {
+ print ''.$object->getLibStatut(5).' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Action column
+ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ print '';
+ if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
+ $selected = 0;
+ if (in_array($object->id, $arrayofselected)) {
+ $selected = 1;
+ }
+ print ' ';
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ print ' '."\n";
}
+ //}
$i++;
}
@@ -1863,10 +1911,10 @@ $parameters = array('arrayfields'=>$arrayfields, 'sql' => $sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
-print "\n";
-print '