Fix orphelins for categories tables

This commit is contained in:
Laurent Destailleur 2017-06-02 13:46:30 +02:00
parent c59d216cf5
commit 447db1b324
3 changed files with 21 additions and 14 deletions

View File

@ -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);

View File

@ -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.

View File

@ -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 '<td class="liste_titr
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
@ -649,7 +649,7 @@ while ($i < min($num,$limit))
$projectstatic->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 '</td>';
if (! $i) $totalarray['nbfield']++;
}
}
// Label
if (! empty($arrayfields['t.label']['checked']))
{
@ -730,7 +730,7 @@ while ($i < min($num,$limit))
print '</td>';
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 '</td>';
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 '</td>';
if (! $i) $totalarray['nbfield']++;
print "</tr>\n";
//print projectLinesa();
}
$i++;
$i++;
}
// Show total line