Merge branch 'develop' into fix-modoristomouv

This commit is contained in:
Laurent Destailleur 2020-02-21 18:05:13 +01:00 committed by GitHub
commit 58a57a0411
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
124 changed files with 2694 additions and 2033 deletions

View File

@ -18,7 +18,7 @@ Following changes may create regressions for some external modules, but were nec
* Default mode for GETPOST function is now 'alphanohtml' instead of 'none'. So check when you make POST or GET requests * Default mode for GETPOST function is now 'alphanohtml' instead of 'none'. So check when you make POST or GET requests
with HTML content that you make a GETPOST('myparam', 'restricthtml') or GETPOST('myparam', 'none') if you really need posted content without sanitizing with HTML content that you make a GETPOST('myparam', 'restricthtml') or GETPOST('myparam', 'none') if you really need posted content without sanitizing
the HTML into content (in such a case, sanitize data later) the HTML into content (in such a case, sanitize data later)
* Removed hidden constant MAIN_EXTRAFIELDS_IN_ONE_TD that was useless.
***** ChangeLog for 11.0.1 compared to 11.0.0 ***** ***** ChangeLog for 11.0.1 compared to 11.0.0 *****

View File

@ -1,13 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT ruleset (description,exclude-pattern*,rule+)> <!ELEMENT ruleset (description,arg*,exclude-pattern*,rule+)>
<!ATTLIST ruleset name CDATA ""> <!ATTLIST ruleset name CDATA "">
<!ELEMENT description (#PCDATA)> <!ELEMENT description (#PCDATA)>
<!ELEMENT arg (#PCDATA)>
<!ATTLIST arg name CDATA "">
<!ATTLIST arg value CDATA "">
<!ELEMENT exclude-pattern (#PCDATA)> <!ELEMENT exclude-pattern (#PCDATA)>
<!ATTLIST exclude-pattern type CDATA ""> <!ATTLIST exclude-pattern type CDATA "">
<!ELEMENT rule (properties*,severity*)> <!ELEMENT rule (properties*,severity*,exclude*)>
<!ATTLIST rule ref CDATA ""> <!ATTLIST rule ref CDATA "">
<!ELEMENT properties (property+)> <!ELEMENT properties (property+)>
<!ELEMENT property (#PCDATA)> <!ELEMENT property (#PCDATA)>
<!ATTLIST property name CDATA ""> <!ATTLIST property name CDATA "">
<!ATTLIST property value CDATA ""> <!ATTLIST property value CDATA "">
<!ELEMENT severity (#PCDATA)> <!ELEMENT severity (#PCDATA)>
<!ELEMENT exclude (#PCDATA)>
<!ATTLIST exclude name CDATA "">

View File

@ -2,6 +2,7 @@
<!DOCTYPE ruleset SYSTEM "ruleset.dtd"> <!DOCTYPE ruleset SYSTEM "ruleset.dtd">
<ruleset name="Dolibarr"> <ruleset name="Dolibarr">
<description>Dolibarr coding standard.</description> <description>Dolibarr coding standard.</description>
<arg name="tab-width" value="4"/>
<exclude-pattern type="relative">build/html</exclude-pattern> <exclude-pattern type="relative">build/html</exclude-pattern>
<exclude-pattern type="relative">build/aps</exclude-pattern> <exclude-pattern type="relative">build/aps</exclude-pattern>
@ -188,7 +189,6 @@
<!-- Disabled as this does not support tab --> <!-- Disabled as this does not support tab -->
<!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> --> <!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> -->
<arg name="tab-width" value="4"/>
<rule ref="Generic.WhiteSpace.ScopeIndent"> <rule ref="Generic.WhiteSpace.ScopeIndent">
<properties> <properties>
<property name="indent" value="4"/> <property name="indent" value="4"/>

View File

@ -25,6 +25,8 @@
* \file htdocs/api/admin/explorer.php * \file htdocs/api/admin/explorer.php
*/ */
use Luracast\Restler\Routes;
require_once '../../main.inc.php'; require_once '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php'; require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php';

View File

@ -141,7 +141,7 @@ print '</td>';
print '</tr>'; print '</tr>';
if (is_object($objectline)) { if (is_object($objectline)) {
print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1); print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', 1);
} }
?> ?>

View File

@ -138,7 +138,7 @@ print '</td>';
print '</tr>'; print '</tr>';
if (is_object($objectline)) { if (is_object($objectline)) {
print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1); print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', 1);
} }
print "<!-- END PHP TEMPLATE objectline_edit.tpl.php -->\n"; print "<!-- END PHP TEMPLATE objectline_edit.tpl.php -->\n";

View File

@ -156,7 +156,7 @@ print '</tr>';
//Line extrafield //Line extrafield
if (!empty($extrafields)) if (!empty($extrafields))
{ {
print $line->showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"', 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1); print $line->showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"', 'colspan'=>$coldisplay), '', '', 1);
} }
print "<!-- END PHP TEMPLATE objectline_view.tpl.php -->\n"; print "<!-- END PHP TEMPLATE objectline_view.tpl.php -->\n";

View File

@ -21,132 +21,6 @@
* \brief File with library for bookmark module * \brief File with library for bookmark module
*/ */
/**
* Add area with bookmarks in menu
*
* @return string
*/
function printBookmarksList()
{
global $conf, $user, $db, $langs;
$ret = '<div class="menu_top"></div>'."\n";
if (! empty($conf->use_javascript_ajax)) { // Bookmark autosubmit can't work when javascript is off.
require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5;
$langs->load("bookmarks");
$url= $_SERVER["PHP_SELF"];
if (! empty($_SERVER["QUERY_STRING"]))
{
$url.=(dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):'');
}
else
{
global $sortfield,$sortorder;
$tmpurl='';
// No urlencode, all param $url will be urlencoded later
if ($sortfield) $tmpurl.=($tmpurl?'&':'').'sortfield='.$sortfield;
if ($sortorder) $tmpurl.=($tmpurl?'&':'').'sortorder='.$sortorder;
if (is_array($_POST))
{
foreach($_POST as $key => $val)
{
if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val;
}
}
$url.=($tmpurl?'?'.$tmpurl:'');
}
// Menu bookmark
$ret = '<div class="menu_top"></div>'."\n";
$ret.= '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
$ret.= '<form id="actionbookmark" name="actionbookmark" method="POST" action="">';
$ret.= '<input type="hidden" name="token" value="'.newToken().'">';
$ret.= '<select name="bookmark" id="boxbookmark" class="flat boxcombo vmenusearchselectcombo" alt="Bookmarks">';
$ret.= '<option hidden value="listbookmarks" class="optiongrey" selected rel="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans('Bookmarks').'</option>';
$ret.= '<option value="listbookmark" class="optionblue" rel="'.dol_escape_htmltag(DOL_URL_ROOT.'/bookmarks/list.php').'" ';
$ret.= ' data-html="'.dol_escape_htmltag(img_picto('', 'bookmark').' '.($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...').'">';
$ret.= dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...</option>';
// Url to go on create new bookmark page
if (! empty($user->rights->bookmark->creer))
{
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;urlsource='.urlencode($url).'&amp;url='.urlencode($url);
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;url='.urlencode($url);
$ret.= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'"';
$ret.= ' data-html="'.dol_escape_htmltag(img_picto('', 'bookmark').' '.$langs->trans('AddThisPageToBookmarks').'...').'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks').'...').'</option>';
}
// Menu with all bookmarks
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU))
{
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
$sql.= " WHERE (fk_user = ".$user->id." OR fk_user is NULL OR fk_user = 0)";
$sql.= " AND entity IN (".getEntity('bookmarks').")";
$sql.= " ORDER BY position";
if ($resql = $db->query($sql) )
{
$i=0;
while ($i < $conf->global->BOOKMARKS_SHOW_IN_MENU && $obj = $db->fetch_object($resql))
{
$ret.='<option name="bookmark'.$obj->rowid.'" value="'.$obj->rowid.'" '.($obj->target == 1?' target="_blank"':'').' rel="'.dol_escape_htmltag($obj->url).'"';
//$ret.=' data-html="'.dol_escape_htmltag('<span class="fa fa-print"></span> '.$obj->title).'"';
$ret.='>';
$ret.=dol_escape_htmltag($obj->title);
$ret.='</option>';
$i++;
}
}
else
{
dol_print_error($db);
}
}
$ret.= '</select>';
$ret.= '</form>';
$ret.=ajax_combobox('boxbookmark');
$ret.='<script>
$(document).ready(function () {';
$ret.=' jQuery("#boxbookmark").change(function() {
var urlselected = jQuery("#boxbookmark option:selected").attr("rel");
if (! urlselected) console.log("Error, failed to get the URL to jump to from the rel attribute");
var urltarget = jQuery("#boxbookmark option:selected").attr("target");
if (! urltarget) { urltarget=""; }
jQuery("form#actionbookmark").attr("target",urltarget);
jQuery("form#actionbookmark").attr("action",urlselected);
console.log("We change select bookmark. We choose urlselected="+urlselected+" with target="+urltarget);
// Method is POST for internal link, GET for external
if (urlselected.startsWith(\'http\'))
{
var newmethod=\'GET\';
jQuery("form#actionbookmark").attr("method", newmethod);
console.log("We change method to newmethod="+newmethod);
jQuery("#actionbookmark").submit();
console.log("We restore method to POST");
jQuery("form#actionbookmark").attr("method", \'POST\');
}
else
{
jQuery("#actionbookmark").submit();
}
});';
$ret.='})</script>';
}
$ret.= '<div class="menu_end"></div>'."\n";
return $ret;
}
/** /**
* Add area with bookmarks in top menu * Add area with bookmarks in top menu
@ -158,7 +32,6 @@ function printDropdownBookmarksList()
global $conf, $user, $db, $langs; global $conf, $user, $db, $langs;
require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5;
$langs->load("bookmarks"); $langs->load("bookmarks");
@ -204,11 +77,8 @@ function printDropdownBookmarksList()
$newbtn .= img_picto('', 'bookmark').' '.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'</a>'; $newbtn .= img_picto('', 'bookmark').' '.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'</a>';
} }
$bookmarkList = '<div id="dropdown-bookmarks-list" >'; $bookmarkList = '<div id="dropdown-bookmarks-list" >';
// Menu with all bookmarks // Menu with list of bookmarks
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU))
{
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark"; $sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
$sql .= " WHERE (fk_user = ".$user->id." OR fk_user is NULL OR fk_user = 0)"; $sql .= " WHERE (fk_user = ".$user->id." OR fk_user is NULL OR fk_user = 0)";
$sql .= " AND entity IN (".getEntity('bookmarks').")"; $sql .= " AND entity IN (".getEntity('bookmarks').")";
@ -216,7 +86,7 @@ function printDropdownBookmarksList()
if ($resql = $db->query($sql)) if ($resql = $db->query($sql))
{ {
$i = 0; $i = 0;
while ($i < $conf->global->BOOKMARKS_SHOW_IN_MENU && $obj = $db->fetch_object($resql)) while (($conf->global->BOOKMARKS_SHOW_IN_MENU == 0 || $i < $conf->global->BOOKMARKS_SHOW_IN_MENU) && $obj = $db->fetch_object($resql))
{ {
$bookmarkList .= '<a class="dropdown-item bookmark-item" id="bookmark-item-'.$obj->rowid.'" data-id="'.$obj->rowid.'" '.($obj->target == 1 ? ' target="_blank"' : '').' href="'.dol_escape_htmltag($obj->url).'" >'; $bookmarkList .= '<a class="dropdown-item bookmark-item" id="bookmark-item-'.$obj->rowid.'" data-id="'.$obj->rowid.'" '.($obj->target == 1 ? ' target="_blank"' : '').' href="'.dol_escape_htmltag($obj->url).'" >';
$bookmarkList .= dol_escape_htmltag($obj->title); $bookmarkList .= dol_escape_htmltag($obj->title);
@ -228,18 +98,14 @@ function printDropdownBookmarksList()
{ {
dol_print_error($db); dol_print_error($db);
} }
}
$bookmarkList .= '</div>'; $bookmarkList .= '</div>';
$html= ''; $html = '
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU)) {
$html.= '
<!-- search input --> <!-- search input -->
<div class="dropdown-header bookmark-header"> <div class="dropdown-header bookmark-header">
' . $searchForm.' ' . $searchForm.'
</div> </div>
'; ';
}
$html .= ' $html .= '
<!-- Menu Body --> <!-- Menu Body -->
@ -256,7 +122,6 @@ function printDropdownBookmarksList()
</div> </div>
'; ';
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU)) {
$html .= '<script> $html .= '<script>
$( document ).on("keyup", "#top-bookmark-search-input", function () { $( document ).on("keyup", "#top-bookmark-search-input", function () {
@ -273,7 +138,6 @@ function printDropdownBookmarksList()
$("#top-bookmark-search-filter-count").text(count); $("#top-bookmark-search-filter-count").text(count);
}); });
</script>'; </script>';
}
return $html; return $html;
} }

View File

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$langs->loadLangs(array("accountancy", "bills", "companies", "salaries", "compta")); $langs->loadLangs(array("accountancy", "bills", "companies", "salaries", "compta", "trips"));
$date_start = GETPOST('date_start', 'alpha'); $date_start = GETPOST('date_start', 'alpha');
$date_startDay = GETPOST('date_startday', 'int'); $date_startDay = GETPOST('date_startday', 'int');
@ -118,51 +118,69 @@ if (($action == "searchfiles" || $action == "dl")) {
$error++; $error++;
} }
$sql = '';
if (!$error) if (!$error)
{ {
$wheretail = " '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'"; $wheretail = " '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'";
// Customer invoices // Customer invoices
$sql = "SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, total as total_ht, total_ttc, tva as total_vat, fk_soc, t.datef as date, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum"; if (GETPOST('selectinvoices')) {
if (! empty($sql)) $sql .= " UNION ALL";
$sql .= "SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, total as total_ht, total_ttc, tva as total_vat, fk_soc, t.datef as date, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
$sql .= " WHERE datef between ".$wheretail; $sql .= " WHERE datef between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
$sql .= " AND t.fk_statut <> ".Facture::STATUS_DRAFT; $sql .= " AND t.fk_statut <> ".Facture::STATUS_DRAFT;
$sql .= " UNION ALL"; }
// Vendor invoices // Vendor invoices
if (GETPOST('selectsupplierinvoices')) {
if (! empty($sql)) $sql .= " UNION ALL";
$sql .= " SELECT t.rowid as id, t.entity, t.ref, paye as paid, total_ht, total_ttc, total_tva as total_vat, fk_soc, datef as date, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum"; $sql .= " SELECT t.rowid as id, t.entity, t.ref, paye as paid, total_ht, total_ttc, total_tva as total_vat, fk_soc, datef as date, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
$sql .= " WHERE datef between ".$wheretail; $sql .= " WHERE datef between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
$sql .= " AND t.fk_statut <> ".FactureFournisseur::STATUS_DRAFT; $sql .= " AND t.fk_statut <> ".FactureFournisseur::STATUS_DRAFT;
$sql .= " UNION ALL"; }
// Expense reports // Expense reports
if (GETPOST('selectexpensereports')) {
if (! empty($sql)) $sql .= " UNION ALL";
$sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, total_ht, total_ttc, total_tva as total_vat, fk_user_author as fk_soc, date_fin as date, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; $sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, total_ht, total_ttc, total_tva as total_vat, fk_user_author as fk_soc, date_fin as date, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user_author LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user_author LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country";
$sql .= " WHERE date_fin between ".$wheretail; $sql .= " WHERE date_fin between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
$sql .= " AND t.fk_statut <> ".ExpenseReport::STATUS_DRAFT; $sql .= " AND t.fk_statut <> ".ExpenseReport::STATUS_DRAFT;
$sql .= " UNION ALL"; }
// Donations // Donations
if (GETPOST('selectdonations')) {
if (! empty($sql)) $sql .= " UNION ALL";
$sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, datedon as date, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; $sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, datedon as date, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
$sql .= " FROM ".MAIN_DB_PREFIX."don as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = t.fk_country"; $sql .= " FROM ".MAIN_DB_PREFIX."don as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = t.fk_country";
$sql .= " WHERE datedon between ".$wheretail; $sql .= " WHERE datedon between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
$sql .= " AND t.fk_statut <> ".Don::STATUS_DRAFT; $sql .= " AND t.fk_statut <> ".Don::STATUS_DRAFT;
$sql .= " UNION ALL"; }
// Paiements of salaries // Paiements of salaries
if (GETPOST('selectpaymentsofsalaries')) {
if (! empty($sql)) $sql .= " UNION ALL";
$sql .= " SELECT t.rowid as id, t.entity, t.ref as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, datep as date, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; $sql .= " SELECT t.rowid as id, t.entity, t.ref as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, datep as date, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country"; $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country";
$sql .= " WHERE datep between ".$wheretail; $sql .= " WHERE datep between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
//$sql.=" AND fk_statut <> ".PaymentSalary::STATUS_DRAFT; //$sql.=" AND fk_statut <> ".PaymentSalary::STATUS_DRAFT;
$sql .= " UNION ALL"; }
// Social contributions // Social contributions
if (GETPOST('selectsocialcontributions')) {
if (! empty($sql)) $sql .= " UNION ALL";
$sql .= " SELECT t.rowid as id, t.entity, t.libelle as ref, paye as paid, amount as total_ht, amount as total_ttc, 0 as total_tva, 0 as fk_soc, date_creation as date, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum"; $sql .= " SELECT t.rowid as id, t.entity, t.libelle as ref, paye as paid, amount as total_ht, amount as total_ttc, 0 as total_tva, 0 as fk_soc, date_creation as date, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum";
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as t"; $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as t";
$sql .= " WHERE date_creation between ".$wheretail; $sql .= " WHERE date_creation between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
//$sql.=" AND fk_statut <> ".ChargeSociales::STATUS_DRAFT; //$sql.=" AND fk_statut <> ".ChargeSociales::STATUS_DRAFT;
}
}
if ($sql) {
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
//print $sql; //print $sql;
@ -238,7 +256,6 @@ if (($action == "searchfiles" || $action == "dl")) {
$files = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview\.png)$', '', SORT_ASC, 1); $files = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview\.png)$', '', SORT_ASC, 1);
//var_dump($upload_dir); //var_dump($upload_dir);
//var_dump($files); //var_dump($files);
if (count($files) < 1) if (count($files) < 1)
{ {
$nofile = array(); $nofile = array();
@ -305,6 +322,9 @@ if (($action == "searchfiles" || $action == "dl")) {
$db->free($resd); $db->free($resd);
} }
else {
setEventMessages($langs->trans("ErrorAtLeastOneObjectMustBeSelected"), null, 'errors');
}
} }
@ -362,23 +382,24 @@ if ($result && $action == "dl" && !$error)
} }
} }
$log .= $file['item']; $log .= '"'.$langs->trans($file['item']).'"';
if (!empty($conf->multicompany->enabled) && is_object($mc)) if (!empty($conf->multicompany->enabled) && is_object($mc))
{ {
$log .= ','.(empty($arrayofentities[$file['entity']]) ? $file['entity'] : $arrayofentities[$file['entity']]); $log .= ',"'.(empty($arrayofentities[$file['entity']]) ? $file['entity'] : $arrayofentities[$file['entity']]).'"';
} }
$log .= ','.dol_print_date($file['date'], 'dayrfc'); $log .= ','.dol_print_date($file['date'], 'dayrfc');
$log .= ','.$file['ref']; $log .= ',"'.$file['ref'].'"';
$log .= ','.$file['amount_ht']; $log .= ','.$file['amount_ht'];
$log .= ','.$file['amount_ttc']; $log .= ','.$file['amount_ttc'];
$log .= ','.$file['amount_vat']; $log .= ','.$file['amount_vat'];
$log .= ','.$file['paid']; $log .= ','.$file['paid'];
$log .= ','.$file["name"]; $log .= ',"'.$file["name"].'"';
$log .= ','.$file['fk']; $log .= ','.$file['fk'];
$log .= ','.$file['thirdparty_name']; $log .= ',"'.$file['thirdparty_name'].'"';
$log .= ','.$file['thirdparty_code']; $log .= ','.$file['thirdparty_code'];
$log .= ','.$file['country_code']; $log .= ',"'.$file['country_code'].'"';
$log .= ',"'.$file['vatnum'].'"'."\n"; $log .= ',"'.$file['vatnum'].'"';
$log .= "\n";
} }
$zip->addFromString('transactions.csv', $log); $zip->addFromString('transactions.csv', $log);
$zip->close(); $zip->close();
@ -442,6 +463,23 @@ if (!empty($conf->multicompany->enabled) && is_object($mc))
print ")</span>\n"; print ")</span>\n";
} }
print '<br>';
$listofchoices = array(
'selectinvoices'=>array('label'=>'Invoices', 'lang'=>'bills'),
'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'lang'=>'bills'),
'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips'),
'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation'),
'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries'),
'selectsocialcontributions'=>array('label'=>'SocialContributions')
);
foreach($listofchoices as $choice => $val) {
/*if ($val['lang']) {
$langs->load($val['lang']);
}*/
print '<div class="paddingleft inline-block marginrightonly"><input type="checkbox" name="'.$choice.'" value="1"'.((! GETPOSTISSET('search') || GETPOST($choice))?' checked="checked"':'').'> '.$langs->trans($val['label']).'</div>';
}
print '<input class="button" type="submit" name="search" value="'.$langs->trans("Search").'">'; print '<input class="button" type="submit" name="search" value="'.$langs->trans("Search").'">';
print '</form>'."\n"; print '</form>'."\n";
@ -465,14 +503,9 @@ if (!empty($date_start) && !empty($date_stop))
print '<input type="hidden" name="date_start" value="'.dol_print_date($date_start, 'dayxcard').'" />'; print '<input type="hidden" name="date_start" value="'.dol_print_date($date_start, 'dayxcard').'" />';
print '<input type="hidden" name="date_stop" value="'.dol_print_date($date_stop, 'dayxcard').'" />'; print '<input type="hidden" name="date_stop" value="'.dol_print_date($date_stop, 'dayxcard').'" />';
foreach($listofchoices as $choice => $val) {
//print '<input type="hidden" name="date_stopDay" value="'.dol_print_date($date_stop, '%d').'" />'; print '<input type="hidden" name="'.$choice.'" value="'.GETPOST($choice).'">';
//print '<input type="hidden" name="date_stopMonth" value="'.dol_print_date($date_stop, '%m').'" />'; }
//print '<input type="hidden" name="date_stopYear" value="'.dol_print_date($date_stop, '%Y').'" />';
//print '<input type="hidden" name="date_startDay" value="'.dol_print_date($date_start, '%d').'" />';
//print '<input type="hidden" name="date_startMonth" value="'.dol_print_date($date_start, '%m').'" />';
//print '<input type="hidden" name="date_startYear" value="'.dol_print_date($date_start, '%m').'" />';
print '<input class="butAction" type="submit" value="'.$langs->trans("Download").'" />'; print '<input class="butAction" type="submit" value="'.$langs->trans("Download").'" />';
print '</form>'."\n"; print '</form>'."\n";

View File

@ -1704,7 +1704,7 @@ else
if (is_array($extralabelslines) && count($extralabelslines) > 0) { if (is_array($extralabelslines) && count($extralabelslines) > 0) {
$line = new ContratLigne($db); $line = new ContratLigne($db);
$line->fetch_optionals($objp->rowid); $line->fetch_optionals($objp->rowid);
print $line->showOptionals($extrafields, 'view', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1); print $line->showOptionals($extrafields, 'view', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', 1);
} }
} }
// Line in mode update // Line in mode update
@ -1794,7 +1794,7 @@ else
if (is_array($extralabelslines) && count($extralabelslines) > 0) { if (is_array($extralabelslines) && count($extralabelslines) > 0) {
$line = new ContratLigne($db); $line = new ContratLigne($db);
$line->fetch_optionals($objp->rowid); $line->fetch_optionals($objp->rowid);
print $line->showOptionals($extrafields, 'edit', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1); print $line->showOptionals($extrafields, 'edit', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', 1);
} }
} }

View File

@ -681,15 +681,11 @@ class Conf
$this->global->AGENDA_DEFAULT_FILTER_TYPE = '0'; // 'AC_NON_AUTO' does not exists when AGENDA_DEFAULT_FILTER_TYPE is not on. $this->global->AGENDA_DEFAULT_FILTER_TYPE = '0'; // 'AC_NON_AUTO' does not exists when AGENDA_DEFAULT_FILTER_TYPE is not on.
} }
if (!isset($this->global->MAIN_EXTRAFIELDS_IN_ONE_TD)) $this->global->MAIN_EXTRAFIELDS_IN_ONE_TD = 1;
if (!isset($this->global->MAIN_USE_OLD_TITLE_BUTTON)) $this->global->MAIN_USE_OLD_TITLE_BUTTON = 0; if (!isset($this->global->MAIN_USE_OLD_TITLE_BUTTON)) $this->global->MAIN_USE_OLD_TITLE_BUTTON = 0;
if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) $this->global->MAIN_MODULE_DOLISTORE_API_SRV = 'https://www.dolistore.com'; if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) $this->global->MAIN_MODULE_DOLISTORE_API_SRV = 'https://www.dolistore.com';
if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) $this->global->MAIN_MODULE_DOLISTORE_API_KEY = 'dolistorecatalogpublickey1234567'; if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) $this->global->MAIN_MODULE_DOLISTORE_API_KEY = 'dolistorecatalogpublickey1234567';
if (! isset($this->global->MAIN_USE_TOP_MENU_BOOKMARK_DROPDOWN)) $this->global->MAIN_USE_TOP_MENU_BOOKMARK_DROPDOWN = 1;
// If we are in develop mode, we activate the option MAIN_SECURITY_CSRF_WITH_TOKEN to 1 if not already defined. // If we are in develop mode, we activate the option MAIN_SECURITY_CSRF_WITH_TOKEN to 1 if not already defined.
if (!isset($this->global->MAIN_SECURITY_CSRF_WITH_TOKEN) && $this->global->MAIN_FEATURES_LEVEL >= 2) $this->global->MAIN_SECURITY_CSRF_WITH_TOKEN = 1; if (!isset($this->global->MAIN_SECURITY_CSRF_WITH_TOKEN) && $this->global->MAIN_FEATURES_LEVEL >= 2) $this->global->MAIN_SECURITY_CSRF_WITH_TOKEN = 1;

View File

@ -90,7 +90,7 @@ class DolEditor
{ {
$content = dol_htmlentitiesbr($content); // If content is not HTML, we convert to HTML. $content = dol_htmlentitiesbr($content); // If content is not HTML, we convert to HTML.
} }
if ($this->tool == 'fckeditor') /*if ($this->tool == 'fckeditor')
{ {
require_once DOL_DOCUMENT_ROOT.'/includes/fckeditor/fckeditor.php'; require_once DOL_DOCUMENT_ROOT.'/includes/fckeditor/fckeditor.php';
@ -121,7 +121,7 @@ class DolEditor
$this->editor->Config['CustomConfigurationsPath'] = DOL_URL_ROOT.'/theme/'.$conf->theme.'/fckeditor/fckconfig.js'; $this->editor->Config['CustomConfigurationsPath'] = DOL_URL_ROOT.'/theme/'.$conf->theme.'/fckeditor/fckconfig.js';
$this->editor->Config['SkinPath'] = DOL_URL_ROOT.'/theme/'.$conf->theme.'/fckeditor/'; $this->editor->Config['SkinPath'] = DOL_URL_ROOT.'/theme/'.$conf->theme.'/fckeditor/';
} }
} }*/
// Define some properties // Define some properties
if (in_array($this->tool, array('textarea', 'ckeditor', 'ace'))) if (in_array($this->tool, array('textarea', 'ckeditor', 'ace')))

View File

@ -59,16 +59,17 @@ class FormAdmin
* @param int $forcecombo Force to use combo box (so no ajax beautify effect) * @param int $forcecombo Force to use combo box (so no ajax beautify effect)
* @param int $multiselect Make the combo a multiselect * @param int $multiselect Make the combo a multiselect
* @param array $onlykeys Show only the following keys (opposite of $filter) * @param array $onlykeys Show only the following keys (opposite of $filter)
* @param int $mainlangonly 1=Show only main languages ('fr_FR' no' fr_BE', 'es_ES' not 'es_MX', ...)
* @return string Return HTML select string with list of languages * @return string Return HTML select string with list of languages
*/ */
public function select_language($selected = '', $htmlname = 'lang_id', $showauto = 0, $filter = null, $showempty = '', $showwarning = 0, $disabled = 0, $morecss = '', $showcode = 0, $forcecombo = 0, $multiselect = 0, $onlykeys = array()) public function select_language($selected = '', $htmlname = 'lang_id', $showauto = 0, $filter = null, $showempty = '', $showwarning = 0, $disabled = 0, $morecss = '', $showcode = 0, $forcecombo = 0, $multiselect = 0, $onlykeys = array(), $mainlangonly = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;
if (!empty($conf->global->MAIN_DEFAULT_LANGUAGE_FILTER)) $filter[$conf->global->MAIN_DEFAULT_LANGUAGE_FILTER] = 1; if (!empty($conf->global->MAIN_DEFAULT_LANGUAGE_FILTER)) $filter[$conf->global->MAIN_DEFAULT_LANGUAGE_FILTER] = 1;
$langs_available=$langs->get_available_languages(DOL_DOCUMENT_ROOT, 12); $langs_available=$langs->get_available_languages(DOL_DOCUMENT_ROOT, 12, 0, $mainlangonly);
$out=''; $out='';
@ -95,21 +96,28 @@ class FormAdmin
{ {
$valuetoshow=$value; $valuetoshow=$value;
if ($showcode == 1) $valuetoshow=$key.' - '.$value; if ($showcode == 1) $valuetoshow=$key.' - '.$value;
if ($showcode == 2) $valuetoshow=$value.' ('.$key.')'; if ($showcode == 2) {
if ($mainlangonly) $valuetoshow=$value.' ('.preg_replace('/[_-].*$/', '', $key).')';
else $valuetoshow=$value.' ('.$key.')';
}
if ($filter && is_array($filter) && array_key_exists($key, $filter)) { $keytouse = $key;
if ($mainlangonly) $keytouse = preg_replace('/[_-].*$/', '', $key);
if ($filter && is_array($filter) && array_key_exists($keytouse, $filter)) {
continue; continue;
} }
if ($onlykeys && is_array($onlykeys) && ! array_key_exists($key, $onlykeys)) { if ($onlykeys && is_array($onlykeys) && ! array_key_exists($keytouse, $onlykeys)) {
continue; continue;
} }
if ($selected == $key)
if ($selected == $keytouse)
{ {
$out.= '<option value="'.$key.'" selected>'.$valuetoshow.'</option>'; $out.= '<option value="'.$keytouse.'" selected>'.$valuetoshow.'</option>';
} }
else else
{ {
$out.= '<option value="'.$key.'">'.$valuetoshow.'</option>'; $out.= '<option value="'.$keytouse.'">'.$valuetoshow.'</option>';
} }
} }
$out.= '</select>'; $out.= '</select>';

View File

@ -269,7 +269,15 @@ class FormWebsite
$valueforoption = '<span class="opacitymedium">['.$valpage->type_container.' '.sprintf("%03d", $valpage->id).']</span> '; $valueforoption = '<span class="opacitymedium">['.$valpage->type_container.' '.sprintf("%03d", $valpage->id).']</span> ';
$valueforoption .= $valpage->pageurl.' - '.$valpage->title; $valueforoption .= $valpage->pageurl.' - '.$valpage->title;
if ($website->fk_default_home && $key == $website->fk_default_home) $valueforoption .= ' <span class="opacitymedium">('.$langs->trans("HomePage").')</span>'; if ($website->otherlang) { // If there is alternative lang for this web site, we show the language code
if ($valpage->lang) {
$valueforoption .= ' <span class="opacitymedium">('.$valpage->lang.')</span>';
}
}
if ($website->fk_default_home && $key == $website->fk_default_home) {
//$valueforoption .= ' <span class="opacitymedium">('.$langs->trans("HomePage").')</span>';
$valueforoption .= ' <span class="opacitymedium fa fa-home"></span>';
}
$out .= '<option value="'.$key.'"'; $out .= '<option value="'.$key.'"';
if ($pageid > 0 && $pageid == $key) $out .= ' selected'; // To preselect a value if ($pageid > 0 && $pageid == $key) $out .= ' selected'; // To preselect a value

View File

@ -102,7 +102,7 @@ class Menubase
/** /**
* @var string Key for menu translation * @var string Key for menu translation
* @deprecated * @deprecated
* @see title * @see $title
*/ */
public $titre; public $titre;

View File

@ -764,28 +764,37 @@ class Translate
* @param string $langdir Directory to scan * @param string $langdir Directory to scan
* @param integer $maxlength Max length for each value in combo box (will be truncated) * @param integer $maxlength Max length for each value in combo box (will be truncated)
* @param int $usecode 1=Show code instead of country name for language variant, 2=Show only code * @param int $usecode 1=Show code instead of country name for language variant, 2=Show only code
* @param int $mainlangonly 1=Show only main languages ('fr_FR' no' fr_BE', 'es_ES' not 'es_MX', ...)
* @return array List of languages * @return array List of languages
*/ */
public function get_available_languages($langdir = DOL_DOCUMENT_ROOT, $maxlength = 0, $usecode = 0) public function get_available_languages($langdir = DOL_DOCUMENT_ROOT, $maxlength = 0, $usecode = 0, $mainlangonly = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
$this->load("languages");
// We scan directory langs to detect available languages // We scan directory langs to detect available languages
$handle = opendir($langdir."/langs"); $handle = opendir($langdir."/langs");
$langs_available = array(); $langs_available = array();
while ($dir = trim(readdir($handle))) while ($dir = trim(readdir($handle)))
{ {
if (preg_match('/^[a-z]+_[A-Z]+/i', $dir)) $regs = array();
if (preg_match('/^([a-z]+)_([A-Z]+)/i', $dir, $regs))
{ {
$this->load("languages"); // We must keep only main languages
if ($mainlangonly) {
$arrayofspecialmainlanguages = array('en_US', 'sq_AL', 'ar_SA', 'eu_ES', 'bn_DB', 'bs_BA', 'ca_ES', 'zh_TW', 'cs_CZ', 'da_DK', 'et_EE', 'ka_GE', 'el_GR', 'he_IL', 'kn_IN', 'km_KH', 'ko_KR', 'lo_LA', 'nb_NO', 'fa_IR', 'sr_RS', 'sl_SI', 'uk_UA', 'vi_VN');
if (strtolower($regs[1]) != strtolower($regs[2]) && ! in_array($dir, $arrayofspecialmainlanguages)) continue;
}
// We must keep only languages into MAIN_LANGUAGES_ALLOWED
if (!empty($conf->global->MAIN_LANGUAGES_ALLOWED) && !in_array($dir, explode(',', $conf->global->MAIN_LANGUAGES_ALLOWED))) continue; if (!empty($conf->global->MAIN_LANGUAGES_ALLOWED) && !in_array($dir, explode(',', $conf->global->MAIN_LANGUAGES_ALLOWED))) continue;
if ($usecode == 2) if ($usecode == 2)
{ {
$langs_available[$dir] = $dir; $langs_available[$dir] = $dir;
} }
if ($usecode == 1 || !empty($conf->global->MAIN_SHOW_LANGUAGE_CODE)) if ($usecode == 1 || !empty($conf->global->MAIN_SHOW_LANGUAGE_CODE))
{ {
$langs_available[$dir] = $dir.': '.dol_trunc($this->trans('Language_'.$dir), $maxlength); $langs_available[$dir] = $dir.': '.dol_trunc($this->trans('Language_'.$dir), $maxlength);
@ -794,6 +803,9 @@ class Translate
{ {
$langs_available[$dir] = $this->trans('Language_'.$dir); $langs_available[$dir] = $this->trans('Language_'.$dir);
} }
if ($mainlangonly) {
$langs_available[$dir] = str_replace(' (United States)', '', $langs_available[$dir]);
}
} }
} }
return $langs_available; return $langs_available;

View File

@ -1401,7 +1401,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
foreach ($tblcateg as $cate) foreach ($tblcateg as $cate)
{ {
// Adding the descriptions if they are filled // Adding the descriptions if they are filled
$desccateg = $cate->add_description; $desccateg = $cate->description;
if ($desccateg) if ($desccateg)
$libelleproduitservice .= '__N__'.$desccateg; $libelleproduitservice .= '__N__'.$desccateg;
} }

View File

@ -425,6 +425,24 @@ function show_stats_for_company($product, $socid)
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
// MO
if (!empty($conf->mrp->enabled) && $user->rights->mrp->read)
{
$nblines++;
//$ret = $product->load_stats_mo($socid);
if ($ret < 0) dol_print_error($db);
$langs->load("orders");
print '<tr><td>';
print '<a href="mo.php?id='.$product->id.'">'.img_object('', 'mrp').' '.$langs->trans("MO").'</a>';
print '</td><td class="right">';
print $product->stats_mo['suppliers'];
print '</td><td class="right">';
print $product->stats_mo['nb'];
print '</td><td class="right">';
print $product->stats_mo['qty'];
print '</td>';
print '</tr>';
}
// Customer invoices // Customer invoices
if (!empty($conf->facture->enabled) && $user->rights->facture->lire) if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
{ {

View File

@ -239,15 +239,15 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
{ {
global $website; global $website;
$content = str_replace('<link rel="stylesheet" href="/styles.css', '<link rel="stylesheet" href="styles.css', $content);
// Protect the link styles.css.php to any replacement that we make after. // Protect the link styles.css.php to any replacement that we make after.
$content = str_replace('href="styles.css.php', 'href="!~!~!~styles.css.php', $content); $content = str_replace('href="styles.css.php', 'href="!~!~!~styles.css.php', $content);
$content = str_replace('href="http', 'href="!~!~!~http', $content); $content = str_replace('href="http', 'href="!~!~!~http', $content);
$content = str_replace('href="//', 'href="!~!~!~//', $content); $content = str_replace('href="//', 'href="!~!~!~//', $content);
$content = str_replace('src="viewimage.php', 'src="!~!~!~/viewimage.php', $content); $content = str_replace(array('src="viewimage.php', 'src="/viewimage.php'), 'src="!~!~!~/viewimage.php', $content);
$content = str_replace('src="/viewimage.php', 'src="!~!~!~/viewimage.php', $content);
$content = str_replace('src="'.DOL_URL_ROOT.'/viewimage.php', 'src="!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content); $content = str_replace('src="'.DOL_URL_ROOT.'/viewimage.php', 'src="!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content);
$content = str_replace('href="document.php', 'href="!~!~!~/document.php', $content); $content = str_replace(array('href="document.php','href="/document.php'), 'href="!~!~!~/document.php', $content);
$content = str_replace('href="/document.php', 'href="!~!~!~/document.php', $content);
$content = str_replace('href="'.DOL_URL_ROOT.'/document.php', 'href="!~!~!~'.DOL_URL_ROOT.'/document.php', $content); $content = str_replace('href="'.DOL_URL_ROOT.'/document.php', 'href="!~!~!~'.DOL_URL_ROOT.'/document.php', $content);
// Replace relative link / with dolibarr URL: ...href="/"... // Replace relative link / with dolibarr URL: ...href="/"...
@ -286,6 +286,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
// Fix relative URL // Fix relative URL
$content = str_replace('src="!~!~!~/viewimage.php', 'src="!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content); $content = str_replace('src="!~!~!~/viewimage.php', 'src="!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content);
$content = str_replace('href="!~!~!~/document.php', 'href="!~!~!~'.DOL_URL_ROOT.'/document.php', $content); $content = str_replace('href="!~!~!~/document.php', 'href="!~!~!~'.DOL_URL_ROOT.'/document.php', $content);
// Remove the protection tag !~!~!~ // Remove the protection tag !~!~!~
$content = str_replace('!~!~!~', '', $content); $content = str_replace('!~!~!~', '', $content);
} }

View File

@ -55,6 +55,7 @@ function dolSaveMasterFile($filemaster)
* @param Website $object Object website * @param Website $object Object website
* @param WebsitePage $objectpage Object websitepage * @param WebsitePage $objectpage Object websitepage
* @return boolean True if OK * @return boolean True if OK
* @see dolSavePageContent()
*/ */
function dolSavePageAlias($filealias, $object, $objectpage) function dolSavePageAlias($filealias, $object, $objectpage)
{ {
@ -74,6 +75,24 @@ function dolSavePageAlias($filealias, $object, $objectpage)
@chmod($filealias, octdec($conf->global->MAIN_UMASK)); @chmod($filealias, octdec($conf->global->MAIN_UMASK));
} }
// Save also alias into language subdirectory if we have to
if ($objectpage->lang && in_array($objectpage->lang, explode(',', $object->otherlang))) {
$dirname = dirname($filealias);
$filename = basename($filealias);
$filealias = $dirname.'/'.$objectpage->lang.'/'.$filename;
$aliascontent = '<?php'."\n";
$aliascontent .= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n";
$aliascontent .= 'global $dolibarr_main_data_root;'."\n";
$aliascontent .= 'if (empty($dolibarr_main_data_root)) require \'../page'.$objectpage->id.'.tpl.php\'; ';
$aliascontent .= 'else require $dolibarr_main_data_root.\'/website/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n";
$aliascontent .= '?>'."\n";
$result = file_put_contents($filealias, $aliascontent);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filealias, octdec($conf->global->MAIN_UMASK));
}
}
return ($result ?true:false); return ($result ?true:false);
} }
@ -85,6 +104,7 @@ function dolSavePageAlias($filealias, $object, $objectpage)
* @param Website $object Object website * @param Website $object Object website
* @param WebsitePage $objectpage Object websitepage * @param WebsitePage $objectpage Object websitepage
* @return boolean True if OK * @return boolean True if OK
* @see dolSavePageAlias()
*/ */
function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
{ {
@ -101,7 +121,10 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
$tplcontent = ''; $tplcontent = '';
$tplcontent .= "<?php // BEGIN PHP\n"; $tplcontent .= "<?php // BEGIN PHP\n";
$tplcontent .= '$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n"; $tplcontent .= '$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n";
$tplcontent .= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n"; $tplcontent .= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) {\n";
$tplcontent .= ' $pathdepth = count(explode(\'/\', $_SERVER[\'SCRIPT_NAME\'])) - 2;'."\n";
$tplcontent .= ' require_once ($pathdepth ? str_repeat(\'../\', $pathdepth) : \'./\').\'master.inc.php\';'."\n";
$tplcontent .= "} // Not already loaded"."\n";
$tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$tplcontent .= "ob_start();\n"; $tplcontent .= "ob_start();\n";
@ -125,7 +148,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
// Add translation reference (main language) // Add translation reference (main language)
if ($object->isMultiLang()) { if ($object->isMultiLang()) {
// Add myself // Add myself
$tplcontent .= '<link rel="alternate" hreflang="'.$shortlangcode.'" href="'.($object->fk_default_home == $objectpage->id ? '/' : '/'.$objectpage->pageurl.'.php').'" />'."\n"; $tplcontent .= '<link rel="alternate" hreflang="'.$shortlangcode.'" href="'.($object->fk_default_home == $objectpage->id ? '/' : '/'.$shortlangcode.'/'.$objectpage->pageurl.'.php').'" />'."\n";
// Add page "translation of" // Add page "translation of"
$translationof = $objectpage->fk_page; $translationof = $objectpage->fk_page;
if ($translationof) { if ($translationof) {
@ -135,7 +158,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
$tmpshortlangcode = ''; $tmpshortlangcode = '';
if ($tmppage->lang) $tmpshortlangcode = preg_replace('/[_-].*$/', '', $tmppage->lang); // en_US or en-US -> en if ($tmppage->lang) $tmpshortlangcode = preg_replace('/[_-].*$/', '', $tmppage->lang); // en_US or en-US -> en
if ($tmpshortlangcode != $shortlangcode) { if ($tmpshortlangcode != $shortlangcode) {
$tplcontent .= '<link rel="alternate" hreflang="'.$tmpshortlangcode.'" href="'.($object->fk_default_home == $tmppage->id ? '/' : '/'.$tmppage->pageurl.'.php').'" />'."\n"; $tplcontent .= '<link rel="alternate" hreflang="'.$tmpshortlangcode.'" href="'.($object->fk_default_home == $tmppage->id ? '/' : '/'.$tmpshortlangcode.'/'.$tmppage->pageurl.'.php').'" />'."\n";
} }
} }
} }
@ -152,7 +175,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
$tmpshortlangcode = ''; $tmpshortlangcode = '';
if ($obj->lang) $tmpshortlangcode = preg_replace('/[_-].*$/', '', $obj->lang); // en_US or en-US -> en if ($obj->lang) $tmpshortlangcode = preg_replace('/[_-].*$/', '', $obj->lang); // en_US or en-US -> en
if ($tmpshortlangcode != $shortlangcode) { if ($tmpshortlangcode != $shortlangcode) {
$tplcontent .= '<link rel="alternate" hreflang="'.$tmpshortlangcode.'" href="'.($object->fk_default_home == $obj->id ? '/' : '/'.$obj->pageurl.'.php').'" />'."\n"; $tplcontent .= '<link rel="alternate" hreflang="'.$tmpshortlangcode.'" href="'.($object->fk_default_home == $obj->id ? '/' : '/'.$tmpshortlangcode.'/'.$obj->pageurl.'.php').'" />'."\n";
} }
} }
} }
@ -160,11 +183,11 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
else dol_print_error($db); else dol_print_error($db);
} }
// Add canonical reference // Add canonical reference
$tplcontent .= '<link href="/'.(($objectpage->id == $object->fk_default_home) ? '' : ($objectpage->pageurl.'.php')).'" rel="canonical" />'."\n"; $tplcontent .= '<link href="/'.(($objectpage->id == $object->fk_default_home) ? '' : $shortlangcode.'/'.($objectpage->pageurl.'.php')).'" rel="canonical" />'."\n";
// Add manifest.json on homepage // Add manifest.json on homepage
$tplcontent .= '<?php if ($website->use_manifest) { print \'<link rel="manifest" href="/manifest.json.php" />\'."\n"; } ?>'."\n"; $tplcontent .= '<?php if ($website->use_manifest) { print \'<link rel="manifest" href="/manifest.json.php" />\'."\n"; } ?>'."\n";
$tplcontent .= '<!-- Include link to CSS file -->'."\n"; $tplcontent .= '<!-- Include link to CSS file -->'."\n";
$tplcontent .= '<link rel="stylesheet" href="styles.css.php?website=<?php echo $websitekey; ?>" type="text/css" />'."\n"; $tplcontent .= '<link rel="stylesheet" href="/styles.css.php?website=<?php echo $websitekey; ?>" type="text/css" />'."\n";
$tplcontent .= '<!-- Include HTML header from common file -->'."\n"; $tplcontent .= '<!-- Include HTML header from common file -->'."\n";
$tplcontent .= '<?php print preg_replace(\'/<\/?html>/ims\', \'\', file_get_contents(DOL_DATA_ROOT."/website/".$websitekey."/htmlheader.html")); ?>'."\n"; $tplcontent .= '<?php print preg_replace(\'/<\/?html>/ims\', \'\', file_get_contents(DOL_DATA_ROOT."/website/".$websitekey."/htmlheader.html")); ?>'."\n";
$tplcontent .= '<!-- Include HTML header from page header block -->'."\n"; $tplcontent .= '<!-- Include HTML header from page header block -->'."\n";

View File

@ -185,7 +185,7 @@ class doc_generic_contract_odt extends ModelePDFContract
/** /**
* Function to build a document on disk using the generic odt module. * Function to build a document on disk using the generic odt module.
* *
* @param Contract $object Object source to build document * @param Contrat $object Object source to build document
* @param Translate $outputlangs Lang output object * @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file * @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details * @param int $hidedetails Do not show line details

View File

@ -41,7 +41,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
{ {
/** /**
* Issuer * Issuer
* @var Company object that emits * @var Societe Object that emits
*/ */
public $emetteur; public $emetteur;

View File

@ -108,7 +108,7 @@ class pdf_soleil extends ModelePDFFicheinter
/** /**
* Issuer * Issuer
* @var Company object that emits * @var Societe Object that emits
*/ */
public $emetteur; public $emetteur;

View File

@ -46,7 +46,7 @@ class mod_arctic extends ModeleNumRefFicheinter
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom = 'arctic'; public $nom = 'arctic';

View File

@ -46,7 +46,7 @@ class mod_pacific extends ModeleNumRefFicheinter
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='pacific'; public $nom='pacific';

View File

@ -107,7 +107,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
/** /**
* Issuer * Issuer
* @var Company object that emits * @var Societe Object that emits
*/ */
public $emetteur; public $emetteur;

View File

@ -44,7 +44,7 @@ class mod_payment_ant extends ModeleNumRefPayments
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Ant'; public $nom='Ant';

View File

@ -45,7 +45,7 @@ class mod_payment_cicada extends ModeleNumRefPayments
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Cicada'; public $nom='Cicada';

View File

@ -47,7 +47,7 @@ class mod_project_simple extends ModeleNumRefProjects
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Simple'; public $nom='Simple';

View File

@ -44,7 +44,7 @@ class mod_project_universal extends ModeleNumRefProjects
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom = 'Universal'; public $nom = 'Universal';

View File

@ -57,7 +57,7 @@ class doc_generic_task_odt extends ModelePDFTask
{ {
/** /**
* Issuer * Issuer
* @var Company object that emits * @var Societe Object that emits
*/ */
public $emetteur; public $emetteur;

View File

@ -47,7 +47,7 @@ class mod_task_simple extends ModeleNumRefTask
/** /**
* @var string * @var string
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Simple'; public $nom='Simple';

View File

@ -44,7 +44,7 @@ class mod_task_universal extends ModeleNumRefTask
/** /**
* @var string * @var string
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom = 'Universal'; public $nom = 'Universal';

View File

@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
class doc_generic_reception_odt extends ModelePdfReception class doc_generic_reception_odt extends ModelePdfReception
{ {
/** /**
* @var Company Issuer object that emits * @var Societe Issuer object that emits
*/ */
public $emetteur; // Objet societe qui emet public $emetteur; // Objet societe qui emet

View File

@ -209,7 +209,7 @@ class doc_generic_stock_odt extends ModelePDFStock
/** /**
* Function to build a document on disk using the generic odt module. * Function to build a document on disk using the generic odt module.
* *
* @param Stock $object Object source to build document * @param Entrepot $object Object source to build document
* @param Translate $outputlangs Lang output object * @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file * @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details * @param int $hidedetails Do not show line details
@ -250,7 +250,7 @@ class doc_generic_stock_odt extends ModelePDFStock
if (!is_object($object)) if (!is_object($object))
{ {
$id = $object; $id = $object;
$object = new Stock($this->db); $object = new Entrepot($this->db);
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result < 0) if ($result < 0)
{ {
@ -258,7 +258,8 @@ class doc_generic_stock_odt extends ModelePDFStock
return -1; return -1;
} }
} }
$stockFournisseur = new StockFournisseur($this->db);
$stockFournisseur = new ProductFournisseur($this->db);
$supplierprices = $stockFournisseur->list_stock_fournisseur_price($object->id); $supplierprices = $stockFournisseur->list_stock_fournisseur_price($object->id);
$object->supplierprices = $supplierprices; $object->supplierprices = $supplierprices;

View File

@ -181,7 +181,7 @@ class pdf_standard extends ModelePDFStock
/** /**
* Function to build a document on disk using the generic odt module. * Function to build a document on disk using the generic odt module.
* *
* @param Stock $object Object source to build document * @param Entrepot $object Object source to build document
* @param Translate $outputlangs Lang output object * @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file * @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details * @param int $hidedetails Do not show line details

View File

@ -47,7 +47,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Cactus'; public $nom='Cactus';

View File

@ -50,7 +50,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Tulip'; public $nom='Tulip';

View File

@ -45,7 +45,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Muguet'; public $nom='Muguet';

View File

@ -46,7 +46,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Orchidee'; public $nom='Orchidee';

View File

@ -44,7 +44,7 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Brodator'; public $nom='Brodator';

View File

@ -45,7 +45,7 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Bronan'; public $nom='Bronan';

View File

@ -225,7 +225,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
/** /**
* Function to build a document on disk using the generic odt module. * Function to build a document on disk using the generic odt module.
* *
* @param Propale $object Object source to build document * @param Propal $object Object source to build document
* @param Translate $outputlangs Lang output object * @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file * @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details * @param int $hidedetails Do not show line details

View File

@ -47,7 +47,7 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Marbre'; public $nom='Marbre';

View File

@ -47,7 +47,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Saphir'; public $nom='Saphir';

View File

@ -46,7 +46,7 @@ class mod_ticket_simple extends ModeleNumRefTicket
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Simple'; public $nom='Simple';

View File

@ -43,7 +43,7 @@ class mod_ticket_universal extends ModeleNumRefTicket
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Universal'; public $nom='Universal';

View File

@ -432,7 +432,7 @@ if ($nolinesbefore) {
<?php <?php
if (is_object($objectline)) { if (is_object($objectline)) {
print $objectline->showOptionals($extrafields, 'edit', array('colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1); print $objectline->showOptionals($extrafields, 'edit', array('colspan'=>$coldisplay), '', '', 1);
} }
if ((!empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required if ((!empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required

View File

@ -260,7 +260,7 @@ $coldisplay++;
//Line extrafield //Line extrafield
if (!empty($extrafields)) if (!empty($extrafields))
{ {
print $line->showOptionals($extrafields, 'edit', array('class'=>'tredited', 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); print $line->showOptionals($extrafields, 'edit', array('class'=>'tredited', 'colspan'=>$coldisplay), '', '', 1);
} }
?> ?>

View File

@ -356,7 +356,7 @@ print "</tr>\n";
//Line extrafield //Line extrafield
if (!empty($extrafields)) if (!empty($extrafields))
{ {
print $line->showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"', 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1); print $line->showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"', 'colspan'=>$coldisplay), '', '', 1);
} }
print "<!-- END PHP TEMPLATE objectline_view.tpl.php -->\n"; print "<!-- END PHP TEMPLATE objectline_view.tpl.php -->\n";

View File

@ -1578,7 +1578,7 @@ if ($action == 'create')
//$line->fetch_optionals($line->id); //$line->fetch_optionals($line->id);
$line->array_options = array_merge($line->array_options, $srcLine->array_options); $line->array_options = array_merge($line->array_options, $srcLine->array_options);
print $expLine->showOptionals($extrafields, 'edit', array('style'=>'class="drag drop oddeven"', 'colspan'=>$colspan), $indiceAsked, '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1); print $expLine->showOptionals($extrafields, 'edit', array('style'=>'class="drag drop oddeven"', 'colspan'=>$colspan), $indiceAsked, '', 1);
} }
} }

View File

@ -253,7 +253,7 @@ class SupplierOrders extends DolibarrApi
* Delete supplier order * Delete supplier order
* *
* @param int $id Supplier order ID * @param int $id Supplier order ID
* @return type * @return array Array of result
*/ */
public function delete($id) public function delete($id)
{ {

View File

@ -263,12 +263,6 @@ class AutoLoader
* @return bool false unless className now exists * @return bool false unless className now exists
*/ */
private function loadLastResort($className, $loader = null) { private function loadLastResort($className, $loader = null) {
// @CHANGE LDR Add protection to avoid conflict with other autoloader
/*print 'Try to load '.$className."\n";
if (in_array($className, array('Google_Client')))
{
return false;
}*/
$loaders = array_unique(static::$rogueLoaders); $loaders = array_unique(static::$rogueLoaders);
if (isset($loader)) { if (isset($loader)) {
if (false === array_search($loader, $loaders)) if (false === array_search($loader, $loaders))

View File

@ -159,7 +159,7 @@ class CommentParser
$addNewline = true; $addNewline = true;
} }
continue; continue;
} elseif ($line{0} == '@') { } elseif ($line[0] == '@') {
$mode = 2; $mode = 2;
$newParam = true; $newParam = true;
} }
@ -353,7 +353,7 @@ class CommentParser
$data = $format->decode($str); $data = $format->decode($str);
} }
} else { // auto detect } else { // auto detect
if ($str{0} == '{') { if ($str[0] == '{') {
$d = json_decode($str, true); $d = json_decode($str, true);
if (json_last_error() != JSON_ERROR_NONE) { if (json_last_error() != JSON_ERROR_NONE) {
throw new Exception('Error parsing embedded JSON data' throw new Exception('Error parsing embedded JSON data'
@ -445,7 +445,7 @@ class CommentParser
{ {
$r = array(); $r = array();
$email = end($value); $email = end($value);
if ($email{0} == '<') { if ($email[0] == '<') {
$email = substr($email, 1, -1); $email = substr($email, 1, -1);
array_pop($value); array_pop($value);
$r['email'] = $email; $r['email'] = $email;
@ -470,7 +470,7 @@ class CommentParser
$data = array_shift($value); $data = array_shift($value);
if (empty($data)) { if (empty($data)) {
$r['type'] = 'mixed'; $r['type'] = 'mixed';
} elseif ($data{0} == '$') { } elseif ($data[0] == '$') {
$r['name'] = substr($data, 1); $r['name'] = substr($data, 1);
$r['type'] = 'mixed'; $r['type'] = 'mixed';
} else { } else {
@ -478,7 +478,7 @@ class CommentParser
$r['type'] = count($data) == 1 ? $data[0] : $data; $r['type'] = count($data) == 1 ? $data[0] : $data;
$data = array_shift($value); $data = array_shift($value);
if (!empty($data) && $data{0} == '$') { if (!empty($data) && $data[0] == '$') {
$r['name'] = substr($data, 1); $r['name'] = substr($data, 1);
} }
} }
@ -498,7 +498,7 @@ class CommentParser
$data = array_shift($value); $data = array_shift($value);
if (empty($data)) { if (empty($data)) {
$r['type'] = 'mixed'; $r['type'] = 'mixed';
} elseif ($data{0} == '$') { } elseif ($data[0] == '$') {
$r['name'] = substr($data, 1); $r['name'] = substr($data, 1);
$r['type'] = 'mixed'; $r['type'] = 'mixed';
} else { } else {

View File

@ -221,7 +221,7 @@ class XmlFormat extends Format
$namespaces = $xml->getNamespaces(); $namespaces = $xml->getNamespaces();
if (count($namespaces)) { if (count($namespaces)) {
$p = strpos($data, $xml->getName()); $p = strpos($data, $xml->getName());
if ($p && $data{$p - 1} == ':') { if ($p && $data[$p - 1] == ':') {
$s = strpos($data, '<') + 1; $s = strpos($data, '<') + 1;
$prefix = substr($data, $s, $p - $s - 1); $prefix = substr($data, $s, $p - $s - 1);
static::$namespacedProperties[static::$rootName] = $prefix; static::$namespacedProperties[static::$rootName] = $prefix;

View File

@ -198,7 +198,7 @@ class Resources implements iUseAuthentication, iProvideMultiVersionApi
} elseif (false !== ($pos = strpos($id, '-v'))) { } elseif (false !== ($pos = strpos($id, '-v'))) {
//$version = intval(substr($id, $pos + 2)); //$version = intval(substr($id, $pos + 2));
$id = substr($id, 0, $pos); $id = substr($id, 0, $pos);
} elseif ($id{0} == 'v' && is_numeric($v = substr($id, 1))) { } elseif ($id[0] == 'v' && is_numeric($v = substr($id, 1))) {
$id = ''; $id = '';
//$version = $v; //$version = $v;
} elseif ($id == 'root' || $id == 'index') { } elseif ($id == 'root' || $id == 'index') {
@ -233,7 +233,7 @@ class Resources implements iUseAuthentication, iProvideMultiVersionApi
if ($tSlash) { if ($tSlash) {
if ($fLen != $tLen && !Text::beginsWith($fullPath, $target . '/')) if ($fLen != $tLen && !Text::beginsWith($fullPath, $target . '/'))
continue; continue;
} elseif ($fLen > $tLen + 1 && $fullPath{$tLen + 1} != '{' && !Text::beginsWith($fullPath, '{')) { } elseif ($fLen > $tLen + 1 && $fullPath[$tLen + 1] != '{' && !Text::beginsWith($fullPath, '{')) {
//when mapped to root exclude paths that have static parts //when mapped to root exclude paths that have static parts
//they are listed else where under that static part name //they are listed else where under that static part name
continue; continue;
@ -275,7 +275,7 @@ class Resources implements iUseAuthentication, iProvideMultiVersionApi
if (count($parts) == 1 && $httpMethod == 'GET') { if (count($parts) == 1 && $httpMethod == 'GET') {
} else { } else {
for ($i = 0; $i < count($parts); $i++) { for ($i = 0; $i < count($parts); $i++) {
if (strlen($parts[$i]) && $parts[$i]{0} == '{') { if (strlen($parts[$i]) && $parts[$i][0] == '{') {
$pos = $i - 1; $pos = $i - 1;
break; break;
} }

View File

@ -533,7 +533,7 @@ class Restler extends EventDispatcher
rtrim($path, '/') //remove trailing slash if found rtrim($path, '/') //remove trailing slash if found
); );
if (Defaults::$useUrlBasedVersioning && strlen($path) && $path{0} == 'v') { if (Defaults::$useUrlBasedVersioning && strlen($path) && $path[0] == 'v') {
$version = intval(substr($path, 1)); $version = intval(substr($path, 1));
if ($version && $version <= $this->apiVersion) { if ($version && $version <= $this->apiVersion) {
$this->requestedApiVersion = $version; $this->requestedApiVersion = $version;
@ -1599,7 +1599,7 @@ class Restler extends EventDispatcher
*/ */
public function __get($name) public function __get($name)
{ {
if ($name{0} == '_') { if ($name[0] == '_') {
$hiddenProperty = substr($name, 1); $hiddenProperty = substr($name, 1);
if (isset($this->$hiddenProperty)) { if (isset($this->$hiddenProperty)) {
return $this->$hiddenProperty; return $this->$hiddenProperty;

View File

@ -87,7 +87,7 @@ class Routes
foreach ($methods as $method) { foreach ($methods as $method) {
$methodUrl = strtolower($method->getName()); $methodUrl = strtolower($method->getName());
//method name should not begin with _ //method name should not begin with _
if ($methodUrl{0} == '_') { if ($methodUrl[0] == '_') {
continue; continue;
} }
$doc = $method->getDocComment(); $doc = $method->getDocComment();
@ -330,7 +330,7 @@ class Routes
if (!$type) { if (!$type) {
return 's'; return 's';
} }
switch ($type{0}) { switch ($type[0]) {
case 'i': case 'i':
case 'f': case 'f':
return 'n'; return 'n';
@ -428,7 +428,7 @@ class Routes
} }
$index = intval(substr($k, 1)); $index = intval(substr($k, 1));
$details = $value[$httpMethod]['metadata']['param'][$index]; $details = $value[$httpMethod]['metadata']['param'][$index];
if ($k{0} == 's' || strpos($k, static::pathVarTypeOf($v)) === 0) { if ($k[0] == 's' || strpos($k, static::pathVarTypeOf($v)) === 0) {
//remove the newlines //remove the newlines
$data[$details['name']] = trim($v, PHP_EOL); $data[$details['name']] = trim($v, PHP_EOL);
} else { } else {

View File

@ -203,7 +203,7 @@ class Scope
$divider = '\\'; $divider = '\\';
$qualified = false; $qualified = false;
if ($className{0} == $divider) { if ($className[0] == $divider) {
$qualified = trim($className, $divider); $qualified = trim($className, $divider);
} elseif (array_key_exists($className, $scope)) { } elseif (array_key_exists($className, $scope)) {
$qualified = $scope[$className]; $qualified = $scope[$className];

View File

@ -356,7 +356,7 @@ class Emmet
$pos = strpos($string, $f, $start); $pos = strpos($string, $f, $start);
$tokens = array(); $tokens = array();
for ($i = $start; $i < $pos; $i++) { for ($i = $start; $i < $pos; $i++) {
$token = $string{$i}; $token = $string[$i];
if (('#' == $token || '.' == $token) && if (('#' == $token || '.' == $token) &&
(!empty($tokens) || $i == 0) (!empty($tokens) || $i == 0)
) { ) {
@ -368,7 +368,7 @@ class Emmet
$r[] = $f; $r[] = $f;
} while (false != ($f = strtok(static::DELIMITERS))); } while (false != ($f = strtok(static::DELIMITERS)));
for ($i = $pos; $i < strlen($string); $i++) { for ($i = $pos; $i < strlen($string); $i++) {
$token = $string{$i}; $token = $string[$i];
$r[] = $tokens[] = $token; $r[] = $tokens[] = $token;
} }
return $r; return $r;

View File

@ -44,6 +44,19 @@ ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD INDEX idx_commande
-- For v12 -- For v12
UPDATE llx_website SET lang = 'en' WHERE lang like 'en_%';
UPDATE llx_website SET lang = 'fr' WHERE lang like 'fr_%';
UPDATE llx_website SET lang = 'es' WHERE lang like 'es_%';
UPDATE llx_website SET lang = 'de' WHERE lang like 'de_%';
UPDATE llx_website SET lang = 'it' WHERE lang like 'it_%';
UPDATE llx_website SET lang = 'pt' WHERE lang like 'pt_%';
UPDATE llx_website_page SET lang = 'en' WHERE lang like 'en_%';
UPDATE llx_website_page SET lang = 'fr' WHERE lang like 'fr_%';
UPDATE llx_website_page SET lang = 'es' WHERE lang like 'es_%';
UPDATE llx_website_page SET lang = 'de' WHERE lang like 'de_%';
UPDATE llx_website_page SET lang = 'it' WHERE lang like 'it_%';
UPDATE llx_website_page SET lang = 'pt' WHERE lang like 'pt_%';
ALTER TABLE llx_website ADD COLUMN lang varchar(8); ALTER TABLE llx_website ADD COLUMN lang varchar(8);
ALTER TABLE llx_website ADD COLUMN otherlang varchar(255); ALTER TABLE llx_website ADD COLUMN otherlang varchar(255);

View File

@ -228,6 +228,8 @@ ErrorFieldRequiredForProduct=Field '%s' is required for product %s
ProblemIsInSetupOfTerminal=Problem is in setup of terminal %s. ProblemIsInSetupOfTerminal=Problem is in setup of terminal %s.
ErrorAddAtLeastOneLineFirst=Add at least one line first ErrorAddAtLeastOneLineFirst=Add at least one line first
ErrorRecordAlreadyInAccountingDeletionNotPossible=Error, record is already transferred in accounting, deletion is not possible. ErrorRecordAlreadyInAccountingDeletionNotPossible=Error, record is already transferred in accounting, deletion is not possible.
ErrorLanguageMandatoryIfPageSetAsTranslationOfAnother=Error, language is mandatory if you set the page as a translation of another one.
ErrorLanguageOfTranslatedPageIsSameThanThisPage=Error, language of translated page is same than this one.
# Warnings # Warnings
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.

View File

@ -65,7 +65,7 @@ Language_mk_MK=Macedonian
Language_mn_MN=Mongolian Language_mn_MN=Mongolian
Language_nb_NO=Norwegian (Bokmål) Language_nb_NO=Norwegian (Bokmål)
Language_nl_BE=Dutch (Belgium) Language_nl_BE=Dutch (Belgium)
Language_nl_NL=Dutch (Netherlands) Language_nl_NL=Dutch
Language_pl_PL=Polish Language_pl_PL=Polish
Language_pt_BR=Portuguese (Brazil) Language_pt_BR=Portuguese (Brazil)
Language_pt_PT=Portuguese Language_pt_PT=Portuguese

View File

@ -1623,31 +1623,6 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
print '<div class="login_block usedropdown">'."\n"; print '<div class="login_block usedropdown">'."\n";
// Add login user link
$toprightmenu .= '<div class="login_block_user">';
// Login name with photo and tooltip
$mode = -1;
$toprightmenu .= '<div class="inline-block nowrap"><div class="inline-block login_block_elem login_block_elem_name" style="padding: 0px;">';
if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) {
// Add search dropdown
$toprightmenu .= top_menu_search();
}
if (!empty($conf->global->MAIN_USE_TOP_MENU_BOOKMARK_DROPDOWN)) {
// Add bookmark dropdown
$toprightmenu .= top_menu_bookmark();
}
// Add user dropdown
$toprightmenu .= top_menu_user();
$toprightmenu .= '</div></div>';
$toprightmenu .= '</div>'."\n";
$toprightmenu .= '<div class="login_block_other">'; $toprightmenu .= '<div class="login_block_other">';
// Execute hook printTopRightMenu (hooks should output string like '<div class="login"><a href="">mylink</a></div>') // Execute hook printTopRightMenu (hooks should output string like '<div class="login"><a href="">mylink</a></div>')
@ -1739,7 +1714,31 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
// Logout link // Logout link
$toprightmenu .= @Form::textwithtooltip('', $logouthtmltext, 2, 1, $logouttext, 'login_block_elem logout-btn', 2); $toprightmenu .= @Form::textwithtooltip('', $logouthtmltext, 2, 1, $logouttext, 'login_block_elem logout-btn', 2);
$toprightmenu .= '</div>'; $toprightmenu .= '</div>'; // end div class="login_block_other"
// Add login user link
$toprightmenu .= '<div class="login_block_user">';
// Login name with photo and tooltip
$mode = -1;
$toprightmenu .= '<div class="inline-block nowrap"><div class="inline-block login_block_elem login_block_elem_name" style="padding: 0px;">';
if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) {
// Add search dropdown
$toprightmenu .= top_menu_search();
}
// Add bookmark dropdown
$toprightmenu .= top_menu_bookmark();
// Add user dropdown
$toprightmenu .= top_menu_user();
$toprightmenu .= '</div></div>';
$toprightmenu .= '</div>'."\n";
print $toprightmenu; print $toprightmenu;
@ -1940,7 +1939,7 @@ function top_menu_bookmark()
$langs->load("bookmarks"); $langs->load("bookmarks");
$html .= '<!-- div for bookmark link --> $html .= '<!-- div for bookmark link -->
<div id="topmenu-bookmark-dropdown" class="atoplogin dropdown inline-block"> <div id="topmenu-bookmark-dropdown" class="dropdown inline-block">
<a class="dropdown-toggle login-dropdown-a" data-toggle="dropdown" href="#" title="'.$langs->trans('Bookmarks').' ('.$langs->trans('BookmarksMenuShortCut').')"> <a class="dropdown-toggle login-dropdown-a" data-toggle="dropdown" href="#" title="'.$langs->trans('Bookmarks').' ('.$langs->trans('BookmarksMenuShortCut').')">
<i class="fa fa-star" ></i> <i class="fa fa-star" ></i>
</a> </a>
@ -1949,20 +1948,20 @@ function top_menu_bookmark()
</div> </div>
</div>'; </div>';
$html .= ' $html .= '
<!-- Code to show/hide the user drop-down --> <!-- Code to show/hide the user drop-down -->
<script> <script>
$( document ).ready(function() { $( document ).ready(function() {
$(document).on("click", function(event) { $(document).on("click", function(event) {
if (!$(event.target).closest("#topmenu-bookmark-dropdown").length) { if (!$(event.target).closest("#topmenu-bookmark-dropdown").length) {
console.log("close");
// Hide the menus. // Hide the menus.
$("#topmenu-bookmark-dropdown").removeClass("open"); $("#topmenu-bookmark-dropdown").removeClass("open");
} }
}); });
$("#topmenu-bookmark-dropdown .dropdown-toggle").on("click", function(event) { $("#topmenu-bookmark-dropdown .dropdown-toggle").on("click", function(event) {
console.log("toggle");
openBookMarkDropDown(); openBookMarkDropDown();
}); });
@ -2188,15 +2187,6 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_
} }
} }
// Define $bookmarks
if (!empty($conf->bookmark->enabled) && $user->rights->bookmark->lire && empty($conf->global->MAIN_USE_TOP_MENU_BOOKMARK_DROPDOWN))
{
include_once DOL_DOCUMENT_ROOT.'/bookmarks/bookmarks.lib.php';
$langs->load("bookmarks");
$bookmarks = printBookmarksList();
}
// Left column // Left column
print '<!-- Begin left menu -->'."\n"; print '<!-- Begin left menu -->'."\n";

View File

@ -985,7 +985,7 @@ class Mo extends CommonObject
* Return a link to the object card (with optionaly the picto) * Return a link to the object card (with optionaly the picto)
* *
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
* @param string $option On what the link point to ('nolink', ...) * @param string $option On what the link point to ('nolink', '', 'production', ...)
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @param string $morecss Add more css on link * @param string $morecss Add more css on link
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
@ -1007,6 +1007,7 @@ class Mo extends CommonObject
} }
$url = dol_buildpath('/mrp/mo_card.php', 1).'?id='.$this->id; $url = dol_buildpath('/mrp/mo_card.php', 1).'?id='.$this->id;
if ($option = 'production') $url = dol_buildpath('/mrp/mo_production.php', 1).'?id='.$this->id;
if ($option != 'nolink') if ($option != 'nolink')
{ {
@ -1370,21 +1371,21 @@ class MoLine extends CommonObjectLine
public $fields = array( public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'fk_mo' =>array('type'=>'integer', 'label'=>'Fk mo', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15), 'fk_mo' =>array('type'=>'integer', 'label'=>'Mo', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15),
'position' =>array('type'=>'integer', 'label'=>'Position', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20), 'position' =>array('type'=>'integer', 'label'=>'Position', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
'fk_product' =>array('type'=>'integer', 'label'=>'Fk product', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25), 'fk_product' =>array('type'=>'integer', 'label'=>'Product', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
'fk_warehouse' =>array('type'=>'integer', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>30), 'fk_warehouse' =>array('type'=>'integer', 'label'=>'Warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
'qty' =>array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), 'qty' =>array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'qty_frozen' => array('type'=>'smallint', 'label'=>'QuantityFrozen', 'enabled'=>1, 'visible'=>1, 'default'=>0, 'position'=>105, 'css'=>'maxwidth50imp', 'help'=>'QuantityConsumedInvariable'), 'qty_frozen' => array('type'=>'smallint', 'label'=>'QuantityFrozen', 'enabled'=>1, 'visible'=>1, 'default'=>0, 'position'=>105, 'css'=>'maxwidth50imp', 'help'=>'QuantityConsumedInvariable'),
'disable_stock_change' => array('type'=>'smallint', 'label'=>'DisableStockChange', 'enabled'=>1, 'visible'=>1, 'default'=>0, 'position'=>108, 'css'=>'maxwidth50imp', 'help'=>'DisableStockChangeHelp'), 'disable_stock_change' => array('type'=>'smallint', 'label'=>'DisableStockChange', 'enabled'=>1, 'visible'=>1, 'default'=>0, 'position'=>108, 'css'=>'maxwidth50imp', 'help'=>'DisableStockChangeHelp'),
'batch' =>array('type'=>'varchar(30)', 'label'=>'Batch', 'enabled'=>1, 'visible'=>-1, 'position'=>140), 'batch' =>array('type'=>'varchar(30)', 'label'=>'Batch', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
'role' =>array('type'=>'varchar(10)', 'label'=>'Role', 'enabled'=>1, 'visible'=>-1, 'position'=>145), 'role' =>array('type'=>'varchar(10)', 'label'=>'Role', 'enabled'=>1, 'visible'=>-1, 'position'=>145),
'fk_mrp_production' =>array('type'=>'integer', 'label'=>'Fk mrp production', 'enabled'=>1, 'visible'=>-1, 'position'=>150), 'fk_mrp_production' =>array('type'=>'integer', 'label'=>'Fk mrp production', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
'fk_stock_movement' =>array('type'=>'integer', 'label'=>'Fk stock movement', 'enabled'=>1, 'visible'=>-1, 'position'=>155), 'fk_stock_movement' =>array('type'=>'integer', 'label'=>'StockMovement', 'enabled'=>1, 'visible'=>-1, 'position'=>155),
'date_creation' =>array('type'=>'datetime', 'label'=>'Date creation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>160), 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>160),
'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>165), 'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>165),
'fk_user_creat' =>array('type'=>'integer', 'label'=>'Fk user creat', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>170), 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>170),
'fk_user_modif' =>array('type'=>'integer', 'label'=>'Fk user modif', 'enabled'=>1, 'visible'=>-1, 'position'=>175), 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModification', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'position'=>180), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
); );

View File

@ -684,9 +684,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($action == 'addconsumeline') { if ($action == 'addconsumeline') {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'; print '<td>';
print $form->select_produits('', 'productidtoadd', '', 0, 0, -1, 2); print $form->select_produits('', 'productidtoadd', '', 0, 0, -1, 2, '', 0, array(), 0, '1', 0, 'maxwidth300');
print '</td>'; print '</td>';
print '<td class="right"><input type="text" name="qtytoadd" value="1"></td>'; print '<td class="right"><input type="text" name="qtytoadd" value="1" class="width50"></td>';
print '<td class="right"></td>'; print '<td class="right"></td>';
print '<td>'; print '<td>';
print '<input type="submit" class="button" name="addconsumelinebutton" value="'.$langs->trans("Add").'">'; print '<input type="submit" class="button" name="addconsumelinebutton" value="'.$langs->trans("Add").'">';

235
htdocs/product/stats/mo.php Normal file
View File

@ -0,0 +1,235 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
*
* 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 <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/product/stats/mo.php
* \ingroup product mo
* \brief Page of MO referring product
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
// Load translation files required by the page
$langs->loadLangs(array('mrp', 'products', 'companies'));
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
// Security check
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('productstatscontract'));
$mesg = '';
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortorder) $sortorder = "DESC";
if (!$sortfield) $sortfield = "c.date_valid";
/*
* View
*/
$staticmo = new Mo($db);
$staticmoligne = new MoLine($db);
$form = new Form($db);
if ($id > 0 || !empty($ref))
{
$product = new Product($db);
$result = $product->fetch($id, $ref);
$object = $product;
$parameters = array('id'=>$id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
llxHeader("", "", $langs->trans("CardProduct".$product->type));
if ($result > 0)
{
$head = product_prepare_head($product);
$titre = $langs->trans("CardProduct".$product->type);
$picto = ($product->type == Product::TYPE_SERVICE ? 'service' : 'product');
dol_fiche_head($head, 'referers', $titre, -1, $picto);
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$shownav = 1;
if ($user->socid && !in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav = 0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
$nboflines = show_stats_for_company($product, $socid);
print "</table>";
print '</div>';
print '<div style="clear:both"></div>';
dol_fiche_end();
$now = dol_now();
$sql = "SELECT";
$sql .= ' sum('.$db->ifsql("cd.role='toconsume'", "cd.qty", 0).') as nb_toconsume,';
$sql .= ' sum('.$db->ifsql("cd.role='consumed'", "cd.qty", 0).') as nb_consumed,';
$sql .= ' sum('.$db->ifsql("cd.role='toproduce'", "cd.qty", 0).') as nb_toproduce,';
$sql .= ' sum('.$db->ifsql("cd.role='produced'", "cd.qty", 0).') as nb_produced,';
$sql .= " c.rowid as rowid, c.ref, c.date_valid, c.status";
//$sql .= " s.nom as name, s.rowid as socid, s.code_client";
$sql .= " FROM ".MAIN_DB_PREFIX."mrp_mo as c";
$sql .= ", ".MAIN_DB_PREFIX."mrp_production as cd";
$sql .= " WHERE c.rowid = cd.fk_mo";
$sql .= " AND c.entity IN (".getEntity('mo').")";
$sql .= " AND cd.fk_product =".$product->id;
if ($socid) $sql .= " AND s.rowid = ".$socid;
$sql .= " GROUP BY c.rowid, c.ref, c.date_valid, c.status";
//$sql .= ", s.nom, s.rowid, s.code_client";
$sql .= $db->order($sortfield, $sortorder);
//Calcul total qty and amount for global if full scan list
$total_ht = 0;
$total_qty = 0;
// Count total nb of records
$totalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$totalofrecords = $db->num_rows($result);
}
$sql .= $db->plimit($limit + 1, $offset);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
if (!empty($id))
$option .= '&amp;id='.$product->id;
if (!empty($search_month))
$option .= '&amp;search_month='.urlencode($search_month);
if (!empty($search_year))
$option .= '&amp;search_year='.urlencode($search_year);
if ($limit > 0 && $limit != $conf->liste_limit) $option .= '&limit='.urlencode($limit);
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
if (!empty($sortfield))
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
if (!empty($sortorder))
print '<input type="hidden" name="sortorder" value="'.$sortorder.'"/>';
if (!empty($page)) {
print '<input type="hidden" name="page" value="'.$page.'"/>';
$option .= '&amp;page='.$page;
}
print_barre_liste($langs->trans("Mos"), $page, $_SERVER["PHP_SELF"], "&amp;id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
$i = 0;
print '<div class="div-table-responsive">';
print '<table class="tagtable liste listwithfilterbefore" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "c.rowid", "", "&amp;id=".$product->id, '', $sortfield, $sortorder);
//print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", "&amp;id=".$product->id, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "c.date_valid", "", "&amp;id=".$product->id, 'align="center"', $sortfield, $sortorder);
//print_liste_field_titre("AmountHT"),$_SERVER["PHP_SELF"],"c.amount","","&amp;id=".$product->id,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("ToConsume", $_SERVER["PHP_SELF"], "", "", "&amp;id=".$product->id, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("QtyAlreadyConsumed", $_SERVER["PHP_SELF"], "", "", "&amp;id=".$product->id, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("QtyToProduce", $_SERVER["PHP_SELF"], "", "", "&amp;id=".$product->id, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("QtyAlreadyProduced", $_SERVER["PHP_SELF"], "", "", "&amp;id=".$product->id, '', $sortfield, $sortorder, 'center ');
print "</tr>\n";
$motmp = new Mo($db);
if ($num > 0)
{
while ($i < min($num, $limit))
{
$objp = $db->fetch_object($result);
$motmp->id = $objp->rowid;
$motmp->ref = $objp->ref;
print '<tr class="oddeven">';
print '<td>';
print $motmp->getNomUrl(1, 'production');
print "</td>\n";
print "<td align=\"center\">";
print dol_print_date($db->jdate($objp->date_valid), 'dayhour')."</td>";
//print "<td align=\"right\">".price($objp->total_ht)."</td>\n";
//print '<td align="right">';
print '<td class="center">'.($objp->nb_toconsume > 0 ? $objp->nb_toconsume : '').'</td>';
print '<td class="center">'.($objp->nb_consumed > 0 ? $objp->nb_consumed : '').'</td>';
print '<td class="center">'.($objp->nb_toproduce > 0 ? $objp->nb_toproduce : '').'</td>';
print '<td class="center">'.($objp->nb_produced > 0 ? $objp->nb_produced : '').'</td>';
//$mostatic->LibStatut($objp->statut,5).'</td>';
print "</tr>\n";
$i++;
}
}
print '</table>';
print '</div>';
print '</form>';
}
else
{
dol_print_error($db);
}
$db->free($result);
}
}
else
{
dol_print_error();
}
// End of page
llxFooter();
$db->close();

View File

@ -620,7 +620,7 @@ foreach ($listofreferent as $key => $value)
$elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field : 'fk_projet'); $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field : 'fk_projet');
if (count($elementarray) > 0 && is_array($elementarray)) if (is_array($elementarray) && count($elementarray) > 0)
{ {
$total_ht = 0; $total_ht = 0;
$total_ttc = 0; $total_ttc = 0;

View File

@ -13,6 +13,15 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Note about $_SERVER:
* REQUEST_URI: /test/before_rewrite/script.php/path/info?q=helloword
* PHP_SELF: /test/after_rewrite/script.php/path/info
* QUERY_STRING: q=helloword
* SCRIPT_NAME: /test/after_rewrite/script.php
* PATH_INFO: /path/info
* SCRIPT_FILENAME: /var/www/test/php/script.php
* __FILE__ : /var/www/test/php/script_included.php
*/ */
/** /**
@ -110,7 +119,7 @@ if (empty($pageid))
if (empty($pageid)) if (empty($pageid))
{ {
$array=$objectpage->fetchAll($object->id); $array=$objectpage->fetchAll($object->id); // TODO Can filter on container of type pages only ?
if (is_array($array) && count($array) > 0) if (is_array($array) && count($array) > 0)
{ {
$firstrep=reset($array); $firstrep=reset($array);

View File

@ -124,7 +124,7 @@ button.dropdown-item.global-search-item {
} }
.tmenu .dropdown-menu, .login_block .dropdown-menu { .tmenu .dropdown-menu, .login_block .dropdown-menu {
position: absolute; position: absolute;
right: 0; right: 2px;
<?php echo $left; ?>: auto; <?php echo $left; ?>: auto;
line-height:1.3em; line-height:1.3em;
} }
@ -219,6 +219,11 @@ a.top-menu-dropdown-link {
max-height: calc(90vh - 110px) ; max-height: calc(90vh - 110px) ;
white-space: normal; white-space: normal;
} }
#topmenu-bookmark-dropdown .dropdown-menu > .bookmark-body, #topmenu-bookmark-dropdown .dropdown-body{
max-height: 60vh ; /* fallback for browsers without support for calc() */
max-height: calc(90vh - 200px) ;
}
.dropdown-body::-webkit-scrollbar { .dropdown-body::-webkit-scrollbar {
width: 8px; width: 8px;

View File

@ -1150,7 +1150,7 @@ td.showDragHandle {
#id-left { #id-left {
padding-top: 20px; padding-top: 20px;
padding-bottom: 5px; padding-bottom: 5px;
<?php if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN) && !empty($conf->global->MAIN_USE_TOP_MENU_BOOKMARK_DROPDOWN)) { ?> <?php if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) { ?>
padding-top: 8px; padding-top: 8px;
<?php } ?> <?php } ?>
} }
@ -1340,7 +1340,7 @@ div.fichetwothirdright {
<?php if ($conf->browser->layout == 'phone') { print "padding-bottom: 6px\n"; } ?> <?php if ($conf->browser->layout == 'phone') { print "padding-bottom: 6px\n"; } ?>
} }
div.fichetwothirdright div.ficheaddleft { div.fichetwothirdright div.ficheaddleft {
padding-left: 20px; padding-<?php echo $left ?>: 20px;
} }
div.fichehalfleft { div.fichehalfleft {
<?php if ($conf->browser->layout != 'phone') { print "float: ".$left.";\n"; } ?> <?php if ($conf->browser->layout != 'phone') { print "float: ".$left.";\n"; } ?>

View File

@ -204,7 +204,7 @@ if (!empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $disableimages = 1; $m
if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; } if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; }
if (!empty($conf->bookmark->enabled) && !empty($conf->global->MAIN_USE_TOP_MENU_BOOKMARK_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; } if (!empty($conf->bookmark->enabled)) { $maxwidthloginblock = $maxwidthloginblock + 55; }
print '/*'."\n"; print '/*'."\n";

View File

@ -1,18 +1,397 @@
<?php <?php
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
/* <style type="text/css" > dont remove this line it's an ide hack */
/* /*
* Dropdown * Dropdown of user popup
*/ */
/* Not supported yet by this theme */
#dropdown-icon-up, #dropdown-icon-down, .login-dropdown-btn { #topmenu-bookmark-dropdown a.login-dropdown-a {
color: #fff;
}
div#topmenu-bookmark-dropdown {
position: fixed;
right: 20px;
top: 0px;
}
#topmenu-login-dropdown .dropdown-toggle:after {
display: none;
}
button.dropdown-item.global-search-item {
outline: none;
}
.open>.dropdown-search, .open>.dropdown-bookmark, .open>.dropdown-menu{
display: block;
}
.dropdown-search {
border-color: #eee;
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
margin: 2px 0 0;
font-size: 14px;
text-align: left;
list-style: none;
background-color: #fff;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 1px solid #ccc;
border: 1px solid rgba(0,0,0,.15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
box-shadow: 0 6px 12px rgba(0,0,0,.175);
}
.dropdown-bookmark {
border-color: #eee;
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
margin: 2px 0 0;
font-size: 14px;
text-align: left;
list-style: none;
background-color: #fff;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 1px solid #ccc;
border: 1px solid rgba(0,0,0,.15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
box-shadow: 0 6px 12px rgba(0,0,0,.175);
}
.dropdown-menu {
border-color: #eee;
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
margin: 2px 0 0;
font-size: 14px;
text-align: left;
list-style: none;
background-color: #fff;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 1px solid #ccc;
border: 1px solid rgba(0,0,0,.15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
box-shadow: 0 6px 12px rgba(0,0,0,.175);
}
.dropdown-toggle{
text-decoration: none !important;
}
.dropdown-toggle::after {
/* font part */
font-family: "Font Awesome 5 Free";
font-size: 0.7em;
font-weight: 900;
font-style: normal;
font-variant: normal;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
text-align:center;
text-decoration:none;
margin: auto 3px;
display: inline-block;
content: "\f078";
-webkit-transition: -webkit-transform .2s ease-in-out;
-ms-transition: -ms-transform .2s ease-in-out;
transition: transform .2s ease-in-out;
}
.open>.dropdown-toggle::after {
transform: rotate(180deg);
}
/*
* MENU Dropdown
*/
.login_block.usedropdown .logout-btn{
display: none;
}
.tmenu .open.dropdown, .tmenu .open.dropdown {
background: rgba(0, 0, 0, 0.1);
}
.tmenu .dropdown-menu, .login_block .dropdown-menu {
position: absolute;
right: 0;
<?php echo $left; ?>: auto;
line-height:1.3em;
}
.tmenu .dropdown-menu, .login_block .dropdown-menu .user-body {
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
}
.user-body {
color: #333;
}
.side-nav-vert .user-menu .dropdown-menu {
border-top-right-radius: 0;
border-top-left-radius: 0;
padding: 1px 0 0 0;
border-top-width: 0;
width: 300px;
}
.side-nav-vert .user-menu .dropdown-menu {
margin-top: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.side-nav-vert .user-menu .dropdown-menu > .user-header {
min-height: 100px;
padding: 10px;
text-align: center;
white-space: normal;
}
#topmenu-global-search-dropdown .dropdown-menu{
width: 300px;
max-width: 100%;
}
div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown {
line-height: 46px;
}
a.top-menu-dropdown-link {
padding: 8px;
}
.dropdown-user-image {
border-radius: 50%;
vertical-align: middle;
z-index: 5;
height: 90px;
width: 90px;
border: 3px solid;
border-color: transparent;
border-color: rgba(255, 255, 255, 0.2);
max-width: 100%;
max-height :100%;
}
.dropdown-menu > .user-header{
background: rgb(<?php echo $colorbackhmenu1 ?>);
}
.dropdown-menu .dropdown-header{
padding: 5px 10px 10px 10px;
}
.dropdown-menu > .user-footer {
background-color: #f9f9f9;
padding: 10px;
}
.user-footer:after {
clear: both;
}
.dropdown-menu > .bookmark-footer{
padding: 10px;
}
.dropdown-menu > .user-body, .dropdown-body{
padding: 15px;
border-bottom: 1px solid #f4f4f4;
border-top: 1px solid #dddddd;
white-space: normal;
}
.dropdown-menu > .bookmark-body, .dropdown-body{
padding: 10px 0;
overflow-y: auto;
max-height: 60vh ; /* fallback for browsers without support for calc() */
max-height: calc(90vh - 110px) ;
white-space: normal;
}
#topmenu-bookmark-dropdown .dropdown-menu > .bookmark-body, #topmenu-bookmark-dropdown .dropdown-body{
max-height: 60vh ; /* fallback for browsers without support for calc() */
max-height: calc(90vh - 200px) ;
}
.dropdown-body::-webkit-scrollbar {
width: 8px;
}
.dropdown-body::-webkit-scrollbar-thumb {
-webkit-border-radius: 0;
border-radius: 0;
/* background: rgb(<?php echo $colorbackhmenu1 ?>); */
background: #aaa;
}
.dropdown-body::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
-webkit-border-radius: 0;
border-radius: 0;
}
#topmenu-login-dropdown, #topmenu-bookmark-dropdown, #topmenu-global-search-dropdown {
padding: 0 5px 0 5px;
}
#topmenu-login-dropdown a:hover{
text-decoration: none;
}
#topmenuloginmoreinfo-btn{
display: block;
text-aling: right;
color:#666;
cursor: pointer;
}
#topmenuloginmoreinfo{
display: none;
clear: both;
font-size: 0.95em;
}
.button-top-menu-dropdown {
display: inline-block;
padding: 6px 12px;
margin-bottom: 0;
font-size: 14px;
font-weight: 400;
line-height: 1.42857143;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
}
.user-footer .button-top-menu-dropdown {
color: #666666;
border-radius: 0;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
border-width: 1px;
background-color: #f4f4f4;
border-color: #ddd;
}
.dropdown-menu a.top-menu-dropdown-link {
color: rgb(<?php print $colortextlink; ?>) !important;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: block;
margin: 5px 0px;
}
.dropdown-item {
display: block !important;
box-sizing: border-box;
width: 100%;
padding: .25rem 1.5rem .25rem 1rem;
clear: both;
font-weight: 400;
color: #212529 !important;
text-align: inherit;
background-color: transparent;
border: 0;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.dropdown-item::before {
/* font part */
font-family: "Font Awesome 5 Free";
font-weight: 900;
font-style: normal;
font-variant: normal;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
text-align:center;
text-decoration:none;
margin-right: 5px;
display: inline-block;
content: "\f0da";
color: rgba(0,0,0,0.3);
}
.dropdown-item.active, .dropdown-item:hover, .dropdown-item:focus {
color: #<?php echo $colortextbackhmenu; ?> !important;
text-decoration: none;
background: rgb(<?php echo $colorbackhmenu1 ?>);
}
/*
* SEARCH
*/
.dropdown-search-input {
width: 100%;
padding: 10px 35px 10px 20px;
background-color: transparent;
font-size: 14px;
line-height: 16px;
box-sizing: border-box;
color: #575756;
background-color: transparent;
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-size: 16px 16px;
background-position: 95% center;
border-radius: 50px;
border: 1px solid #c4c4c2 !important;
transition: all 250ms ease-in-out;
backface-visibility: hidden;
transform-style: preserve-3d;
}
.dropdown-search-input::placeholder {
color: color(#575756 a(0.8));
letter-spacing: 1.5px;
}
.hidden-search-result{
display: none !important; display: none !important;
} }
/* Disable the hover underline on the login */
a.login-dropdown-a:hover, a.login-dropdown-a span:hover {
text-decoration: none !important;
cursor: default;
}

View File

@ -1841,6 +1841,8 @@ ul.tmenu { /* t r b l */
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
list-style: none; list-style: none;
display: table; display: table;
margin-right: 65px; /* to keep space for bookmark */
padding-left: 5px;
} }
ul.tmenu li { ul.tmenu li {
background: rgb(<?php echo $colorbackhmenu1 ?>); background: rgb(<?php echo $colorbackhmenu1 ?>);
@ -2278,7 +2280,7 @@ div.login_block_other { padding-top: 3px; }
float: right; float: right;
vertical-align: top; vertical-align: top;
padding: 0px 0px 0px 2px !important; padding: 0px 0px 0px 2px !important;
height: 16px; height: 18px;
} }
.login_block_elem_name { .login_block_elem_name {
margin-top: 1px; margin-top: 1px;
@ -6163,6 +6165,17 @@ border-top-right-radius: 6px;
<?php
include dol_buildpath($path.'/theme/'.$theme.'/dropdown.inc.php', 0);
include dol_buildpath($path.'/theme/'.$theme.'/info-box.inc.php', 0);
include dol_buildpath($path.'/theme/'.$theme.'/progress.inc.php', 0);
include dol_buildpath($path.'/theme/eldy/timeline.inc.php', 0); // actually md use same style as eldy theme
if (!empty($conf->global->THEME_CUSTOM_CSS)) print $conf->global->THEME_CUSTOM_CSS;
if (is_object($db)) $db->close();
?>
/* This must be at end */ /* This must be at end */
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 12px; width: 12px;
@ -6177,14 +6190,7 @@ border-top-right-radius: 6px;
background: #ddd; background: #ddd;
}​ }​
div#topmenu-bookmark-dropdown {
position: fixed;
<?php right: 20px;
include dol_buildpath($path.'/theme/'.$theme.'/dropdown.inc.php', 0); }
include dol_buildpath($path.'/theme/'.$theme.'/info-box.inc.php', 0);
include dol_buildpath($path.'/theme/'.$theme.'/progress.inc.php', 0);
include dol_buildpath($path.'/theme/eldy/timeline.inc.php', 0); // actually md use same style as eldy theme
if (!empty($conf->global->THEME_CUSTOM_CSS)) print $conf->global->THEME_CUSTOM_CSS;
if (is_object($db)) $db->close();

View File

@ -144,7 +144,7 @@ class Website extends CommonObject
*/ */
public function create(User $user, $notrigger = false) public function create(User $user, $notrigger = false)
{ {
global $conf; global $conf, $langs;
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
@ -170,11 +170,24 @@ class Website extends CommonObject
if (empty($this->date_modification)) { if (empty($this->date_modification)) {
$this->date_modification = $now; $this->date_modification = $now;
} }
// Remove spaces and be sure we have main language only
$this->lang = preg_replace('/[_-].*$/', '', trim($this->lang)); // en_US or en-US -> en
$tmparray = explode(',', $this->otherlang);
if (is_array($tmparray)) {
foreach($tmparray as $key => $val) {
$tmparray[$key] = preg_replace('/[_-].*$/', '', trim($val)); // en_US or en-US -> en
}
$this->otherlang = join(',', $tmparray);
}
// Check parameters // Check parameters
if (empty($this->entity)) { if (empty($this->entity)) {
$this->entity = $conf->entity; $this->entity = $conf->entity;
} }
if (empty($this->lang)) {
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MainLanguage"));
return -1;
}
// Insert request // Insert request
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'('; $sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'(';
@ -435,7 +448,7 @@ class Website extends CommonObject
*/ */
public function update(User $user, $notrigger = false) public function update(User $user, $notrigger = false)
{ {
global $conf; global $conf, $langs;
$error = 0; $error = 0;
@ -456,6 +469,20 @@ class Website extends CommonObject
$this->status = (int) $this->status; $this->status = (int) $this->status;
} }
// Remove spaces and be sure we have main language only
$this->lang = preg_replace('/[_-].*$/', '', trim($this->lang)); // en_US or en-US -> en
$tmparray = explode(',', $this->otherlang);
if (is_array($tmparray)) {
foreach($tmparray as $key => $val) {
$tmparray[$key] = preg_replace('/[_-].*$/', '', trim($val)); // en_US or en-US -> en
}
$this->otherlang = join(',', $tmparray);
}
if (empty($this->lang)) {
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MainLanguage"));
return -1;
}
// Check parameters // Check parameters
// Put here code to add a control on parameters values // Put here code to add a control on parameters values
@ -837,7 +864,7 @@ class Website extends CommonObject
$this->ref = 'myspecimenwebsite'; $this->ref = 'myspecimenwebsite';
$this->description = 'A specimen website'; $this->description = 'A specimen website';
$this->lang = 'en'; $this->lang = 'en';
$this->otherlang = 'fr,es_MX'; $this->otherlang = 'fr,es';
$this->status = ''; $this->status = '';
$this->fk_default_home = null; $this->fk_default_home = null;
$this->virtualhost = 'http://myvirtualhost'; $this->virtualhost = 'http://myvirtualhost';
@ -975,7 +1002,7 @@ class Website extends CommonObject
fputs($fp, $line); fputs($fp, $line);
// Warning: We must keep llx_ here. It is a generic SQL. // Warning: We must keep llx_ here. It is a generic SQL.
$line = 'INSERT INTO llx_website_page(rowid, fk_page, fk_website, pageurl, aliasalt, title, description, lang, otherlang, image, keywords, status, date_creation, tms, lang, import_key, grabbed_from, type_container, htmlheader, content)'; $line = 'INSERT INTO llx_website_page(rowid, fk_page, fk_website, pageurl, aliasalt, title, description, lang, otherlang, image, keywords, status, date_creation, tms, import_key, grabbed_from, type_container, htmlheader, content)';
$line .= " VALUES("; $line .= " VALUES(";
$line .= $objectpageold->newid."__+MAX_llx_website_page__, "; $line .= $objectpageold->newid."__+MAX_llx_website_page__, ";
@ -992,7 +1019,6 @@ class Website extends CommonObject
$line .= "'".$this->db->escape($objectpageold->status)."', "; $line .= "'".$this->db->escape($objectpageold->status)."', ";
$line .= "'".$this->db->idate($objectpageold->date_creation)."', "; $line .= "'".$this->db->idate($objectpageold->date_creation)."', ";
$line .= "'".$this->db->idate($objectpageold->date_modification)."', "; $line .= "'".$this->db->idate($objectpageold->date_modification)."', ";
$line .= "'".$this->db->escape($objectpageold->lang)."', ";
$line .= ($objectpageold->import_key ? "'".$this->db->escape($objectpageold->import_key)."'" : "null").", "; $line .= ($objectpageold->import_key ? "'".$this->db->escape($objectpageold->import_key)."'" : "null").", ";
$line .= "'".$this->db->escape($objectpageold->grabbed_from)."', "; $line .= "'".$this->db->escape($objectpageold->grabbed_from)."', ";
$line .= "'".$this->db->escape($objectpageold->type_container)."', "; $line .= "'".$this->db->escape($objectpageold->type_container)."', ";
@ -1178,7 +1204,11 @@ class Website extends CommonObject
// The move is not enough, so we regenerate page // The move is not enough, so we regenerate page
$filetpl = $conf->website->dir_output.'/'.$object->ref.'/page'.$newid.'.tpl.php'; $filetpl = $conf->website->dir_output.'/'.$object->ref.'/page'.$newid.'.tpl.php';
dolSavePageContent($filetpl, $object, $objectpagestatic); $result = dolSavePageContent($filetpl, $object, $objectpagestatic);
if (!$result) {
$this->errors[] = 'Failed to write file '.basename($filetpl);
$error++;
}
// Regenerate alternative aliases pages // Regenerate alternative aliases pages
if (is_array($aliasesarray)) if (is_array($aliasesarray))
@ -1188,7 +1218,11 @@ class Website extends CommonObject
if (trim($aliasshortcuttocreate)) if (trim($aliasshortcuttocreate))
{ {
$filealias = $conf->website->dir_output.'/'.$object->ref.'/'.trim($aliasshortcuttocreate).'.php'; $filealias = $conf->website->dir_output.'/'.$object->ref.'/'.trim($aliasshortcuttocreate).'.php';
dolSavePageAlias($filealias, $object, $objectpagestatic); $result = dolSavePageAlias($filealias, $object, $objectpagestatic);
if (!$result) {
$this->errors[] = 'Failed to write file '.basename($filealias);
$error++;
}
} }
} }
} }

View File

@ -158,6 +158,9 @@ class WebsitePage extends CommonObject
$this->keywords = dol_trunc($this->keywords, 255, 'right', 'utf-8', 1); $this->keywords = dol_trunc($this->keywords, 255, 'right', 'utf-8', 1);
if ($this->aliasalt) $this->aliasalt = ','.preg_replace('/,+$/', '', preg_replace('/^,+/', '', $this->aliasalt)).','; // content in database must be ',xxx,...,yyy,' if ($this->aliasalt) $this->aliasalt = ','.preg_replace('/,+$/', '', preg_replace('/^,+/', '', $this->aliasalt)).','; // content in database must be ',xxx,...,yyy,'
// Remove spaces and be sure we have main language only
$this->lang = preg_replace('/[_-].*$/', '', trim($this->lang)); // en_US or en-US -> en
return $this->createCommon($user, $notrigger); return $this->createCommon($user, $notrigger);
} }
@ -377,6 +380,22 @@ class WebsitePage extends CommonObject
$this->keywords = dol_trunc($this->keywords, 255, 'right', 'utf-8', 1); $this->keywords = dol_trunc($this->keywords, 255, 'right', 'utf-8', 1);
if ($this->aliasalt) $this->aliasalt = ','.preg_replace('/,+$/', '', preg_replace('/^,+/', '', $this->aliasalt)).','; // content in database must be ',xxx,...,yyy,' if ($this->aliasalt) $this->aliasalt = ','.preg_replace('/,+$/', '', preg_replace('/^,+/', '', $this->aliasalt)).','; // content in database must be ',xxx,...,yyy,'
// Remove spaces and be sure we have main language only
$this->lang = preg_replace('/[_-].*$/', '', trim($this->lang)); // en_US or en-US -> en
if ($this->fk_page > 0) {
if (empty($this->lang)) {
$this->error = "ErrorLanguageMandatoryIfPageSetAsTranslationOfAnother";
return -1;
}
$tmppage = new WebsitePage($this->db);
$tmppage->fetch($this->fk_page);
if ($tmppage->lang == $this->lang) {
$this->error = "ErrorLanguageOfTranslatedPageIsSameThanThisPage";
return -1;
}
}
return $this->updateCommon($user, $notrigger); return $this->updateCommon($user, $notrigger);
} }
@ -513,7 +532,8 @@ class WebsitePage extends CommonObject
$label .= '<br>'; $label .= '<br>';
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref.'<br>'; $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref.'<br>';
$label .= '<b>'.$langs->trans('ID').':</b> '.$this->id.'<br>'; $label .= '<b>'.$langs->trans('ID').':</b> '.$this->id.'<br>';
$label .= '<b>'.$langs->trans('Title').':</b> '.$this->title; $label .= '<b>'.$langs->trans('Title').':</b> '.$this->title.'<br>';
$label .= '<b>'.$langs->trans('Language').':</b> '.$this->lang;
$url = DOL_URL_ROOT.'/website/index.php?websiteid='.$this->fk_website.'&pageid='.$this->id; $url = DOL_URL_ROOT.'/website/index.php?websiteid='.$this->fk_website.'&pageid='.$this->id;

View File

@ -860,7 +860,7 @@ if ($action == 'addcontainer')
$result = dolSavePageAlias($filealias, $object, $objectpage); $result = dolSavePageAlias($filealias, $object, $objectpage);
if (!$result) if (!$result)
{ {
setEventMessages('Failed to write file '.$filealias, null, 'errors'); setEventMessages('Failed to write file '.basename($filealias), null, 'errors');
} }
// Save page of content // Save page of content
@ -1499,8 +1499,9 @@ if ($action == 'updatemeta')
{ {
if (trim($tmpaliasalt)) if (trim($tmpaliasalt))
{ {
$result = dolSavePageAlias($pathofwebsite.'/'.trim($tmpaliasalt).'.php', $object, $objectpage); $filealias = $pathofwebsite.'/'.trim($tmpaliasalt).'.php';
if (!$result) setEventMessages('Failed to write file '.$pathofwebsite.'/'.trim($tmpaliasalt).'.php', null, 'errors'); $result = dolSavePageAlias($filealias, $object, $objectpage);
if (!$result) setEventMessages('Failed to write file '.basename($filealias), null, 'errors');
} }
} }
} }
@ -1756,7 +1757,7 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
// Save page alias // Save page alias
$result = dolSavePageAlias($filealias, $object, $objectpage); $result = dolSavePageAlias($filealias, $object, $objectpage);
if (!$result) setEventMessages('Failed to write file '.$filealias, null, 'errors'); if (!$result) setEventMessages('Failed to write file '.basename($filealias), null, 'errors');
// Save page content // Save page content
$result = dolSavePageContent($filetpl, $object, $objectpage); $result = dolSavePageContent($filetpl, $object, $objectpage);
@ -2691,18 +2692,18 @@ if ($action == 'editcss')
print '<table class="border centpercent">'; print '<table class="border centpercent">';
// Website // Website
print '<tr><td class="titlefieldcreate">'; print '<tr><td class="titlefieldcreate fieldrequired">';
print $langs->trans('WebSite'); print $langs->trans('WebSite');
print '</td><td>'; print '</td><td>';
print $websitekey; print $websitekey;
print '</td></tr>'; print '</td></tr>';
// Main language // Main language
print '<tr><td class="tdtop">'; print '<tr><td class="tdtop fieldrequired">';
$htmltext=''; $htmltext='';
print $form->textwithpicto($langs->trans('MainLanguage'), $htmltext, 1, 'help', '', 0, 2, 'WEBSITE_LANG'); print $form->textwithpicto($langs->trans('MainLanguage'), $htmltext, 1, 'help', '', 0, 2, 'WEBSITE_LANG');
print '</td><td>'; print '</td><td>';
print $formadmin->select_language((GETPOSTISSET('WEBSITE_LANG') ? GETPOST('WEBSITE_LANG', 'aZ09comma') : ($object->lang ? $object->lang : '0')), 'WEBSITE_LANG', 0, null, 1, 0, 0, 'minwidth300', 2); print $formadmin->select_language((GETPOSTISSET('WEBSITE_LANG') ? GETPOST('WEBSITE_LANG', 'aZ09comma') : ($object->lang ? $object->lang : '0')), 'WEBSITE_LANG', 0, null, 1, 0, 0, 'minwidth300', 2, 0, 0, array(), 1);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -2852,18 +2853,19 @@ if ($action == 'createsite')
print '<input type="text" class="flat maxwidth300" name="WEBSITE_REF" value="'.dol_escape_htmltag($siteref).'" autofocus>'; print '<input type="text" class="flat maxwidth300" name="WEBSITE_REF" value="'.dol_escape_htmltag($siteref).'" autofocus>';
print '</td></tr>'; print '</td></tr>';
print '<tr><td class="fieldrequired">';
print $langs->trans('MainLanguage');
print '</td><td>';
$shortlangcode = preg_replace('/[_-].*$/', '', trim($langs->defaultlang));
print $formadmin->select_language((GETPOSTISSET('WEBSITE_LANG') ? GETPOST('WEBSITE_LANG', 'aZ09comma') : $shortlangcode), 'WEBSITE_LANG', 0, null, 1, 0, 0, 'minwidth300', 2, 0, 0, array(), 1);
print '</td></tr>';
print '<tr><td>'; print '<tr><td>';
print $langs->trans('Description'); print $langs->trans('Description');
print '</td><td>'; print '</td><td>';
print '<input type="text" class="flat minwidth500" name="WEBSITE_DESCRIPTION" value="'.dol_escape_htmltag($sitedesc).'">'; print '<input type="text" class="flat minwidth500" name="WEBSITE_DESCRIPTION" value="'.dol_escape_htmltag($sitedesc).'">';
print '</td></tr>'; print '</td></tr>';
print '<tr><td>';
print $langs->trans('MainLanguage');
print '</td><td>';
print $formadmin->select_language((GETPOSTISSET('WEBSITE_LANG') ? GETPOST('WEBSITE_LANG', 'aZ09comma') : '0'), 'WEBSITE_LANG', 0, null, 1, 0, 0, 'minwidth300', 2);
print '</td></tr>';
print '<tr><td>'; print '<tr><td>';
print $langs->trans('OtherLanguages'); print $langs->trans('OtherLanguages');
print '</td><td>'; print '</td><td>';
@ -3104,7 +3106,7 @@ if ($action == 'editmeta' || $action == 'createcontainer')
foreach ($tmparray as $key) { foreach ($tmparray as $key) {
$tmpkey = trim($key); $tmpkey = trim($key);
if (strlen($key) == 2) { if (strlen($key) == 2) {
$tmpkey = strtolower($key).'_'.strtoupper($tmpkey); $tmpkey = strtolower($key);
} }
$onlykeys[$tmpkey] = $tmpkey; $onlykeys[$tmpkey] = $tmpkey;
} }
@ -3112,7 +3114,7 @@ if ($action == 'editmeta' || $action == 'createcontainer')
if (empty($object->lang) && empty($object->otherlang)) { if (empty($object->lang) && empty($object->otherlang)) {
$onlykeys = null; // We keep full list of languages $onlykeys = null; // We keep full list of languages
} }
print $formadmin->select_language($pagelang ? $pagelang : '', 'WEBSITE_LANG', 0, null, '1', 0, 0, 'minwidth200', 0, 0, 0, $onlykeys); print $formadmin->select_language($pagelang ? $pagelang : '', 'WEBSITE_LANG', 0, null, '1', 0, 0, 'minwidth200', 0, 0, 0, $onlykeys, 1);
$htmltext = $langs->trans("AvailableLanguagesAreDefinedIntoWebsiteProperties"); $htmltext = $langs->trans("AvailableLanguagesAreDefinedIntoWebsiteProperties");
print $form->textwithpicto('', $htmltext); print $form->textwithpicto('', $htmltext);
print '</td></tr>'; print '</td></tr>';