Merge branch 'develop' of github.com:Dolibarr/dolibarr into new_stats_percent

This commit is contained in:
Maxime Kohlhaas 2015-08-07 13:30:12 +02:00
commit 1cbb20c89f
18 changed files with 79 additions and 62 deletions

View File

@ -26,6 +26,7 @@ php-iban 1.4.6 LGPL-3+ Yes
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
Restler 3.0 LGPL-3+ Yes Library to develop REST Web services
TCPDF 6.2.6 LGPL-3+ Yes PDF generation
EvalMath 1.0 BSD Yes Safe math expressions evaluation
JS libraries:
jQuery 1.11.3 MIT License Yes JS library

View File

@ -235,6 +235,7 @@ FIX [ bug 1634 ] Error deleting a project when it had many linked objects
FIX [ bug 1925 ] "Link to order" option in supplier invoices is not working properly
FIX [ bug #3198 ] Trigger LINECONTRACT_INSERT passes Contrat as $object instead of ContratLigne
FIX: Not showing delivery date on rouget pdf
FIX: Not showing task extrafields when creating from left menu
NEW: Created new ContratLigne::insert function

View File

@ -222,10 +222,11 @@ class Skeleton_Class extends CommonObject
* @param int $limit offset limit
* @param int $offset offset limit
* @param array $filter filter array
* @param string $filtermode filter mode (AND or OR)
*
* @return int <0 if KO, >0 if OK
*/
public function fetchAll($sortorder, $sortfield, $limit, $offset, array $filter = array())
public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND')
{
dol_syslog(__METHOD__, LOG_DEBUG);
@ -240,14 +241,19 @@ class Skeleton_Class extends CommonObject
$sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
$sqlwhere [] = ' AND ' . $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
$sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
}
}
if (count($sqlwhere) > 0) {
$sql .= ' WHERE ' . implode(' AND ', $sqlwhere);
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere);
}
if (!empty($sortfield)) {
$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder;
}
if (!empty($limit)) {
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
}
$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder . ' ' . $this->db->plimit($limit + 1, $offset);
$this->lines = array();
$resql = $this->db->query($sql);

View File

@ -95,6 +95,7 @@ class HookManager
$pathroot = '';
// Include actions class overwriting hooks
dol_syslog('Loading hook:' . $actionfile, LOG_INFO);
$resaction=dol_include_once($path.$actionfile);
if ($resaction)
{

View File

@ -2072,10 +2072,12 @@ class Form
if ($filterkey && $filterkey != '') $label=preg_replace('/('.preg_quote($filterkey).')/i','<strong>$1</strong>',$label,1);
$opt.=$objp->ref;
if (! empty($objp->idprodfournprice)) $opt.=' ('.$objp->ref_fourn.')';
if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn))
$opt.=' ('.$objp->ref_fourn.')';
$opt.=' - ';
$outval.=$objRef;
if (! empty($objp->idprodfournprice)) $outval.=' ('.$objRefFourn.')';
if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn))
$outval.=' ('.$objRefFourn.')';
$outval.=' - ';
$opt.=dol_trunc($label, 72).' - ';
$outval.=dol_trunc($label, 72).' - ';
@ -2110,7 +2112,7 @@ class Form
$outval.= ' '.$langs->transnoentities("Units");
}
if ($objp->quantity >= 1)
if ($objp->quantity > 1)
{
$opt.=" (".price($objp->unitprice,1,$langs,0,0,-1,$conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
$outval.=" (".price($objp->unitprice,0,$langs,0,0,-1,$conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding

View File

@ -2015,7 +2015,7 @@ function img_picto($titlealt, $picto, $options = '', $pictoisfullpath = false, $
$tmparray=array(0=>$titlealt);
if (preg_match('/:[^\s]/',$titlealt)) $tmparray=explode(':',$titlealt); // We explode if we have TextA:TextB. Not if we have TextA: TextB
$title=$tmparray[0];
$alt=empty($tmparray[1])?'':$tmparray[1];
$alt=empty($tmparray[1])?$tmparray[0]:$tmparray[1]; // Use title for alt if no alt is provided
return '<img src="'.$fullpathpicto.'" border="0" alt="'.dol_escape_htmltag($alt).'"'.($notitle?'':' title="'.dol_escape_htmltag($title).'"').($options?' '.$options:'').'>'; // Alt is used for accessibility, title for popup
}
}

View File

@ -1,7 +1,8 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -10,7 +11,7 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
@ -18,11 +19,11 @@
*/
/**
* \defgroup barcode Module barcode
* \brief Module pour gerer les codes barres
* \file htdocs/core/modules/modBarcode.class.php
* \ingroup barcode,produit
* \brief Fichier de description et activation du module Barcode
* \defgroup barcode Module barcode
* \brief Module pour gerer les codes barres
* \file htdocs/core/modules/modBarcode.class.php
* \ingroup barcode,produit
* \brief Fichier de description et activation du module Barcode
*/
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
@ -34,9 +35,9 @@ class modBarcode extends DolibarrModules
{
/**
* Constructor. Define names, constants, directories, boxes, permissions
* Constructor. Define names, constants, directories, boxes, permissions
*
* @param DoliDB $db Database handler
* @param DoliDB $db Database handler
*/
function __construct($db)
{
@ -56,7 +57,7 @@ class modBarcode extends DolibarrModules
$this->dirs = array("/barcode/temp");
// Dependances
$this->depends = array(); // May be used for product or service or third party module
$this->depends = array(); // May be used for product or service or third party module
$this->requiredby = array();
// Config pages
@ -90,43 +91,43 @@ class modBarcode extends DolibarrModules
$this->rights[2][3] = 0; // La permission est-elle une permission par defaut
$this->rights[2][4] = 'creer_advance';
// Main menu entries
$r=0;
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'mainmenu'=>'tools',
'leftmenu'=>'barcodeprint',
'type'=>'left', // This is a Left menu entry
'titre'=>'BarCodePrintsheet',
'url'=>'/barcode/printsheet.php?mainmenu=tools&leftmenu=barcodeprint',
'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>200,
'enabled'=>'$conf->barcode->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// Main menu entries
$r=0;
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'mainmenu'=>'tools',
'leftmenu'=>'barcodeprint',
'type'=>'left', // This is a Left menu entry
'titre'=>'BarCodePrintsheet',
'url'=>'/barcode/printsheet.php?mainmenu=tools&leftmenu=barcodeprint',
'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>200,
'enabled'=>'$conf->barcode->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'$user->rights->barcode->lire_advance', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
$r++;
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=modulesadmintools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Left menu entry
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=modulesadmintools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Left menu entry
'titre'=>'MassBarcodeInit',
'url'=>'/barcode/codeinit.php?mainmenu=home&leftmenu=modulesadmintools',
'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>300,
'enabled'=>'$conf->barcode->enabled && $leftmenu=="modulesadmintools"', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'enabled'=>'$conf->barcode->enabled && $leftmenu=="modulesadmintools"', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'$user->rights->barcode->creer_advance', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>0); // 0=Menu for internal users, 1=external users, 2=both
'user'=>0); // 0=Menu for internal users, 1=external users, 2=both
$r++;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories.
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories.
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{

View File

@ -252,7 +252,7 @@ class modProduct extends DolibarrModules
if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode'));
// Add extra fields
$import_extrafield_sample=array();
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' entity IN (0, ".$conf->entity.')';
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0, ".$conf->entity.')';
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2015 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -329,7 +329,7 @@ if ($id > 0 || ! empty($ref))
print $langs->trans('AvailabilityPeriod');
print '</td>';
if ($action != 'editavailability')
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetAvailability'), 1) . '</a></td>';
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&amp;id=' . $commande->id . '">' . img_edit($langs->trans('SetAvailability'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'editavailability') {
@ -345,7 +345,7 @@ if ($id > 0 || ! empty($ref))
print $langs->trans('Source');
print '</td>';
if ($action != 'editdemandreason')
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdemandreason&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . '</a></td>';
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdemandreason&amp;id=' . $commande->id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'editdemandreason') {

View File

@ -949,7 +949,7 @@ $formfile = new FormFile($db);
if ($conf->contrat->enabled)
$formcontract = new FormContract($db);
llxHeader('',$langs->trans("Fichinter"));
llxHeader('',$langs->trans("Intervention"));
if ($action == 'create')
{

View File

@ -106,7 +106,7 @@ $formcompany = new FormCompany($db);
$contactstatic=new Contact($db);
$userstatic=new User($db);
llxHeader();
llxHeader('',$langs->trans("Intervention"));
// Mode vue et edition

View File

@ -81,8 +81,7 @@ include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php
$form = new Form($db);
llxHeader("","",$langs->trans("InterventionCard"));
llxHeader('',$langs->trans("Intervention"));
if ($object->id)
{

View File

@ -49,7 +49,7 @@ if ($id > 0)
* View
*/
llxHeader();
llxHeader('',$langs->trans("Intervention"));
$societe = new Societe($db);
$societe->fetch($object->socid);

View File

@ -10,6 +10,7 @@ PrintTestDesc=List of Printers.
FileWasSentToPrinter=File %s was sent to printer
NoActivePrintingModuleFound=No active module to print document
PleaseSelectaDriverfromList=Please select a driver from list.
PleaseConfigureDriverfromList=Please configure the selected driver from list.
SetupDriver=Driver setup
TestDriver=Test
TargetedPrinter=Targeted printer

View File

@ -229,7 +229,12 @@ if ($mode == 'test' && $user->admin)
$langs->load($driver);
$printer = new $classname($db);
//print '<pre>'.print_r($printer, true).'</pre>';
print $printer->listAvailablePrinters();
if (count($printer->getlist_available_printers)) {
print $printer->listAvailablePrinters();
}
else {
print $langs->trans('PleaseConfigureDriverfromList');
}
} else {
print $langs->trans('PleaseSelectaDriverfromList');

View File

@ -55,8 +55,8 @@ if ($id > 0 || ! empty($ref))
{
// fetch optionals attributes and labels
$extralabels_projet=$extrafields_project->fetch_name_optionals_label($object->table_element);
$extralabels_task=$extrafields_task->fetch_name_optionals_label($taskstatic->table_element);
}
$extralabels_task=$extrafields_task->fetch_name_optionals_label($taskstatic->table_element);
// Security check
$socid=0;

View File

@ -740,7 +740,7 @@ $formcompany = new FormCompany($db);
if ($socid > 0 && empty($object->id))
{
$res=$object->fetch($socid);
$result=$object->fetch($socid);
if ($result <= 0) dol_print_error('',$object->error);
}

View File

@ -639,11 +639,11 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
$s=img_picto('title','/fullpath/img.png','',1);
print __METHOD__." s=".$s."\n";
$this->assertEquals('<img src="/fullpath/img.png" border="0" alt="" title="title">',$s,'testImgPicto3');
$this->assertEquals('<img src="/fullpath/img.png" border="0" alt="title" title="title">',$s,'testImgPicto3');
$s=img_picto('title','/fullpath/img.png','',true);
print __METHOD__." s=".$s."\n";
$this->assertEquals('<img src="/fullpath/img.png" border="0" alt="" title="title">',$s,'testImgPicto4');
$this->assertEquals('<img src="/fullpath/img.png" border="0" alt="title" title="title">',$s,'testImgPicto4');
$s=img_picto('title:alt','/fullpath/img.png','',true);
print __METHOD__." s=".$s."\n";