Merge remote-tracking branch 'origin/3.9' into develop

Conflicts:
	htdocs/admin/menus/edit.php
	htdocs/fourn/ajax/getSupplierPrices.php
	htdocs/societe/consumption.php
This commit is contained in:
Laurent Destailleur 2016-06-04 01:14:36 +02:00
commit b57476153f
16 changed files with 108 additions and 49 deletions

View File

@ -272,7 +272,7 @@ if ($action == 'create')
</script>';
print load_fiche_titre($langs->trans("NewMenu"),'','title_setup');
print '<form action="./edit.php?action=add&menuId='.$_GET['menuId'].'" method="post" name="formmenucreate">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -284,7 +284,7 @@ if ($action == 'create')
$parent_rowid = $_GET['menuId'];
if ($_GET['menuId'])
{
$sql = "SELECT m.rowid, m.mainmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".$_GET['menuId'];
$sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".$_GET['menuId'];
$res = $db->query($sql);
if ($res)
{
@ -293,6 +293,7 @@ if ($action == 'create')
{
$parent_rowid = $menu['rowid'];
$parent_mainmenu = $menu['mainmenu'];
$parent_leftmenu = $menu['leftmenu'];
$parent_langs = $menu['langs'];
$parent_level = $menu['level'];
}
@ -343,7 +344,9 @@ if ($action == 'create')
{
print '<td><input type="text" size="20" id="menuId" name="menuId" value="'.($_POST["menuId"]?$_POST["menuId"]:'').'"></td>';
}
print '<td>'.$langs->trans('DetailMenuIdParent').'</td></tr>';
print '<td>'.$langs->trans('DetailMenuIdParent');
print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
print '</td></tr>';
// Title
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.$_POST["titre"].'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
@ -423,9 +426,10 @@ elseif ($action == 'edit')
// MenuId Parent
print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent').'</td>';
print '<td><input type="text" name="fk_menu" value="'.$menu->fk_menu.'" size=10></td>';
//$menu_handler
//print '<td><input type="text" size="50" name="handler" value="all"></td>';
$valtouse=$menu->fk_menu;
if ($menu->fk_mainmenu) $valtouse='fk_mainmenu='.$menu->fk_mainmenu;
if ($menu->fk_leftmenu) $valtouse.='&fk_leftmenu='.$menu->fk_leftmenu;
print '<td><input type="text" name="fk_menu" value="'.$valtouse.'" size="10"></td>';
print '<td>'.$langs->trans('DetailMenuIdParent').'</td></tr>';
// Niveau

View File

@ -289,17 +289,18 @@ if ($conf->use_javascript_ajax)
- la chaine a afficher
ie: data[]= array (index, index parent, chaine )
*/
//il faut d'abord declarer un element racine de l'arbre
$data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>'');
$data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>'');
//puis tous les elements enfants
$sql = "SELECT m.rowid, m.titre, m.langs, m.mainmenu, m.leftmenu, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu";
$sql = "SELECT m.rowid, m.titre, m.langs, m.mainmenu, m.leftmenu, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.module";
$sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
$sql.= " WHERE menu_handler = '".$menu_handler_to_search."'";
$sql.= " AND entity = ".$conf->entity;
$sql.= " AND fk_menu >= 0";
//$sql.= " AND fk_menu >= 0";
$sql.= " ORDER BY m.position, m.rowid"; // Order is position then rowid (because we need a sort criteria when position is same)
$res = $db->query($sql);
@ -314,9 +315,10 @@ if ($conf->use_javascript_ajax)
$titre = $langs->trans($menu['titre']);
$data[] = array(
'rowid'=>$menu['rowid'],
'module'=>$menu['module'],
'fk_menu'=>$menu['fk_menu'],
'title'=>$titre,
'mainmenu'=>$menu['mainmenu'],
'mainmenu'=>$menu['mainmenu'],
'leftmenu'=>$menu['leftmenu'],
'fk_mainmenu'=>$menu['fk_mainmenu'],
'fk_leftmenu'=>$menu['fk_leftmenu'],
@ -334,17 +336,54 @@ if ($conf->use_javascript_ajax)
}
}
global $tree_recur_alreadyadded; // This var was def into tree_recur
// Appelle de la fonction recursive (ammorce)
// avec recherche depuis la racine.
//var_dump($data);
tree_recur($data,$data[0],0);
tree_recur($data, $data[0], 0, 'iddivjstree'); // $data[0] is virtual record 'racine'
print '</td>';
print '</tr>';
print '</table>';
// Process remaining records (records that are not linked to root by any path)
$remainingdata = array();
foreach($data as $datar)
{
if (empty($datar['rowid']) || $tree_recur_alreadyadded[$datar['rowid']]) continue;
$remainingdata[] = $datar;
}
if (count($remainingdata))
{
print '<table class="border" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("NotTopTreeMenuPersonalized").'</td>';
print '<td align="right"></td>';
print '</tr>';
print '<tr>';
print '<td colspan="2">';
foreach($remainingdata as $datar)
{
$father = array('rowid'=>$datar['rowid'],'title'=>"???",'mainmenu'=>$datar['fk_mainmenu'],'leftmenu'=>$datar['fk_leftmenu'],'fk_mainmenu'=>'','fk_leftmenu'=>'');
//print 'Start with rowid='.$datar['rowid'].' mainmenu='.$father ['mainmenu'].' leftmenu='.$father ['leftmenu'].'<br>'."\n";
tree_recur($data, $father, 0, 'iddivjstree'.$datar['rowid'], 1, 1);
}
print '</td>';
print '</tr>';
print '</table>';
}
print '</div>';

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
@ -199,7 +199,7 @@ if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (
if ($filtert > 0 || $usergroup > 0)
{
$sql.= " AND (";
if ($filtert > 0) $sql.= "(ar.fk_element = ".$filtert." OR a.fk_user_action=".$filtert.")";
if ($filtert > 0) $sql.= "(ar.fk_element = ".$filtert." OR (ar.fk_element IS NULL AND a.fk_user_action=".$filtert."))"; // The OR is for backward compatibility
if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
$sql.= ")";
}
@ -368,7 +368,7 @@ if ($resql)
$actionstatic->type_code=$obj->type_code;
$actionstatic->type_label=$obj->type_label;
$actionstatic->label=$obj->label;
print $actionstatic->getNomUrl(1,28);
print $actionstatic->getNomUrl(1,36);
print '</td>';
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))

View File

@ -206,7 +206,7 @@ class CommandeStats extends Stats
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
$sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
//if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE ".$this->where;
$sql.= " AND c.rowid = tl.fk_commande AND tl.fk_product = product.rowid";
$sql.= " AND c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year,1,false))."' AND '".$this->db->idate(dol_get_last_day($year,12,false))."'";

View File

@ -2036,7 +2036,7 @@ if ($action == 'create')
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
}
$absolute_discount = $soc->getAvailableDiscounts();
if(!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts();
if (! empty($conf->use_javascript_ajax))
{

View File

@ -256,7 +256,7 @@ if ($resql)
print '<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="6" name="search_ref_customer value="'.dol_escape_htmltag($search_ref_supplier).'">';
print '<input type="text" class="flat" size="6" name="search_ref_customer value="'.dol_escape_htmltag($search_ref_customer).'">';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="6" name="search_ref_supplier value="'.dol_escape_htmltag($search_ref_supplier).'">';

View File

@ -264,6 +264,8 @@ class Menubase
$sql.= " t.mainmenu,";
$sql.= " t.leftmenu,";
$sql.= " t.fk_menu,";
$sql.= " t.fk_mainmenu,";
$sql.= " t.fk_leftmenu,";
$sql.= " t.position,";
$sql.= " t.url,";
$sql.= " t.target,";
@ -293,6 +295,8 @@ class Menubase
$this->mainmenu = $obj->mainmenu;
$this->leftmenu = $obj->leftmenu;
$this->fk_menu = $obj->fk_menu;
$this->fk_mainmenu = $obj->fk_mainmenu;
$this->fk_leftmenu = $obj->fk_leftmenu;
$this->position = $obj->position;
$this->url = $obj->url;
$this->target = $obj->target;

View File

@ -109,15 +109,17 @@ function tree_showpad(&$fulltree,$key,$silent=0)
* @param int $pere Array with parent ids ('rowid'=>,'mainmenu'=>,'leftmenu'=>,'fk_mainmenu=>,'fk_leftmenu=>)
* @param int $rang Level of element
* @param string $iddivjstree Id to use for parent ul element
* @param int $donoresetalreadyloaded Do not reset global array $donoresetalreadyloaded used to avoid to go down on an aleady processed record
* @param int $showfk Show fk links to parent into label
* @return void
*/
function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree')
function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetalreadyloaded=0, $showfk=0)
{
global $tree_recur_alreadyadded;
if ($rang == 0) $tree_recur_alreadyadded=array();
if ($rang == 0 && empty($donoresetalreadyloaded)) $tree_recur_alreadyadded=array();
if (empty($pere['rowid']))
if ($rang == 0)
{
// Test also done with jstree and dynatree (not able to have <a> inside label)
print '<script type="text/javascript" language="javascript">
@ -161,7 +163,9 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree')
}
print "\n".'<li '.($tab[$x]['statut']?' class="liuseractive"':'class="liuserdisabled"').'>';
print $tab[$x]['entry'];
$tree_recur_alreadyadded[$tab[$x]['rowid']]=$rang;
if ($showfk) print '&nbsp; (fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].')';
//print ' -> A '.$tab[$x]['rowid'].' mainmenu='.$tab[$x]['mainmenu'].' leftmenu='.$tab[$x]['leftmenu'].' fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].'<br>'."\n";
$tree_recur_alreadyadded[$tab[$x]['rowid']]=($rang + 1);
// And now we search all its sons of lower level
tree_recur($tab,$tab[$x],$rang+1);
print '</li>';
@ -173,7 +177,8 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree')
{
if (! empty($tree_recur_alreadyadded[$tab[$x]['rowid']]))
{
dol_syslog('Error, record with id '.$tab[$x]['rowid'].' seems to be a child of record with id '.$pere['rowid'].' but it was already output. Complete field "leftmenu" and "mainmenu" on ALL records to avoid ambiguity.', LOG_WARNING);
dol_syslog('Error, record with id '.$tab[$x]['rowid'].' seems to be a child of record with id '.$pere['rowid'].' but it was already output. Complete field "leftmenu" and "mainmenu" on ALL records to avoid ambiguity.', LOG_WARNING);
//print 'Error, record with id '.$tab[$x]['rowid'].' seems to be a child of record with id '.$pere['rowid'].' but it was already output. Complete field "leftmenu" and "mainmenu" on ALL records to avoid ambiguity.';
continue;
}
@ -181,15 +186,17 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree')
}
print "\n".'<li '.($tab[$x]['statut']?' class="liuseractive"':'class="liuserdisabled"').'>';
print $tab[$x]['entry'];
$tree_recur_alreadyadded[$tab[$x]['rowid']]=$rang;
if ($showfk) print '&nbsp; (fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].')';
//print ' -> B '.$tab[$x]['rowid'].' mainmenu='.$tab[$x]['mainmenu'].' leftmenu='.$tab[$x]['leftmenu'].' fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].'<br>'."\n";
$tree_recur_alreadyadded[$tab[$x]['rowid']]=($rang + 1);
// And now we search all its sons of lower level
//print 'Appel de tree_recur pour x='.$x.' rowid='.$tab[$x]['rowid']." fk_mainmenu pere = ".$tab[$x]['fk_mainmenu']." fk_leftmenu pere = ".$tab[$x]['fk_leftmenu']."<br>\n";
//print 'Call tree_recur for x='.$x.' rowid='.$tab[$x]['rowid']." fk_mainmenu pere = ".$tab[$x]['fk_mainmenu']." fk_leftmenu pere = ".$tab[$x]['fk_leftmenu']."<br>\n";
tree_recur($tab,$tab[$x],$rang+1);
print '</li>';
}
}
if (! empty($ulprinted) && ! empty($pere['rowid'])) { print '</ul>'."\n"; }
if (empty($pere['rowid'])) print '</ul>';
if ($rang == 0) print '</ul>';
}

View File

@ -711,7 +711,7 @@ class pdf_azur extends ModelePDFPropales
if (file_exists($infile) && is_readable($infile)) {
$pagecount = $pdf->setSourceFile($infile);
for($i = 1; $i <= $pagecount; $i ++) {
$tplIdx = $pdf->importPage(1);
$tplIdx = $pdf->importPage($i);
if ($tplIdx!==false) {
$s = $pdf->getTemplatesize($tplIdx);
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');

View File

@ -92,13 +92,16 @@ if ($idprod > 0)
}
}
// Add price for pmp
$price=$producttmp->pmp;
$prices[] = array("id" => 'pmpprice', "price" => price2num($price), "label" => $langs->trans("PMPValueShort").': '.price($price,0,$langs,0,0,-1,$conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price,0,$langs,0,0,-1,$conf->currency)); // For price field, we must use price2num(), for label or title, price()
// Add price for costprice
$price=$producttmp->cost_price;
$prices[] = array("id" => 'costprice', "price" => price2num($price), "label" => $langs->trans("CostPrice").': '.price($price,0,$langs,0,0,-1,$conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price,0,$langs,0,0,-1,$conf->currency)); // For price field, we must use price2num(), for label or title, price()
if(!empty($conf->stock->enabled))
{
// Add price for pmp
$price=$producttmp->pmp;
$prices[] = array("id" => 'pmpprice', "price" => price2num($price), "label" => $langs->trans("PMPValueShort").': '.price($price,0,$langs,0,0,-1,$conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price,0,$langs,0,0,-1,$conf->currency)); // For price field, we must use price2num(), for label or title, price()
}
}
echo json_encode($prices);

View File

@ -610,3 +610,4 @@ INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (14
-- VMYSQL4.1 ALTER TABLE llx_c_type_resource CHANGE COLUMN rowid rowid integer NOT NULL AUTO_INCREMENT;
ALTER TABLE llx_import_model MODIFY COLUMN type varchar(50);

View File

@ -23,6 +23,6 @@ create table llx_import_model
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_user integer DEFAULT 0 NOT NULL,
label varchar(50) NOT NULL,
type varchar(20) NOT NULL,
type varchar(50) NOT NULL,
field text NOT NULL
)ENGINE=innodb;

View File

@ -1526,6 +1526,7 @@ MenuDeleted=Menu deleted
TreeMenu=Tree menus
Menus=Menus
TreeMenuPersonalized=Personalized menus
NotTopTreeMenuPersonalized=Personalized menus not linked to a top menu entry
NewMenu=New menu
MenuConf=Menus setup
Menu=Selection of menu

View File

@ -408,7 +408,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
/*
* Form to add time spent
*/
if ($user->rights->projet->creer)
if ($user->rights->projet->lire)
{
print '<br>';

View File

@ -115,7 +115,7 @@ $head = societe_prepare_head($object);
dol_fiche_head($head, 'consumption', $langs->trans("ThirdParty"),0,'company');
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
@ -266,7 +266,7 @@ if ($type_element == 'contract')
{ // Supplier : Show products from orders.
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
$documentstatic=new Contrat($db);
$documentstaticline=new ContratLigne($db);
$documentstaticline=new ContratLigne($db);
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_contrat as dateprint, d.statut as status, ';
$tables_from = MAIN_DB_PREFIX."contrat as c,".MAIN_DB_PREFIX."contratdet as d";
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid;
@ -331,7 +331,7 @@ if ($sql_select)
$var=true;
$num = $db->num_rows($resql);
$param="&socid=".$socid."&type_element=".$type_element;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sprod_fulldescr) $param.= "&sprod_fulldescr=".urlencode($sprod_fulldescr);
@ -339,15 +339,15 @@ if ($sql_select)
if ($month) $param.= "&month=".$month;
if ($year) $param.= "&year=".$year;
if ($optioncss != '') $param.='&optioncss='.$optioncss;
print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $totalnboflines, '', 0, '', '', $limit);
print '<table class="liste" width="100%">'."\n";
// Titles with sort buttons
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'doc_number','',$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'dateprint','',$param,'align="center" width="150"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_status','',$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_statut','',$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Product'),$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Quantity'),$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
@ -382,7 +382,7 @@ if ($sql_select)
$documentstatic->statut=$objp->status;
$documentstatic->status=$objp->status;
$documentstatic->paye=$objp->paid;
if (is_object($documentstaticline)) $documentstaticline->statut=$objp->status;
$var=!$var;
@ -548,7 +548,7 @@ if ($sql_select)
}
print "</table>";
if ($num > $limit) {
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num);
}
@ -557,7 +557,7 @@ if ($sql_select)
else if (empty($type_element) || $type_element == -1)
{
print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', '');
print '<table class="liste" width="100%">'."\n";
// Titles with sort buttons
print '<tr class="liste_titre">';
@ -567,16 +567,16 @@ else if (empty($type_element) || $type_element == -1)
print_liste_field_titre($langs->trans('Product'),$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Quantity'),$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
print '<tr '.$bc[0].'><td colspan="5">'.$langs->trans("SelectElementAndClickRefresh").'</td></tr>';
print "</table>";
}
else {
print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', '');
print '<table class="liste" width="100%">'."\n";
print '<tr '.$bc[0].'><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
print "</table>";

View File

@ -1889,7 +1889,7 @@ else
/*
* View
*/
$res=$object->fetch_optionals($object->id,$extralabels);
if (!empty($object->id)) $res=$object->fetch_optionals($object->id,$extralabels);
//if ($res < 0) { dol_print_error($db); exit; }