';
+ return $return;
+ }
}
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index 6da7fcf3779..5f9abeb743b 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -461,7 +461,6 @@ if ($resql) {
} else {
dol_print_error($db);
}
-
$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.address, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, s.logo,";
$sql .= " s.entity,";
$sql .= " st.libelle as stcomm, st.picto as stcomm_picto, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,";
@@ -479,7 +478,7 @@ if ($search_sale && $search_sale != '-1') {
$sql .= ", sc.fk_soc, sc.fk_user";
}
// Add fields from extrafields
-if (!empty($extrafields->attributes[$object->table_element]['label'])) {
+if (empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
}
@@ -493,9 +492,10 @@ $sqlfields = $sql; // $sql fields to remove for count total
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s.parent = s2.rowid";
-if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (s.rowid = ef.fk_object)";
+if (empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."extrafields as ef on (s.rowid = ef.fk_object)";
}
+
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_effectif as staff on (staff.id = s.fk_effectif)";
@@ -504,7 +504,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region.code_region
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id";
// We'll need this table joined to the select in order to filter by sale
if ($search_sale == -2) {
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
//elseif ($search_sale || (empty($user->rights->societe->client->voir) && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->societe->client->readallthirdparties_advance)) && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
} elseif (!empty($search_sale) && $search_sale != '-1' || (empty($user->rights->societe->client->voir) && !$socid)) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@@ -783,6 +783,9 @@ $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('', $title, $help_url);
$param = '';
+if (!empty($mode)) {
+ $param .= '&mode='.urlencode($mode);
+}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
@@ -969,7 +972,10 @@ if ($contextpage != 'poslist') {
if (!empty($socid)) {
$url .= '&socid='.$socid;
}
- $newcardbutton = dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url, '', $user->rights->societe->creer);
+ $newcardbutton = '';
+ $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
+ $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
+ $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url, '', $user->rights->societe->creer);
} elseif ($user->rights->societe->creer) {
$url = DOL_URL_ROOT.'/societe/card.php?action=create&type=t&contextpage=poslist&optioncss=print&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type=t&contextpage=poslist&nomassaction=1&optioncss=print&place='.$place);
$label = 'MenuNewCustomer';
@@ -986,6 +992,7 @@ print '';
print '';
//print '';
print '';
+print '';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'building', 0, $newcardbutton, '', $limit, 0, 0, 1);
@@ -1476,349 +1483,364 @@ while ($i < min($num, $limit)) {
$companystatic->entity = $obj->entity;
}
- print '
';
+ if ($mode == 'kanban') {
+ if ($i == 0) {
+ print '
';
+ print '
';
+ }
- // Action column (Show the massaction button only when this page is not opend from the Extended POS)
- if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
- print '
';
- if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // 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->rowid, $arrayofselected)) {
- $selected = 1;
- }
- print '';
+ // Output Kanban
+ print $companystatic->getKanbanView('');
+ //print_r($obj->nb_rights);
+ if ($i == ($imaxinloop - 1)) {
+ print '';
+ print '
';
- foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
- $titlealt = 'default';
- if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) {
- $titlealt = $val['label'];
+ // Action column (Show the massaction button only when this page is not opend from the Extended POS)
+ if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+ print '
\n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Action column (Show the massaction button only when this page is not opend from the Extended POS)
- if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
- print '
';
- if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // 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->rowid, $arrayofselected)) {
- $selected = 1;
+ if (!empty($arrayfields['s.rowid']['checked'])) {
+ print '
';
+ print $obj->rowid;
+ print "
\n";
+ if (!$i) {
+ $totalarray['nbfield']++;
}
- print '';
}
- print '';
- if (!$i) {
- $totalarray['nbfield']++;
+ if (!empty($arrayfields['s.nom']['checked'])) {
+ print '
\n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Action column (Show the massaction button only when this page is not opend from the Extended POS)
+ if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+ print '
';
+ if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // 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->rowid, $arrayofselected)) {
+ $selected = 1;
+ }
+ print '';
+ }
+ print '