Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2019-07-27 02:40:56 +02:00
commit 9f7d118f6f
13 changed files with 58 additions and 38 deletions

View File

@ -88,18 +88,21 @@ if (preg_match('/api\/index\.php\/explorer/', $_SERVER["PHP_SELF"]) && ! empty($
// index.php/xxx called by any REST client to run API
$reg=array();
preg_match('/index\.php\/([^\/]+)(.*)$/', $_SERVER["PHP_SELF"], $reg);
// .../index.php/categories?sortfield=t.rowid&sortorder=ASC
// Set the flag to say to refresh (when we reload the explorer, production must be for API call only)
$refreshcache=false;
// When in production mode, a file api/temp/routes.php is created with the API available of current call.
// But, if we set $refreshcache to false, so it may have only one API in the routes.php file if we make a call for one API without
// using the explorer. And when we make another call for another API, the API is not into the api/temp/routes.php and a 404 is returned.
// So we force refresh to each call.
$refreshcache=(empty($conf->global->API_PRODUCTION_DO_NOT_ALWAYS_REFRESH_CACHE) ? true : false);
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
{
$refreshcache=true;
}
$api = new DolibarrApi($db, '', $refreshcache);
//var_dump($api->r->apiVersionMap);
@ -115,7 +118,7 @@ UploadFormat::$allowedMimeTypes = array('image/jpeg', 'image/png', 'text/plain',
// Call Explorer file for all APIs definitions
// Call Explorer file for all APIs definitions (this part is slow)
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
{
// Scan all API files to load them
@ -254,5 +257,6 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
//var_dump($api->r->apiVersionMap);
//exit;
// Call API (we suppose we found it)
// Call API (we suppose we found it).
// The handle will use the file api/temp/routes.php to get data to run the API. If the file exists and the entry for API is not found, it will return 404.
$api->r->handle();

View File

@ -694,7 +694,7 @@ if ($object->id > 0)
if ($num > 0)
{
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<table class="noborder centpercent lastrecordtable">';
print '<tr class="liste_titre">';
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastPropals", ($num<=$MAXLIST?"":$MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->id.'">'.$langs->trans("AllPropals").' <span class="badge">'.$num.'</span></a></td>';
@ -779,7 +779,7 @@ if ($object->id > 0)
$db->free($resql2);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<table class="noborder centpercent lastrecordtable">';
print '<tr class="liste_titre">';
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomerOrders", ($num<=$MAXLIST?"":$MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'">'.$langs->trans("AllOrders").' <span class="badge">'.$num.'</span></a></td>';
@ -855,7 +855,7 @@ if ($object->id > 0)
$num = $db->num_rows($resql);
if ($num > 0) {
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<table class="noborder centpercent lastrecordtable">';
print '<tr class="liste_titre">';
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastSendings", ($num<=$MAXLIST?"":$MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/expedition/list.php?socid='.$object->id.'">'.$langs->trans("AllSendings").' <span class="badge">'.$num.'</span></a></td>';
@ -919,7 +919,7 @@ if ($object->id > 0)
if ($num >0)
{
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<table class="noborder centpercent lastrecordtable">';
print '<tr class="liste_titre">';
print '<td colspan="6"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastContracts", ($num<=$MAXLIST?"":$MAXLIST)).'</td>';
@ -989,7 +989,7 @@ if ($object->id > 0)
if ($num > 0)
{
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<table class="noborder centpercent lastrecordtable">';
print '<tr class="liste_titre">';
print '<td colspan="3"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastInterventions", ($num<=$MAXLIST?"":$MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/fichinter/list.php?socid='.$object->id.'">'.$langs->trans("AllInterventions").' <span class="badge">'.$num.'</span></td>';
@ -1062,7 +1062,7 @@ if ($object->id > 0)
if ($num > 0)
{
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<table class="noborder centpercent lastrecordtable">';
print '<tr class="liste_titre">';
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LatestCustomerTemplateInvoices", ($num<=$MAXLIST?"":$MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllCustomerTemplateInvoices").' <span class="badge">'.$num.'</span></a></td>';
@ -1167,7 +1167,7 @@ if ($object->id > 0)
if ($num > 0)
{
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<table class="noborder centpercent lastrecordtable">';
print '<tr class="liste_titre">';
print '<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomersBills", ($num<=$MAXLIST?"":$MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllBills").' <span class="badge">'.$num.'</span></a></td>';

View File

@ -6382,7 +6382,7 @@ abstract class CommonObject
* @param array $params Optional parameters. Example: array('style'=>'class="oddeven"', 'colspan'=>$colspan)
* @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names)
* @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names)
* @param string $onetrtd All fields in same tr td
* @param string $onetrtd All fields in same tr td (TODO field not used ?)
* @return string
*/
public function showOptionals($extrafields, $mode = 'view', $params = null, $keysuffix = '', $keyprefix = '', $onetrtd = 0)
@ -6494,10 +6494,7 @@ abstract class CommonObject
$out .= '<tr id="'.$html_id.'" '.$csstyle.' class="'.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.'" '.$domData.' >';
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0)
{
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { $colspan='0'; }
}
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { $colspan='0'; }
if ($action == 'selectlines') { $colspan++; }

View File

@ -1217,6 +1217,8 @@ class pdf_einstein extends ModelePDFCommandes
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -1227,8 +1229,9 @@ class pdf_einstein extends ModelePDFCommandes
* @param string $titlekey Translation key to show as title of document
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "PdfOrderTitle")
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "PdfOrderTitle")
{
// phpcs:enable
global $conf,$langs,$hookmanager;
// Load traductions files requiredby by page
@ -1437,6 +1440,8 @@ class pdf_einstein extends ModelePDFCommandes
return $top_shift;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -1446,8 +1451,9 @@ class pdf_einstein extends ModelePDFCommandes
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
// phpcs:enable
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);

View File

@ -1352,6 +1352,8 @@ class pdf_eratosthene extends ModelePDFCommandes
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -1362,8 +1364,9 @@ class pdf_eratosthene extends ModelePDFCommandes
* @param string $titlekey Translation key to show as title of document
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "PdfOrderTitle")
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "PdfOrderTitle")
{
// phpcs:enable
global $conf,$langs,$hookmanager;
// Translations
@ -1564,6 +1567,8 @@ class pdf_eratosthene extends ModelePDFCommandes
return $top_shift;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -1573,8 +1578,9 @@ class pdf_eratosthene extends ModelePDFCommandes
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
// phpcs:enable
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);

View File

@ -57,6 +57,8 @@ class pdf_proforma extends pdf_einstein
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -67,8 +69,9 @@ class pdf_proforma extends pdf_einstein
* @param string $titlekey Translation key to show as title of document
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "InvoiceProForma")
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "InvoiceProForma")
{
// phpcs:enable
global $conf,$langs,$hookmanager;
parent::_pagehead($pdf, $object, $showaddress, $outputlangs, $titlekey);

View File

@ -1132,11 +1132,10 @@ class ExpenseReport extends CommonObject
$resql=$this->db->query($sql);
if ($resql)
{
if (!$notrigger)
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('EXPENSE_REPORT_VALIDATE', $fuser);
if ($result < 0) {
$error++;
}
@ -1160,7 +1159,7 @@ class ExpenseReport extends CommonObject
$dirdest = $conf->expensereport->dir_output.'/'.$newref;
if (file_exists($dirsource))
{
dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest);
dol_syslog(get_class($this)."::setValidate() rename dir ".$dirsource." into ".$dirdest);
if (@rename($dirsource, $dirdest))
{

View File

@ -469,7 +469,7 @@ if ($object->id > 0)
$num = $db->num_rows($query);
print '<table class="noborder" width="100%">';
print '<table class="noborder centpercent lastrecordtable">';
print '<tr class="liste_titre'.(($num == 0) ? ' nobottom':'').'">';
print '<td colspan="3">'.$langs->trans("ProductsAndServices").'</td><td class="right">';
print '<a class="notasortlink" href="'.DOL_URL_ROOT.'/fourn/product/list.php?fourn_id='.$object->id.'">'.$langs->trans("AllProductReferencesOfSupplier").' <span class="badge">'.$object->nbOfProductRefs().'</span>';
@ -541,7 +541,7 @@ if ($object->id > 0)
if ($num > 0)
{
print '<table class="noborder" width="100%">';
print '<table class="noborder centpercent lastrecordtable">';
print '<tr class="liste_titre">';
print '<td colspan="3">';
@ -644,7 +644,7 @@ if ($object->id > 0)
if ($num > 0)
{
print '<table class="noborder" width="100%">';
print '<table class="noborder centpercent lastrecordtable">';
print '<tr class="liste_titre">';
print '<td colspan="3">';
@ -717,7 +717,7 @@ if ($object->id > 0)
$num = $db->num_rows($resql);
if ($num > 0)
{
print '<table class="noborder" width="100%">';
print '<table class="noborder centpercent lastrecordtable">';
print '<tr class="liste_titre">';
print '<td colspan="4">';

View File

@ -399,5 +399,8 @@ insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) v
ALTER TABLE llx_ticket_extrafields ADD INDEX idx_ticket_extrafields (fk_object);
-- Use special_code=3 in Takepos
-- VMYSQL4.1 UPDATE llx_facturedet AS fd LEFT JOIN llx_facture AS f ON f.rowid = fd.fk_facture SET fd.special_code = 4 WHERE f.module_source = 'takepos' AND fd.special_code = 3;
UPDATE llx_website_page set fk_user_creat = fk_user_modif WHERE fk_user_creat IS NULL and fk_user_modif IS NOT NULL;

View File

@ -18,7 +18,7 @@
/**
* \file htdocs/margin/tabs/thirdpartyMargins.php
* \ingroup product margins
* \brief Page des marges des factures clients pour un tiers
* \brief Page for invoice margins of a thirdparty
*/
require '../../main.inc.php';
@ -170,7 +170,7 @@ if ($socid > 0)
{
$num = $db->num_rows($result);
print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], "&amp;socid=".$object->id, $sortfield, $sortorder, '', 0, 0, '');
print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], "&amp;socid=".$object->id, $sortfield, $sortorder, '', $num, $num, '');
$i = 0;
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table

View File

@ -331,14 +331,14 @@ if ($action == "order" and $placeid != 0)
$catsprinter2 = explode(';', $conf->global->TAKEPOS_PRINTED_CATEGORIES_2);
foreach($invoice->lines as $line)
{
if ($line->special_code == "3") { continue;
if ($line->special_code == "4") { continue;
}
$c = new Categorie($db);
$existing = $c->containing($line->fk_product, Categorie::TYPE_PRODUCT, 'id');
$result = array_intersect($catsprinter1, $existing);
$count = count($result);
if ($count > 0) {
$sql = "UPDATE " . MAIN_DB_PREFIX . "facturedet set special_code='3' where rowid=$line->rowid";
$sql = "UPDATE " . MAIN_DB_PREFIX . "facturedet set special_code='4' where rowid=$line->rowid";
$db->query($sql);
$order_receipt_printer1.= '<tr>' . $line->product_label . '<td class="right">' . $line->qty;
if (!empty($line->array_options['options_order_notes'])) $order_receipt_printer1.="<br>(".$line->array_options['options_order_notes'].")";
@ -348,14 +348,14 @@ if ($action == "order" and $placeid != 0)
foreach($invoice->lines as $line)
{
if ($line->special_code == "3") { continue;
if ($line->special_code == "4") { continue;
}
$c = new Categorie($db);
$existing = $c->containing($line->fk_product, Categorie::TYPE_PRODUCT, 'id');
$result = array_intersect($catsprinter2, $existing);
$count = count($result);
if ($count > 0) {
$sql = "UPDATE " . MAIN_DB_PREFIX . "facturedet set special_code='3' where rowid=$line->rowid";
$sql = "UPDATE " . MAIN_DB_PREFIX . "facturedet set special_code='4' where rowid=$line->rowid";
$db->query($sql);
$order_receipt_printer2.= '<tr>' . $line->product_label . '<td class="right">' . $line->qty;
if (!empty($line->array_options['options_order_notes'])) $order_receipt_printer2.="<br>(".$line->array_options['options_order_notes'].")";
@ -612,7 +612,7 @@ if ($placeid > 0)
$htmlforlines = '';
$htmlforlines.= '<tr class="drag drop oddeven posinvoiceline';
if ($line->special_code == "3") {
if ($line->special_code == "4") {
$htmlforlines.= ' order';
}
$htmlforlines.= '" id="' . $line->id . '">';

View File

@ -2523,7 +2523,7 @@ table.liste tr:last-of-type td, table.noborder:not(#tablelines) tr:last-of-type
border-bottom-color: rgb(<?php echo $colortopbordertitle1 ?>);
border-bottom-style: solid;
}
div.tabBar div.fichehalfright table.noborder:not(.margintable):not(.paymenttable):last-of-type {
div.tabBar div.fichehalfright table.noborder:not(.margintable):not(.paymenttable):not(.lastrecordtable):last-of-type {
border-bottom: 1px solid rgb(<?php echo $colortopbordertitle1 ?>);
}
div.tabBar table.border>tbody>tr:last-of-type>td {

View File

@ -450,8 +450,10 @@ if ($projectid) print '<input type="hidden" name="projectid" value="' . $project
$newcardbutton='';
$newcardbutton.= dolGetButtonTitle($langs->trans('NewTicket'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/ticket/card.php?action=create' . ($socid ? '&socid=' . $socid : '') . ($projectid ? '&origin=projet_project&originid=' . $projectid : ''), '', !empty($user->rights->ticket->write));
$picto = 'title_ticket';
if ($socid > 0) $picto = '';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_ticket', 0, $newcardbutton, '', $limit);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $newcardbutton, '', $limit);
if ($mode == 'mine') {
print '<div class="opacitymedium">' . $langs->trans('TicketAssignedToMeInfos') . '</div><br>';