Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into dev_compta

This commit is contained in:
florian HENRY 2016-06-29 16:55:59 +02:00
commit 9b044ec5ec
14 changed files with 75 additions and 33 deletions

View File

@ -166,14 +166,13 @@ if ($action == 'writebookkeeping') {
$now = dol_now();
$error = 0;
foreach ( $tabfac as $key => $val ) {
foreach ($tabfac as $key => $val)
{
$companystatic = new Societe($db);
$invoicestatic = new FactureFournisseur($db);
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$invoicestatic->ref = $val["refsologest"];
$invoicestatic->ref = (string) $val["refsologest"];
$invoicestatic->refsupplier = $val["refsuppliersologest"];
$invoicestatic->type = $val["type"];
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));

View File

@ -207,7 +207,7 @@ if ($action == 'writebookkeeping') {
$companystatic->client = $tabcompany[$key]['code_client'];
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$invoicestatic->ref = (string) $val["ref"];
foreach ( $tabttc[$key] as $k => $mt ) {
$bookkeeping = new BookKeeping($db);

View File

@ -316,7 +316,7 @@ class Adherent extends CommonObject
if ($id > 0)
{
$this->id=$id;
$this->ref=$id;
$this->ref=(string) $id;
// Update minor fields
$result=$this->update($user,1,1,0,0,'add'); // nosync is 1 to avoid update data of user
@ -1578,6 +1578,7 @@ class Adherent extends CommonObject
$label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$link=''; $linkend='';
if ($option == 'card')
{
$link = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.$linkclose;

View File

@ -213,7 +213,7 @@ class Cotisation extends CommonObject
$result=$member->fetch($this->fk_adherent);
$result=$member->update_end_date($user);
if ($accountline->id > 0) // If we found bank account line (this means this->fk_bank defined)
if (is_object($accountline) && $accountline->id > 0) // If we found bank account line (this means this->fk_bank defined)
{
$result=$accountline->delete($user); // Return false if refused because line is conciliated
if ($result > 0)

View File

@ -62,6 +62,23 @@ if ($action == 'update')
{
if (! $_POST['cancel'])
{
$leftmenu=''; $mainmenu='';
if (! empty($_POST['menuIdParent']) && ! is_numeric($_POST['menuIdParent']))
{
$tmp=explode('&',$_POST['menuIdParent']);
foreach($tmp as $s)
{
if (preg_match('/fk_mainmenu=/',$s))
{
$mainmenu=preg_replace('/fk_mainmenu=/','',$s);
}
if (preg_match('/fk_leftmenu=/',$s))
{
$leftmenu=preg_replace('/fk_leftmenu=/','',$s);
}
}
}
$menu = new Menubase($db);
$result=$menu->fetch($_POST['menuId']);
if ($result > 0)
@ -75,7 +92,18 @@ if ($action == 'update')
$menu->perms=$_POST['perms'];
$menu->target=$_POST['target'];
$menu->user=$_POST['user'];
$menu->fk_menu=$_POST['fk_menu'];
if (is_numeric($_POST['menuIdParent']))
{
$menu->fk_menu=$_POST['menuIdParent'];
}
else
{
if ($_POST['type'] == 'top') $menu->fk_menu=0;
else $menu->fk_menu=-1;
$menu->fk_mainmenu=$mainmenu;
$menu->fk_leftmenu=$leftmenu;
}
$result=$menu->update($user);
if ($result > 0)
{
@ -342,7 +370,7 @@ if ($action == 'create')
}
else
{
print '<td><input type="text" size="20" id="menuId" name="menuId" value="'.($_POST["menuId"]?$_POST["menuId"]:'').'"></td>';
print '<td><input type="text" size="40" id="menuId" name="menuId" value="'.($_POST["menuId"]?$_POST["menuId"]:'').'"></td>';
}
print '<td>'.$langs->trans('DetailMenuIdParent');
print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
@ -425,12 +453,15 @@ elseif ($action == 'edit')
print '<tr><td class="fieldrequired">'.$langs->trans('Type').'</td><td>'.$langs->trans(ucfirst($menu->type)).'</td><td>'.$langs->trans('DetailType').'</td></tr>';
// MenuId Parent
print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent').'</td>';
print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent');
print '</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>';
print '<td><input type="text" name="menuIdParent" value="'.$valtouse.'" size="40"></td>';
print '<td>'.$langs->trans('DetailMenuIdParent');
print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
print '</td></tr>';
// Niveau
//print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>';

View File

@ -361,7 +361,7 @@ if ($conf->use_javascript_ajax)
if (count($remainingdata))
{
print '<table class="border" width="100%">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("NotTopTreeMenuPersonalized").'</td>';

View File

@ -617,13 +617,14 @@ else if ($id || $ref)
* @param Object $object Object we want to see categories it can be classified into
* @param int $typeid Type of category (0, 1, 2, 3)
* @param int $socid Id thirdparty
* @param int $showclassifyform 1=Add form to 'Classify', 0=Do not show form to 'Classify'
* @param int $showclassifyform 1=Add form to 'Classify', 0=Do not show form to 'Classify'
* @return int 0
*/
function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
{
global $user,$langs,$form,$bc;
$title='NotDefined';
if ($typeid == Categorie::TYPE_PRODUCT) $title = $langs->trans("ProductsCategoriesShort");
if ($typeid == Categorie::TYPE_SUPPLIER) $title = $langs->trans("SuppliersCategoriesShort");
if ($typeid == Categorie::TYPE_CUSTOMER) $title = $langs->trans("CustomersProspectsCategoriesShort");

View File

@ -208,7 +208,7 @@ class ICal
//print 'type='.$type.' key='.$key.' value='.$value.'<br>'."\n";
if ($key == false)
if (empty($key))
{
$key = $this->last_key;
switch ($type)

View File

@ -509,7 +509,7 @@ class FactureRec extends CommonInvoice
$facid=$this->id;
dol_syslog(get_class($this)."::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG);
dol_syslog(get_class($this)."::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG);
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Check parameters
@ -631,7 +631,7 @@ class FactureRec extends CommonInvoice
$facid=$this->id;
dol_syslog(get_class($this)."::updateline facid=".$facid." rowid=$rowid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG);
dol_syslog(get_class($this)."::updateline facid=".$facid." rowid=$rowid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG);
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Check parameters

View File

@ -633,7 +633,8 @@ class ExtraFields
}
else
{
print dol_print_error($this->db);
$this->error=$this->db->lasterror();
dol_syslog(get_class($this)."::fetch_name_optionals_label ".$this->error, LOG_ERR);
}
return $array_name_label;

View File

@ -4548,9 +4548,9 @@ function dol_textishtml($msg,$option=0)
if (preg_match('/<html/i',$msg)) return true;
elseif (preg_match('/<body/i',$msg)) return true;
elseif (preg_match('/<(b|em|i)>/i',$msg)) return true;
elseif (preg_match('/<(br|div|font|li|span|strong|table)>/i',$msg)) return true;
elseif (preg_match('/<(br|div|font|li|span|strong|table)\s+[^<>\/]*>/i',$msg)) return true;
elseif (preg_match('/<(br|div|font|li|span|strong|table)\s+[^<>\/]*\/>/i',$msg)) return true;
elseif (preg_match('/<(br|div|font|li|p|span|strong|table)>/i',$msg)) return true;
elseif (preg_match('/<(br|div|font|li|p|span|strong|table)\s+[^<>\/]*>/i',$msg)) return true;
elseif (preg_match('/<(br|div|font|li|p|span|strong|table)\s+[^<>\/]*\/>/i',$msg)) return true;
elseif (preg_match('/<img\s+[^<>]*src[^<>]*>/i',$msg)) return true; // must accept <img src="http://example.com/aaa.png" />
elseif (preg_match('/<a\s+[^<>]*href[^<>]*>/i',$msg)) return true; // must accept <a href="http://example.com/aaa.png" />
elseif (preg_match('/<h[0-9]>/i',$msg)) return true;

View File

@ -78,7 +78,7 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url']))
{
$tmp=explode('?',$newTabMenu[$i]['url'],2);
$tmp=explode('?',$newTabMenu[$i]['url'],2);
$url = $shorturl = $tmp[0];
$param = (isset($tmp[1])?$tmp[1]:'');

View File

@ -1453,15 +1453,25 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
}
}
// For external modules
$tmp=explode('?',$menu_array[$i]['url'],2);
$url = $tmp[0];
$param = (isset($tmp[1])?$tmp[1]:'');
$url = dol_buildpath($url,1).($param?'?'.$param:'');
$url = $shorturl = $menu_array[$i]['url'];
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$menu_array[$i]['url']))
{
$tmp=explode('?',$menu_array[$i]['url'],2);
$url = $shorturl = $tmp[0];
$param = (isset($tmp[1])?$tmp[1]:'');
if (! preg_match('/mainmenu/i',$param) || ! preg_match('/leftmenu/i',$param)) $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&amp;leftmenu=';
//$url.="idmenu=".$menu_array[$i]['rowid']; // Already done by menuLoad
$url = dol_buildpath($url,1).($param?'?'.$param:'');
$shorturl = $shorturl.($param?'?'.$param:'');
}
$url=preg_replace('/__LOGIN__/',$user->login,$url);
$shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl);
$url=preg_replace('/__USERID__/',$user->id,$url);
$shorturl=preg_replace('/__USERID__/',$user->id,$shorturl);
print '<!-- Process menu entry with mainmenu='.$menu_array[$i]['mainmenu'].', leftmenu='.$menu_array[$i]['leftmenu'].', level='.$menu_array[$i]['level'].' enabled='.$menu_array[$i]['enabled'].', position='.$menu_array[$i]['position'].' -->'."\n";
// Menu niveau 0

View File

@ -1,6 +1,6 @@
#!/usr/bin/env php
<?php
/* Copyright (C) 2007-2013 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Jean Heimburger <http://tiaris.eu>
*
* This program is free software; you can redistribute it and/or modify
@ -21,7 +21,6 @@
* \file scripts/product/migrate_picture_path.php
* \ingroup scripts
* \brief Migrate pictures from old system prior to 3.7 to new path for 3.7+
*
*/
$sapi_type = php_sapi_name();
@ -119,7 +118,7 @@ function migrate_product_photospath($product)
$handle=opendir($origin_osencoded);
if (is_resource($handle))
{
while (($file = readdir($handle)) != false)
while (($file = readdir($handle)) !== false)
{
if ($file != '.' && $file != '..' && is_dir($origin_osencoded.'/'.$file))
{
@ -127,7 +126,7 @@ function migrate_product_photospath($product)
if (is_resource($thumbs))
{
dol_mkdir($destin.'/'.$file);
while (($thumb = readdir($thumbs)) != false)
while (($thumb = readdir($thumbs)) !== false)
{
dol_move($origin.'/'.$file.'/'.$thumb, $destin.'/'.$file.'/'.$thumb);
}