From 447db1b3245a56e98ea53c9448ebe7a685d180fb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Jun 2017 13:46:30 +0200 Subject: [PATCH] Fix orphelins for categories tables --- .../install/mysql/migration/5.0.0-6.0.0.sql | 6 ++++ htdocs/install/mysql/migration/repair.sql | 1 + htdocs/projet/tasks/list.php | 28 +++++++++---------- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index f8b638b079a..11a86724cf0 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -348,5 +348,11 @@ ALTER TABLE llx_facture ADD COLUMN fk_fac_rec_source integer; DELETE from llx_c_actioncomm where code in ('AC_PROP','AC_COM','AC_FAC','AC_SHIP','AC_SUP_ORD','AC_SUP_INV') AND id NOT IN (SELECT DISTINCT fk_action FROM llx_actioncomm); +-- Fix: delete orphelin category. +delete from llx_categorie_product where fk_categorie not in (select rowid from llx_categorie where type = 0); +delete from llx_categorie_societe where fk_categorie not in (select rowid from llx_categorie where type in (1, 2)); +delete from llx_categorie_member where fk_categorie not in (select rowid from llx_categorie where type = 3); +delete from llx_categorie_contact where fk_categorie not in (select rowid from llx_categorie where type = 4); +delete from llx_categorie_project where fk_categorie not in (select rowid from llx_categorie where type = 5); ALTER TABLE llx_inventory ADD COLUMN ref varchar(48); \ No newline at end of file diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 4d3658d20bb..c748f38acb3 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -124,6 +124,7 @@ delete from llx_categorie_product where fk_categorie not in (select rowid from l delete from llx_categorie_societe where fk_categorie not in (select rowid from llx_categorie where type in (1, 2)); delete from llx_categorie_member where fk_categorie not in (select rowid from llx_categorie where type = 3); delete from llx_categorie_contact where fk_categorie not in (select rowid from llx_categorie where type = 4); +delete from llx_categorie_project where fk_categorie not in (select rowid from llx_categorie where type = 5); -- Fix: delete orphelin deliveries. Note: deliveries are linked to shipment by llx_element_element only. No other links. diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 4e31434dbc4..4af874ce21e 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -43,7 +43,7 @@ $id=GETPOST('id','int'); $search_all=GETPOST('search_all', 'alphanohtml'); $search_categ=GETPOST("search_categ",'alpha'); $search_project=GETPOST('search_project'); -if (! isset($_GET['search_projectstatus']) && ! isset($_POST['search_projectstatus'])) +if (! isset($_GET['search_projectstatus']) && ! isset($_POST['search_projectstatus'])) { if ($search_all != '') $search_projectstatus=-1; else $search_projectstatus=1; @@ -173,14 +173,14 @@ if (empty($reshook)) $toselect=''; $search_array_options=array(); } - + // Mass actions $objectclass='Task'; $objectlabel='Tasks'; $permtoread = $user->rights->projet->lire; $permtodelete = $user->rights->projet->supprimer; $uploaddir = $conf->projet->dir_output.'/tasks'; - include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } if (empty($search_projectstatus) && $search_projectstatus == '') $search_projectstatus=1; @@ -322,7 +322,7 @@ foreach ($search_array_options as $key => $val) $typ=$extrafields->attribute_type[$tmpkey]; $mode=0; if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric - if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) + if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) { $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); } @@ -396,7 +396,7 @@ foreach ($search_array_options as $key => $val) $tmpkey=preg_replace('/search_options_/','',$key); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); } - + // List of mass actions available $arrayofmassactions = array( // 'presend'=>$langs->trans("SendByMail"), @@ -544,7 +544,7 @@ if (! empty($arrayfields['t.progress']['checked'])) print 'public = $obj->public; $projectstatic->statut = $obj->projectstatus; $projectstatic->datee = $db->jdate($obj->projectdatee); - + $userAccess = $projectstatic->restrictedProjectArea($user); // why this ? if ($userAccess >= 0) { @@ -663,7 +663,7 @@ while ($i < min($num,$limit)) if ($object->hasDelay()) print img_warning("Late"); print ''; if (! $i) $totalarray['nbfield']++; - } + } // Label if (! empty($arrayfields['t.label']['checked'])) { @@ -730,7 +730,7 @@ while ($i < min($num,$limit)) print ''; if (! $i) $totalarray['nbfield']++; } - + // Planned workload if (! empty($arrayfields['t.planned_workload']['checked'])) { @@ -764,7 +764,7 @@ while ($i < min($num,$limit)) if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totaldurationeffectivefield']=$totalarray['nbfield']; $totalarray['totaldurationeffective'] += $obj->duration_effective; - } + } // Calculated progress if (! empty($arrayfields['t.progress_calculated']['checked'])) { @@ -777,7 +777,7 @@ while ($i < min($num,$limit)) print ''; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalprogress_calculated']=$totalarray['nbfield']; - } + } // Declared progress if (! empty($arrayfields['t.progress']['checked'])) { @@ -843,13 +843,13 @@ while ($i < min($num,$limit)) } print ''; if (! $i) $totalarray['nbfield']++; - + print "\n"; - + //print projectLinesa(); } - $i++; + $i++; } // Show total line