diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 44f57ef9086f7..6098a0e013944 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -115,7 +115,10 @@ 0 - + + 0 + + 0 diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 9e9d5cad8f1f3..befe131950d00 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -144,9 +144,9 @@ } $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)) @@ -214,9 +214,9 @@ $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 { diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 429603ed4fcb9..a1c1d8ae34934 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -50,8 +50,8 @@ $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 @@ $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'); diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 54e1d285f3e85..33a06e09136db 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -106,7 +106,7 @@ if ($mode != 'sconly') { - print $langs->trans("DescTaxAndDividendsArea").'
'; + print ''.$langs->trans("DescTaxAndDividendsArea").'
'; print "
"; } diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/compta-files.php index 23eff46da5158..665b9ba63deb3 100644 --- a/htdocs/compta/compta-files.php +++ b/htdocs/compta/compta-files.php @@ -30,6 +30,7 @@ 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'; $langs->loadLangs(array("accountancy","bills")); @@ -59,7 +60,7 @@ $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"; @@ -69,7 +70,7 @@ ); // 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) @@ -81,6 +82,8 @@ * 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 +94,35 @@ $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.=" 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.=" 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,'ExpenseReport' 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, '0' as fk_soc, datedon as date,'Donation' as item FROM ".MAIN_DB_PREFIX."don"; + $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,'SalaryPayment' as item FROM ".MAIN_DB_PREFIX."payment_salary"; + $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, 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.=" 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=''; @@ -120,7 +137,7 @@ $upload_dir =''; $i=0; - while($i<$numd) + while ($i < $numd) { $objd = $db->fetch_object($resd); @@ -131,18 +148,18 @@ $upload_dir = $conf->facture->dir_output.'/'.$subdir; $link="document.php?modulepart=facture&file=".str_replace('/', '%2F', $subdir).'%2F'; break; - case "InvoiceSupplier": + case "SupplierInvoice": $tmpinvoicesupplier->fetch($objd->id); - $subdir=get_exdir(0, 0, 0, 1, $tmpinvoicesupplier, 'invoice_supplier').'/'.dol_sanitizeFileName($objd->ref); + $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 "Expense": + 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 "Salary": + 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'; @@ -169,7 +186,9 @@ { $result=true; $files=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview\.png)$', '', SORT_ASC, 1); - if (count($files)<1) { + //var_dump($upload_dir); + if (count($files) < 1) + { $nofile['date']=$db->idate($objd->date); $nofile['paid']=$objd->paid; $nofile['amount']=$objd->total_ttc; @@ -212,15 +231,19 @@ */ //FIXME /* -*ZIP creation -*/ + *ZIP creation + */ 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); @@ -228,8 +251,8 @@ { 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.=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(); @@ -251,21 +274,63 @@ * View */ +$form = new Form($db); +$userstatic=new User($db); + +$title=$langs->trans("ComptaFiles").' - '.$langs->trans("List"); + llxHeader('', $title, $help_url); $h=0; $head[$h][0] = $_SERVER["PHP_SELF"].$varlink; -$head[$h][1] = $langs->trans("AccountantFiles"); -$head[$h][2] = 'AccountantFiles'; +$head[$h][1] = $langs->trans("AccountancyFiles"); +$head[$h][2] = 'AccountancyFiles'; + +dol_fiche_head($head, 'AccountancyFiles'); -dol_fiche_head($head, 'AccountantFiles'); -$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 ''; +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 '   -   '.$langs->trans("Entity").' : '; + $mc->dao->getEntities(); + $mc->dao->fetch($conf->entity); + print $mc->dao->label; + print "
\n"; +} + print '
'."\n"; dol_fiche_end(); @@ -281,6 +346,7 @@ $param.='&date_stopyear='.GETPOST('date_stopyear', 'int'); print '
'."\n"; + print ''; echo dol_print_date($date_start, 'day')." - ".dol_print_date($date_stop, 'day'); @@ -315,17 +381,21 @@ if ($result) { $TData = dol_sort_array($filesarray, 'date', 'ASC'); - if(empty($TData)) { + + if (empty($TData)) + { print ''.$langs->trans("NoItem").''; - } else { - // Sort array by date ASC to calucalte balance + } + 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' ){ + if ($data1['item']!='Invoice'&& $data1['item']!='Donation' ){ $data1['amount']=-$data1['amount']; } if ($data1['amount']>0){ @@ -334,8 +404,10 @@ $balance += $data1['amount']; $data1['balance'] = $balance; } + // Display array - foreach($TData as $data) { + 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']; @@ -343,7 +415,7 @@ print ""; print dol_print_date($data['date'], 'day'); print "\n"; - print ''.$data['item'].''; + print ''.$langs->trans($data['item']).''; print ''.$data['ref'].''; // File link @@ -358,6 +430,7 @@ print ''.price($data['balance'])."\n"; print "\n"; } + print ''; print ' '; print ''.price($totalDebit).''; @@ -370,6 +443,5 @@ print ''; } - llxFooter(); $db->close(); diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 5e55565522847..b58ac1d1e93da 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -279,7 +279,7 @@ $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"; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 5181ae026672b..addc56a240b28 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -922,7 +922,7 @@ 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 @@ } print ""; - print ' '; + print ' '; if ($modecompta == 'BOOKKEEPING') { if (isset($encaiss[$case])) @@ -978,8 +978,8 @@ 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 ''.$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 7b7d37a6cb9b0..fcee95b688fae 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -228,18 +228,18 @@ print ''; print ''.$langs->trans("AccountingCategory").''; print ''; -print ''.$langs->trans("PreviousPeriod").''; -print ''.$langs->trans("SelectedPeriod").''; +print ''.$langs->trans("PreviousPeriod").''; +print ''.$langs->trans("SelectedPeriod").''; foreach($months as $k => $v){ if (($k+1) >= $date_startmonth) { - print ''.$langs->trans('MonthShort'.sprintf("%02s", ($k+1))).''; + print ''.$langs->trans('MonthShort'.sprintf("%02s", ($k+1))).''; } } foreach($months as $k => $v){ if (($k+1) < $date_startmonth) { - print ''.$langs->trans('MonthShort'.sprintf("%02s", ($k+1))).''; + print ''.$langs->trans('MonthShort'.sprintf("%02s", ($k+1))).''; } } print ''; @@ -493,15 +493,15 @@ } print ''; - print '' . price($totCat['NP']) . ''; - print '' . price($totCat['N']) . ''; + print '' . price($totCat['NP']) . ''; + print '' . price($totCat['N']) . ''; // Each month foreach($totCat['M'] as $k => $v){ - if (($k+1) >= $date_startmonth) print '' . price($v) . ''; + if (($k+1) >= $date_startmonth) print '' . price($v) . ''; } foreach($totCat['M'] as $k => $v){ - if (($k+1) < $date_startmonth) print '' . price($v) . ''; + if (($k+1) < $date_startmonth) print '' . price($v) . ''; } print "\n"; @@ -523,8 +523,8 @@ print ' - '; print $cpt['account_label']; print ''; - print '' . price($resultNP) . ''; - print '' . price($resultN) . ''; + print '' . price($resultNP) . ''; + print '' . price($resultN) . ''; // Make one call for each month foreach($months as $k => $v) @@ -532,7 +532,7 @@ if (($k+1) >= $date_startmonth) { $resultM=$totPerAccount[$cpt['account_number']]['M'][$k]; - print '' . price($resultM) . ''; + print '' . price($resultM) . ''; } } foreach($months as $k => $v) @@ -540,7 +540,7 @@ if (($k+1) < $date_startmonth) { $resultM=$totPerAccount[$cpt['account_number']]['M'][$k]; - print '' . price($resultM) . ''; + print '' . price($resultM) . ''; } } print "\n"; diff --git a/htdocs/compta/salaries/list.php b/htdocs/compta/salaries/list.php index 99a41f5ad9f89..e0fb1b38636bd 100644 --- a/htdocs/compta/salaries/list.php +++ b/htdocs/compta/salaries/list.php @@ -194,9 +194,9 @@ print ''; } // Amount - print ''; + print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; @@ -204,11 +204,11 @@ 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 @@ print ''; } // Amount - print "".price($obj->amount).""; - print ""; + print ''.price($obj->amount).''; + print ''; print "\n"; $total = $total + $obj->amount; @@ -281,7 +281,7 @@ $colspan=5; if (! empty($conf->banque->enabled)) $colspan++; print ''.$langs->trans("Total").''; - print ''.price($total).""; + print ''.price($total).""; print ""; print ""; diff --git a/htdocs/compta/salaries/stats/index.php b/htdocs/compta/salaries/stats/index.php index f51e102d4f2fc..0c64ed5865ec5 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 ''; $oldyear=0; @@ -234,17 +234,17 @@ print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; } print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; $oldyear=$year; } diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index bc0727889a683..fe29e133edc2c 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -537,7 +537,7 @@ 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 @@ 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 @@ 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 @@ $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 @@ 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 847cb431a6bd7..8a8cc1f61b8ab 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -203,17 +203,17 @@ // 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 @@ 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 @@ 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 @@ // 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 @@ 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 9b2bb9552a84a..384601ca989c7 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -122,8 +122,8 @@ 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($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 @@ $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 @@ 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 @@ print "".$obj->label."\n"; - print ''.price($obj->amount).""; + print ''.price($obj->amount).""; // Ref payment $tva_static->id=$obj->rowid; @@ -271,16 +271,16 @@ 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 @@ 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 @@ print "".$obj->label."\n"; - print ''.price($obj->amount).""; + print ''.price($obj->amount).""; // Ref payment $tva_static->id=$obj->rowid; @@ -372,16 +372,16 @@ 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 @@ 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 @@ 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 @@ 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 ""; diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index dd14f17543237..c69547740dc91 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -257,10 +257,10 @@ { $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 @@ $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 @@ $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 @@ { $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 @@ $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 @@ $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 fffb63055aa98..cb8a3cc451d61 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -315,7 +315,7 @@ $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 @@ "qty", "", $paramslink, - 'align="right"', + 'class="right"', $sortfield, $sortorder ); @@ -347,7 +347,7 @@ "qty", "", $paramslink, - 'align="right"', + 'class="right"', $sortfield, $sortorder ); @@ -356,8 +356,8 @@ $_SERVER["PHP_SELF"], "amount", "", - $paramslink, - 'align="right"', + $classslink, + 'class="right"', $sortfield, $sortorder ); @@ -367,7 +367,7 @@ "amount_ttc", "", $paramslink, - 'align="right"', + 'class="right"', $sortfield, $sortorder ); @@ -377,7 +377,7 @@ "amount_ttc", "", $paramslink, - 'align="right"', + 'class="right"', $sortfield, $sortorder ); @@ -400,15 +400,15 @@ 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 ''; // Amount with VAT - print ''; + print ''; /*if ($key > 0) { print ''; } else { @@ -430,7 +430,7 @@ 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 @@ // 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 7bf98b8045263..89552c54199e1 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -310,7 +310,7 @@ "amount_ht", "", $paramslink, - 'align="right"', + 'class="right"', $sortfield, $sortorder ); @@ -323,7 +323,7 @@ "amount_ttc", "", $paramslink, - 'align="right"', + 'class="right"', $sortfield, $sortorder ); @@ -332,7 +332,7 @@ $_SERVER["PHP_SELF"], "amount_ttc", "", $paramslink, - 'align="right"', + 'class="right"', $sortfield, $sortorder ); @@ -391,7 +391,7 @@ print "".$linkname."\n"; // Amount w/o VAT - print ''; + print ''; if ($modecompta != 'CREANCES-DETTES') { if ($key > 0) { @@ -410,7 +410,7 @@ print ''; // Amount with VAT - print ''; + print ''; if ($modecompta != 'CREANCES-DETTES') { if ($key > 0) { print ''; @@ -428,7 +428,7 @@ 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 ($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/casoc.php b/htdocs/compta/stats/casoc.php index 864dd6ef314d5..a9108fff0f631 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -378,22 +378,22 @@ 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 @@ "amount_ht", "", $paramslink, - 'align="right"', + 'class="right"', $sortfield, $sortorder ); @@ -461,7 +461,7 @@ "amount_ttc", "", $paramslink, - 'align="right"', + 'class="right"', $sortfield, $sortorder ); @@ -471,7 +471,7 @@ "amount_ttc", "", $paramslink, - 'align="right"', + 'class="right"', $sortfield, $sortorder ); @@ -567,7 +567,7 @@ print ''; // Amount w/o VAT - print ''; + print ''; if ($modecompta != 'CREANCES-DETTES') { if ($key > 0) { print ''; @@ -585,7 +585,7 @@ print ''; // Amount with VAT - print ''; + print ''; if ($modecompta != 'CREANCES-DETTES') { if ($key > 0) { print ''; @@ -604,7 +604,7 @@ 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 ($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 67a3a1117905f..fe31f68380af5 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -285,9 +285,9 @@ 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 @@ { 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 @@ } // 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 @@ { $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 @@ $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 @@ { $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 @@ // 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 @@ // 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 @@ { 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 @@ $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 @@ $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 @@ { 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 ""; diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index a53f77a702152..e35396203518a 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -351,15 +351,15 @@ 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 @@ print ''; // Ref - print ''.$fields['link'].''; + print ''.$fields['link'].''; // Invoice date print '' . dol_print_date($fields['datef'], 'day') . ''; @@ -424,7 +424,7 @@ else print ''; // Rate - print '' . $fields['drate'] . ''; + print '' . $fields['drate'] . ''; // Description print ''; @@ -464,7 +464,7 @@ // Total HT if ($modetax != 1) { - print ''; + print ''; print price($fields['totalht']); if (price2num($fields['ftotal_ttc'])) { @@ -479,7 +479,7 @@ $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 @@ } // 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 @@ // 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 @@ { 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 @@ 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 @@ print ''; // Ref - print ''.$fields['link'].''; + print ''.$fields['link'].''; // Invoice date print '' . dol_print_date($fields['datef'], 'day') . ''; @@ -657,7 +657,7 @@ // Total HT if ($modetax != 1) { - print ''; + print ''; print price($fields['totalht']); if (price2num($fields['ftotal_ttc'])) { @@ -672,7 +672,7 @@ $ratiopaymentinvoice=1; if ($modetax != 1) { - print ''; + print ''; if ($fields['payment_amount'] && $fields['ftotal_ttc']) { $paymentfourn_static->id=$fields['payment_id']; @@ -698,13 +698,13 @@ } // 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 @@ // 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 @@ $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++; diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 4191563eaecad..ebbe7332236f1 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -488,7 +488,8 @@ $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/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 235dde6309666..98d7e7206285e 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -488,10 +488,10 @@ function get_substitutionarray_object($object, $outputlangs, $array_key = 'objec 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 @@ function get_substitutionarray_object($object, $outputlangs, $array_key = 'objec $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 @@ function get_substitutionarray_object($object, $outputlangs, $array_key = 'objec $resarray = $this->fill_substitutionarray_with_extrafields($object, $resarray, $extrafields, $array_key, $outputlangs); } - + return $resarray; } @@ -585,7 +585,7 @@ function get_substitutionarray_lines($line, $outputlangs) $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/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index be046ae889dd2..89933fcd49974 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; } diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index c1bed8daf80a4..eacf0386eb560 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', $donoreset if ($showfk) { 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); if ($num > 0) { - $var=true; - $group_list = array(); while ($objp = $db->fetch_object($result)) { if ($agentid > 0) { @@ -241,11 +239,11 @@ $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); } diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php new file mode 100644 index 0000000000000..3b396a16fe343 --- /dev/null +++ b/htdocs/product/stock/movement_card.php @@ -0,0 +1,1199 @@ + + * 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", 'int'); +$action=GETPOST('action', 'aZ09'); +$cancel=GETPOST('cancel', 'alpha'); +$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'movementlist'; + +$idproduct = GETPOST('idproduct', 'int'); +$year = GETPOST("year", 'int'); +$month = GETPOST("month", 'int'); +$search_ref = GETPOST('search_ref', 'alpha'); +$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'); +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', 'alpha'); + + //$eatby=GETPOST('eatby'); + //$sellby=GETPOST('sellby'); + $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", 'int'), + GETPOST("label", 'san_alpha'), + GETPOST('unitprice', 'alpha'), + $eatby, + $sellby, + $batch, + GETPOST('inventorycode', 'alpha'), + $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", 'alpha'), + GETPOST("label", 'san_alpha'), + GETPOST('unitprice', 'alpha'), + GETPOST('inventorycode', 'alpha'), + $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", 'alpha')) + { + 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', 'alpha'); + $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', 'alpha') + ); + // 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', 'alpha') + ); + } + } + else + { + // Remove stock + $result1=$product->correct_stock( + $user, + $id, + GETPOST("nbpiece", 'int'), + 1, + GETPOST("label", 'alpha'), + $pricesrc, + GETPOST('inventorycode', 'alpha') + ); + + // Add stock + $result2=$product->correct_stock( + $user, + GETPOST("id_entrepot_destination"), + GETPOST("nbpiece", 'int'), + 0, + GETPOST("label", 'alpha'), + $pricedest, + GETPOST('inventorycode', 'alpha') + ); + } + 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 '   '; + 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'].')'; diff --git a/htdocs/core/modules/fichinter/modules_fichinter.php b/htdocs/core/modules/fichinter/modules_fichinter.php index 3903d6154e5bf..0c88cd88d56df 100644 --- a/htdocs/core/modules/fichinter/modules_fichinter.php +++ b/htdocs/core/modules/fichinter/modules_fichinter.php @@ -109,7 +109,7 @@ function getExample() } /** - * 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 diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 913a328558cbb..f6c2ff1847cec 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -92,6 +92,11 @@ class Don extends CommonObject public $labelstatut; public $labelstatutshort; + /** + * Draft + */ + const STATUS_DRAFT = 0; + /** * Constructor diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index a4c09f8ae30f3..460fc1f1557e2 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); 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 2087e03266028..9012448959c77 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 @@ -262,6 +262,11 @@ 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); diff --git a/htdocs/langs/en_US/stripe.lang b/htdocs/langs/en_US/stripe.lang index d45a768ff39bc..46de5f4485b19 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 diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 8d5f496a6f570..e644b57fa6258 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2137,6 +2137,5 @@ function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = }); 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,25 +208,23 @@ 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 = ".(int) $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='.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); + 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='.urlencode($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(); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index be87a52fcd982..1f09d7e9a77ee 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1045,8 +1045,8 @@ $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 39b789c2b7d1c..e4cc5a64ab7c2 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -85,7 +85,7 @@ function select_resource_list($selected = '', $htmlname = 'fk_resource', $filter $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) { diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 859b2220b28c8..63a2a598d41ea 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1104,8 +1104,7 @@ { 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 ""; } diff --git a/htdocs/webservices/server_category.php b/htdocs/webservices/server_category.php index 74d175ac2c9f4..4495de9917fd5 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 d49a76af117b8..32f25fa2ca83c 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