From 837821ebb637f8fc87bc3f9b72d23bb6b98520f9 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Mon, 28 Jan 2019 05:12:20 +0100 Subject: [PATCH 01/36] Create movement_card.php --- htdocs/product/stock/movement_card.php | 1194 ++++++++++++++++++++++++ 1 file changed, 1194 insertions(+) create mode 100644 htdocs/product/stock/movement_card.php diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php new file mode 100644 index 00000000000..abf7d21284b --- /dev/null +++ b/htdocs/product/stock/movement_card.php @@ -0,0 +1,1194 @@ + + * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2005-2014 Regis Houssin + * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2018 Ferran Marcet + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/product/stock/movement_card.php + * \ingroup stock + * \brief Page to list stock movements + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +if (! empty($conf->projet->enabled)) +{ + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +} + +// Load translation files required by the page +$langs->loadLangs(array('products', 'stocks', 'orders')); +if (! empty($conf->productbatch->enabled)) $langs->load("productbatch"); + +// Security check +$result=restrictedArea($user,'stock'); + +$id=GETPOST('id','int'); +$ref = GETPOST('ref','alpha'); +$msid=GETPOST('msid','int'); +$product_id=GETPOST("product_id"); +$action=GETPOST('action','aZ09'); +$cancel=GETPOST('cancel','alpha'); +$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'movementlist'; + +$idproduct = GETPOST('idproduct','int'); +$year = GETPOST("year"); +$month = GETPOST("month"); +$search_ref = GETPOST('search_ref', 'alpha'); +$search_movement = GETPOST("search_movement"); +$search_product_ref = trim(GETPOST("search_product_ref")); +$search_product = trim(GETPOST("search_product")); +$search_warehouse = trim(GETPOST("search_warehouse")); +$search_inventorycode = trim(GETPOST("search_inventorycode")); +$search_user = trim(GETPOST("search_user")); +$search_batch = trim(GETPOST("search_batch")); +$search_qty = trim(GETPOST("search_qty")); +$search_type_mouvement=GETPOST('search_type_mouvement','int'); + +$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; +$page = GETPOST("page",'int'); +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$offset = $limit * $page; +if (! $sortfield) $sortfield="m.datem"; +if (! $sortorder) $sortorder="DESC"; + +$pdluoid=GETPOST('pdluoid','int'); + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$object = new MouvementStock($db); +$hookmanager->initHooks(array('movementlist')); +$extrafields = new ExtraFields($db); +$formfile = new FormFile($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('movement'); +$search_array_options=$extrafields->getOptionalsFromPost($object->table_element,'','search_'); + +$arrayfields=array( + 'm.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), + 'm.datem'=>array('label'=>$langs->trans("Date"), 'checked'=>1), + 'p.ref'=>array('label'=>$langs->trans("ProductRef"), 'checked'=>1, 'css'=>'maxwidth100'), + 'p.label'=>array('label'=>$langs->trans("ProductLabel"), 'checked'=>1), + 'm.batch'=>array('label'=>$langs->trans("BatchNumberShort"), 'checked'=>1, 'enabled'=>(! empty($conf->productbatch->enabled))), + 'pl.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>0, 'enabled'=>(! empty($conf->productbatch->enabled))), + 'pl.sellby'=>array('label'=>$langs->trans("SellByDate"), 'checked'=>0, 'position'=>10, 'enabled'=>(! empty($conf->productbatch->enabled))), + 'e.ref'=>array('label'=>$langs->trans("Warehouse"), 'checked'=>1, 'enabled'=>(! $id > 0)), // If we are on specific warehouse, we hide it + 'm.fk_user_author'=>array('label'=>$langs->trans("Author"), 'checked'=>0), + 'm.inventorycode'=>array('label'=>$langs->trans("InventoryCodeShort"), 'checked'=>1), + 'm.label'=>array('label'=>$langs->trans("MovementLabel"), 'checked'=>1), + 'm.type_mouvement'=>array('label'=>$langs->trans("TypeMovement"), 'checked'=>1), + 'origin'=>array('label'=>$langs->trans("Origin"), 'checked'=>1), + 'm.value'=>array('label'=>$langs->trans("Qty"), 'checked'=>1), + 'm.price'=>array('label'=>$langs->trans("UnitPurchaseValue"), 'checked'=>0), + //'m.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + //'m.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500) +); + + + +/* + * Actions + */ + +$usercanread = (($user->rights->stock->mouvement->lire)); +$usercancreate = (($user->rights->stock->mouvement->creer)); +$usercandelete = (($user->rights->stock->mouvement->supprimer)); + +if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } + +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + +// Do we click on purge search criteria ? +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers +{ + $year=''; + $month=''; + $search_ref=''; + $search_movement=""; + $search_type_mouvement=""; + $search_inventorycode=""; + $search_product_ref=""; + $search_product=""; + $search_warehouse=""; + $search_user=""; + $search_batch=""; + $search_qty=''; + $sall=""; + $toselect=''; + $search_array_options=array(); +} + +// Correct stock +if ($action == "correct_stock") +{ + $product = new Product($db); + if (! empty($product_id)) $result=$product->fetch($product_id); + + $error=0; + + if (empty($product_id)) + { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")), null, 'errors'); + $action='correction'; + } + if (! is_numeric($_POST["nbpiece"])) + { + $error++; + setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentitiesnoconv("NumberOfUnit")), null, 'errors'); + $action='correction'; + } + + if (! $error) + { + $origin_element = ''; + $origin_id = null; + + if (GETPOST('projectid', 'int')) + { + $origin_element = 'project'; + $origin_id = GETPOST('projectid', 'int'); + } + + if ($product->hasbatch()) + { + $batch=GETPOST('batch_number'); + + //$eatby=GETPOST('eatby'); + //$sellby=GETPOST('sellby'); + $eatby=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); + $sellby=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); + + $result=$product->correct_stock_batch( + $user, + $id, + GETPOST("nbpiece",'int'), + GETPOST("mouvement"), + GETPOST("label",'san_alpha'), + GETPOST('unitprice'), + $eatby,$sellby,$batch, + GETPOST('inventorycode'), + $origin_element, + $origin_id + ); // We do not change value of stock for a correction + } + else + { + $result=$product->correct_stock( + $user, + $id, + GETPOST("nbpiece",'int'), + GETPOST("mouvement"), + GETPOST("label",'san_alpha'), + GETPOST('unitprice'), + GETPOST('inventorycode'), + $origin_element, + $origin_id + ); // We do not change value of stock for a correction + } + + if ($result > 0) + { + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); + exit; + } + else + { + $error++; + setEventMessages($product->error, $product->errors, 'errors'); + $action='correction'; + } + } + + if (! $error) $action=''; +} + +// Transfer stock from a warehouse to another warehouse +if ($action == "transfert_stock" && ! $cancel) +{ + $product = new Product($db); + if (! empty($product_id)) $result=$product->fetch($product_id); + + if (! (GETPOST("id_entrepot_destination",'int') > 0)) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); + $error++; + $action='transfert'; + } + if (empty($product_id)) + { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")), null, 'errors'); + $action='transfert'; + } + if (! GETPOST("nbpiece",'int')) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumberOfUnit")), null, 'errors'); + $error++; + $action='transfert'; + } + if ($id == GETPOST("id_entrepot_destination",'int')) + { + setEventMessages($langs->trans("ErrorSrcAndTargetWarehouseMustDiffers"), null, 'errors'); + $error++; + $action='transfert'; + } + + if (! empty($conf->productbatch->enabled)) + { + $product = new Product($db); + $result=$product->fetch($product_id); + + if ($product->hasbatch() && ! GETPOST("batch_number")) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("batch_number")), null, 'errors'); + $error++; + $action='transfert'; + } + } + + if (! $error) + { + if ($id) + { + $object = new Entrepot($db); + $result=$object->fetch($id); + + $db->begin(); + + $product->load_stock('novirtual'); // Load array product->stock_warehouse + + // Define value of products moved + $pricesrc=0; + if (isset($product->pmp)) $pricesrc=$product->pmp; + $pricedest=$pricesrc; + + if ($product->hasbatch()) + { + $pdluo = new Productbatch($db); + + if ($pdluoid > 0) + { + $result=$pdluo->fetch($pdluoid); + if ($result) + { + $srcwarehouseid=$pdluo->warehouseid; + $batch=$pdluo->batch; + $eatby=$pdluo->eatby; + $sellby=$pdluo->sellby; + } + else + { + setEventMessages($pdluo->error, $pdluo->errors, 'errors'); + $error++; + } + } + else + { + $srcwarehouseid=$id; + $batch=GETPOST('batch_number'); + $eatby=$d_eatby; + $sellby=$d_sellby; + } + + if (! $error) + { + // Remove stock + $result1=$product->correct_stock_batch( + $user, + $srcwarehouseid, + GETPOST("nbpiece",'int'), + 1, + GETPOST("label",'san_alpha'), + $pricesrc, + $eatby,$sellby,$batch, + GETPOST('inventorycode') + ); + // Add stock + $result2=$product->correct_stock_batch( + $user, + GETPOST("id_entrepot_destination",'int'), + GETPOST("nbpiece",'int'), + 0, + GETPOST("label",'san_alpha'), + $pricedest, + $eatby,$sellby,$batch, + GETPOST('inventorycode') + ); + } + } + else + { + // Remove stock + $result1=$product->correct_stock( + $user, + $id, + GETPOST("nbpiece"), + 1, + GETPOST("label"), + $pricesrc, + GETPOST('inventorycode') + ); + + // Add stock + $result2=$product->correct_stock( + $user, + GETPOST("id_entrepot_destination"), + GETPOST("nbpiece"), + 0, + GETPOST("label"), + $pricedest, + GETPOST('inventorycode') + ); + } + if (! $error && $result1 >= 0 && $result2 >= 0) + { + $db->commit(); + + if ($backtopage) + { + header("Location: ".$backtopage); + exit; + } + else + { + header("Location: movement_list.php?id=".$object->id); + exit; + } + } + else + { + setEventMessages($product->error, $product->errors, 'errors'); + $db->rollback(); + $action='transfert'; + } + } + } +} + + +/* + * Build document + */ +// The builddoc action for object of a movement must be on the movement card +// Actions to build doc +$upload_dir = $conf->stock->dir_output . "movement/"; +$permissioncreate = $user->rights->stock->creer; +include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + + +if (empty($reshook) && $action != 'remove_file') +{ + $objectclass='MouvementStock'; + $objectlabel='Movements'; + $permtoread = $user->rights->stock->lire; + $permtodelete = $user->rights->stock->supprimer; + $uploaddir = $conf->stock->dir_output . "/movement/"; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; +} + + + +/* + * View + */ + +$productlot=new ProductLot($db); +$productstatic=new Product($db); +$warehousestatic=new Entrepot($db); +$movement=new MouvementStock($db); +$userstatic=new User($db); +$form=new Form($db); +$formother=new FormOther($db); +$formproduct=new FormProduct($db); +if (!empty($conf->projet->enabled)) $formproject=new FormProjets($db); + +$sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.entity,"; +$sql.= " e.ref as stock, e.rowid as entrepot_id, e.lieu,"; +$sql.= " m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,"; +$sql.= " m.batch, m.price,"; +$sql.= " m.type_mouvement,"; +$sql.= " pl.rowid as lotid, pl.eatby, pl.sellby,"; +$sql.= " u.login, u.photo, u.lastname, u.firstname"; +// Add fields from extrafields +foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e,"; +$sql.= " ".MAIN_DB_PREFIX."product as p,"; +$sql.= " ".MAIN_DB_PREFIX."stock_mouvement as m"; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."movement_extrafields as ef on (m.rowid = ef.fk_object)"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON m.fk_user_author = u.rowid"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_lot as pl ON m.batch = pl.batch AND m.fk_product = pl.fk_product"; +$sql.= " WHERE m.fk_product = p.rowid"; +if ($msid > 0) $sql .= " AND m.rowid = ".$msid; +$sql.= " AND m.fk_entrepot = e.rowid"; +$sql.= " AND e.entity IN (".getEntity('stock').")"; +if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql.= " AND p.fk_product_type = 0"; +if ($id > 0) $sql.= " AND e.rowid ='".$id."'"; +if ($month > 0) +{ + if ($year > 0) + $sql.= " AND m.datem BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'"; + else + $sql.= " AND date_format(m.datem, '%m') = '$month'"; +} +elseif ($year > 0) +{ + $sql.= " AND m.datem BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; +} +if ($idproduct > 0) $sql.= " AND p.rowid = '".$idproduct."'"; +if (! empty($search_ref)) $sql.= natural_search('m.rowid', $search_ref, 1); +if (! empty($search_movement)) $sql.= natural_search('m.label', $search_movement); +if (! empty($search_inventorycode)) $sql.= natural_search('m.inventorycode', $search_inventorycode); +if (! empty($search_product_ref)) $sql.= natural_search('p.ref', $search_product_ref); +if (! empty($search_product)) $sql.= natural_search('p.label', $search_product); +if ($search_warehouse != '' && $search_warehouse != '-1') $sql.= natural_search('e.rowid', $search_warehouse, 2); +if (! empty($search_user)) $sql.= natural_search('u.login', $search_user); +if (! empty($search_batch)) $sql.= natural_search('m.batch', $search_batch); +if ($search_qty != '') $sql.= natural_search('m.value', $search_qty, 1); +if ($search_type_mouvement != '' && $search_type_mouvement != '-1') $sql.= natural_search('m.type_mouvement', $search_type_mouvement, 2); +// Add where from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql.= $db->order($sortfield,$sortorder); + +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); + if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 + { + $page = 0; + $offset = 0; + } +} + +if(empty($search_inventorycode)) +{ + $sql.= $db->plimit($limit+1, $offset); +} +else +{ + $limit = 0; +} + +//print $sql; + +$resql = $db->query($sql); + +if(!empty($search_inventorycode)) $limit = $db->num_rows($resql); + +if ($resql) +{ + $product = new Product($db); + $object = new Entrepot($db); + + if ($idproduct > 0) + { + $product->fetch($idproduct); + } + if ($id > 0 || $ref) + { + $result = $object->fetch($id, $ref); + if ($result < 0) + { + dol_print_error($db); + } + } + + $num = $db->num_rows($resql); + + $arrayofselected=is_array($toselect)?$toselect:array(); + + + $i = 0; + $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; + if ($msid) $texte = $langs->trans('StockMovementForId', $msid); + else + { + $texte = $langs->trans("ListOfStockMovements"); + if ($id) $texte.=' ('.$langs->trans("ForThisWarehouse").')'; + } + llxHeader("",$texte,$help_url); + + /* + * Show tab only if we ask a particular warehouse + */ + if ($object->id > 0) + { + $head = stock_prepare_head($object); + + dol_fiche_head($head, 'movements', $langs->trans("Warehouse"), -1, 'stock'); + + + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + $morehtmlref.=$langs->trans("LocationSummary").' : '.$object->lieu; + $morehtmlref.='
'; + + $shownav = 1; + if ($user->societe_id && ! in_array('stock', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + + dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + + print ''; + + print ''; + + // Description + print ''; + + $calcproductsunique=$object->nb_different_products(); + $calcproducts=$object->nb_products(); + + // Total nb of different products + print '"; + + // Nb of products + print '"; + + print '
'.$langs->trans("Description").''.dol_htmlentitiesbr($object->description).'
'.$langs->trans("NumberOfDifferentProducts").''; + print empty($calcproductsunique['nb'])?'0':$calcproductsunique['nb']; + print "
'.$langs->trans("NumberOfProducts").''; + $valtoshow=price2num($calcproducts['nb'], 'MS'); + print empty($valtoshow)?'0':$valtoshow; + print "
'; + + print '
'; + print '
'; + print '
'; + print '
'; + + print ''; + + // Value + print '"; + + // Last movement + $sql = "SELECT MAX(m.datem) as datem"; + $sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m"; + $sql .= " WHERE m.fk_entrepot = '".$object->id."'"; + $resqlbis = $db->query($sql); + if ($resqlbis) + { + $obj = $db->fetch_object($resqlbis); + $lastmovementdate=$db->jdate($obj->datem); + } + else + { + dol_print_error($db); + } + + print '"; + + print "
'.$langs->trans("EstimatedStockValueShort").''; + print price((empty($calcproducts['value'])?'0':price2num($calcproducts['value'],'MT')), 0, $langs, 0, -1, -1, $conf->currency); + print "
'.$langs->trans("LastMovement").''; + if ($lastmovementdate) + { + print dol_print_date($lastmovementdate,'dayhour'); + } + else + { + print $langs->trans("None"); + } + print "
"; + + print '
'; + print '
'; + print '
'; + + print '
'; + + dol_fiche_end(); + } + + + /* + * Correct stock + */ + if ($action == "correction") + { + include DOL_DOCUMENT_ROOT.'/product/stock/tpl/stockcorrection.tpl.php'; + print '
'; + } + + /* + * Transfer of units + */ + if ($action == "transfert") + { + include DOL_DOCUMENT_ROOT.'/product/stock/tpl/stocktransfer.tpl.php'; + print '
'; + } + + + /* ************************************************************************** */ + /* */ + /* Barre d'action */ + /* */ + /* ************************************************************************** */ + + if ((empty($action) || $action == 'list') && $id > 0) + { + print "
\n"; + + if ($user->rights->stock->mouvement->creer) + { + print ''.$langs->trans("CorrectStock").''; + } + + if ($user->rights->stock->mouvement->creer) + { + print ''.$langs->trans("TransferStock").''; + } + + print '

'; + } + + $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($id > 0) $param.='&id='.$id; + if ($search_movement) $param.='&search_movement='.urlencode($search_movement); + if ($search_inventorycode) $param.='&search_inventorycode='.urlencode($search_inventorycode); + if ($search_type_mouvement) $param.='&search_type_mouvement='.urlencode($search_type_mouvement); + if ($search_product_ref) $param.='&search_product_ref='.urlencode($search_product_ref); + if ($search_product) $param.='&search_product='.urlencode($search_product); + if ($search_batch) $param.='&search_batch='.urlencode($search_batch); + if ($search_warehouse > 0) $param.='&search_warehouse='.urlencode($search_warehouse); + if (!empty($sref)) $param.='&sref='.urlencode($sref); // FIXME $sref is not defined + if (!empty($snom)) $param.='&snom='.urlencode($snom); // FIXME $snom is not defined + if ($search_user) $param.='&search_user='.urlencode($search_user); + if ($idproduct > 0) $param.='&idproduct='.$idproduct; + // Add $param from extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + + // List of mass actions available + $arrayofmassactions = array( + // 'presend'=>$langs->trans("SendByMail"), + // 'builddoc'=>$langs->trans("PDFMerge"), + ); + //if ($user->rights->stock->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); + $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + + print '
'; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if ($id > 0) print ''; + + if ($id > 0) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,$massactionbutton,$num, $nbtotalofrecords, '', 0, '', '', $limit); + else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,$massactionbutton,$num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit); + + if ($sall) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; + } + + $moreforfilter=''; + + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; + else $moreforfilter = $hookmanager->resPrint; + + if (! empty($moreforfilter)) + { + print '
'; + print $moreforfilter; + print '
'; + } + + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + + print '
'; + print ''."\n"; + + // Lignes des champs de filtre + print ''; + if (! empty($arrayfields['m.rowid']['checked'])) + { + // Ref + print ''; + } + if (! empty($arrayfields['m.datem']['checked'])) + { + print ''; + } + if (! empty($arrayfields['p.ref']['checked'])) + { + // Product Ref + print ''; + } + if (! empty($arrayfields['p.label']['checked'])) + { + // Product label + print ''; + } + // Batch + if (! empty($arrayfields['m.batch']['checked'])) + { + print ''; + } + if (! empty($arrayfields['pl.eatby']['checked'])) + { + print ''; + } + if (! empty($arrayfields['pl.sellby']['checked'])) + { + print ''; + } + // Warehouse + if (! empty($arrayfields['e.ref']['checked'])) + { + print ''; + } + if (! empty($arrayfields['m.fk_user_author']['checked'])) + { + // Author + print ''; + } + if (! empty($arrayfields['m.inventorycode']['checked'])) + { + // Inventory code + print ''; + } + if (! empty($arrayfields['m.label']['checked'])) + { + // Label of movement + print ''; + } + if (! empty($arrayfields['m.type_mouvement']['checked'])) + { + // Type of movement + print ''; + } + if (! empty($arrayfields['origin']['checked'])) + { + // Origin of movement + print ''; + } + if (! empty($arrayfields['m.value']['checked'])) + { + // Qty + print ''; + } + if (! empty($arrayfields['m.price']['checked'])) + { + // Price + print ''; + } + + + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (! empty($arrayfields['m.datec']['checked'])) + { + print ''; + } + // Date modification + if (! empty($arrayfields['m.tms']['checked'])) + { + print ''; + } + // Actions + print ''; + print "\n"; + + print ''; + if (! empty($arrayfields['m.rowid']['checked'])) print_liste_field_titre($arrayfields['m.rowid']['label'],$_SERVER["PHP_SELF"],'m.rowid','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['m.datem']['checked'])) print_liste_field_titre($arrayfields['m.datem']['label'],$_SERVER["PHP_SELF"],'m.datem','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'],$_SERVER["PHP_SELF"],'p.label','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['m.batch']['checked'])) print_liste_field_titre($arrayfields['m.batch']['label'],$_SERVER["PHP_SELF"],'m.batch','',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['pl.eatby']['checked'])) print_liste_field_titre($arrayfields['pl.eatby']['label'],$_SERVER["PHP_SELF"],'pl.eatby','',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['pl.sellby']['checked'])) print_liste_field_titre($arrayfields['pl.sellby']['label'],$_SERVER["PHP_SELF"],'pl.sellby','',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['e.ref']['checked'])) print_liste_field_titre($arrayfields['e.ref']['label'],$_SERVER["PHP_SELF"], "e.ref","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible + if (! empty($arrayfields['m.fk_user_author']['checked'])) print_liste_field_titre($arrayfields['m.fk_user_author']['label'],$_SERVER["PHP_SELF"], "m.fk_user_author","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['m.inventorycode']['checked'])) print_liste_field_titre($arrayfields['m.inventorycode']['label'],$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['m.label']['checked'])) print_liste_field_titre($arrayfields['m.label']['label'],$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['m.type_mouvement']['checked'])) print_liste_field_titre($arrayfields['m.type_mouvement']['label'],$_SERVER["PHP_SELF"], "m.type_mouvement","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['origin']['checked'])) print_liste_field_titre($arrayfields['origin']['label'],$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['m.value']['checked'])) print_liste_field_titre($arrayfields['m.value']['label'],$_SERVER["PHP_SELF"], "m.value","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['m.price']['checked'])) print_liste_field_titre($arrayfields['m.price']['label'],$_SERVER["PHP_SELF"], "m.price","",$param,'align="right"',$sortfield,$sortorder); + + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; + + // Hook fields + $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); + $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (! empty($arrayfields['m.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['m.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); + print "\n"; + + + $arrayofuniqueproduct=array(); + + while ($i < min($num,$limit)) + { + $objp = $db->fetch_object($resql); + + $userstatic->id=$objp->fk_user_author; + $userstatic->login=$objp->login; + $userstatic->lastname=$objp->lastname; + $userstatic->firstname=$objp->firstname; + $userstatic->photo=$objp->photo; + + $productstatic->id=$objp->rowid; + $productstatic->ref=$objp->product_ref; + $productstatic->label=$objp->produit; + $productstatic->type=$objp->type; + $productstatic->entity=$objp->entity; + $productstatic->status_batch=$objp->tobatch; + + $productlot->id = $objp->lotid; + $productlot->batch= $objp->batch; + $productlot->eatby= $objp->eatby; + $productlot->sellby= $objp->sellby; + + $warehousestatic->id=$objp->entrepot_id; + $warehousestatic->libelle=$objp->stock; + $warehousestatic->lieu=$objp->lieu; + + $arrayofuniqueproduct[$objp->rowid]=$objp->produit; + if(!empty($objp->fk_origin)) { + $origin = $movement->get_origin($objp->fk_origin, $objp->origintype); + } else { + $origin = ''; + } + + print ''; + // Id movement + if (! empty($arrayfields['m.rowid']['checked'])) + { + print ''; // This is primary not movement id + } + if (! empty($arrayfields['m.datem']['checked'])) + { + // Date + print ''; + } + if (! empty($arrayfields['p.ref']['checked'])) + { + // Product ref + print '\n"; + } + if (! empty($arrayfields['p.label']['checked'])) + { + // Product label + print '\n"; + } + if (! empty($arrayfields['m.batch']['checked'])) + { + print ''; + } + if (! empty($arrayfields['pl.eatby']['checked'])) + { + print ''; + } + if (! empty($arrayfields['pl.sellby']['checked'])) + { + print ''; + } + // Warehouse + if (! empty($arrayfields['e.ref']['checked'])) + { + print '\n"; + } + // Author + if (! empty($arrayfields['m.fk_user_author']['checked'])) + { + print '\n"; + } + if (! empty($arrayfields['m.inventorycode']['checked'])) + { + // Inventory code + print ''; + } + if (! empty($arrayfields['m.label']['checked'])) + { + // Label of movement + print ''; + } + if (! empty($arrayfields['m.type_mouvement']['checked'])) + { + // Type of movement + switch($objp->type_mouvement){ + case "0": + print ''; + break; + case "1": + print ''; + break; + case "2": + print ''; + break; + case "3": + print ''; + break; + } + } + if (! empty($arrayfields['origin']['checked'])) + { + // Origin of movement + print ''; + } + if (! empty($arrayfields['m.value']['checked'])) + { + // Qty + print ''; + } + if (! empty($arrayfields['m.price']['checked'])) + { + // Price + print ''; + } + // Action column + print ''; + if (! $i) $totalarray['nbfield']++; + + print "\n"; + $i++; + } + $db->free($resql); + + print "
'; + print ''; + print ''; + print ''; + if (empty($conf->productbatch->enabled)) print ' '; + //else print '
'; + $syear = $year?$year:-1; + print ''; + //print $formother->selectyear($syear,'year',1, 20, 5); + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; + print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'maxwidth200'); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; + print ''; + print ajax_combobox('search_type_mouvement'); + // TODO: add new function $formentrepot->selectTypeOfMovement(...) like + // print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'maxwidth200'); + print ''; + print '  '; + print ''; + print ''; + print ''; + print '  '; + print ''; + print ''; + print ''; + $searchpicto=$form->showFilterAndCheckAddButtons(0); + print $searchpicto; + print '
'.$objp->mid.''.dol_print_date($db->jdate($objp->datem),'dayhour').''; + print $productstatic->getNomUrl(1,'stock',16); + print "'; + /*$productstatic->id=$objp->rowid; + $productstatic->ref=$objp->produit; + $productstatic->type=$objp->type; + print $productstatic->getNomUrl(1,'',16);*/ + print $productstatic->label; + print "'; + if ($productlot->id > 0) print $productlot->getNomUrl(1); + else print $productlot->batch; // the id may not be defined if movement was entered when lot was not saved or if lot was removed after movement. + print ''. dol_print_date($objp->eatby,'day') .''. dol_print_date($objp->sellby,'day') .''; + print $warehousestatic->getNomUrl(1); + print "'; + print $userstatic->getNomUrl(-1); + print "'.'' + .$objp->inventorycode + .'' + .''.$objp->label.''.$langs->trans('StockIncreaseAfterCorrectTransfer').''.$langs->trans('StockDecreaseAfterCorrectTransfer').''.$langs->trans('StockDecrease').''.$langs->trans('StockIncrease').''.$origin.''; + if ($objp->qt > 0) print '+'; + print $objp->qty; + print ''; + if ($objp->price != 0) print price($objp->price); + print ''; + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + { + $selected=0; + if (in_array($obj->rowid, $arrayofselected)) $selected=1; + print ''; + } + print '
"; + print '
'; + print "
"; + + // Add number of product when there is a filter on period + if (count($arrayofuniqueproduct) == 1 && is_numeric($year)) + { + print "
"; + + $productidselected=0; + foreach ($arrayofuniqueproduct as $key => $val) + { + $productidselected=$key; + $productlabelselected=$val; + } + $datebefore=dol_get_first_day($year?$year:strftime("%Y",time()), $month?$month:1, true); + $dateafter=dol_get_last_day($year?$year:strftime("%Y",time()), $month?$month:12, true); + $balancebefore=$movement->calculateBalanceForProductBefore($productidselected, $datebefore); + $balanceafter=$movement->calculateBalanceForProductBefore($productidselected, $dateafter); + + //print ''; + print $langs->trans("NbOfProductBeforePeriod", $productlabelselected, dol_print_date($datebefore,'day','gmt')); + //print ''; + //print ''; + print ': '.$balancebefore; + print "
\n"; + //print ''; + //print ''; + print $langs->trans("NbOfProductAfterPeriod", $productlabelselected, dol_print_date($dateafter,'day','gmt')); + //print ''; + //print ''; + print ': '.$balanceafter; + print "
\n"; + //print ''; + } +} +else +{ + dol_print_error($db); +} + + + +/* + * Documents generes + */ +//Area for doc and last events of warehouse are stored on the main card of warehouse +$modulepart='movement'; + +if ($action != 'create' && $action != 'edit' && $action != 'delete' && $id>0) +{ + print '
'; + print '
'; + print ''; // ancre + + // Documents + $objectref = dol_sanitizeFileName($object->ref); + // Add inventorycode & type_mouvement to filename of the pdf + if(!empty($search_inventorycode)) $objectref.="_".$id."_".$search_inventorycode; + if($search_type_mouvement) $objectref.="_".$search_type_mouvement; + $relativepath = $comref . '/' . $objectref . '.pdf'; + $filedir = $conf->stock->dir_output . '/movement/' . $objectref; + + $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id."&search_inventorycode=".$search_inventorycode."&search_type_mouvement=$search_type_mouvement"; + $genallowed=$usercanread; + $delallowed=$usercancreate; + + $genallowed=$user->rights->stock->lire; + $delallowed=$user->rights->stock->creer; + + print $formfile->showdocuments($modulepart,$objectref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object); + $somethingshown=$formfile->numoffiles; + + print '
'; + + $MAXEVENT = 10; + + $morehtmlright = ''; + $morehtmlright.= $langs->trans("SeeAll"); + $morehtmlright.= ''; + + // List of actions on element + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $somethingshown = $formactions->showactions($object, 'mouvement', 0, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for product + + print '
'; +} + + +// End of page +llxFooter(); +$db->close(); From 2ba7bb9d4e49e107d4aad51eb9f240d649ce1058 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Mon, 28 Jan 2019 17:13:24 +0100 Subject: [PATCH 02/36] Add & Update pdf_stdmouvement.modules.php Fix Bug Generate pdf --- .../stock/doc/pdf_stdmouvement.modules.php | 196 ++++++++++-------- 1 file changed, 109 insertions(+), 87 deletions(-) diff --git a/htdocs/core/modules/stock/doc/pdf_stdmouvement.modules.php b/htdocs/core/modules/stock/doc/pdf_stdmouvement.modules.php index 16d979d60ee..65c1275a129 100644 --- a/htdocs/core/modules/stock/doc/pdf_stdmouvement.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_stdmouvement.modules.php @@ -17,12 +17,12 @@ */ /** - * \file htdocs/core/modules/stock/doc/pdf_standard.modules.php + * \file htdocs/core/modules/stock/doc/pdf_stdmouvement.modules.php * \ingroup societe - * \brief File of class to build PDF documents for stocks/services + * \brief File of class to build PDF documents for stocks movements */ -require_once DOL_DOCUMENT_ROOT.'/core/modules/stock/modules_stock.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/modules/stock/modules_movement.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; /** * Class to build documents using ODF templates generator */ -class pdf_stdmouvement extends ModelePDFMouvement +class pdf_stdmouvement extends ModelePDFMovement { /** * @var DoliDb Database handler @@ -59,9 +59,9 @@ class pdf_stdmouvement extends ModelePDFMouvement /** * @var array() Minimum version of PHP required by module. - * e.g.: PHP ≥ 5.3 = array(5, 3) + * e.g.: PHP ≥ 5.4 = array(5, 4) */ - public $phpmin = array(5, 2); + public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document @@ -69,15 +69,46 @@ class pdf_stdmouvement extends ModelePDFMouvement */ public $version = 'dolibarr'; + /** + * @var int page_largeur + */ public $page_largeur; + + /** + * @var int page_hauteur + */ public $page_hauteur; + + /** + * @var array format + */ public $format; + + /** + * @var int marge_gauche + */ public $marge_gauche; + + /** + * @var int marge_droite + */ public $marge_droite; + + /** + * @var int marge_haute + */ public $marge_haute; + + /** + * @var int marge_basse + */ public $marge_basse; - public $emetteur; // Objet societe qui emet + /** + * Issuer + * @var Societe + */ + public $emetteur; /** @@ -89,8 +120,8 @@ class pdf_stdmouvement extends ModelePDFMouvement { global $conf,$langs,$mysoc; - $langs->load("main"); - $langs->load("companies"); + // Load traductions files requiredby by page + $langs->loadLangs(array("main", "companies")); $this->db = $db; $this->name = "stdmouvement"; @@ -115,14 +146,14 @@ class pdf_stdmouvement extends ModelePDFMouvement // Recupere emetteur $this->emetteur=$mysoc; if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined - + // Define position of columns $this->wref = 15; $this->posxidref = $this->marge_gauche; - $this->posxdatemouv = $this->marge_gauche+8;; + $this->posxdatemouv = $this->marge_gauche+8; $this->posxdesc=37; $this->posxlabel=50; - $this->posxtva=80; + $this->posxtva=80; $this->posxqty=105; $this->posxup=119; $this->posxunit=136; @@ -149,6 +180,7 @@ class pdf_stdmouvement extends ModelePDFMouvement } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build a document on disk using the generic odt module. * @@ -160,22 +192,18 @@ class pdf_stdmouvement extends ModelePDFMouvement * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ - function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) + function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) { + // phpcs:enable global $user,$langs,$conf,$mysoc,$db,$hookmanager; if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - $outputlangs->load("main"); - $outputlangs->load("dict"); - $outputlangs->load("companies"); - $outputlangs->load("bills"); - $outputlangs->load("stocks"); - $outputlangs->load("orders"); - $outputlangs->load("deliveries"); - + // Load traductions files requiredby by page + $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "stocks", "orders", "deliveries")); + /** * TODO: get from object */ @@ -219,7 +247,7 @@ class pdf_stdmouvement extends ModelePDFMouvement // fetch optionals attributes and labels $extralabels = $extrafields->fetch_name_optionals_label('movement'); - $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); + $search_array_options=$extrafields->getOptionalsFromPost('movement','','search_'); $productlot=new ProductLot($db); $productstatic=new Product($db); @@ -259,7 +287,7 @@ class pdf_stdmouvement extends ModelePDFMouvement else $sql.= " AND date_format(m.datem, '%m') = '$month'"; } - else if ($year > 0) + elseif ($year > 0) { $sql.= " AND m.datem BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } @@ -308,7 +336,7 @@ class pdf_stdmouvement extends ModelePDFMouvement if ($conf->stock->dir_output) { - + if ($resql) { $product = new Product($db); @@ -340,11 +368,11 @@ class pdf_stdmouvement extends ModelePDFMouvement if ($id) $texte.=' ('.$langs->trans("ForThisWarehouse").')'; } } - + // Definition of $dir and $file if ($object->specimen) { - $dir = $conf->stock->dir_output . "/mouvement"; + $dir = $conf->stock->dir_output . "/movement"; $file = $dir . "/SPECIMEN.pdf"; } else @@ -352,14 +380,14 @@ class pdf_stdmouvement extends ModelePDFMouvement $objectref = dol_sanitizeFileName($object->ref); if(!empty($search_inventorycode)) $objectref.="_".$id."_".$search_inventorycode; if($search_type_mouvement) $objectref.="_".$search_type_mouvement; - $dir = $conf->stock->dir_output . "/mouvement/" . $objectref; + $dir = $conf->stock->dir_output . "/movement/" . $objectref; $file = $dir . "/" . $objectref . ".pdf"; } - + $stockFournisseur = new ProductFournisseur($this->db); $supplierprices = $stockFournisseur->list_product_fournisseur_price($object->id); $object->supplierprices = $supplierprices; - + $productstatic=new Product($db); if (! file_exists($dir)) @@ -439,14 +467,15 @@ class pdf_stdmouvement extends ModelePDFMouvement /* Affichage de la liste des produits du MouvementStock */ /* */ /* ************************************************************************** */ - - $nexY+=5; + + $nexY+=5; $nexY = $pdf->GetY(); $nexY+=10; $totalunit=0; $totalvalue=$totalvaluesell=0; - + $arrayofuniqueproduct = array(); + //dol_syslog('List products', LOG_DEBUG); $resql = $db->query($sql); if ($resql) @@ -474,7 +503,7 @@ class pdf_stdmouvement extends ModelePDFMouvement if ($objtp->label != '') $objp->produit = $objtp->label; } } - + $curY = $nexY; $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0,0,0); @@ -482,7 +511,7 @@ class pdf_stdmouvement extends ModelePDFMouvement $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); - + // Description of product line $curX = $this->posxdesc-1; @@ -535,7 +564,7 @@ class pdf_stdmouvement extends ModelePDFMouvement } $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut - + // $objp = $db->fetch_object($resql); $userstatic->id=$objp->fk_user_author; @@ -565,8 +594,8 @@ class pdf_stdmouvement extends ModelePDFMouvement $origin = $movement->get_origin($objp->fk_origin, $objp->origintype); } else { $origin = ''; - } - + } + // Id movement. $pdf->SetXY($this->posxidref, $curY); $pdf->MultiCell($this->posxdesc-$this->posxidref-0.8, 3, $objp->mid, 0, 'L'); @@ -585,8 +614,8 @@ class pdf_stdmouvement extends ModelePDFMouvement // Lot/serie $pdf->SetXY($this->posxqty, $curY); - $pdf->MultiCell($this->posxup-$this->posxqty-0.8, 3, $productlot->batch, 0, 'R'); - + $pdf->MultiCell($this->posxup-$this->posxqty-0.8, 3, $productlot->batch, 0, 'R'); + // Inv. code $pdf->SetXY($this->posxup, $curY); $pdf->MultiCell($this->posxunit-$this->posxup-0.8, 3, $objp->inventorycode, 0, 'R'); @@ -595,7 +624,7 @@ class pdf_stdmouvement extends ModelePDFMouvement $pdf->SetXY($this->posxunit, $curY); $pdf->MultiCell($this->posxdiscount-$this->posxunit-0.8, 3, $objp->label, 0, 'R'); $totalvalue+=price2num($objp->ppmp*$objp->value,'MT'); - + // Origin $pricemin=$objp->price; $pdf->SetXY($this->posxdiscount, $curY); @@ -608,9 +637,9 @@ class pdf_stdmouvement extends ModelePDFMouvement $pdf->SetXY($this->postotalht, $curY); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $objp->qty, 0, 'R', 0); - + $totalvaluesell+=price2num($pricemin*$objp->value,'MT'); - + $nexY+=3.5; // Passe espace entre les lignes // Add line if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) @@ -623,7 +652,7 @@ class pdf_stdmouvement extends ModelePDFMouvement } $nexY+=2; // Passe espace entre les lignes - + // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) { @@ -668,9 +697,9 @@ class pdf_stdmouvement extends ModelePDFMouvement */ $nexY = $pdf->GetY(); $nexY+=5; - $curY = $nexY; + $curY = $nexY; - $pdf->SetLineStyle(array('dash'=>'0','color'=>array(220,26,26))); + $pdf->SetLineStyle(array('dash'=>'0','color'=>array(220,26,26))); $pdf->line($this->marge_gauche, $curY-1, $this->page_largeur-$this->marge_droite, $curY-1); $pdf->SetLineStyle(array('dash'=>0)); @@ -680,11 +709,10 @@ class pdf_stdmouvement extends ModelePDFMouvement // Total $pdf->SetXY($this->posxidref, $curY); $pdf->MultiCell($this->posxdesc-$this->posxidref, 3, $langs->trans("Total"), 0, 'L'); - + // Total Qty $pdf->SetXY($this->postotalht, $curY); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $totalunit, 0, 'R', 0); - } else { @@ -720,8 +748,8 @@ class pdf_stdmouvement extends ModelePDFMouvement $curY = $tab_top + 7; $nexY = $tab_top + 7; - $tab_top = $tab_top_newpage+21; - + $tab_top = $tab_top_newpage+21; + // Show square if ($pagenb == 1) { @@ -733,7 +761,7 @@ class pdf_stdmouvement extends ModelePDFMouvement $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; // Affiche zone infos @@ -790,7 +818,7 @@ class pdf_stdmouvement extends ModelePDFMouvement * @param string $currency Currency code * @return void */ - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '') { global $conf; @@ -820,14 +848,14 @@ class pdf_stdmouvement extends ModelePDFMouvement // Output Rect //$this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param - + $pdf->SetLineStyle(array('dash'=>'0','color'=>array(220,26,26))); - $pdf->SetDrawColor(220,26,26); + $pdf->SetDrawColor(220,26,26); $pdf->line($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite, $tab_top); $pdf->SetLineStyle(array('dash'=>0)); $pdf->SetDrawColor(128,128,128); $pdf->SetTextColor(0,0,120); - + //Ref mouv if (empty($hidetop)) { @@ -835,7 +863,7 @@ class pdf_stdmouvement extends ModelePDFMouvement $pdf->SetXY($this->posxidref, $tab_top+1); $pdf->MultiCell($this->posxdatemouv-$this->posxdatemouv-0.8,3, $outputlangs->transnoentities("Ref"),'','L'); } - + //Date mouv //$pdf->line($this->posxlabel-1, $tab_top, $this->posxlabel-1, $tab_top + $tab_height); if (empty($hidetop)) @@ -847,7 +875,7 @@ class pdf_stdmouvement extends ModelePDFMouvement //Ref Product //$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); if (empty($hidetop)) - { + { $pdf->SetXY($this->posxdesc-1, $tab_top+1); $pdf->MultiCell($this->posxlabel-$this->posxdesc,2, $outputlangs->transnoentities("Ref. Product"),'','C'); } @@ -862,7 +890,7 @@ class pdf_stdmouvement extends ModelePDFMouvement //Lot/serie Product //$pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height); - if (empty($hidetop)) + if (empty($hidetop)) { $pdf->SetXY($this->posxqty, $tab_top + 1); $pdf->MultiCell($this->posxup - $this->posxqty, 2, $outputlangs->transnoentities("Lot/Série"), '','C'); @@ -877,34 +905,33 @@ class pdf_stdmouvement extends ModelePDFMouvement } //Label mouvement - //$pdf->line($this->posxunit, $tab_top, $this->posxunit, $tab_top + $tab_height); + //$pdf->line($this->posxunit, $tab_top, $this->posxunit, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxunit, $tab_top+1); $pdf->MultiCell($this->posxdiscount-$this->posxunit,2, $outputlangs->transnoentities("Label Mouvement"),'','C'); } - + //Origin - //$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height); + //$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxdiscount+2, $tab_top+1); $pdf->MultiCell($this->postotalht-$this->posxdiscount-0.8,2, $outputlangs->transnoentities("Origin"),'','C'); } - + //Qty - //$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height); + //$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->postotalht+2, $tab_top+1); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht,2, $outputlangs->transnoentities("Qty"),'','C'); } - - $pdf->SetDrawColor(220,26,26); + + $pdf->SetDrawColor(220,26,26); $pdf->SetLineStyle(array('dash'=>'0','color'=>array(220,26,26))); - $pdf->line($this->marge_gauche, $tab_top+11, $this->page_largeur-$this->marge_droite, $tab_top+11); + $pdf->line($this->marge_gauche, $tab_top+11, $this->page_largeur-$this->marge_droite, $tab_top+11); $pdf->SetLineStyle(array('dash'=>0)); - } /** @@ -917,16 +944,13 @@ class pdf_stdmouvement extends ModelePDFMouvement * @param string $titlekey Translation key to show as title of document * @return void */ - function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="") + function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "") { global $conf,$langs,$db,$hookmanager; - $outputlangs->load("main"); - $outputlangs->load("bills"); - $outputlangs->load("propal"); - $outputlangs->load("companies"); - $outputlangs->load("orders"); - $outputlangs->load("stocks"); + // Load traductions files requiredby by page + $outputlangs->loadLangs(array("main", "propal", "companies", "bills", "orders", "stocks")); + $default_font_size = pdf_getPDFFontSize($outputlangs); if ($object->type == 1) $titlekey='ServiceSheet'; @@ -990,22 +1014,22 @@ class pdf_stdmouvement extends ModelePDFMouvement $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("LocationSummary").' :', '', 'R'); - + $posy+=4; $pdf->SetXY($posx-50,$posy); $pdf->MultiCell(150, 3, $object->lieu, '', 'R'); - - + + // Parent MouvementStock $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ParentWarehouse").' :', '', 'R'); - + $posy+=4; $pdf->SetXY($posx-50,$posy); $e = new MouvementStock($db); - if(!empty($object->fk_parent) && $e->fetch($object->fk_parent) > 0) + if(!empty($object->fk_parent) && $e->fetch($object->fk_parent) > 0) { $pdf->MultiCell(150, 3, $e->libelle, '', 'R'); } @@ -1013,14 +1037,14 @@ class pdf_stdmouvement extends ModelePDFMouvement { $pdf->MultiCell(150, 3, $outputlangs->transnoentities("None"), '', 'R'); } - + // Description $nexY = $pdf->GetY(); $nexY+=5; $pdf->SetXY($posx,$posy); $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, ''.$outputlangs->transnoentities("Description").' : '.nl2br($object->description), 0, 1); $nexY = $pdf->GetY(); - + $calcproductsunique=$object->nb_different_products(); $calcproducts=$object->nb_products(); @@ -1032,12 +1056,12 @@ class pdf_stdmouvement extends ModelePDFMouvement $valtoshow=price2num($calcproducts['nb'], 'MS'); $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, ''.$outputlangs->transnoentities("NumberOfProducts").' : '.(empty($valtoshow)?'0':$valtoshow), 0, 1); $nexY = $pdf->GetY(); - + // Value $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, ''.$outputlangs->transnoentities("EstimatedStockValueShort").' : '. price((empty($calcproducts['value'])?'0':price2num($calcproducts['value'],'MT')), 0, $langs, 0, -1, -1, $conf->currency), 0, 1); $nexY = $pdf->GetY(); - - + + // Last movement $sql = "SELECT max(m.datem) as datem"; $sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m"; @@ -1065,7 +1089,7 @@ class pdf_stdmouvement extends ModelePDFMouvement $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, ''.$outputlangs->transnoentities("LastMovement").' : '.$toWrite, 0, 1); $nexY = $pdf->GetY(); - + /*if ($object->ref_client) { $posy+=5; @@ -1148,12 +1172,10 @@ class pdf_stdmouvement extends ModelePDFMouvement * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text */ - function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) + function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf,$outputlangs,'PRODUCT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } - } - From 8a62c9bc5f30edb530b655edf7a340ce98225d12 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 12 Feb 2019 14:40:30 +0100 Subject: [PATCH 03/36] update with html5 compliant code --- htdocs/compta/paiement/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 5e555655228..b58ac1d1e93 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -279,7 +279,7 @@ if ($resql) $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "p.statut", "", $param, 'align="right"', $sortfield, $sortorder); + if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "p.statut", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; From e10d1eb36533b472aaacb36fad9a956dea791f87 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 12 Feb 2019 14:44:25 +0100 Subject: [PATCH 04/36] update with html5 compliant code --- htdocs/compta/resultat/index.php | 10 +++++----- htdocs/compta/resultat/result.php | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 5181ae02667..addc56a240b 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -922,7 +922,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) if($mois>12) {$annee_decalage=$annee+1;} $case = strftime("%Y-%m", dol_mktime(12, 0, 0, $mois_modulo, 1, $annee_decalage)); - print ' '; + print ' '; if ($modecompta == 'BOOKKEEPING') { if (isset($decaiss[$case]) && $decaiss[$case] != 0) @@ -943,7 +943,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) } print ""; - print ' '; + print ' '; if ($modecompta == 'BOOKKEEPING') { if (isset($encaiss[$case])) @@ -978,8 +978,8 @@ print ''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { $nbcols+=2; - print ''.(isset($totsorties[$annee])?price(price2num($totsorties[$annee], 'MT')):' ').''; - print ''.(isset($totentrees[$annee])?price(price2num($totentrees[$annee], 'MT')):' ').''; + print ''.(isset($totsorties[$annee])?price(price2num($totsorties[$annee], 'MT')):' ').''; + print ''.(isset($totentrees[$annee])?price(price2num($totentrees[$annee], 'MT')):' ').''; } print "\n"; @@ -993,7 +993,7 @@ print "\n"; print ''.$langs->trans("AccountingResult").''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { - print ' '; + print ' '; if (isset($totentrees[$annee]) || isset($totsorties[$annee])) { $in=(isset($totentrees[$annee])?price2num($totentrees[$annee], 'MT'):0); diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 7b7d37a6cb9..fcee95b688f 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -228,18 +228,18 @@ print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; foreach($months as $k => $v){ if (($k+1) >= $date_startmonth) { - print ''; + print ''; } } foreach($months as $k => $v){ if (($k+1) < $date_startmonth) { - print ''; + print ''; } } print ''; @@ -493,15 +493,15 @@ elseif ($modecompta=="BOOKKEEPING") } print ''; - print ''; - print ''; + print ''; + print ''; // Each month foreach($totCat['M'] as $k => $v){ - if (($k+1) >= $date_startmonth) print ''; + if (($k+1) >= $date_startmonth) print ''; } foreach($totCat['M'] as $k => $v){ - if (($k+1) < $date_startmonth) print ''; + if (($k+1) < $date_startmonth) print ''; } print "\n"; @@ -523,8 +523,8 @@ elseif ($modecompta=="BOOKKEEPING") print ' - '; print $cpt['account_label']; print ''; - print ''; - print ''; + print ''; + print ''; // Make one call for each month foreach($months as $k => $v) @@ -532,7 +532,7 @@ elseif ($modecompta=="BOOKKEEPING") if (($k+1) >= $date_startmonth) { $resultM=$totPerAccount[$cpt['account_number']]['M'][$k]; - print ''; + print ''; } } foreach($months as $k => $v) @@ -540,7 +540,7 @@ elseif ($modecompta=="BOOKKEEPING") if (($k+1) < $date_startmonth) { $resultM=$totPerAccount[$cpt['account_number']]['M'][$k]; - print ''; + print ''; } } print "\n"; From 66e8380a4a5e66f9eae5b31eb2f2f3c927666b63 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 12 Feb 2019 14:48:07 +0100 Subject: [PATCH 05/36] update with html5 compliant code --- htdocs/compta/salaries/list.php | 16 ++++++++-------- htdocs/compta/salaries/stats/index.php | 18 +++++++++--------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/compta/salaries/list.php b/htdocs/compta/salaries/list.php index 99a41f5ad9f..e0fb1b38636 100644 --- a/htdocs/compta/salaries/list.php +++ b/htdocs/compta/salaries/list.php @@ -194,9 +194,9 @@ if ($result) print ''; } // Amount - print ''; + print ''; - print ''; @@ -204,11 +204,11 @@ if ($result) print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.rowid", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, 'align="left"', $sortfield, $sortorder); + print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, 'class="left"', $sortfield, $sortorder); print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "s.datep,s.rowid", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, 'align="left"', $sortfield, $sortorder); + print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder); if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "s.amount", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "s.amount", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; @@ -269,8 +269,8 @@ if ($result) print ''; } // Amount - print ""; - print ""; + print ''; + print ''; print "\n"; $total = $total + $obj->amount; @@ -281,7 +281,7 @@ if ($result) $colspan=5; if (! empty($conf->banque->enabled)) $colspan++; print ''; - print '"; + print '"; print ""; print "
'.$langs->trans("AccountingCategory").''.$langs->trans("PreviousPeriod").''.$langs->trans("SelectedPeriod").''.$langs->trans("PreviousPeriod").''.$langs->trans("SelectedPeriod").''.$langs->trans('MonthShort'.sprintf("%02s", ($k+1))).''.$langs->trans('MonthShort'.sprintf("%02s", ($k+1))).''.$langs->trans('MonthShort'.sprintf("%02s", ($k+1))).''.$langs->trans('MonthShort'.sprintf("%02s", ($k+1))).'
' . price($totCat['NP']) . '' . price($totCat['N']) . '' . price($totCat['NP']) . '' . price($totCat['N']) . '' . price($v) . '' . price($v) . '' . price($v) . '' . price($v) . '
' . price($resultNP) . '' . price($resultN) . '' . price($resultNP) . '' . price($resultN) . '' . price($resultM) . '' . price($resultM) . '' . price($resultM) . '' . price($resultM) . '
'; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
".price($obj->amount)."'.price($obj->amount).'
'.$langs->trans("Total").''.price($total)."'.price($total)."
"; diff --git a/htdocs/compta/salaries/stats/index.php b/htdocs/compta/salaries/stats/index.php index f51e102d4f2..0c64ed5865e 100644 --- a/htdocs/compta/salaries/stats/index.php +++ b/htdocs/compta/salaries/stats/index.php @@ -218,9 +218,9 @@ print '
'; print ''; print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print ''; $oldyear=0; @@ -234,17 +234,17 @@ foreach ($data as $val) print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; } print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; $oldyear=$year; } From fd6eaf8c3da64d37a3cab82789205777eb70cc48 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 12 Feb 2019 14:53:35 +0100 Subject: [PATCH 06/36] update with html5 compliant code --- htdocs/compta/sociales/card.php | 20 ++++++------ htdocs/compta/sociales/list.php | 20 ++++++------ htdocs/compta/sociales/payments.php | 50 ++++++++++++++--------------- 3 files changed, 45 insertions(+), 45 deletions(-) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index bc0727889a6..fe29e133edc 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -537,7 +537,7 @@ if ($id > 0) print $langs->trans('PaymentMode'); print ''; if ($action != 'editmode') - print ''; + print ''; print '
'.$langs->trans("Year").''.$langs->trans("Number").''.$langs->trans("AmountTotal").''.$langs->trans("AmountAverage").''.$langs->trans("Number").''.$langs->trans("AmountTotal").''.$langs->trans("AmountAverage").'
'.$oldyear.'000000
'.$year.''.$val['nb'].''.price(price2num($val['total'], 'MT'), 1).''.price(price2num($val['avg'], 'MT'), 1).''.$val['nb'].''.price(price2num($val['total'], 'MT'), 1).''.price(price2num($val['avg'], 'MT'), 1).'
id . '">' . img_edit($langs->trans('SetMode'), 1) . 'id . '">' . img_edit($langs->trans('SetMode'), 1) . '
'; print ''; if ($action == 'editmode') { @@ -555,7 +555,7 @@ if ($id > 0) print $langs->trans('BankAccount'); print ''; if ($action != 'editbankaccount' && $user->rights->tax->charges->creer) - print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; print ''; print ''; if ($action == 'editbankaccount') { @@ -608,9 +608,9 @@ if ($id > 0) print ''.$langs->trans("Date").''; print ''.$langs->trans("Type").''; if (! empty($conf->banque->enabled)) { - print '' . $langs->trans('BankAccount') . ''; + print '' . $langs->trans('BankAccount') . ''; } - print ''.$langs->trans("Amount").''; + print ''.$langs->trans("Amount").''; print ''; if ($num > 0) @@ -639,12 +639,12 @@ if ($id > 0) $bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); } - print ''; + print ''; if ($bankaccountstatic->id) print $bankaccountstatic->getNomUrl(1, 'transactions'); print ''; } - print ''.price($objp->amount)."\n"; + print ''.price($objp->amount)."\n"; print ""; $totalpaye += $objp->amount; $i++; @@ -658,14 +658,14 @@ if ($id > 0) print ''; } - print ''.$langs->trans("AlreadyPaid")." :".price($totalpaye)."\n"; - print ''.$langs->trans("AmountExpected")." :".price($object->amount)."\n"; + print ''.$langs->trans("AlreadyPaid")." :".price($totalpaye)."\n"; + print ''.$langs->trans("AmountExpected")." :".price($object->amount)."\n"; $resteapayer = $object->amount - $totalpaye; $cssforamountpaymentcomplete = 'amountpaymentcomplete'; - print ''.$langs->trans("RemainderToPay")." :"; - print ''.price($resteapayer)."\n"; + print ''.$langs->trans("RemainderToPay")." :"; + print ''.price($resteapayer)."\n"; print ""; $db->free($resql); diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 847cb431a6b..8a8cc1f61b8 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -203,17 +203,17 @@ if ($resql) // Period end date print ' '; // Amount - print ''; + print ''; print ''; print ''; print ' '; // Status - print ''; + print ''; $liststatus=array('0'=>$langs->trans("Unpaid"), '1'=>$langs->trans("Paid")); print $form->selectarray('search_status', $liststatus, $search_status, 1); print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; @@ -221,12 +221,12 @@ if ($resql) print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "id", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "cs.libelle", "", $param, 'align="left"', $sortfield, $sortorder); - print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "type", "", $param, 'align="left"', $sortfield, $sortorder); + print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "cs.libelle", "", $param, 'class="left"', $sortfield, $sortorder); + print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder); print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "periode", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "cs.amount", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "cs.amount", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("DateDue", $_SERVER["PHP_SELF"], "cs.date_ech", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "cs.paye", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "cs.paye", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; @@ -267,7 +267,7 @@ if ($resql) print ''; // Amount - print ''.price($obj->amount).''; + print ''.price($obj->amount).''; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; $totalarray['totalttc'] += $obj->amount; @@ -275,7 +275,7 @@ if ($resql) // Due date print ''.dol_print_date($db->jdate($obj->date_ech), 'day').''; - print ''.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).''; + print ''.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).''; print ''; @@ -292,7 +292,7 @@ if ($resql) print ''; print ''; print ''; - print ''.price($totalarray['totalttc']).''; + print ''.price($totalarray['totalttc']).''; print ''; print ''; print ''; diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index 9b2bb9552a8..384601ca989 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -122,8 +122,8 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print_liste_field_titre("LabelContrib", $_SERVER["PHP_SELF"], "c.libelle", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("TypeContrib", $_SERVER["PHP_SELF"], "cs.fk_type", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "cs.date_ech", "", $param, 'width="140px"', $sortfield, $sortorder); - print_liste_field_titre("ExpectedToPay", $_SERVER["PHP_SELF"], "cs.amount", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pc.amount", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("ExpectedToPay", $_SERVER["PHP_SELF"], "cs.amount", "", $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pc.amount", "", $param, 'class="right"', $sortfield, $sortorder); print "\n"; $sql = "SELECT c.id, c.libelle as lib,"; @@ -187,9 +187,9 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) if (empty($date)) $date=$obj->date_ech; print ''.dol_print_date($date, 'day').''; // Expected to pay - print ''.price($obj->total).''; + print ''.price($obj->total).''; // Paid - print ''; + print ''; if ($obj->totalpaye) print price($obj->totalpaye); print ''; print ''; @@ -200,11 +200,11 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $i++; } print ''.$langs->trans("Total").''; - print ''; // A total here has no sense + print ''; // A total here has no sense print ' '; print ' '; print ' '; - print ''.price($totalpaye).""; + print ''.price($totalpaye).""; print ""; } else @@ -246,10 +246,10 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ''; print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "pv.datev", "", $param, 'width="140px"', $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "pv.label", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("ExpectedToPay", $_SERVER["PHP_SELF"], "pv.amount", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("ExpectedToPay", $_SERVER["PHP_SELF"], "pv.amount", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "pv.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "pv.datev", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pv.amount", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pv.amount", "", $param, 'class="right"', $sortfield, $sortorder); print "\n"; while ($i < $num) @@ -263,7 +263,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print "".$obj->label."\n"; - print ''.price($obj->amount).""; + print ''.price($obj->amount).""; // Ref payment $tva_static->id=$obj->rowid; @@ -271,16 +271,16 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ''.$tva_static->getNomUrl(1)."\n"; print ''.dol_print_date($db->jdate($obj->dm), 'day')."\n"; - print ''.price($obj->amount).""; + print ''.price($obj->amount).""; print "\n"; $i++; } print ''.$langs->trans("Total").''; - print ''.price($total).''; + print ''.price($total).''; print ' '; print ' '; - print ''.price($total).""; + print ''.price($total).""; print ""; print ""; @@ -347,10 +347,10 @@ while($j<$numlt) print ''; print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "pv.datev", "", $param, 'width="120"', $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "pv.label", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("ExpectedToPay", $_SERVER["PHP_SELF"], "pv.amount", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("ExpectedToPay", $_SERVER["PHP_SELF"], "pv.amount", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "pv.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "pv.datep", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pv.amount", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pv.amount", "", $param, 'class="right"', $sortfield, $sortorder); print "\n"; while ($i < $num) @@ -364,7 +364,7 @@ while($j<$numlt) print "".$obj->label."\n"; - print ''.price($obj->amount).""; + print ''.price($obj->amount).""; // Ref payment $tva_static->id=$obj->rowid; @@ -372,16 +372,16 @@ while($j<$numlt) print ''.$tva_static->getNomUrl(1)."\n"; print ''.dol_print_date($db->jdate($obj->dp), 'day')."\n"; - print ''.price($obj->amount).""; + print ''.price($obj->amount).""; print "\n"; $i++; } - print ''.$langs->trans("Total").''; - print ''.price($total).""; + print ''.$langs->trans("Total").''; + print ''.price($total).""; print ' '; print ' '; - print ''.price($total).""; + print ''.price($total).""; print ""; print ""; @@ -428,10 +428,10 @@ if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) print ''; print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "s.dateep", "", $param, 'width="140px"', $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("ExpectedToPay", $_SERVER["PHP_SELF"], "s.amount", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("ExpectedToPay", $_SERVER["PHP_SELF"], "s.amount", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "s.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "s.datep", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "s.amount", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "s.amount", "", $param, 'class="right"', $sortfield, $sortorder); print "\n"; while ($i < $num) @@ -446,7 +446,7 @@ if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) print "".$obj->label."\n"; - print ''.($obj->salary?price($obj->salary):'').""; + print ''.($obj->salary?price($obj->salary):'').""; // Ref payment $sal_static->id=$obj->rowid; @@ -454,16 +454,16 @@ if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) print ''.$sal_static->getNomUrl(1)."\n"; print ''.dol_print_date($db->jdate($obj->datep), 'day')."\n"; - print ''.price($obj->amount).""; + print ''.price($obj->amount).""; print "\n"; $i++; } print ''.$langs->trans("Total").''; - print ''; // A total here has no sense + print ''; // A total here has no sense print ' '; print ' '; - print ''.price($total).""; + print ''.price($total).""; print ""; print ""; From 5007ef82c8487e711c50783d2f42a6c88435cb15 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 12 Feb 2019 14:56:38 +0100 Subject: [PATCH 07/36] update with html5 compliant code --- htdocs/compta/stats/byratecountry.php | 24 +++++++++---------- htdocs/compta/stats/cabyprodserv.php | 34 +++++++++++++-------------- htdocs/compta/stats/cabyuser.php | 16 ++++++------- 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index dd14f175432..c69547740dc 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -257,10 +257,10 @@ while($i < 12) { $j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START); if ($j > 12) $j -= 12; - print '' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . ''; + print '' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . ''; $i++; } -print '' . $langs->trans("TotalHT") . ''; +print '' . $langs->trans("TotalHT") . ''; $sql = "SELECT fd.tva_tx AS vatrate,"; $sql .= " fd.product_type AS product_type,"; @@ -301,10 +301,10 @@ if ($resql) { $j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START); if ($j > 12) $j -= 12; $monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT); - print '' . price($obj->$monthj) . ''; + print '' . price($obj->$monthj) . ''; $totalpermonth[$j]=(empty($totalpermonth[$j])?0:$totalpermonth[$j])+$obj->$monthj; } - print '' . price($obj->total) . ''; + print '' . price($obj->total) . ''; $totalpermonth['total']=(empty($totalpermonth['total'])?0:$totalpermonth['total'])+$obj->total; print ''; } @@ -318,9 +318,9 @@ if ($resql) { $j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START); if ($j > 12) $j -= 12; $monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT); - print '' . price($totalpermonth[$j]) . ''; + print '' . price($totalpermonth[$j]) . ''; } - print '' . price($totalpermonth['total']) . ''; + print '' . price($totalpermonth['total']) . ''; print ''; } else { print $db->lasterror(); // Show last sql error @@ -335,10 +335,10 @@ while($i < 12) { $j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START); if ($j > 12) $j -= 12; - print '' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . ''; + print '' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . ''; $i++; } -print '' . $langs->trans("TotalHT") . ''; +print '' . $langs->trans("TotalHT") . ''; $sql2 = "SELECT ffd.tva_tx AS vatrate,"; $sql2 .= " ffd.product_type AS product_type,"; @@ -380,10 +380,10 @@ if ($resql2) { $j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START); if ($j > 12) $j -= 12; $monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT); - print '' . price($obj->$monthj) . ''; + print '' . price($obj->$monthj) . ''; $totalpermonth[$j]=(empty($totalpermonth[$j])?0:$totalpermonth[$j])+$obj->$monthj; } - print '' . price($obj->total) . ''; + print '' . price($obj->total) . ''; $totalpermonth['total']=(empty($totalpermonth['total'])?0:$totalpermonth['total'])+$obj->total; print ''; } @@ -397,9 +397,9 @@ if ($resql2) { $j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START); if ($j > 12) $j -= 12; $monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT); - print '' . price($totalpermonth[$j]) . ''; + print '' . price($totalpermonth[$j]) . ''; } - print '' . price($totalpermonth['total']) . ''; + print '' . price($totalpermonth['total']) . ''; print ''; } else { print $db->lasterror(); // Show last sql error diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index fffb63055aa..cb8a3cc451d 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -315,7 +315,7 @@ if ($modecompta == 'CREANCES-DETTES') $form->select_type_of_lines(isset($selected_type)?$selected_type:-1, 'search_type', 1, 1, 1); print ''; - print ''; + print ''; print ''; print ''; @@ -337,7 +337,7 @@ print_liste_field_titre( "qty", "", $paramslink, - 'align="right"', + 'class="right"', $sortfield, $sortorder ); @@ -347,7 +347,7 @@ print_liste_field_titre( "qty", "", $paramslink, - 'align="right"', + 'class="right"', $sortfield, $sortorder ); @@ -356,8 +356,8 @@ print_liste_field_titre( $_SERVER["PHP_SELF"], "amount", "", - $paramslink, - 'align="right"', + $classslink, + 'class="right"', $sortfield, $sortorder ); @@ -367,7 +367,7 @@ print_liste_field_titre( "amount_ttc", "", $paramslink, - 'align="right"', + 'class="right"', $sortfield, $sortorder ); @@ -377,7 +377,7 @@ print_liste_field_titre( "amount_ttc", "", $paramslink, - 'align="right"', + 'class="right"', $sortfield, $sortorder ); @@ -400,15 +400,15 @@ print_liste_field_titre( print "\n"; // Quantity - print ''; + print ''; print $qty[$key]; print ''; // Percent; - print ''.($qtytotal > 0 ? round(100 * $qty[$key] / $qtytotal, 2).'%' : ' ').''; + print ''.($qtytotal > 0 ? round(100 * $qty[$key] / $qtytotal, 2).'%' : ' ').''; // Amount w/o VAT - print ''; + print ''; /*if ($key > 0) { print ''; } else { @@ -419,7 +419,7 @@ print_liste_field_titre( print ''; // Amount with VAT - print ''; + print ''; /*if ($key > 0) { print ''; } else { @@ -430,7 +430,7 @@ print_liste_field_titre( print ''; // Percent; - print ''.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : ' ').''; + print ''.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : ' ').''; // TODO: statistics? @@ -441,11 +441,11 @@ print_liste_field_titre( // Total print ''; print ''.$langs->trans("Total").''; - print ''.$qtytotal.''; - print '100%'; - print ''.price($catotal_ht).''; - print ''.price($catotal).''; - print '100%'; + print ''.$qtytotal.''; + print '100%'; + print ''.price($catotal_ht).''; + print ''.price($catotal).''; + print '100%'; print ''; $db->free($result); diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 7bf98b80452..89552c54199 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -310,7 +310,7 @@ if ($modecompta == 'CREANCES-DETTES') { "amount_ht", "", $paramslink, - 'align="right"', + 'class="right"', $sortfield, $sortorder ); @@ -323,7 +323,7 @@ print_liste_field_titre( "amount_ttc", "", $paramslink, - 'align="right"', + 'class="right"', $sortfield, $sortorder ); @@ -332,7 +332,7 @@ print_liste_field_titre( $_SERVER["PHP_SELF"], "amount_ttc", "", $paramslink, - 'align="right"', + 'class="right"', $sortfield, $sortorder ); @@ -391,7 +391,7 @@ if (count($amount)) { print "".$linkname."\n"; // Amount w/o VAT - print ''; + print ''; if ($modecompta != 'CREANCES-DETTES') { if ($key > 0) { @@ -410,7 +410,7 @@ if (count($amount)) { print ''; // Amount with VAT - print ''; + print ''; if ($modecompta != 'CREANCES-DETTES') { if ($key > 0) { print ''; @@ -428,7 +428,7 @@ if (count($amount)) { print ''; // Percent - print ''.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : ' ').''; + print ''.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : ' ').''; // Other stats print ''; @@ -452,9 +452,9 @@ if (count($amount)) { if ($modecompta != 'CREANCES-DETTES') { print ''; } else { - print ''.price($catotal_ht).''; + print ''.price($catotal_ht).''; } - print ''.price($catotal).''; + print ''.price($catotal).''; print ' '; print ' '; print ''; From 60e503c7d1d32ba72917be1d9c6d5a76e1326f62 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 12 Feb 2019 15:02:54 +0100 Subject: [PATCH 08/36] update with html5 compliant code --- htdocs/compta/stats/casoc.php | 26 ++++++++-------- htdocs/compta/stats/index.php | 56 +++++++++++++++++------------------ 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 864dd6ef314..a9108fff0f6 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -378,22 +378,22 @@ if ($subcat) { print ' checked'; } print'>'; -print ''; +print ''; print ''; print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; -print ''; +print ''; print $form->select_country($search_country, 'search_country'); //print ''; print ''; @@ -448,7 +448,7 @@ if ($modecompta == 'CREANCES-DETTES') { "amount_ht", "", $paramslink, - 'align="right"', + 'class="right"', $sortfield, $sortorder ); @@ -461,7 +461,7 @@ print_liste_field_titre( "amount_ttc", "", $paramslink, - 'align="right"', + 'class="right"', $sortfield, $sortorder ); @@ -471,7 +471,7 @@ print_liste_field_titre( "amount_ttc", "", $paramslink, - 'align="right"', + 'class="right"', $sortfield, $sortorder ); @@ -567,7 +567,7 @@ if (count($amount)) { print ''; // Amount w/o VAT - print ''; + print ''; if ($modecompta != 'CREANCES-DETTES') { if ($key > 0) { print ''; @@ -585,7 +585,7 @@ if (count($amount)) { print ''; // Amount with VAT - print ''; + print ''; if ($modecompta != 'CREANCES-DETTES') { if ($key > 0) { print ''; @@ -604,7 +604,7 @@ if (count($amount)) { print ''; // Percent; - print ''.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : ' ').''; + print ''.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : ' ').''; // Other stats print ''; @@ -631,9 +631,9 @@ if (count($amount)) { if ($modecompta != 'CREANCES-DETTES') { print ''; } else { - print ''.price($catotal_ht).''; + print ''.price($catotal_ht).''; } - print ''.price($catotal).''; + print ''.price($catotal).''; print ' '; print ' '; print ''; diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 67a3a111790..fe31f68380a 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -285,9 +285,9 @@ print ''; print ''.$langs->trans("Month").''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { - if ($modecompta == 'CREANCES-DETTES') print ''.$langs->trans("AmountHT").''; - print ''.$langs->trans("AmountTTC").''; - print ''.$langs->trans("Delta").''; + if ($modecompta == 'CREANCES-DETTES') print ''.$langs->trans("AmountHT").''; + print ''.$langs->trans("AmountTTC").''; + print ''.$langs->trans("Delta").''; if ($annee != $year_end) print ' '; } print ''; @@ -322,7 +322,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) { if ($modecompta == 'CREANCES-DETTES') { // Valeur CA du mois w/o VAT - print ''; + print ''; if ($cum_ht[$case]) { $now_show_delta=1; // On a trouve le premier mois de la premiere annee generant du chiffre. @@ -337,7 +337,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) } // Valeur CA du mois - print ''; + print ''; if ($cum[$case]) { $now_show_delta=1; // On a trouve le premier mois de la premiere annee generant du chiffre. @@ -359,29 +359,29 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) { $percent=(round(($cum[$case]-$cum[$caseprev])/$cum[$caseprev], 4)*100); //print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X"; - print ''.($percent>=0?"+$percent":"$percent").'%'; + print ''.($percent>=0?"+$percent":"$percent").'%'; } if ($cum[$caseprev] && ! $cum[$case]) { - print '-100%'; + print '-100%'; } if (! $cum[$caseprev] && $cum[$case]) { - //print '+Inf%'; - print '-'; + //print '+Inf%'; + print '-'; } if (isset($cum[$caseprev]) && ! $cum[$caseprev] && ! $cum[$case]) { - print '+0%'; + print '+0%'; } if (! isset($cum[$caseprev]) && ! $cum[$case]) { - print '-'; + print '-'; } } else { - print ''; + print ''; if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } else { print ' '; } print ''; @@ -410,7 +410,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) $caseprev = dol_print_date(dol_mktime(1,1,1,$mois,1,$annee-1),"%Y-%m"); // Valeur CA du mois - print ''; + print ''; if ($cum[$case]) { $now_show_delta=1; // On a trouve le premier mois de la premiere annee generant du chiffre. @@ -429,25 +429,25 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) { $percent=(round(($cum[$case]-$cum[$caseprev])/$cum[$caseprev],4)*100); //print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X"; - print ''.($percent>=0?"+$percent":"$percent").'%'; + print ''.($percent>=0?"+$percent":"$percent").'%'; } if ($cum[$caseprev] && ! $cum[$case]) { - print '-100%'; + print '-100%'; } if (! $cum[$caseprev] && $cum[$case]) { - print '+Inf%'; + print '+Inf%'; } if (! $cum[$caseprev] && ! $cum[$case]) { - print '+0%'; + print '+0%'; } } else { - print ''; + print ''; if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } else { print ' '; } print ''; @@ -469,7 +469,7 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++) // Montant total HT if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) { - print ''.($total_ht[$annee]?price($total_ht[$annee]):"0").""; + print ''.($total_ht[$annee]?price($total_ht[$annee]):"0").""; } else { @@ -480,7 +480,7 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++) // Montant total if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) { - print ''.($total[$annee]?price($total[$annee]):"0").""; + print ''.($total[$annee]?price($total[$annee]):"0").""; } else { @@ -492,24 +492,24 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++) { if ($total[$annee-1] && $total[$annee]) { $percent=(round(($total[$annee]-$total[$annee-1])/$total[$annee-1], 4)*100); - print ''.($percent>=0?"+$percent":"$percent").'%'; + print ''.($percent>=0?"+$percent":"$percent").'%'; } if ($total[$annee-1] && ! $total[$annee]) { - print '-100%'; + print '-100%'; } if (! $total[$annee-1] && $total[$annee]) { - print '+'.$langs->trans('Inf').'%'; + print '+'.$langs->trans('Inf').'%'; } if (! $total[$annee-1] && ! $total[$annee]) { - print '+0%'; + print '+0%'; } } else { - print ''; + print ''; if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { print '-'; } else { print ' '; } print ''; @@ -567,7 +567,7 @@ print '
'; $i++; } - print "Facture a encaisser : ".price($total_ttc_Rac)."<-- bug ici car n'exclut pas le deja r?gl? des factures partiellement r?gl?es"; + print "Facture a encaisser : ".price($total_ttc_Rac)."<-- bug ici car n'exclut pas le deja r?gl? des factures partiellement r?gl?es"; } $db->free($resql); } @@ -616,7 +616,7 @@ print ''; $i++; } - print "Signe et non facture:".price($total_pr)."<-- bug ici, ca devrait exclure le deja facture"; + print "Signe et non facture:".price($total_pr)."<-- bug ici, ca devrait exclure le deja facture"; } $db->free($resql); } @@ -624,7 +624,7 @@ print ''; { dol_print_error($db); } - print "Total CA previsionnel : ".price($total_CA)."<-- bug ici car bug sur les 2 precedents"; + print "Total CA previsionnel : ".price($total_CA)."<-- bug ici car bug sur les 2 precedents"; } print ""; From 828e561c86e31b865d292c790f97667e6aed5c40 Mon Sep 17 00:00:00 2001 From: Laurent De Coninck Date: Tue, 12 Feb 2019 15:09:55 +0100 Subject: [PATCH 09/36] fix the ref vs facnumber --- htdocs/accountancy/journal/purchasesjournal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index caaf0b24d37..7c5a567cbf2 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -93,7 +93,7 @@ if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end) $idpays = $mysoc->country_id; -$sql = "SELECT f.rowid, f.facnumber as ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, f.close_code,"; +$sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, f.close_code,"; $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,"; $sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; $sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte"; From f7a28328edea147c9f97e3cbe9d4cf6066832983 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 12 Feb 2019 15:40:16 +0100 Subject: [PATCH 10/36] update with html5 compliant code --- htdocs/compta/tva/clients.php | 82 +++++++++++++++++------------------ 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index a53f77a7021..e3539620351 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -351,15 +351,15 @@ if (! is_array($x_coll) || ! is_array($x_paye)) print ''.$langs->trans("DateInvoice").''; if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') print ''.$langs->trans("DatePayment").''; else print ''; - print ''.$namerate.''; + print ''.$namerate.''; print ''.$productcust.''; if ($modetax != 1) { - print ''.$amountcust.''; - print ''.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')'; + print ''.$amountcust.''; + print ''.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')'; } - print ''.$langs->trans("AmountHTVATRealReceived").''; - print ''.$vatcust.''; + print ''.$langs->trans("AmountHTVATRealReceived").''; + print ''.$vatcust.''; print ''; $action = "tvadetail"; @@ -414,7 +414,7 @@ if (! is_array($x_coll) || ! is_array($x_paye)) print ''; // Ref - print ''.$fields['link'].''; + print ''.$fields['link'].''; // Invoice date print '' . dol_print_date($fields['datef'], 'day') . ''; @@ -424,7 +424,7 @@ if (! is_array($x_coll) || ! is_array($x_paye)) else print ''; // Rate - print '' . $fields['drate'] . ''; + print '' . $fields['drate'] . ''; // Description print ''; @@ -464,7 +464,7 @@ if (! is_array($x_coll) || ! is_array($x_paye)) // Total HT if ($modetax != 1) { - print ''; + print ''; print price($fields['totalht']); if (price2num($fields['ftotal_ttc'])) { @@ -479,7 +479,7 @@ if (! is_array($x_coll) || ! is_array($x_paye)) $ratiopaymentinvoice=1; if ($modetax != 1) { - print ''; + print ''; //print $fields['totalht']."-".$fields['payment_amount']."-".$fields['ftotal_ttc']; if ($fields['payment_amount'] && $fields['ftotal_ttc']) { @@ -503,13 +503,13 @@ if (! is_array($x_coll) || ! is_array($x_paye)) } // Total collected - print ''; + print ''; $temp_ht=$fields['totalht']*$ratiopaymentinvoice; print price(price2num($temp_ht, 'MT'), 1); print ''; // VAT - print ''; + print ''; $temp_vat=$fields['vat']*$ratiopaymentinvoice; print price(price2num($temp_vat, 'MT'), 1); //print price($fields['vat']); @@ -524,13 +524,13 @@ if (! is_array($x_coll) || ! is_array($x_paye)) // Total customers for this vat rate print ''; print ''; - print ''.$langs->trans("Total").':'; + print ''.$langs->trans("Total").':'; if ($modetax != 1) { - print ' '; - print ' '; + print ' '; + print ' '; } - print ''.price(price2num($subtot_coll_total_ht, 'MT')).''; - print ''.price(price2num($subtot_coll_vat, 'MT')).''; + print ''.price(price2num($subtot_coll_total_ht, 'MT')).''; + print ''.price(price2num($subtot_coll_vat, 'MT')).''; print ''; } @@ -538,13 +538,13 @@ if (! is_array($x_coll) || ! is_array($x_paye)) { print ''; print ''; - print ''.$langs->trans("Total").':'; + print ''.$langs->trans("Total").':'; if ($modetax != 1) { - print ' '; - print ' '; + print ' '; + print ' '; } - print ''.price(price2num(0, 'MT')).''; - print ''.price(price2num(0, 'MT')).''; + print ''.price(price2num(0, 'MT')).''; + print ''.price(price2num(0, 'MT')).''; print ''; } @@ -560,11 +560,11 @@ if (! is_array($x_coll) || ! is_array($x_paye)) print ''.$namesup.''; print ''.$productsup.''; if ($modetax != 1) { - print ''.$amountsup.''; - print ''.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')'; + print ''.$amountsup.''; + print ''.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')'; } - print ''.$langs->trans("AmountHTVATRealPaid").''; - print ''.$vatsup.''; + print ''.$langs->trans("AmountHTVATRealPaid").''; + print ''.$vatsup.''; print ''."\n"; foreach (array_keys($x_paye) as $thirdparty_id) @@ -607,7 +607,7 @@ if (! is_array($x_coll) || ! is_array($x_paye)) print ''; // Ref - print ''.$fields['link'].''; + print ''.$fields['link'].''; // Invoice date print '' . dol_print_date($fields['datef'], 'day') . ''; @@ -657,7 +657,7 @@ if (! is_array($x_coll) || ! is_array($x_paye)) // Total HT if ($modetax != 1) { - print ''; + print ''; print price($fields['totalht']); if (price2num($fields['ftotal_ttc'])) { @@ -672,7 +672,7 @@ if (! is_array($x_coll) || ! is_array($x_paye)) $ratiopaymentinvoice=1; if ($modetax != 1) { - print ''; + print ''; if ($fields['payment_amount'] && $fields['ftotal_ttc']) { $paymentfourn_static->id=$fields['payment_id']; @@ -698,13 +698,13 @@ if (! is_array($x_coll) || ! is_array($x_paye)) } // VAT paid - print ''; + print ''; $temp_ht=$fields['totalht']*$ratiopaymentinvoice; print price(price2num($temp_ht, 'MT'), 1); print ''; // VAT - print ''; + print ''; $temp_vat=$fields['vat']*$ratiopaymentinvoice; print price(price2num($temp_vat, 'MT'), 1); //print price($fields['vat']); @@ -719,26 +719,26 @@ if (! is_array($x_coll) || ! is_array($x_paye)) // Total suppliers for this vat rate print ''; print ''; - print ''.$langs->trans("Total").':'; + print ''.$langs->trans("Total").':'; if ($modetax != 1) { - print ' '; - print ' '; + print ' '; + print ' '; } - print ''.price(price2num($subtot_paye_total_ht, 'MT')).''; - print ''.price(price2num($subtot_paye_vat, 'MT')).''; + print ''.price(price2num($subtot_paye_total_ht, 'MT')).''; + print ''.price(price2num($subtot_paye_vat, 'MT')).''; print ''; } if (count($x_paye) == 0) { // Show a total line if nothing shown print ''; print ''; - print ''.$langs->trans("Total").':'; + print ''.$langs->trans("Total").':'; if ($modetax != 1) { - print ' '; - print ' '; + print ' '; + print ' '; } - print ''.price(price2num(0, 'MT')).''; - print ''.price(price2num(0, 'MT')).''; + print ''.price(price2num(0, 'MT')).''; + print ''.price(price2num(0, 'MT')).''; print ''; } @@ -750,7 +750,7 @@ if (! is_array($x_coll) || ! is_array($x_paye)) $diff = $x_coll_sum - $x_paye_sum; print ''; print ''.$langs->trans("TotalToPay").($q?', '.$langs->trans("Quadri").' '.$q:'').''; - print ''.price(price2num($diff, 'MT'))."\n"; + print ''.price(price2num($diff, 'MT'))."\n"; print "\n"; $i++; From a0c1e5ed845a9c7255b681ae29c35e82c7449a98 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 15:43:24 +0100 Subject: [PATCH 11/36] Fix unique key in accounting_account --- htdocs/install/mysql/migration/8.0.0-9.0.0.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index 2087e032660..27301707360 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -265,3 +265,7 @@ CREATE TABLE llx_pos_cash_fence( -- Withdrawals / Prelevements UPDATE llx_const set name = 'PRELEVEMENT_END_TO_END' where name = 'END_TO_END'; UPDATE llx_const set name = 'PRELEVEMENT_USTRD' where name = 'USTRD'; + + +ALTER TABLE llx_accounting_account DROP INDEX uk_accounting_account; +ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (account_number, entity, fk_pcg_version); From f311d5020185130c255403261e353b0876e20976 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 15:43:24 +0100 Subject: [PATCH 12/36] Fix unique key in accounting_account Conflicts: htdocs/install/mysql/migration/8.0.0-9.0.0.sql --- htdocs/install/mysql/migration/8.0.0-9.0.0.sql | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index 9b97f7c1918..f2a8ca9f380 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -260,3 +260,12 @@ CREATE TABLE llx_pos_cash_fence( -- VMYSQL4.3 ALTER TABLE llx_accounting_account MODIFY COLUMN account_number varchar(32) NOT NULL; -- VPGSQL8.2 ALTER TABLE llx_accounting_account ALTER COLUMN account_number SET NOT NULL; + + +-- Withdrawals / Prelevements +UPDATE llx_const set name = 'PRELEVEMENT_END_TO_END' where name = 'END_TO_END'; +UPDATE llx_const set name = 'PRELEVEMENT_USTRD' where name = 'USTRD'; + + +ALTER TABLE llx_accounting_account DROP INDEX uk_accounting_account; +ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (account_number, entity, fk_pcg_version); From 7e60c3bf843267603a3fb6ede1bec04b69756faa Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 12 Feb 2019 16:27:25 +0100 Subject: [PATCH 13/36] FIX: In various payment, subledger & accout may be alphanumeric --- htdocs/compta/bank/various_payment/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 429603ed4fc..a1c1d8ae349 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -50,8 +50,8 @@ $label=GETPOST("label", "alpha"); $sens=GETPOST("sens", "int"); $amount=GETPOST("amount", "alpha"); $paymenttype=GETPOST("paymenttype", "int"); -$accountancy_code=GETPOST("accountancy_code", "int"); -$subledger_account=GETPOST("subledger_account", "int"); +$accountancy_code=GETPOST("accountancy_code", "alpha"); +$subledger_account=GETPOST("subledger_account", "alpha"); $projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int')); // Security check @@ -114,8 +114,8 @@ if (empty($reshook)) $object->num_payment=GETPOST("num_payment", 'alpha'); $object->fk_user_author=$user->id; - $object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "int") : ""; - $object->subledger_account=GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "int") : ""; + $object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "alpha") : ""; + $object->subledger_account=GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : ""; $object->sens=GETPOST('sens'); $object->fk_project= GETPOST('fk_project', 'int'); From 04950a5c918e452cc3b0ed9fd54e36d283c700a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 16:29:37 +0100 Subject: [PATCH 14/36] Trans --- htdocs/langs/en_US/stripe.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/stripe.lang b/htdocs/langs/en_US/stripe.lang index d45a768ff39..46de5f4485b 100644 --- a/htdocs/langs/en_US/stripe.lang +++ b/htdocs/langs/en_US/stripe.lang @@ -62,3 +62,4 @@ CreateCustomerOnStripe=Create customer on Stripe CreateCardOnStripe=Create card on Stripe ShowInStripe=Show in Stripe StripeUserAccountForActions=User account to use for email notification of some Stripe events (Stripe payouts) +StripePayoutList=List of Stripe payouts \ No newline at end of file From b99149b94086f826d889ad7ef45af507f86c21e5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 12 Feb 2019 16:34:52 +0100 Subject: [PATCH 15/36] Move error on function dol_include_once() to LOG_WARNING --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index be046ae889d..89933fcd499 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -622,7 +622,7 @@ function dol_include_once($relpath, $classname = '') $fullpath = dol_buildpath($relpath); if (!file_exists($fullpath)) { - dol_syslog('functions::dol_include_once Tried to load unexisting file: '.$relpath, LOG_ERR); + dol_syslog('functions::dol_include_once Tried to load unexisting file: '.$relpath, LOG_WARNING); return false; } From 0d8447ad3918c41a248cbbbecafb8e9d4c745710 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 16:58:55 +0100 Subject: [PATCH 16/36] Merge branch 'develop' of https://github.com/wdammak/dolibarr into wdammak-develop # Conflicts: # htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php --- htdocs/core/modules/fichinter/modules_fichinter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/fichinter/modules_fichinter.php b/htdocs/core/modules/fichinter/modules_fichinter.php index 3903d6154e5..0c88cd88d56 100644 --- a/htdocs/core/modules/fichinter/modules_fichinter.php +++ b/htdocs/core/modules/fichinter/modules_fichinter.php @@ -109,7 +109,7 @@ abstract class ModeleNumRefFicheinter } /** - * Tests if the numbers already in force in the database do not cause conflicts + * Tests if the numbers already in force in the database do not cause conflicts * that would prevent this numbering from working. * * @return boolean false si conflit, true si ok From fb5466fca0c1b54e4bb1e0293ec24ea6fdc3de46 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 17:02:27 +0100 Subject: [PATCH 17/36] Fix remove bad rule --- dev/setup/codesniffer/ruleset.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 44f57ef9086..6098a0e0139 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -115,7 +115,10 @@ 0 - + + 0 + + 0 From 0bb59bf6ccc7aa1a556d4506c676381b931522fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 17:03:09 +0100 Subject: [PATCH 18/36] Fix phpcs --- htdocs/main.inc.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 8d5f496a6f5..e644b57fa62 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2137,6 +2137,5 @@ if (! function_exists("llxFooter")) }); Date: Tue, 12 Feb 2019 17:05:45 +0100 Subject: [PATCH 19/36] Fix phpcs --- htdocs/margin/agentMargins.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 4ea641f2f70..8bdbaac5861 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -54,12 +54,12 @@ if (! $sortfield) $startdate=$enddate=''; -$startdateday = GETPOST('startdateday','int'); -$startdatemonth = GETPOST('startdatemonth','int'); -$startdateyear = GETPOST('startdateyear','int'); -$enddateday = GETPOST('enddateday','int'); -$enddatemonth = GETPOST('enddatemonth','int'); -$enddateyear = GETPOST('enddateyear','int'); +$startdateday = GETPOST('startdateday', 'int'); +$startdatemonth = GETPOST('startdatemonth', 'int'); +$startdateyear = GETPOST('startdateyear', 'int'); +$enddateday = GETPOST('enddateday', 'int'); +$enddatemonth = GETPOST('enddatemonth', 'int'); +$enddateyear = GETPOST('enddateyear', 'int'); if (!empty($startdatemonth)) $startdate = dol_mktime(0, 0, 0, $startdatemonth, $startdateday, $startdateyear); @@ -171,7 +171,7 @@ if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPr //if ($agentid > 0) $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, u.rowid, u.login, u.lastname, u.firstname"; //else $sql.= " GROUP BY u.rowid, u.login, u.lastname, u.firstname"; $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, u.rowid, u.login, u.lastname, u.firstname"; -$sql.=$db->order($sortfield,$sortorder); +$sql.=$db->order($sortfield, $sortorder); // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); @@ -208,17 +208,17 @@ if ($result) print ''; if ($agentid > 0) - print_liste_field_titre("Customer",$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); else - print_liste_field_titre("SalesRepresentative",$_SERVER["PHP_SELF"],"u.lastname","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("SalesRepresentative", $_SERVER["PHP_SELF"], "u.lastname", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("SellingPrice",$_SERVER["PHP_SELF"],"selling_price","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($labelcostprice,$_SERVER["PHP_SELF"],"buying_price","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre("Margin",$_SERVER["PHP_SELF"],"marge","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("SellingPrice",$_SERVER["PHP_SELF"], "selling_price", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($labelcostprice,$_SERVER["PHP_SELF"], "buying_price", "", $param,' align="right"', $sortfield, $sortorder); + print_liste_field_titre("Margin",$_SERVER["PHP_SELF"], "marge", "", $param, 'align="right"', $sortfield, $sortorder); if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print_liste_field_titre("MarginRate",$_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("MarginRate",$_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder); if (! empty($conf->global->DISPLAY_MARK_RATES)) - print_liste_field_titre("MarkRate",$_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("MarkRate",$_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder); print "\n"; $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); @@ -241,11 +241,11 @@ if ($result) $companystatic->id = $objp->socid; $companystatic->name = $objp->name; $companystatic->client = $objp->client; - $group_htmlname = $companystatic->getNomUrl(1,'customer'); + $group_htmlname = $companystatic->getNomUrl(1, 'customer'); } else { $group_name = $objp->lastname; $userstatic->fetch($objp->agent); - $group_htmlname = $userstatic->getFullName($langs,0,0,0); + $group_htmlname = $userstatic->getFullName($langs, 0, 0, 0); } $group_list[$group_id] = array('name' => $group_name, 'htmlname' => $group_htmlname, 'selling_price' => 0, 'buying_price' => 0, 'marge' => 0); } From f7d183f3ef6b11140e122d9a25d6cc2893703e5e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 17:43:38 +0100 Subject: [PATCH 20/36] Add Kosovo country --- htdocs/install/mysql/data/llx_00_c_country.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index 0ea1a55d3d3..b97ce386eab 100644 --- a/htdocs/install/mysql/data/llx_00_c_country.sql +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -274,4 +274,5 @@ INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (24 INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (244,'ME','MNE','Monténégro',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (245,'BL','BLM','Saint-Barthélemy',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (246,'MF','MAF','Saint-Martin',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (247,'XK','XKX','Kosovo',1,0); From 68e6f32320bfe9fb5836b90cd01efba4515191d9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 17:56:03 +0100 Subject: [PATCH 21/36] css --- htdocs/compta/charges/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 54e1d285f3e..33a06e09136 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -106,7 +106,7 @@ if ($year) $param.='&year='.$year; if ($mode != 'sconly') { - print $langs->trans("DescTaxAndDividendsArea").'
'; + print ''.$langs->trans("DescTaxAndDividendsArea").'
'; print "
"; } From 666d03f596de232f92c945b595c827fc3d2722c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 18:15:30 +0100 Subject: [PATCH 22/36] Fix multicompany for page to export zip of invoices --- htdocs/compta/compta-files.php | 41 ++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/compta-files.php index 23eff46da51..7fa3e8fb251 100644 --- a/htdocs/compta/compta-files.php +++ b/htdocs/compta/compta-files.php @@ -81,6 +81,8 @@ if ($user->societe_id > 0) * Actions */ +$entity = GETPOST('entity','int')?GETPOST('entity','int'):$conf->entity; + //$parameters = array('socid' => $id); //$reshook = $hookmanager->executeHooks('doActions', $parameters, $object); // Note that $object may have been modified by some hooks //if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -91,21 +93,27 @@ if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){ $wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'"; $sql="SELECT rowid as id, ref as ref,paye as paid, total_ttc, fk_soc, datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture"; $sql.=" WHERE datef between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; $sql.=" UNION ALL"; $sql.=" SELECT rowid as id, ref, paye as paid, total_ttc, fk_soc, datef as date, 'InvoiceSupplier' as item FROM ".MAIN_DB_PREFIX."facture_fourn"; $sql.=" WHERE datef between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; $sql.=" UNION ALL"; $sql.=" SELECT rowid as id, ref, paid, total_ttc, fk_user_author as fk_soc, date_fin as date,'ExpenseReport' as item FROM ".MAIN_DB_PREFIX."expensereport"; $sql.=" WHERE date_fin between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; $sql.=" UNION ALL"; $sql.=" SELECT rowid as id, ref,paid,amount as total_ttc, '0' as fk_soc, datedon as date,'Donation' as item FROM ".MAIN_DB_PREFIX."don"; $sql.=" WHERE datedon between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; $sql.=" UNION ALL"; $sql.=" SELECT rowid as id, label as ref, 1 as paid, amount as total_ttc, fk_user as fk_soc,datep as date,'SalaryPayment' as item FROM ".MAIN_DB_PREFIX."payment_salary"; $sql.=" WHERE datep between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; $sql.=" UNION ALL"; $sql.=" SELECT rowid as id, libelle as ref, paye as paid, amount as total_ttc, 0 as fk_soc, date_creation as date, 'SocialContributions' as item FROM ".MAIN_DB_PREFIX."chargesociales"; $sql.=" WHERE date_creation between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; $resd = $db->query($sql); $files=array(); $link=''; @@ -264,8 +272,37 @@ $form = new Form($db); $userstatic=new User($db); $title=$langs->trans("ComptaFiles").' - '.$langs->trans("List"); print '
'."\n"; -print $langs->trans("ReportPeriod").': '.$form->select_date($date_start, 'date_start', 0, 0, 0, "", 1, 1, 1); -print ' - '.$form->select_date($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 1)."\n"; +print $langs->trans("ReportPeriod").': '.$form->selectDate($date_start, 'date_start', 0, 0, 0, "", 1, 1, 0); +print ' - '.$form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0)."\n"; +// Multicompany +if (! empty($conf->multicompany->enabled) && is_object($mc)) +{ + print '
'; + // This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module + if (method_exists($mc, 'formObjectOptions')) + { + if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) // condition must be same for create and edit mode + { + print "".''.$langs->trans("Entity").''; + print "".$mc->select_entities($entity); + print "\n"; + } + else + { + print ''; + } + } + + /*$object = new stdClass(); + // Other attributes + $parameters=array('objectsrc' => null, 'colspan' => ' colspan="3"'); + $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook)) + { + print $object->showOptionals($extrafields, 'edit'); + }*/ +} print '
'."\n"; dol_fiche_end(); From affbd20cdb5018cd788712bcc26917d82a3d0135 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 18:56:32 +0100 Subject: [PATCH 23/36] FIX Bad link in menu manager --- htdocs/core/lib/treeview.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index 6c66079090a..11f6e2652c1 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -115,7 +115,7 @@ function tree_showpad(&$fulltree,$key,$silent=0) */ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetalreadyloaded=0, $showfk=0) { - global $tree_recur_alreadyadded; + global $tree_recur_alreadyadded, $menu_handler_to_search; if ($rang == 0 && empty($donoresetalreadyloaded)) $tree_recur_alreadyadded=array(); @@ -203,7 +203,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetal if ($showfk) { print '"; } diff --git a/htdocs/webservices/server_category.php b/htdocs/webservices/server_category.php index 74d175ac2c9..4495de9917f 100644 --- a/htdocs/webservices/server_category.php +++ b/htdocs/webservices/server_category.php @@ -190,6 +190,8 @@ function getCategory($authentication, $id) { global $db,$conf,$langs; + $nbmax = 10; + dol_syslog("Function: getCategory login=".$authentication['login']." id=".$id); if ($authentication['entity']) $conf->entity=$authentication['entity']; @@ -228,7 +230,7 @@ function getCategory($authentication, $id) //'visible'=>$categorie->visible, 'type' => $categorie->type, 'dir' => $pdir, - 'photos' => $categorie->liste_photos($dir, $nbmax=10) + 'photos' => $categorie->liste_photos($dir, $nbmax) ); $cats = $categorie->get_filles(); @@ -248,7 +250,7 @@ function getCategory($authentication, $id) //'visible'=>$fille->visible, 'type'=>$fille->type, 'dir' => $pdir, - 'photos' => $fille->liste_photos($dir, $nbmax=10) + 'photos' => $fille->liste_photos($dir, $nbmax) ); } } diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index d49a76af117..32f25fa2ca8 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -337,6 +337,8 @@ function getProductOrService($authentication, $id = '', $ref = '', $ref_ext = '' { global $db,$conf,$langs; + $nbmax = 10; + dol_syslog("Function: getProductOrService login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext); $langcode=($lang?$lang:(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT)); @@ -417,7 +419,7 @@ function getProductOrService($authentication, $id = '', $ref = '', $ref_ext = '' 'pmp' => $product->pmp, 'import_key' => $product->import_key, 'dir' => $pdir, - 'images' => $product->liste_photos($dir, $nbmax=10) + 'images' => $product->liste_photos($dir, $nbmax) ); //Retreive all extrafield for thirdsparty @@ -1001,6 +1003,8 @@ function getProductsForCategory($authentication, $id, $lang = '') { global $db,$conf,$langs; + $nbmax = 10; + $langcode=($lang?$lang:(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT)); $langs->setDefaultLang($langcode); @@ -1086,7 +1090,7 @@ function getProductsForCategory($authentication, $id, $lang = '') 'pmp' => $obj->pmp, 'import_key' => $obj->import_key, 'dir' => $pdir, - 'images' => $obj->liste_photos($dir, $nbmax=10) + 'images' => $obj->liste_photos($dir, $nbmax) ); //Retreive all extrafield for thirdsparty From 986fb2ae38cfeb9a10cc8df150ec83a1d71ffd85 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 19:09:27 +0100 Subject: [PATCH 25/36] FIX creation of menu entry with parent id not int --- htdocs/admin/menus/edit.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 9e9d5cad8f1..9e5bcd9ca72 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -144,9 +144,9 @@ if ($action == 'add') } $leftmenu=''; $mainmenu=''; - if (GETPOST('menuId', 'int') && ! is_numeric(GETPOST('menuId', 'int'))) + if (GETPOST('menuId', 'alpha') && ! is_numeric(GETPOST('menuId', 'alpha'))) { - $tmp=explode('&', GETPOST('menuId', 'int')); + $tmp=explode('&', GETPOST('menuId', 'alpha')); foreach($tmp as $s) { if (preg_match('/fk_mainmenu=/', $s)) From 1f9f335e44371fc33399d8dfb1af98cfd8c86574 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 19:09:27 +0100 Subject: [PATCH 26/36] FIX creation of menu entry with parent id not int Conflicts: htdocs/admin/menus/edit.php --- htdocs/admin/menus/edit.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index b16e9047b26..33a73147251 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -144,9 +144,9 @@ if ($action == 'add') } $leftmenu=''; $mainmenu=''; - if (GETPOST('menuId','int') && ! is_numeric(GETPOST('menuId','int'))) + if (GETPOST('menuId', 'alpha') && ! is_numeric(GETPOST('menuId', 'alpha'))) { - $tmp=explode('&',GETPOST('menuId','int')); + $tmp=explode('&', GETPOST('menuId', 'alpha')); foreach($tmp as $s) { if (preg_match('/fk_mainmenu=/',$s)) From 6a8504e1f812dee73075fac8407679a0242775b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 19:44:12 +0100 Subject: [PATCH 27/36] Fix missing constant --- htdocs/don/class/don.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index c3941059e64..e7296e2e157 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -91,6 +91,11 @@ class Don extends CommonObject public $labelstatut; public $labelstatutshort; + /** + * Draft + */ + const STATUS_DRAFT = 0; + /** * Constructor From 5a2161ad09de371fa6a1b36a27a1396b6ce656be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 19:47:46 +0100 Subject: [PATCH 28/36] Debug export of zip --- htdocs/compta/compta-files.php | 525 ++++++++++++++++++++------------- 1 file changed, 322 insertions(+), 203 deletions(-) diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/compta-files.php index d8f4885a3b2..61b05f81e37 100644 --- a/htdocs/compta/compta-files.php +++ b/htdocs/compta/compta-files.php @@ -25,166 +25,207 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; +require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; +require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; -restrictedArea($user,'banque'); +$langs->loadLangs(array("accountancy","bills")); -$langs->load("companies"); -if (! empty($conf->facture->enabled)) $langs->load("bills"); -$date_start =GETPOST('date_start','alpha'); -$date_startDay= GETPOST('date_startday','int'); -$date_startMonth= GETPOST('date_startmonth','int'); -$date_startYear= GETPOST('date_startyear','int'); -$date_start=($date_startDay)?dol_mktime(0,0,0,$date_startMonth,$date_startDay,$date_startYear):strtotime($date_start); -$date_stop =GETPOST('date_stop','alpha'); -$date_stopDay= GETPOST('date_stopday','int'); -$date_stopMonth= GETPOST('date_stopmonth','int'); -$date_stopYear= GETPOST('date_stopyear','int'); +$date_start =GETPOST('date_start', 'alpha'); +$date_startDay= GETPOST('date_startday', 'int'); +$date_startMonth= GETPOST('date_startmonth', 'int'); +$date_startYear= GETPOST('date_startyear', 'int'); +$date_start=($date_startDay)?dol_mktime(0, 0, 0, $date_startMonth, $date_startDay, $date_startYear):strtotime($date_start); +$date_stop =GETPOST('date_stop', 'alpha'); +$date_stopDay= GETPOST('date_stopday', 'int'); +$date_stopMonth= GETPOST('date_stopmonth', 'int'); +$date_stopYear= GETPOST('date_stopyear', 'int'); //FIXME doldate -$date_stop=($date_stopDay)?dol_mktime(0,0,0,$date_stopMonth,$date_stopDay,$date_stopYear):strtotime($date_stop); -$action =GETPOST('action','alpha'); -// Security check -//if ($user->societe_id) $id=$user->societe_id; -//$result = restrictedArea($user, 'societe', $id, '&societe'); -//$object = new Societe($db); -//if ($id > 0) $object->fetch($id); +$date_stop=($date_stopDay)?dol_mktime(0, 0, 0, $date_stopMonth, $date_stopDay, $date_stopYear):strtotime($date_stop); +$action =GETPOST('action', 'alpha'); + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('comptafilescard','globalcard')); +$hookmanager->initHooks(array('comptafileslist','globallist')); + // Load variable for pagination -$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; -$sortfield = GETPOST('sortfield','alpha'); -$sortorder = GETPOST('sortorder','alpha'); -$page = GETPOST('page','int'); +$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; +$sortfield = GETPOST('sortfield', 'alpha'); +$sortorder = GETPOST('sortorder', 'alpha'); +$page = GETPOST('page', 'int'); if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortfield) $sortfield="f.datef,f.rowid"; // Set here default search field +if (! $sortfield) $sortfield="date,item"; // Set here default search field if (! $sortorder) $sortorder="DESC"; + + $arrayfields=array( 'date'=>array('label'=>"Date", 'checked'=>1), //... ); +// Security check +if (empty($conf->compta->enabled) && empty($conf->accounting->enabled)) { + accessforbidden(); +} +if ($user->societe_id > 0) + accessforbidden(); + + /* * Actions */ +$entity = GETPOST('entity','int')?GETPOST('entity','int'):$conf->entity; + //$parameters = array('socid' => $id); //$reshook = $hookmanager->executeHooks('doActions', $parameters, $object); // Note that $object may have been modified by some hooks //if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - - -/* - * View - */ - $filesarray=array(); $result=false; if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){ $wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'"; - $sql="SELECT rowid as id, facnumber as ref,paye as paid,total_ttc,fk_soc,datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture"; + $sql="SELECT rowid as id, facnumber as ref,paye as paid, total_ttc, fk_soc, datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture"; $sql.=" WHERE datef between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND fk_statut <> ".Facture::STATUS_DRAFT; $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id,ref, paye as paid, total_ttc, fk_soc,datef as date, 'InvoiceSupplier' as item FROM ".MAIN_DB_PREFIX."facture_fourn"; - $sql.=" WHERE datef between ".$wheretail; + $sql.=" SELECT rowid as id, ref, paye as paid, total_ttc, fk_soc, datef as date, 'SupplierInvoice' as item FROM ".MAIN_DB_PREFIX."facture_fourn"; + $sql.=" WHERE datef between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND fk_statut <> ".FactureFournisseur::STATUS_DRAFT; $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id,ref,paid,total_ttc,fk_user_author as fk_soc,date_fin as date,'Expense' as item FROM ".MAIN_DB_PREFIX."expensereport"; + $sql.=" SELECT rowid as id, ref, paid, total_ttc, fk_user_author as fk_soc, date_fin as date,'ExpenseReport' as item FROM ".MAIN_DB_PREFIX."expensereport"; $sql.=" WHERE date_fin between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND fk_statut <> ".ExpenseReport::STATUS_DRAFT; $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id,ref,paid,amount as total_ttc,CONCAT(firstname,' ',lastname) as fk_soc,datedon as date,'Donation' as item FROM ".MAIN_DB_PREFIX."don"; - $sql.=" WHERE datedon between ".$wheretail; + $sql.=" SELECT rowid as id, ref,paid,amount as total_ttc, '0' as fk_soc, datedon as date,'Donation' as item FROM ".MAIN_DB_PREFIX."don"; + $sql.=" WHERE datedon between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND fk_statut <> ".Don::STATUS_DRAFT; $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id,label as ref,1 as paid,amount as total_ttc,fk_user as fk_soc,datep as date,'Salary' as item FROM ".MAIN_DB_PREFIX."payment_salary"; - $sql.=" WHERE datep between ".$wheretail; + $sql.=" SELECT rowid as id, label as ref, 1 as paid, amount as total_ttc, fk_user as fk_soc,datep as date,'SalaryPayment' as item FROM ".MAIN_DB_PREFIX."payment_salary"; + $sql.=" WHERE datep between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; + //$sql.=" AND fk_statut <> ".PaymentSalary::STATUS_DRAFT; $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id,num_paiement as ref,1 as paid,amount as total_ttc,fk_charge as fk_soc,datep as date,'Charge' as item FROM ".MAIN_DB_PREFIX."paiementcharge"; - $sql.=" WHERE datep between ".$wheretail; + $sql.=" SELECT rowid as id, libelle as ref, paye as paid, amount as total_ttc, 0 as fk_soc, date_creation as date, 'SocialContributions' as item FROM ".MAIN_DB_PREFIX."chargesociales"; + $sql.=" WHERE date_creation between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; + //$sql.=" AND fk_statut <> ".ChargeSociales::STATUS_DRAFT; + $sql.= $db->order($sortfield, $sortorder); + $resd = $db->query($sql); $files=array(); $link=''; if ($resd) - { - $numd = $db->num_rows($resd); + { + $numd = $db->num_rows($resd); + + $tmpinvoice=new Facture($db); + $tmpinvoicesupplier=new FactureFournisseur($db); + $tmpdonation=new Don($db); $upload_dir =''; - $i=0; - while($i<$numd) - { - - + $i=0; + while ($i < $numd) + { $objd = $db->fetch_object($resd); - switch($objd->item){ - case "Invoice": - $subdir=dol_sanitizeFileName($objd->ref); - $upload_dir = $conf->facture->dir_output.'/'.$subdir; - $link="../../document.php?modulepart=facture&file=".str_replace('/','%2F',$subdir).'%2F'; - break; - case "InvoiceSupplier": - $subdir=get_exdir($objd->id,2,0,0,$objd,'invoice_supplier').dol_sanitizeFileName($objd->ref); - $upload_dir = $conf->fournisseur->facture->dir_output.'/'.$subdir; - $link="../../document.php?modulepart=facture_fournisseur&file=".str_replace('/','%2F',$subdir).'%2F'; - break; - case "Expense": - $subdir=dol_sanitizeFileName($objd->ref); - $upload_dir = $conf->expensereport->dir_output.'/'.$subdir; - $link="../../document.php?modulepart=expensereport&file=".str_replace('/','%2F',$subdir).'%2F'; - break; - case "Salary": - $subdir=dol_sanitizeFileName($objd->id); - $upload_dir = $conf->salaries->dir_output.'/'.$subdir; - $link="../../document.php?modulepart=salaries&file=".str_replace('/','%2F',$subdir).'%2F'; - break; - case "Donation": - $subdir=get_exdir(null,2,0,1,$objd,'donation'). '/'. dol_sanitizeFileName($objd->id); - $upload_dir = $conf->don->dir_output . '/' . $subdir; - $link="../../document.php?modulepart=don&file=".str_replace('/','%2F',$subdir).'%2F'; - break; - case "Charge": - $subdir=dol_sanitizeFileName($objd->id); - $upload_dir = $conf->tax->dir_output . '/' . $subdir; - $link="../../document.php?modulepart=tax&file=".str_replace('/','%2F',$subdir).'%2F'; - break; - default: - break; + switch($objd->item) + { + case "Invoice": + $subdir=dol_sanitizeFileName($objd->ref); + $upload_dir = $conf->facture->dir_output.'/'.$subdir; + $link="document.php?modulepart=facture&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; + case "SupplierInvoice": + $tmpinvoicesupplier->fetch($objd->id); + $subdir=get_exdir($tmpinvoicesupplier->id, 2, 0, 0, $tmpinvoicesupplier, 'invoice_supplier').'/'.dol_sanitizeFileName($objd->ref); + $upload_dir = $conf->fournisseur->facture->dir_output.'/'.$subdir; + $link="document.php?modulepart=facture_fournisseur&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; + case "ExpenseReport": + $subdir=dol_sanitizeFileName($objd->ref); + $upload_dir = $conf->expensereport->dir_output.'/'.$subdir; + $link="document.php?modulepart=expensereport&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; + case "SalaryPayment": + $subdir=dol_sanitizeFileName($objd->id); + $upload_dir = $conf->salaries->dir_output.'/'.$subdir; + $link="document.php?modulepart=salaries&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; + case "Donation": + $tmpdonation->fetch($objp->id); + $subdir=get_exdir(0, 0, 0, 1, $tmpdonation, 'donation'). '/'. dol_sanitizeFileName($objd->id); + $upload_dir = $conf->don->dir_output . '/' . $subdir; + $link="document.php?modulepart=don&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; + case "SocialContributions": + $subdir=dol_sanitizeFileName($objd->id); + $upload_dir = $conf->tax->dir_output . '/' . $subdir; + $link="document.php?modulepart=tax&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; + default: + $subdir=''; + $upload_dir=''; + $link=''; + break; } - if(!empty($upload_dir)){ + if (!empty($upload_dir)) + { $result=true; - $files=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$','',SORT_ASC,1); - foreach ($files as $key => $file){ - $file['date']=$db->idate($objd->date); - $file['paid']=$objd->paid; - $file['amount']=$objd->total_ttc; - $file['ref']=$objd->ref; - $file['fk']=$objd->fk_soc; - $file['item']=$objd->item; - $file['link']=$link.$file['name']; - $out.= '
'.$file['name'].''; - $filesarray[]=$file; - } - if(count($files)<1){ + $files=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview\.png)$', '', SORT_ASC, 1); + //var_dump($upload_dir); + if (count($files) < 1) + { $nofile['date']=$db->idate($objd->date); $nofile['paid']=$objd->paid; $nofile['amount']=$objd->total_ttc; $nofile['ref']=$objd->ref; $nofile['fk']=$objd->fk_soc; $nofile['item']=$objd->item; - $filesarray[]=$nofile; + + $filesarray[]=$nofile; + } + else + { + foreach ($files as $key => $file) + { + $file['date']=$db->idate($objd->date); + $file['paid']=$objd->paid; + $file['amount']=$objd->total_ttc; + $file['ref']=$objd->ref; + $file['fk']=$objd->fk_soc; + $file['item']=$objd->item; + $file['link']=$link.$file['name']; + $file['relpathnamelang'] = $langs->trans($file['item']).'/'.$file['name']; + + $filesarray[]=$file; + } } } - $i++; - } - } - $db->free($resd); + $i++; + } + } + else + { + dol_print_error($db); + } + + $db->free($resd); } + /* * cleanup of old ZIP */ @@ -192,124 +233,202 @@ if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){ /* *ZIP creation */ -if($result & $action=="dl"){ - unset($zip); - $log='date,type,ref,total,paid,filename,item_id'."\n"; - $zipname = ($date_start)."-".($date_stop).'_export.zip'; - $zip = new ZipArchive; - $res = $zip->open($zipname, ZipArchive::OVERWRITE|ZipArchive::CREATE); - if ($res){ - foreach ($filesarray as $key=> $file) { - if(file_exists($file["fullname"])) $zip->addFile($file["fullname"],$file["name"]);// - $log.=$file['date'].','.$file['item'].','.$file['ref'].','.$file['amount'].','.$file['paid'].','.$file["name"].','.$file['fk']."\n"; - } - $zip->addFromString('log.csv', $log); - $zip->close(); - ///Then download the zipped file. - header('Content-Type: application/zip'); - header('Content-disposition: attachment; filename='.$zipname); - header('Content-Length: ' . filesize($zipname)); - readfile($zipname); - unlink($zipname); - exit(); + +if ($result && $action == "dl") +{ + dol_delete_file($zip); + + $log='date,type,ref,total,paid,filename,item_id'."\n"; + $zipname = ($conf->accounting->dir_temp ? $conf->accounting->dir_temp : $conf->compta->dir_temp).'/'.($date_start)."-".($date_stop).'_export.zip'; + + $zip = new ZipArchive; + $res = $zip->open($zipname, ZipArchive::OVERWRITE|ZipArchive::CREATE); + if ($res) + { + foreach ($filesarray as $key=> $file) + { + if (file_exists($file["fullname"])) $zip->addFile($file["fullname"], $file["relpathnamelang"]); // + $log.=$file['date'].','.$file['item'].','.$file['ref'].','.$file['amount'].','.$file['paid'].','.$file["name"].','.$file['fk']."\n"; } + $zip->addFromString('transactions.csv', $log); + $zip->close(); + + ///Then download the zipped file. + header('Content-Type: application/zip'); + header('Content-disposition: attachment; filename='.basename($zipname)); + header('Content-Length: ' . filesize($zipname)); + readfile($zipname); + + dol_delete_file($zipname); + + exit(); + } } -// None + + /* - * View + * View */ + $form = new Form($db); $userstatic=new User($db); + $title=$langs->trans("ComptaFiles").' - '.$langs->trans("List"); -//if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Symmary"); -$help_url='EN:Module_Accounting|FR:Module_Compatibilite'; //FIXME -llxHeader('',$title,$help_url); -print ''."\n\t\t"; -if (!empty($date_start) && !empty($date_stop))echo dol_print_date($date_start)." - ".dol_print_date($date_stop); -print '
'; - print '   '; + print '   '; print $tab[$x]['title']; print ''; print '  (mainmenu='.$tab[$x]['mainmenu'].' leftmenu='.$tab[$x]['leftmenu'].' - fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].')'; From f1500281efb6b36895ed59606e9126b1b6d99ff9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 19:00:50 +0100 Subject: [PATCH 24/36] Fix phpcs --- htdocs/contact/consumption.php | 3 ++- htdocs/user/card.php | 3 +-- htdocs/webservices/server_category.php | 6 ++++-- htdocs/webservices/server_productorservice.php | 8 ++++++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 4191563eaec..ebbe7332236 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -488,7 +488,8 @@ if ($sql_select) $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($objp->description)); } - if (($objp->info_bits & 2) == 2) { + if (($objp->info_bits & 2) == 2) + { print ''; $txt=''; print img_object($langs->trans("ShowReduc"), 'reduc').' '; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 859b2220b28..63a2a598d41 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1104,8 +1104,7 @@ if ($action == 'create' || $action == 'adduserldap') { print '
' . $form->editfieldkey('Categories', 'usercats', '', $object, 0) . ''; $cate_arbo = $form->select_all_categories('user', null, 'parent', null, null, 1); -print $form->multiselectarray('usercats', $cate_arbo, GETPOST('usercats', 'array'), null, null, null, - null, '90%' ); + print $form->multiselectarray('usercats', $cate_arbo, GETPOST('usercats', 'array'), null, null, null, null, '90%'); print "
'; -print ''; -//if (! empty($arrayfields['f.datef']['checked'])) -print_liste_field_titre($arrayfields['date']['label'],$_SERVER["PHP_SELF"],"date","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -if ($result) + +llxHeader('', $title, $help_url); + +$h=0; +$head[$h][0] = $_SERVER["PHP_SELF"].$varlink; +$head[$h][1] = $langs->trans("AccountancyFiles"); +$head[$h][2] = 'AccountancyFiles'; + +dol_fiche_head($head, 'AccountancyFiles'); + + +print ''."\n"; +print ''; +print $langs->trans("ReportPeriod").': '.$form->selectDate($date_start, 'date_start', 0, 0, 0, "", 1, 1, 0); +print ' - '.$form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0)."\n"; +// Multicompany +if (! empty($conf->multicompany->enabled) && is_object($mc)) { - $TData = dol_sort_array($filesarray, 'date', 'ASC'); - if(empty($TData)) { - print ''; - } else { - // Sort array by date ASC to calucalte balance - - $totalDebit = 0; - $totalCredit = 0; - // Balance calculation - $balance = 0; - foreach($TData as &$data1) { - if($data1['item']!='Invoice'&& $data1['item']!='Donation' ){ - $data1['amount']=-$data1['amount']; - } - if ($data1['amount']>0){ - }else{ - } - $balance += $data1['amount']; - $data1['balance'] = $balance; - } - // Display array - foreach($TData as $data) { - $html_class = ''; - //if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture']; - //elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement']; - print ''; - print "\n"; - print ''; - print ''; - print '\n"; - print ''; - print '\n"; - $totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0; - print '\n"; - $totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']); - // Balance - print '\n"; - print "\n"; - } - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - } + print '
'; + // This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module + if (method_exists($mc, 'formObjectOptions')) + { + if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) // condition must be same for create and edit mode + { + print "".''; + print "\n"; } -print "
'.$langs->trans("Type").''.$langs->trans("Ref").''.$langs->trans("File").''.$langs->trans("Paid").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("Balance").'
'.$langs->trans("NoItem").'
"; - print dol_print_date($data['date'],'day'); - print "'.$data['item'].''.$data['ref'].' ".$data['name']."'.$data['paid'].''.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."'.(($data['amount'] > 0) ? '' : price(abs($data['amount'])))."'.price($data['balance'])."
 '.price($totalDebit).''.price($totalCredit).''.price(price2num($totalDebit - $totalCredit, 'MT')).'
'.$langs->trans("Entity").'".$mc->select_entities($entity); + print "
"; -print ''."\n\t\t\t"; + else + { + print ''; + } + } -print ''; -print ''; + /*$object = new stdClass(); + // Other attributes + $parameters=array('objectsrc' => null, 'colspan' => ' colspan="3"'); + $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook)) + { + print $object->showOptionals($extrafields, 'edit'); + }*/ +} +print ''."\n"; -//print ''; -//print ''; -//print ''; +dol_fiche_end(); -//print ''; -//print ''; -//print ''; +if (!empty($date_start) && !empty($date_stop)) +{ + $param='action=searchfiles'; + $param.='&date_startday='.GETPOST('date_startday', 'int'); + $param.='&date_startmonth='.GETPOST('date_startmonth', 'int'); + $param.='&date_startyear='.GETPOST('date_startyear', 'int'); + $param.='&date_stopday='.GETPOST('date_stopday', 'int'); + $param.='&date_stopmonth='.GETPOST('date_stopmonth', 'int'); + $param.='&date_stopyear='.GETPOST('date_stopyear', 'int'); + print '
'."\n"; + print ''; -print '
'."\n\t\t\n\t\t\n\t\t\t"; + echo dol_print_date($date_start, 'day')." - ".dol_print_date($date_stop, 'day'); + print ''; + print ''; + + //print ''; + //print ''; + //print ''; + + //print ''; + //print ''; + //print ''; + + print ''; + print ''."\n"; + + print '
'; + + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print ''; + print ''; + print_liste_field_titre($arrayfields['date']['label'], $_SERVER["PHP_SELF"], "date", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if ($result) + { + $TData = dol_sort_array($filesarray, 'date', 'ASC'); + + if (empty($TData)) + { + print ''; + } + else + { + // Sort array by date ASC to calculate balance + + $totalDebit = 0; + $totalCredit = 0; + // Balance calculation + $balance = 0; + foreach($TData as &$data1) { + if ($data1['item']!='Invoice'&& $data1['item']!='Donation' ){ + $data1['amount']=-$data1['amount']; + } + if ($data1['amount']>0){ + }else{ + } + $balance += $data1['amount']; + $data1['balance'] = $balance; + } + + // Display array + foreach($TData as $data) + { + $html_class = ''; + //if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture']; + //elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement']; + print ''; + print "\n"; + print ''; + print ''; + + // File link + print '\n"; + + print ''; + print '\n"; + $totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0; + print '\n"; + $totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']); + // Balance + print '\n"; + print "\n"; + } + + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + } + } + print "
'.$langs->trans("Type").''.$langs->trans("Ref").''.$langs->trans("Link").''.$langs->trans("Paid").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("Balance").'
'.$langs->trans("NoItem").'
"; + print dol_print_date($data['date'], 'day'); + print "'.$langs->trans($data['item']).''.$data['ref'].'".$data['name']."'.$data['paid'].''.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."'.(($data['amount'] > 0) ? '' : price(abs($data['amount'])))."'.price($data['balance'])."
 '.price($totalDebit).''.price($totalCredit).''.price(price2num($totalDebit - $totalCredit, 'MT')).'
"; + print '
'; +} llxFooter(); From 036dc52170f96f892baaaa488076ef2bb82a213a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 19:55:54 +0100 Subject: [PATCH 29/36] Fix test --- htdocs/compta/compta-files.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/compta-files.php index 61b05f81e37..1411c52591e 100644 --- a/htdocs/compta/compta-files.php +++ b/htdocs/compta/compta-files.php @@ -70,7 +70,7 @@ $arrayfields=array( ); // Security check -if (empty($conf->compta->enabled) && empty($conf->accounting->enabled)) { +if (empty($conf->comptabilite->enabled) && empty($conf->accounting->enabled)) { accessforbidden(); } if ($user->societe_id > 0) @@ -231,8 +231,8 @@ if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){ */ //FIXME /* -*ZIP creation -*/ + *ZIP creation + */ if ($result && $action == "dl") { @@ -247,8 +247,8 @@ if ($result && $action == "dl") { foreach ($filesarray as $key=> $file) { - if (file_exists($file["fullname"])) $zip->addFile($file["fullname"], $file["relpathnamelang"]); // - $log.=$file['date'].','.$file['item'].','.$file['ref'].','.$file['amount'].','.$file['paid'].','.$file["name"].','.$file['fk']."\n"; + if (file_exists($file["fullname"])) $zip->addFile($file["fullname"], $file["relpathnamelang"]); // + $log.=$file['date'].','.$file['item'].','.$file['ref'].','.$file['amount'].','.$file['paid'].','.$file["name"].','.$file['fk']."\n"; } $zip->addFromString('transactions.csv', $log); $zip->close(); @@ -309,14 +309,14 @@ if (! empty($conf->multicompany->enabled) && is_object($mc)) } /*$object = new stdClass(); - // Other attributes - $parameters=array('objectsrc' => null, 'colspan' => ' colspan="3"'); - $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (empty($reshook)) - { - print $object->showOptionals($extrafields, 'edit'); - }*/ + // Other attributes + $parameters=array('objectsrc' => null, 'colspan' => ' colspan="3"'); + $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook)) + { + print $object->showOptionals($extrafields, 'edit'); + }*/ } print ''."\n"; From d42bf54436a082992044e7edb798873d143e510b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 23:12:33 +0100 Subject: [PATCH 30/36] Fix export zip --- htdocs/compta/compta-files.php | 69 ++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 28 deletions(-) diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/compta-files.php index 1411c52591e..33f8b2dcb96 100644 --- a/htdocs/compta/compta-files.php +++ b/htdocs/compta/compta-files.php @@ -236,10 +236,14 @@ if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){ if ($result && $action == "dl") { - dol_delete_file($zip); + $dirfortmpfile = ($conf->accounting->dir_temp ? $conf->accounting->dir_temp : $conf->compta->dir_temp); + + dol_mkdir($dirfortmpfile); $log='date,type,ref,total,paid,filename,item_id'."\n"; - $zipname = ($conf->accounting->dir_temp ? $conf->accounting->dir_temp : $conf->compta->dir_temp).'/'.($date_start)."-".($date_stop).'_export.zip'; + $zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc')."-".dol_print_date($date_stop, 'dayrfc').'_export.zip'; + + dol_delete_file(name); $zip = new ZipArchive; $res = $zip->open($zipname, ZipArchive::OVERWRITE|ZipArchive::CREATE); @@ -248,7 +252,7 @@ if ($result && $action == "dl") foreach ($filesarray as $key=> $file) { if (file_exists($file["fullname"])) $zip->addFile($file["fullname"], $file["relpathnamelang"]); // - $log.=$file['date'].','.$file['item'].','.$file['ref'].','.$file['amount'].','.$file['paid'].','.$file["name"].','.$file['fk']."\n"; + $log.=dol_print_date($file['date'], 'dayrfc').','.$file['item'].','.$file['ref'].','.$file['amount'].','.$file['paid'].','.$file["name"].','.$file['fk']."\n"; } $zip->addFromString('transactions.csv', $log); $zip->close(); @@ -290,34 +294,43 @@ print ''; print $langs->trans("ReportPeriod").': '.$form->selectDate($date_start, 'date_start', 0, 0, 0, "", 1, 1, 0); print ' - '.$form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0)."\n"; // Multicompany +/*if (! empty($conf->multicompany->enabled) && is_object($mc)) + { + print '
'; + // This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module + if (method_exists($mc, 'formObjectOptions')) + { + if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) // condition must be same for create and edit mode + { + print "".''.$langs->trans("Entity").''; + print "".$mc->select_entities($entity); + print "\n"; + } + else + { + print ''; + } + } + + $object = new stdClass(); + // Other attributes + $parameters=array('objectsrc' => null, 'colspan' => ' colspan="3"'); + $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook)) + { + print $object->showOptionals($extrafields, 'edit'); + } + }*/ if (! empty($conf->multicompany->enabled) && is_object($mc)) { - print '
'; - // This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module - if (method_exists($mc, 'formObjectOptions')) - { - if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) // condition must be same for create and edit mode - { - print "".''.$langs->trans("Entity").''; - print "".$mc->select_entities($entity); - print "\n"; - } - else - { - print ''; - } - } - - /*$object = new stdClass(); - // Other attributes - $parameters=array('objectsrc' => null, 'colspan' => ' colspan="3"'); - $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (empty($reshook)) - { - print $object->showOptionals($extrafields, 'edit'); - }*/ + print '   -   '.$langs->trans("Entity").' : '; + $mc->dao->getEntities(); + $mc->dao->fetch($conf->entity); + print $mc->dao->label; + print "
\n"; } + print ''."\n"; dol_fiche_end(); From 639dfa09aa6e7c743685b55e7244dddd345511a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 23:17:40 +0100 Subject: [PATCH 31/36] Fix creation of left menu --- htdocs/admin/menus/edit.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 33a73147251..35707360e60 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -214,9 +214,9 @@ if ($action == 'add') $menu->target=GETPOST('target','alpha'); $menu->user=GETPOST('user','alpha'); $menu->mainmenu=GETPOST('propertymainmenu','alpha'); - if (is_numeric(GETPOST('menuId','int'))) + if (is_numeric(GETPOST('menuId','alpha'))) { - $menu->fk_menu=GETPOST('menuId','int'); + $menu->fk_menu=GETPOST('menuId','alpha'); } else { From d86017b8ff55c09d5c932c229b413e6acae43774 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 23:21:53 +0100 Subject: [PATCH 32/36] Fix create left menu entry --- htdocs/admin/menus/edit.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 35707360e60..fde40ecdca5 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -144,6 +144,22 @@ if ($action == 'add') } $leftmenu=''; $mainmenu=''; + if (! empty($_POST['menuId']) && ! is_numeric($_POST['menuId'])) + { + $tmp=explode('&',$_POST['menuId']); + 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); + } + } + } + if (GETPOST('menuId', 'alpha') && ! is_numeric(GETPOST('menuId', 'alpha'))) { $tmp=explode('&', GETPOST('menuId', 'alpha')); From 11f48460b2c3912acfd2c0cbc7b6ace47ed39460 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 23:26:25 +0100 Subject: [PATCH 33/36] Fix --- htdocs/admin/menus/edit.php | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index fde40ecdca5..35707360e60 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -144,22 +144,6 @@ if ($action == 'add') } $leftmenu=''; $mainmenu=''; - if (! empty($_POST['menuId']) && ! is_numeric($_POST['menuId'])) - { - $tmp=explode('&',$_POST['menuId']); - 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); - } - } - } - if (GETPOST('menuId', 'alpha') && ! is_numeric(GETPOST('menuId', 'alpha'))) { $tmp=explode('&', GETPOST('menuId', 'alpha')); From ced386fdca5f7e84f2c9b174d4e77bd8b463fe14 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Feb 2019 11:32:00 +0100 Subject: [PATCH 34/36] Fix phpcs --- .../core/class/commondocgenerator.class.php | 10 +- htdocs/margin/agentMargins.php | 10 +- htdocs/product/stock/movement_card.php | 136 +++++++++--------- htdocs/projet/tasks/time.php | 4 +- .../class/html.formresource.class.php | 2 +- 5 files changed, 81 insertions(+), 81 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 235dde63096..98d7e720628 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -488,10 +488,10 @@ abstract class CommonDocGenerator if (empty($resarray[$array_key.'_total_vat_'.$vatformated])) $resarray[$array_key.'_total_vat_'.$vatformated]=0; $resarray[$array_key.'_total_vat_'.$vatformated]+=$line->total_tva; $resarray[$array_key.'_total_vat_locale_'.$vatformated]=price($resarray[$array_key.'_total_vat_'.$vatformated]); - + $totalUp += $line->subprice * $line->qty; } - + // @GS: Calculate total up and total discount percentage // Note that this added fields correspond to nothing in Dolibarr (Dolibarr manage discount on lines not globally) $resarray['object_total_up'] = $totalUp; @@ -501,7 +501,7 @@ abstract class CommonDocGenerator $resarray['object_total_discount_locale'] = price($resarray['object_total_discount'], 0, $outputlangs); } } - + // Retrieve extrafields if (is_array($object->array_options) && count($object->array_options)) { @@ -514,7 +514,7 @@ abstract class CommonDocGenerator $resarray = $this->fill_substitutionarray_with_extrafields($object, $resarray, $extrafields, $array_key, $outputlangs); } - + return $resarray; } @@ -585,7 +585,7 @@ abstract class CommonDocGenerator $extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey, true); $line->fetch_optionals(); - $resarray = $this->fill_substitutionarray_with_extrafields($line, $resarray, $extrafields, $array_key=$array_key, $outputlangs); + $resarray = $this->fill_substitutionarray_with_extrafields($line, $resarray, $extrafields, $array_key, $outputlangs); // Load product data optional fields to the line -> enables to use "line_options_{extrafield}" if (isset($line->fk_product) && $line->fk_product > 0) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 8bdbaac5861..197c912494a 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -212,13 +212,13 @@ if ($result) else print_liste_field_titre("SalesRepresentative", $_SERVER["PHP_SELF"], "u.lastname", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("SellingPrice",$_SERVER["PHP_SELF"], "selling_price", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($labelcostprice,$_SERVER["PHP_SELF"], "buying_price", "", $param,' align="right"', $sortfield, $sortorder); - print_liste_field_titre("Margin",$_SERVER["PHP_SELF"], "marge", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", $param,' align="right"', $sortfield, $sortorder); + print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", $param, 'align="right"', $sortfield, $sortorder); if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print_liste_field_titre("MarginRate",$_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder); if (! empty($conf->global->DISPLAY_MARK_RATES)) - print_liste_field_titre("MarkRate",$_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder); print "\n"; $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index abf7d21284b..fcfa26bb832 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -49,38 +49,38 @@ if (! empty($conf->productbatch->enabled)) $langs->load("productbatch"); // Security check $result=restrictedArea($user,'stock'); -$id=GETPOST('id','int'); -$ref = GETPOST('ref','alpha'); -$msid=GETPOST('msid','int'); -$product_id=GETPOST("product_id"); -$action=GETPOST('action','aZ09'); -$cancel=GETPOST('cancel','alpha'); -$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'movementlist'; +$id=GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$msid=GETPOST('msid', 'int'); +$product_id=GETPOST("product_id", 'int'); +$action=GETPOST('action', 'aZ09'); +$cancel=GETPOST('cancel', 'alpha'); +$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'movementlist'; -$idproduct = GETPOST('idproduct','int'); -$year = GETPOST("year"); -$month = GETPOST("month"); +$idproduct = GETPOST('idproduct', 'int'); +$year = GETPOST("year", 'int'); +$month = GETPOST("month", 'int'); $search_ref = GETPOST('search_ref', 'alpha'); -$search_movement = GETPOST("search_movement"); -$search_product_ref = trim(GETPOST("search_product_ref")); -$search_product = trim(GETPOST("search_product")); -$search_warehouse = trim(GETPOST("search_warehouse")); -$search_inventorycode = trim(GETPOST("search_inventorycode")); -$search_user = trim(GETPOST("search_user")); -$search_batch = trim(GETPOST("search_batch")); -$search_qty = trim(GETPOST("search_qty")); +$search_movement = GETPOST("search_movement", 'alpha'); +$search_product_ref = trim(GETPOST("search_product_ref", 'alpha')); +$search_product = trim(GETPOST("search_product", 'alpha')); +$search_warehouse = trim(GETPOST("search_warehouse", 'alpha')); +$search_inventorycode = trim(GETPOST("search_inventorycode", 'alpha')); +$search_user = trim(GETPOST("search_user", 'alpha')); +$search_batch = trim(GETPOST("search_batch", 'alpha')); +$search_qty = trim(GETPOST("search_qty", 'alpha')); $search_type_mouvement=GETPOST('search_type_mouvement','int'); -$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; -$page = GETPOST("page",'int'); -$sortfield = GETPOST("sortfield",'alpha'); -$sortorder = GETPOST("sortorder",'alpha'); +$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; +$page = GETPOST("page", 'int'); +$sortfield = GETPOST("sortfield", 'alpha'); +$sortorder = GETPOST("sortorder", 'alpha'); if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; if (! $sortfield) $sortfield="m.datem"; if (! $sortorder) $sortorder="DESC"; -$pdluoid=GETPOST('pdluoid','int'); +$pdluoid=GETPOST('pdluoid', 'int'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $object = new MouvementStock($db); @@ -90,7 +90,7 @@ $formfile = new FormFile($db); // fetch optionals attributes and labels $extralabels = $extrafields->fetch_name_optionals_label('movement'); -$search_array_options=$extrafields->getOptionalsFromPost($object->table_element,'','search_'); +$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); $arrayfields=array( 'm.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), @@ -132,7 +132,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Do we click on purge search criteria ? -if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers { $year=''; $month=''; @@ -185,22 +185,22 @@ if ($action == "correct_stock") if ($product->hasbatch()) { - $batch=GETPOST('batch_number'); + $batch=GETPOST('batch_number', 'alpha'); //$eatby=GETPOST('eatby'); //$sellby=GETPOST('sellby'); - $eatby=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); - $sellby=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); + $eatby=dol_mktime(0, 0, 0, GETPOST('eatbymonth', 'int'), GETPOST('eatbyday', 'int'), GETPOST('eatbyyear', 'int')); + $sellby=dol_mktime(0, 0, 0, GETPOST('sellbymonth', 'int'), GETPOST('sellbyday', 'int'), GETPOST('sellbyyear', 'int')); $result=$product->correct_stock_batch( $user, $id, - GETPOST("nbpiece",'int'), - GETPOST("mouvement"), - GETPOST("label",'san_alpha'), - GETPOST('unitprice'), + GETPOST("nbpiece", 'int'), + GETPOST("mouvement", 'int'), + GETPOST("label", 'san_alpha'), + GETPOST('unitprice', 'alpha'), $eatby,$sellby,$batch, - GETPOST('inventorycode'), + GETPOST('inventorycode', 'alpha'), $origin_element, $origin_id ); // We do not change value of stock for a correction @@ -210,11 +210,11 @@ if ($action == "correct_stock") $result=$product->correct_stock( $user, $id, - GETPOST("nbpiece",'int'), - GETPOST("mouvement"), + GETPOST("nbpiece", 'int'), + GETPOST("mouvement", 'alpha'), GETPOST("label",'san_alpha'), - GETPOST('unitprice'), - GETPOST('inventorycode'), + GETPOST('unitprice', 'alpha'), + GETPOST('inventorycode', 'alpha'), $origin_element, $origin_id ); // We do not change value of stock for a correction @@ -242,7 +242,7 @@ if ($action == "transfert_stock" && ! $cancel) $product = new Product($db); if (! empty($product_id)) $result=$product->fetch($product_id); - if (! (GETPOST("id_entrepot_destination",'int') > 0)) + if (! (GETPOST("id_entrepot_destination", 'int') > 0)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); $error++; @@ -272,7 +272,7 @@ if ($action == "transfert_stock" && ! $cancel) $product = new Product($db); $result=$product->fetch($product_id); - if ($product->hasbatch() && ! GETPOST("batch_number")) + if ($product->hasbatch() && ! GETPOST("batch_number", 'alpha')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("batch_number")), null, 'errors'); $error++; @@ -319,7 +319,7 @@ if ($action == "transfert_stock" && ! $cancel) else { $srcwarehouseid=$id; - $batch=GETPOST('batch_number'); + $batch=GETPOST('batch_number', 'alpha'); $eatby=$d_eatby; $sellby=$d_sellby; } @@ -330,23 +330,23 @@ if ($action == "transfert_stock" && ! $cancel) $result1=$product->correct_stock_batch( $user, $srcwarehouseid, - GETPOST("nbpiece",'int'), + GETPOST("nbpiece", 'int'), 1, - GETPOST("label",'san_alpha'), + GETPOST("label", 'san_alpha'), $pricesrc, $eatby,$sellby,$batch, - GETPOST('inventorycode') + GETPOST('inventorycode', 'alpha') ); // Add stock $result2=$product->correct_stock_batch( $user, - GETPOST("id_entrepot_destination",'int'), - GETPOST("nbpiece",'int'), + GETPOST("id_entrepot_destination", 'int'), + GETPOST("nbpiece", 'int'), 0, - GETPOST("label",'san_alpha'), + GETPOST("label", 'san_alpha'), $pricedest, $eatby,$sellby,$batch, - GETPOST('inventorycode') + GETPOST('inventorycode', 'alpha') ); } } @@ -356,22 +356,22 @@ if ($action == "transfert_stock" && ! $cancel) $result1=$product->correct_stock( $user, $id, - GETPOST("nbpiece"), + GETPOST("nbpiece", 'int'), 1, - GETPOST("label"), + GETPOST("label", 'alpha'), $pricesrc, - GETPOST('inventorycode') + GETPOST('inventorycode', 'alpha') ); // Add stock $result2=$product->correct_stock( $user, GETPOST("id_entrepot_destination"), - GETPOST("nbpiece"), + GETPOST("nbpiece", 'int'), 0, - GETPOST("label"), + GETPOST("label", 'alpha'), $pricedest, - GETPOST('inventorycode') + GETPOST('inventorycode', 'alpha') ); } if (! $error && $result1 >= 0 && $result2 >= 0) @@ -568,7 +568,7 @@ if ($resql) $morehtmlref.=''; $shownav = 1; - if ($user->societe_id && ! in_array('stock', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->societe_id && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref); @@ -693,9 +693,9 @@ if ($resql) } $param=''; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - if ($id > 0) $param.='&id='.$id; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); + if ($id > 0) $param.='&id='.urlencode($id); if ($search_movement) $param.='&search_movement='.urlencode($search_movement); if ($search_inventorycode) $param.='&search_inventorycode='.urlencode($search_inventorycode); if ($search_type_mouvement) $param.='&search_type_mouvement='.urlencode($search_type_mouvement); @@ -706,7 +706,7 @@ if ($resql) if (!empty($sref)) $param.='&sref='.urlencode($sref); // FIXME $sref is not defined if (!empty($snom)) $param.='&snom='.urlencode($snom); // FIXME $snom is not defined if ($search_user) $param.='&search_user='.urlencode($search_user); - if ($idproduct > 0) $param.='&idproduct='.$idproduct; + if ($idproduct > 0) $param.='&idproduct='.urlencode($idproduct); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -737,7 +737,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'
'; } $moreforfilter=''; @@ -928,9 +928,9 @@ if ($resql) $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($arrayfields['m.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['m.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); + if (! empty($arrayfields['m.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'] ,$_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + if (! empty($arrayfields['m.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; @@ -978,7 +978,7 @@ if ($resql) if (! empty($arrayfields['m.datem']['checked'])) { // Date - print ''.dol_print_date($db->jdate($objp->datem),'dayhour').''; + print ''.dol_print_date($db->jdate($objp->datem), 'dayhour').''; } if (! empty($arrayfields['p.ref']['checked'])) { @@ -1007,11 +1007,11 @@ if ($resql) } if (! empty($arrayfields['pl.eatby']['checked'])) { - print ''. dol_print_date($objp->eatby,'day') .''; + print ''. dol_print_date($objp->eatby, 'day') .''; } if (! empty($arrayfields['pl.sellby']['checked'])) { - print ''. dol_print_date($objp->sellby,'day') .''; + print ''. dol_print_date($objp->sellby, 'day') .''; } // Warehouse if (! empty($arrayfields['e.ref']['checked'])) @@ -1120,14 +1120,14 @@ if ($resql) $balanceafter=$movement->calculateBalanceForProductBefore($productidselected, $dateafter); //print ''; - print $langs->trans("NbOfProductBeforePeriod", $productlabelselected, dol_print_date($datebefore,'day','gmt')); + print $langs->trans("NbOfProductBeforePeriod", $productlabelselected, dol_print_date($datebefore, 'day', 'gmt')); //print ''; //print ''; print ': '.$balancebefore; print "
\n"; //print ''; //print ''; - print $langs->trans("NbOfProductAfterPeriod", $productlabelselected, dol_print_date($dateafter,'day','gmt')); + print $langs->trans("NbOfProductAfterPeriod", $productlabelselected, dol_print_date($dateafter, 'day', 'gmt')); //print ''; //print ''; print ': '.$balanceafter; @@ -1169,7 +1169,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete' && $id>0) $genallowed=$user->rights->stock->lire; $delallowed=$user->rights->stock->creer; - print $formfile->showdocuments($modulepart,$objectref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object); + print $formfile->showdocuments($modulepart, $objectref, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object); $somethingshown=$formfile->numoffiles; print '
'; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index be87a52fcd9..1f09d7e9a77 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1045,8 +1045,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $contactsofproject=$projectstatic->getListContactId('internal'); if (count($contactsofproject)>0) { - if (in_array($user->id, $userid=$contactsofproject)) $userid = $user->id; - else $userid=$contactsofproject[0]; + if (in_array($user->id, $contactsofproject)) $userid = $user->id; + else $userid = $contactsofproject[0]; if ($projectstatic->public) $contactsofproject = array(); print $form->select_dolusers((GETPOST('userid')?GETPOST('userid'):$userid), 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, $langs->trans("ResourceNotAssignedToProject"), 'maxwidth200'); } diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php index 39b789c2b7d..e4cc5a64ab7 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -85,7 +85,7 @@ class FormResource $resourcestat = new Dolresource($this->db); - $resources_used = $resourcestat->fetch_all('ASC', 't.rowid', $limit, $offset, $filter=''); + $resources_used = $resourcestat->fetch_all('ASC', 't.rowid', $limit, $offset, $filter); if ($outputmode != 2) { From 04e3f2347606f9fd0b33c01c20822ba32694b641 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Feb 2019 11:52:45 +0100 Subject: [PATCH 35/36] Fix phpcs --- htdocs/compta/compta-files.php | 2 +- htdocs/margin/agentMargins.php | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/compta-files.php index cb49b35d242..665b9ba63de 100644 --- a/htdocs/compta/compta-files.php +++ b/htdocs/compta/compta-files.php @@ -82,7 +82,7 @@ if ($user->societe_id > 0) * Actions */ -$entity = GETPOST('entity','int')?GETPOST('entity','int'):$conf->entity; +$entity = GETPOST('entity', 'int')?GETPOST('entity', 'int'):$conf->entity; //$parameters = array('socid' => $id); //$reshook = $hookmanager->executeHooks('doActions', $parameters, $object); // Note that $object may have been modified by some hooks diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 197c912494a..8f6c03d5623 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -213,7 +213,7 @@ if ($result) print_liste_field_titre("SalesRepresentative", $_SERVER["PHP_SELF"], "u.lastname", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", $param,' align="right"', $sortfield, $sortorder); + print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", $param, 'align="right"', $sortfield, $sortorder); if (! empty($conf->global->DISPLAY_MARGIN_RATES)) print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder); @@ -225,8 +225,6 @@ if ($result) if ($num > 0) { - $var=true; - $group_list = array(); while ($objp = $db->fetch_object($result)) { if ($agentid > 0) { From 44fd36b15ced9c30a5c3425485423a86afd223d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Feb 2019 12:39:26 +0100 Subject: [PATCH 36/36] Fix phpcs --- htdocs/product/stock/movement_card.php | 67 ++++++++++++++------------ 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index fcfa26bb832..3b396a16fe3 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -47,7 +47,7 @@ $langs->loadLangs(array('products', 'stocks', 'orders')); if (! empty($conf->productbatch->enabled)) $langs->load("productbatch"); // Security check -$result=restrictedArea($user,'stock'); +$result=restrictedArea($user, 'stock'); $id=GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); @@ -69,7 +69,7 @@ $search_inventorycode = trim(GETPOST("search_inventorycode", 'alpha')); $search_user = trim(GETPOST("search_user", 'alpha')); $search_batch = trim(GETPOST("search_batch", 'alpha')); $search_qty = trim(GETPOST("search_qty", 'alpha')); -$search_type_mouvement=GETPOST('search_type_mouvement','int'); +$search_type_mouvement=GETPOST('search_type_mouvement', 'int'); $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $page = GETPOST("page", 'int'); @@ -122,8 +122,8 @@ $usercanread = (($user->rights->stock->mouvement->lire)); $usercancreate = (($user->rights->stock->mouvement->creer)); $usercandelete = (($user->rights->stock->mouvement->supprimer)); -if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } -if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } +if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } $parameters=array(); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks @@ -199,7 +199,9 @@ if ($action == "correct_stock") GETPOST("mouvement", 'int'), GETPOST("label", 'san_alpha'), GETPOST('unitprice', 'alpha'), - $eatby,$sellby,$batch, + $eatby, + $sellby, + $batch, GETPOST('inventorycode', 'alpha'), $origin_element, $origin_id @@ -212,7 +214,7 @@ if ($action == "correct_stock") $id, GETPOST("nbpiece", 'int'), GETPOST("mouvement", 'alpha'), - GETPOST("label",'san_alpha'), + GETPOST("label", 'san_alpha'), GETPOST('unitprice', 'alpha'), GETPOST('inventorycode', 'alpha'), $origin_element, @@ -334,7 +336,9 @@ if ($action == "transfert_stock" && ! $cancel) 1, GETPOST("label", 'san_alpha'), $pricesrc, - $eatby,$sellby,$batch, + $eatby, + $sellby, + $batch, GETPOST('inventorycode', 'alpha') ); // Add stock @@ -345,7 +349,9 @@ if ($action == "transfert_stock" && ! $cancel) 0, GETPOST("label", 'san_alpha'), $pricedest, - $eatby,$sellby,$batch, + $eatby, + $sellby, + $batch, GETPOST('inventorycode', 'alpha') ); } @@ -464,13 +470,13 @@ if ($id > 0) $sql.= " AND e.rowid ='".$id."'"; if ($month > 0) { if ($year > 0) - $sql.= " AND m.datem BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'"; + $sql.= " AND m.datem BETWEEN '".$db->idate(dol_get_first_day($year, $month, false))."' AND '".$db->idate(dol_get_last_day($year, $month, false))."'"; else $sql.= " AND date_format(m.datem, '%m') = '$month'"; } elseif ($year > 0) { - $sql.= " AND m.datem BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; + $sql.= " AND m.datem BETWEEN '".$db->idate(dol_get_first_day($year, 1, false))."' AND '".$db->idate(dol_get_last_day($year, 12, false))."'"; } if ($idproduct > 0) $sql.= " AND p.rowid = '".$idproduct."'"; if (! empty($search_ref)) $sql.= natural_search('m.rowid', $search_ref, 1); @@ -615,7 +621,7 @@ if ($resql) // Last movement $sql = "SELECT MAX(m.datem) as datem"; $sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m"; - $sql .= " WHERE m.fk_entrepot = '".$object->id."'"; + $sql .= " WHERE m.fk_entrepot = ".(int) $object->id; $resqlbis = $db->query($sql); if ($resqlbis) { @@ -630,7 +636,7 @@ if ($resql) print ''.$langs->trans("LastMovement").''; if ($lastmovementdate) { - print dol_print_date($lastmovementdate,'dayhour'); + print dol_print_date($lastmovementdate, 'dayhour'); } else { @@ -883,7 +889,7 @@ if ($resql) // Fields from hook $parameters=array('arrayfields'=>$arrayfields); - $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation if (! empty($arrayfields['m.datec']['checked'])) @@ -905,21 +911,21 @@ if ($resql) print "\n"; print ''; - if (! empty($arrayfields['m.rowid']['checked'])) print_liste_field_titre($arrayfields['m.rowid']['label'],$_SERVER["PHP_SELF"],'m.rowid','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['m.datem']['checked'])) print_liste_field_titre($arrayfields['m.datem']['label'],$_SERVER["PHP_SELF"],'m.datem','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'],$_SERVER["PHP_SELF"],'p.label','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['m.batch']['checked'])) print_liste_field_titre($arrayfields['m.batch']['label'],$_SERVER["PHP_SELF"],'m.batch','',$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['pl.eatby']['checked'])) print_liste_field_titre($arrayfields['pl.eatby']['label'],$_SERVER["PHP_SELF"],'pl.eatby','',$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['pl.sellby']['checked'])) print_liste_field_titre($arrayfields['pl.sellby']['label'],$_SERVER["PHP_SELF"],'pl.sellby','',$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['e.ref']['checked'])) print_liste_field_titre($arrayfields['e.ref']['label'],$_SERVER["PHP_SELF"], "e.ref","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible - if (! empty($arrayfields['m.fk_user_author']['checked'])) print_liste_field_titre($arrayfields['m.fk_user_author']['label'],$_SERVER["PHP_SELF"], "m.fk_user_author","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['m.inventorycode']['checked'])) print_liste_field_titre($arrayfields['m.inventorycode']['label'],$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['m.label']['checked'])) print_liste_field_titre($arrayfields['m.label']['label'],$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['m.type_mouvement']['checked'])) print_liste_field_titre($arrayfields['m.type_mouvement']['label'],$_SERVER["PHP_SELF"], "m.type_mouvement","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['origin']['checked'])) print_liste_field_titre($arrayfields['origin']['label'],$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['m.value']['checked'])) print_liste_field_titre($arrayfields['m.value']['label'],$_SERVER["PHP_SELF"], "m.value","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['m.price']['checked'])) print_liste_field_titre($arrayfields['m.price']['label'],$_SERVER["PHP_SELF"], "m.price","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['m.rowid']['checked'])) print_liste_field_titre($arrayfields['m.rowid']['label'], $_SERVER["PHP_SELF"], 'm.rowid', '', $param, '', $sortfield, $sortorder); + if (! empty($arrayfields['m.datem']['checked'])) print_liste_field_titre($arrayfields['m.datem']['label'], $_SERVER["PHP_SELF"], 'm.datem', '', $param, '', $sortfield, $sortorder); + if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); + if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder); + if (! empty($arrayfields['m.batch']['checked'])) print_liste_field_titre($arrayfields['m.batch']['label'], $_SERVER["PHP_SELF"], 'm.batch', '', $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['pl.eatby']['checked'])) print_liste_field_titre($arrayfields['pl.eatby']['label'], $_SERVER["PHP_SELF"], 'pl.eatby', '', $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['pl.sellby']['checked'])) print_liste_field_titre($arrayfields['pl.sellby']['label'], $_SERVER["PHP_SELF"], 'pl.sellby', '', $param,'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['e.ref']['checked'])) print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", '', $param, "", $sortfield, $sortorder); // We are on a specific warehouse card, no filter on other should be possible + if (! empty($arrayfields['m.fk_user_author']['checked'])) print_liste_field_titre($arrayfields['m.fk_user_author']['label'], $_SERVER["PHP_SELF"], "m.fk_user_author", "", $param, "", $sortfield, $sortorder); + if (! empty($arrayfields['m.inventorycode']['checked'])) print_liste_field_titre($arrayfields['m.inventorycode']['label'], $_SERVER["PHP_SELF"], "m.inventorycode", "", $param, "", $sortfield, $sortorder); + if (! empty($arrayfields['m.label']['checked'])) print_liste_field_titre($arrayfields['m.label']['label'], $_SERVER["PHP_SELF"], "m.label", "", $param, "", $sortfield, $sortorder); + if (! empty($arrayfields['m.type_mouvement']['checked'])) print_liste_field_titre($arrayfields['m.type_mouvement']['label'], $_SERVER["PHP_SELF"], "m.type_mouvement", "", $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['origin']['checked'])) print_liste_field_titre($arrayfields['origin']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder); + if (! empty($arrayfields['m.value']['checked'])) print_liste_field_titre($arrayfields['m.value']['label'], $_SERVER["PHP_SELF"], "m.value", "", $param, 'align="right"', $sortfield, $sortorder); + if (! empty($arrayfields['m.price']['checked'])) print_liste_field_titre($arrayfields['m.price']['label'], $_SERVER["PHP_SELF"], "m.price", "", $param, 'align="right"', $sortfield, $sortorder); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; @@ -928,12 +934,11 @@ if ($resql) $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($arrayfields['m.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'] ,$_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + if (! empty($arrayfields['m.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); if (! empty($arrayfields['m.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; - $arrayofuniqueproduct=array(); while ($i < min($num,$limit)) @@ -984,7 +989,7 @@ if ($resql) { // Product ref print ''; - print $productstatic->getNomUrl(1,'stock',16); + print $productstatic->getNomUrl(1, 'stock', 16); print "\n"; } if (! empty($arrayfields['p.label']['checked']))