Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into 7.0

Conflicts:
	htdocs/accountancy/class/accountancycategory.class.php
	htdocs/core/actions_massactions.inc.php
	htdocs/product/reassort.php
This commit is contained in:
Laurent Destailleur 2018-10-19 14:16:53 +02:00
commit de4ead2558
8 changed files with 102 additions and 45 deletions

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -491,9 +492,9 @@ class AccountancyCategory
* Get all accounting account of a group.
* You must choose between first parameter (personalized group) or the second (free criteria filter)
*
* @param int $cat_id Id if personalized accounting group/category
* @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts
* @return array|int Array of accounting accounts or -1 if error
* @param int $cat_id Id if personalized accounting group/category
* @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts
* @return array|int Array of accounting accounts or -1 if error
*/
public function getCptsCat($cat_id, $predefinedgroupwhere='')
{

View File

@ -1005,6 +1005,28 @@ if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm ==
continue;
}*/
if ($objectclass == "Task" && $objecttmp->hasChildren() > 0)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET fk_task_parent = 0 WHERE fk_task_parent = ".$objecttmp->id;
$res = $db->query($sql);
if (!$res)
{
setEventMessage('ErrorRecordParentingNotModified', 'errors');
$error++;
}
}
if (in_array($objecttmp->element, array('societe','member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1);
else $result = $objecttmp->delete($user);
if ($result <= 0)
{
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
}
else $nbok++;
if (in_array($objecttmp->element, array('societe','member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1);
else $result = $objecttmp->delete($user);

View File

@ -13,6 +13,7 @@
* Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -6480,11 +6481,12 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode=
// No need to make a return $head. Var is modified as a reference
if (! empty($hookmanager))
{
$parameters=array('object' => $object, 'mode' => $mode, 'head'=>$head);
$reshook=$hookmanager->executeHooks('completeTabsHead',$parameters);
$parameters=array('object' => $object, 'mode' => $mode, 'head' => $head);
$reshook=$hookmanager->executeHooks('completeTabsHead', $parameters);
if ($reshook > 0)
{
$head = $hookmanager->resArray;
$h = count($head);
}
}
}

View File

@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
/* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,10 +21,9 @@
*/
/**
* \file htdocs/core/lib/order.lib.php
* \brief Ensemble de fonctions de base pour le module commande
* \ingroup commande
*/
* \file htdocs/core/lib/import.lib.php
* \brief Ensemble de fonctions de base pour le module import
* \ingroup import
/**
* Function to return list of tabs for import pages

View File

@ -12,7 +12,7 @@
* Copyright (C) 2014 Henry Florian <florian.henry@open-concept.pro>
* Copyright (C) 2014-2016 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2014 Ion agorria <ion@agorria.com>
* Copyright (C) 2016-2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2017 Gustavo Novaro
*
* This program is free software; you can redistribute it and/or modify
@ -1078,7 +1078,7 @@ class Product extends CommonObject
$sql.= " WHERE fk_product_stock IN (";
$sql.= "SELECT rowid FROM ".MAIN_DB_PREFIX.'product_stock';
$sql.= " WHERE fk_product = ".$id.")";
dol_syslog(get_class($this).'::delete', LOG_DEBUG);
$result = $this->db->query($sql);
if (! $result)
{
@ -1097,7 +1097,7 @@ class Product extends CommonObject
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE fk_product = ".$id;
dol_syslog(get_class($this).'::delete', LOG_DEBUG);
$result = $this->db->query($sql);
if (! $result)
{
@ -1128,12 +1128,25 @@ class Product extends CommonObject
}
}
// Delete from product_association
if (!$error){
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_association";
$sql.= " WHERE fk_product_pere = ".$id." OR fk_product_fils = ".$id;
$result = $this->db->query($sql);
if (! $result)
{
$error++;
$this->errors[] = $this->db->lasterror();
}
}
// Delete product
if (! $error)
{
$sqlz = "DELETE FROM ".MAIN_DB_PREFIX."product";
$sqlz.= " WHERE rowid = ".$id;
dol_syslog(get_class($this).'::delete', LOG_DEBUG);
$resultz = $this->db->query($sqlz);
if ( ! $resultz )
{

View File

@ -54,6 +54,7 @@ $fourn_id = GETPOST("fourn_id",'int');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if (empty($page) || $page < 0) $page = 0;
if (! $sortfield) $sortfield="p.ref";
if (! $sortorder) $sortorder="ASC";
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
@ -91,11 +92,15 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$sref="";
$snom="";
$sall="";
$tosell="";
$tobuy="";
$search_sale="";
$search_categ="";
$type="";
$catid='';
$toolowstock='';
$fourn_id='';
$sbarcode='';
}
@ -182,6 +187,20 @@ if ($resql)
}
$texte.=' ('.$langs->trans("Stocks").')';
$param='';
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sall) $param.="&sall=".$sall;
if ($tosell) $param.="&tosell=".$tosell;
if ($tobuy) $param.="&tobuy=".$tobuy;
if ($type) $param.="&type=".$type;
if ($fourn_id) $param.="&fourn_id=".$fourn_id;
if ($snom) $param.="&snom=".$snom;
if ($sref) $param.="&sref=".$sref;
if ($search_sale) $param.="&search_sale=".$search_sale;
if ($search_categ) $param.="&search_categ=".$search_categ;
if ($toolowstock) $param.="&toolowstock=".$toolowstock;
if ($sbarcode) $param.="&sbarcode=".$sbarcode;
if ($catid) $param.="&catid=".$catid;
llxHeader("", $texte, $helpurl);
@ -192,14 +211,7 @@ if ($resql)
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="type" value="'.$type.'">';
if ($sref || $snom || $sall || GETPOST('search'))
{
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&amp;sall=".$sall."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy.(!empty($search_categ) ? '&amp;search_categ='.$search_categ : '').(!empty($toolowstock) ? '&amp;toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit);
}
else
{
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&amp;type=$type":"").(!empty($search_categ) ? '&amp;search_categ='.$search_categ : '').(!empty($toolowstock) ? '&amp;toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit);
}
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit);
if (! empty($catid))
{

View File

@ -59,6 +59,7 @@ $fourn_id = GETPOST("fourn_id",'int');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if (empty($page) || $page < 0) $page = 0;
if (! $sortfield) $sortfield="p.ref";
if (! $sortorder) $sortorder="ASC";
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
@ -89,6 +90,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$sref="";
$snom="";
$sall="";
$tosell="";
$tobuy="";
$search_sale="";
$search_categ="";
$type="";
@ -96,6 +99,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$toolowstock='';
$search_batch='';
$search_warehouse='';
$fourn_id='';
$sbarcode='';
}
@ -194,6 +199,24 @@ if ($resql)
}
$texte.=' ('.$langs->trans("StocksByLotSerial").')';
$param='';
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sall) $param.="&sall=".$sall;
if ($tosell) $param.="&tosell=".$tosell;
if ($tobuy) $param.="&tobuy=".$tobuy;
if ($type) $param.="&type=".$type;
if ($fourn_id) $param.="&fourn_id=".$fourn_id;
if ($snom) $param.="&snom=".$snom;
if ($sref) $param.="&sref=".$sref;
if ($search_batch) $param.="&search_batch=".$search_batch;
if ($sbarcode) $param.="&sbarcode=".$sbarcode;
if ($search_warehouse) $param.="&search_warehouse=".$search_warehouse;
if ($catid) $param.="&catid=".$catid;
if ($toolowstock) $param.="&toolowstock=".$toolowstock;
if ($search_sale) $param.="&search_sale=".$search_sale;
if ($search_categ) $param.="&search_categ=".$search_categ;
/*if ($eatby) $param.="&eatby=".$eatby;
if ($sellby) $param.="&sellby=".$sellby;*/
llxHeader("",$title,$helpurl,$texte);
@ -204,14 +227,8 @@ if ($resql)
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="type" value="'.$type.'">';
if ($sref || $snom || $sall || GETPOST('search'))
{
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&amp;sall=".$sall."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit);
}
else
{
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&amp;type=$type":""), $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit);
}
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit);
if (! empty($catid))
{
@ -245,17 +262,6 @@ if ($resql)
}
$param='';
if ($tosell) $param.="&tosell=".$tosell;
if ($tobuy) $param.="&tobuy=".$tobuy;
if ($type) $param.="&type=".$type;
if ($fourn_id) $param.="&fourn_id=".$fourn_id;
if ($snom) $param.="&snom=".$snom;
if ($sref) $param.="&sref=".$sref;
if ($search_batch) $param.="&search_batch=".$search_batch;
/*if ($eatby) $param.="&eatby=".$eatby;
if ($sellby) $param.="&sellby=".$sellby;*/
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';

View File

@ -47,6 +47,7 @@ $id = GETPOST('id','int');
$action = GETPOST('action','alpha');
$backtopage = GETPOST('backtopage','alpha');
$myparam = GETPOST('myparam','alpha');
$toselect = GETPOST('toselect', 'array');
$search_entity=GETPOST('search_entity','int');
@ -152,7 +153,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$search_import_key='';
$search_date_creation='';
$search_date_update='';
$toselect='';
$toselect=array();
$search_array_options=array();
}