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

This commit is contained in:
ATM john 2020-02-22 11:19:49 +01:00
commit 4117aa56a2
186 changed files with 4128 additions and 2747 deletions

View File

@ -1,3 +1,4 @@
# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: Greetings PR name: Greetings PR
on: [pull_request] on: [pull_request]

View File

@ -1,4 +1,6 @@
# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: "Close stale issues (bugs and feature requests)" name: "Close stale issues (bugs and feature requests)"
on: on:
schedule: schedule:
- cron: "0 0 * * *" - cron: "0 0 * * *"

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

@ -66,8 +66,9 @@ $obj = new Facture($db);
$obj->ref = 'ABCDE'; $obj->ref = 'ABCDE';
$obj->socid = 4; // Put id of third party (rowid in llx_societe table) $obj->socid = 4; // Put id of third party (rowid in llx_societe table)
$obj->date = mktime(); $obj->date = dol_now();
$obj->note = 'A comment'; $obj->note_public = 'A public comment';
$obj->note_private = 'A private comment';
$obj->cond_reglement_id = 1; $obj->cond_reglement_id = 1;
$line1=new FactureLigne($db); $line1=new FactureLigne($db);

View File

@ -66,8 +66,9 @@ $com = new Commande($db);
$com->ref = 'ABCDE'; $com->ref = 'ABCDE';
$com->socid = 4; // Put id of third party (rowid in llx_societe table) $com->socid = 4; // Put id of third party (rowid in llx_societe table)
$com->date_commande = mktime(); $com->date = dol_now();
$com->note = 'A comment'; $com->note_public = 'A public comment';
$com->note_private = 'A private comment';
$com->source = 1; $com->source = 1;
$com->remise_percent = 0; $com->remise_percent = 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

@ -96,7 +96,7 @@ llxHeader();
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ApiSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("ApiSetup"), $linkback, 'title_setup');
print $langs->trans("ApiDesc")."<br>\n"; print '<span class="opacitymedium">'.$langs->trans("ApiDesc")."</span><br>\n";
print "<br>\n"; print "<br>\n";
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -40,6 +40,7 @@ $backtopage = GETPOST('backtopage', 'alpha');
* Actions * Actions
*/ */
$reg = array();
if (preg_match('/set_(.*)/', $action, $reg)) if (preg_match('/set_(.*)/', $action, $reg))
{ {
$code = $reg[1]; $code = $reg[1];

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

@ -1070,7 +1070,7 @@ if ($action == 'create')
$numproject = $formproject->select_projects((!empty($societe->id) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1); $numproject = $formproject->select_projects((!empty($societe->id) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1);
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>'; print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>';
$urloption = '?action=create'; $urloption = '?action=create&donotclearsession=1';
$url = dol_buildpath('comm/action/card.php', 2).$urloption; $url = dol_buildpath('comm/action/card.php', 2).$urloption;
// update task list // update task list
@ -1503,7 +1503,7 @@ if ($id > 0)
{ {
print '<td id="project-task-input-container" >'; print '<td id="project-task-input-container" >';
$urloption = '?action=create'; // we use create not edit for more flexibility $urloption = '?action=create&donotclearsession=1'; // we use create not edit for more flexibility
$url = DOL_URL_ROOT.'/comm/action/card.php'.$urloption; $url = DOL_URL_ROOT.'/comm/action/card.php'.$urloption;
// update task list // update task list

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -149,6 +150,9 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
$sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
$sql .= ", s.code_client"; $sql .= ", s.code_client";
$sql .= ", s.email";
$sql .= ", s.entity";
$sql .= ", s.code_compta";
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p"; $sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
$sql .= ", ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -193,6 +197,9 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
$companystatic->code_client = $obj->code_client; $companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas = $obj->canvas; $companystatic->canvas = $obj->canvas;
$companystatic->entity = $obj->entity;
$companystatic->email = $obj->email;
$companystatic->code_compta = $obj->code_compta;
print $companystatic->getNomUrl(1, 'customer', 16); print $companystatic->getNomUrl(1, 'customer', 16);
print '</td>'; print '</td>';
print '<td class="nowrap right">'.price($obj->total_ht).'</td></tr>'; print '<td class="nowrap right">'.price($obj->total_ht).'</td></tr>';
@ -233,6 +240,9 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
$sql = "SELECT p.rowid, p.ref, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql = "SELECT p.rowid, p.ref, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
$sql .= ", s.code_client"; $sql .= ", s.code_client";
$sql .= ", s.code_fournisseur";
$sql .= ", s.entity";
$sql .= ", s.email";
$sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p"; $sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p";
$sql .= ", ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -276,6 +286,8 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
$companystatic->code_client = $obj->code_client; $companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas = $obj->canvas; $companystatic->canvas = $obj->canvas;
$companystatic->entity = $obj->entity;
$companystatic->email = $obj->email;
print $companystatic->getNomUrl(1, 'supplier', 16); print $companystatic->getNomUrl(1, 'supplier', 16);
print '</td>'; print '</td>';
print '<td class="nowrap right">'.price($obj->total_ht).'</td></tr>'; print '<td class="nowrap right">'.price($obj->total_ht).'</td></tr>';
@ -315,6 +327,9 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
$sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
$sql .= ", s.code_client"; $sql .= ", s.code_client";
$sql .= ", s.email";
$sql .= ", s.entity";
$sql .= ", s.code_compta";
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
$sql .= ", ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -358,6 +373,8 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
$companystatic->code_client = $obj->code_client; $companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas = $obj->canvas; $companystatic->canvas = $obj->canvas;
$companystatic->email = $obj->email;
$companystatic->entity = $obj->entity;
print $companystatic->getNomUrl(1, 'customer', 16); print $companystatic->getNomUrl(1, 'customer', 16);
print '</td>'; print '</td>';
if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
@ -404,6 +421,8 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande-
$sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
$sql .= ", s.code_client"; $sql .= ", s.code_client";
$sql .= ", s.code_fournisseur"; $sql .= ", s.code_fournisseur";
$sql .= ", s.entity";
$sql .= ", s.email";
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf"; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf";
$sql .= ", ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -447,6 +466,8 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande-
$companystatic->code_client = $obj->code_client; $companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas = $obj->canvas; $companystatic->canvas = $obj->canvas;
$companystatic->entity = $obj->entity;
$companystatic->email = $obj->email;
print $companystatic->getNomUrl(1, 'supplier', 16); print $companystatic->getNomUrl(1, 'supplier', 16);
print '</td>'; print '</td>';
if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
@ -496,6 +517,9 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire)
$sql = "SELECT s.rowid, s.nom as name, s.client, s.datec, s.tms, s.canvas"; $sql = "SELECT s.rowid, s.nom as name, s.client, s.datec, s.tms, s.canvas";
$sql .= ", s.code_client"; $sql .= ", s.code_client";
$sql .= ", s.code_compta";
$sql .= ", s.entity";
$sql .= ", s.email";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE s.client IN (1, 2, 3)"; $sql .= " WHERE s.client IN (1, 2, 3)";
@ -532,6 +556,9 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire)
$companystatic->code_client = $objp->code_client; $companystatic->code_client = $objp->code_client;
$companystatic->code_fournisseur = $objp->code_fournisseur; $companystatic->code_fournisseur = $objp->code_fournisseur;
$companystatic->canvas = $objp->canvas; $companystatic->canvas = $objp->canvas;
$companystatic->code_compta = $objp->code_compta;
$companystatic->entity = $objp->entity;
$companystatic->email = $objp->email;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 48).'</td>'; print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 48).'</td>';
print '<td class="right" nowrap>'; print '<td class="right" nowrap>';
@ -560,6 +587,8 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->societe->lire)
$sql = "SELECT s.nom as name, s.rowid, s.datec as dc, s.canvas, s.tms as dm"; $sql = "SELECT s.nom as name, s.rowid, s.datec as dc, s.canvas, s.tms as dm";
$sql .= ", s.code_fournisseur"; $sql .= ", s.code_fournisseur";
$sql .= ", s.entity";
$sql .= ", s.email";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE s.fournisseur = 1"; $sql .= " WHERE s.fournisseur = 1";
@ -591,6 +620,8 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->societe->lire)
$companystatic->code_client = $objp->code_client; $companystatic->code_client = $objp->code_client;
$companystatic->code_fournisseur = $objp->code_fournisseur; $companystatic->code_fournisseur = $objp->code_fournisseur;
$companystatic->canvas = $objp->canvas; $companystatic->canvas = $objp->canvas;
$companystatic->entity = $objp->entity;
$companystatic->email = $objp->email;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'supplier', 44).'</td>'; print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'supplier', 44).'</td>';
print '<td class="right">'.dol_print_date($db->jdate($objp->dm), 'day').'</td>'; print '<td class="right">'.dol_print_date($db->jdate($objp->dm), 'day').'</td>';
@ -628,7 +659,7 @@ if ($user->rights->agenda->myactions->read)
/* /*
* Last contracts * Latest contracts
*/ */
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT
{ {
@ -636,7 +667,9 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TOD
$sql = "SELECT s.nom as name, s.rowid, s.canvas, "; $sql = "SELECT s.nom as name, s.rowid, s.canvas, ";
$sql .= ", s.code_client"; $sql .= ", s.code_client";
$sql .= " c.statut, c.rowid as contratid, p.ref, c.fin_validite as datefin, c.date_cloture as dateclo"; $sql .= ", s.entity";
$sql .= ", s.email";
$sql .= ", c.statut, c.rowid as contratid, p.ref, c.fin_validite as datefin, c.date_cloture as dateclo";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."contrat as c"; $sql .= ", ".MAIN_DB_PREFIX."contrat as c";
$sql .= ", ".MAIN_DB_PREFIX."product as p"; $sql .= ", ".MAIN_DB_PREFIX."product as p";
@ -673,6 +706,8 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TOD
$companystatic->code_client = $objp->code_client; $companystatic->code_client = $objp->code_client;
$companystatic->code_fournisseur = $objp->code_fournisseur; $companystatic->code_fournisseur = $objp->code_fournisseur;
$companystatic->canvas = $objp->canvas; $companystatic->canvas = $objp->canvas;
$companystatic->entity = $objp->entity;
$companystatic->email = $objp->email;
print $companystatic->getNomUrl(1, 'customer', 44); print $companystatic->getNomUrl(1, 'customer', 44);
print '</td>'."\n"; print '</td>'."\n";
print "<td class=\"right\">".$staticcontrat->LibStatut($obj->statut, 3)."</td></tr>\n"; print "<td class=\"right\">".$staticcontrat->LibStatut($obj->statut, 3)."</td></tr>\n";
@ -697,6 +732,8 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
$langs->load("propal"); $langs->load("propal");
$sql = "SELECT s.nom as name, s.rowid, s.code_client"; $sql = "SELECT s.nom as name, s.rowid, s.code_client";
$sql .= ", s.entity";
$sql .= ", s.email";
$sql .= ", p.rowid as propalid, p.entity, p.total as total_ttc, p.total_ht, p.tva as total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; $sql .= ", p.rowid as propalid, p.entity, p.total as total_ttc, p.total_ht, p.tva as total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."propal as p"; $sql .= ", ".MAIN_DB_PREFIX."propal as p";
@ -760,6 +797,8 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
$companystatic->code_client = $obj->code_client; $companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas = $obj->canvas; $companystatic->canvas = $obj->canvas;
$companystatic->entity = $obj->entity;
$companystatic->email = $obj->email;
print $companystatic->getNomUrl(1, 'customer', 44); print $companystatic->getNomUrl(1, 'customer', 44);
print '</td>'; print '</td>';
print '<td class="right">'; print '<td class="right">';
@ -802,6 +841,8 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
$sql = "SELECT s.nom as name, s.rowid, c.rowid as commandeid, c.total_ttc, c.total_ht, c.tva as total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed"; $sql = "SELECT s.nom as name, s.rowid, c.rowid as commandeid, c.total_ttc, c.total_ht, c.tva as total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed";
$sql .= ", s.code_client"; $sql .= ", s.code_client";
$sql .= ", s.entity";
$sql .= ", s.email";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."commande as c"; $sql .= ", ".MAIN_DB_PREFIX."commande as c";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -864,6 +905,8 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
$companystatic->code_client = $obj->code_client; $companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas = $obj->canvas; $companystatic->canvas = $obj->canvas;
$companystatic->entity = $obj->entity;
$companystatic->email = $obj->email;
print $companystatic->getNomUrl(1, 'customer', 44); print $companystatic->getNomUrl(1, 'customer', 44);
print '</td>'; print '</td>';
print '<td class="right">'; print '<td class="right">';

View File

@ -377,8 +377,9 @@ class Proposals extends DolibarrApi
* @url DELETE {id}/lines/{lineid} * @url DELETE {id}/lines/{lineid}
* *
* @return int * @return int
* @throws 401 *
* @throws 404 * @throws RestException 401
* @throws RestException 404
*/ */
public function deleteLine($id, $lineid) public function deleteLine($id, $lineid)
{ {
@ -417,8 +418,9 @@ class Proposals extends DolibarrApi
* @url POST {id}/contact/{contactid}/{type} * @url POST {id}/contact/{contactid}/{type}
* *
* @return int * @return int
* @throws 401 *
* @throws 404 * @throws RestException 401
* @throws RestException 404
*/ */
public function postContact($id, $contactid, $type) public function postContact($id, $contactid, $type)
{ {
@ -458,9 +460,10 @@ class Proposals extends DolibarrApi
* @url DELETE {id}/contact/{rowid} * @url DELETE {id}/contact/{rowid}
* *
* @return int * @return int
* @throws 401 *
* @throws 404 * @throws RestException 401
* @throws 500 * @throws RestException 404
* @throws RestException 500
*/ */
public function deleteContact($id, $rowid) public function deleteContact($id, $rowid)
{ {
@ -629,10 +632,10 @@ class Proposals extends DolibarrApi
* *
* @url POST {id}/validate * @url POST {id}/validate
* *
* @throws 304 * @throws RestException 304
* @throws 401 * @throws RestException 401
* @throws 404 * @throws RestException 404
* @throws 500 * @throws RestException 500
* *
* @return array * @return array
*/ */

View File

@ -425,8 +425,9 @@ class Orders extends DolibarrApi
* @url DELETE {id}/lines/{lineid} * @url DELETE {id}/lines/{lineid}
* *
* @return int * @return int
* @throws 401 *
* @throws 404 * @throws RestException 401
* @throws RestException 404
*/ */
public function deleteLine($id, $lineid) public function deleteLine($id, $lineid)
{ {
@ -463,8 +464,9 @@ class Orders extends DolibarrApi
* @url POST {id}/contact/{contactid}/{type} * @url POST {id}/contact/{contactid}/{type}
* *
* @return int * @return int
* @throws 401 *
* @throws 404 * @throws RestException 401
* @throws RestException 404
*/ */
public function postContact($id, $contactid, $type) public function postContact($id, $contactid, $type)
{ {
@ -499,9 +501,10 @@ class Orders extends DolibarrApi
* @url DELETE {id}/contact/{rowid} * @url DELETE {id}/contact/{rowid}
* *
* @return int * @return int
* @throws 401 *
* @throws 404 * @throws RestException 401
* @throws 500 * @throws RestException 404
* @throws RestException 500
*/ */
public function deleteContact($id, $rowid) public function deleteContact($id, $rowid)
{ {
@ -617,10 +620,10 @@ class Orders extends DolibarrApi
* *
* @url POST {id}/validate * @url POST {id}/validate
* *
* @throws 304 * @throws RestException 304
* @throws 401 * @throws RestException 401
* @throws 404 * @throws RestException 404
* @throws 500 * @throws RestException 500
* *
* @return array * @return array
*/ */
@ -670,11 +673,11 @@ class Orders extends DolibarrApi
* *
* @return int * @return int
* *
* @throws 304 * @throws RestException 304
* @throws 400 * @throws RestException 400
* @throws 401 * @throws RestException 401
* @throws 404 * @throws RestException 404
* @throws 405 * @throws RestException 405
*/ */
public function reopen($id) public function reopen($id)
{ {
@ -709,10 +712,10 @@ class Orders extends DolibarrApi
* *
* @return int * @return int
* *
* @throws 400 * @throws RestException 400
* @throws 401 * @throws RestException 401
* @throws 404 * @throws RestException 404
* @throws 405 * @throws RestException 405
*/ */
public function setinvoiced($id) public function setinvoiced($id)
{ {
@ -849,10 +852,10 @@ class Orders extends DolibarrApi
* @url POST /createfromproposal/{proposalid} * @url POST /createfromproposal/{proposalid}
* *
* @return int * @return int
* @throws 400 * @throws RestException 400
* @throws 401 * @throws RestException 401
* @throws 404 * @throws RestException 404
* @throws 405 * @throws RestException 405
*/ */
public function createOrderFromProposal($proposalid) public function createOrderFromProposal($proposalid)
{ {

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');
@ -77,7 +77,22 @@ if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
$entity = GETPOST('entity', 'int') ?GETPOST('entity', 'int') : $conf->entity; // Define $arrayofentities if multientity is set.
$arrayofentities = array();
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
$arrayofentities = $mc->getEntitiesList();
}
$entity = (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : (GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $conf->entity));
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
if (empty($entity) && !empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) {
$entity = '0,'.join(',', array_keys($arrayofentities));
}
}
if (empty($entity)) $entity = $conf->entity;
$error = 0;
/* /*
@ -103,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.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
$sql .= " SELECT t.rowid as id, 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"; 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 .= " 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
$sql .= " SELECT t.rowid as id, 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"; 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 .= " 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
$sql .= " SELECT t.rowid as id, 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"; 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 .= " 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
$sql .= " SELECT t.rowid as id, 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"; 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 .= " 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
$sql .= " SELECT t.rowid as id, 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"; 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 .= " 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;
@ -223,11 +256,11 @@ 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();
$nofile['id'] = $objd->id; $nofile['id'] = $objd->id;
$nofile['entity'] = $objd->entity;
$nofile['date'] = $db->idate($objd->date); $nofile['date'] = $db->idate($objd->date);
$nofile['paid'] = $objd->paid; $nofile['paid'] = $objd->paid;
$nofile['amount_ht'] = $objd->total_ht; $nofile['amount_ht'] = $objd->total_ht;
@ -248,6 +281,7 @@ if (($action == "searchfiles" || $action == "dl")) {
foreach ($files as $key => $file) foreach ($files as $key => $file)
{ {
$file['id'] = $objd->id; $file['id'] = $objd->id;
$file['entity'] = $objd->entity;
$file['date'] = $db->idate($objd->date); $file['date'] = $db->idate($objd->date);
$file['paid'] = $objd->paid; $file['paid'] = $objd->paid;
$file['amount_ht'] = $objd->total_ht; $file['amount_ht'] = $objd->total_ht;
@ -288,6 +322,9 @@ if (($action == "searchfiles" || $action == "dl")) {
$db->free($resd); $db->free($resd);
} }
else {
setEventMessages($langs->trans("ErrorAtLeastOneObjectMustBeSelected"), null, 'errors');
}
} }
@ -314,6 +351,10 @@ if ($result && $action == "dl" && !$error)
dol_mkdir($dirfortmpfile); dol_mkdir($dirfortmpfile);
$log = $langs->transnoentitiesnoconv("Type"); $log = $langs->transnoentitiesnoconv("Type");
if (!empty($conf->multicompany->enabled) && is_object($mc))
{
$log .= ','.$langs->transnoentitiesnoconv("Entity");
}
$log .= ','.$langs->transnoentitiesnoconv("Date"); $log .= ','.$langs->transnoentitiesnoconv("Date");
$log .= ','.$langs->transnoentitiesnoconv("Ref"); $log .= ','.$langs->transnoentitiesnoconv("Ref");
$log .= ','.$langs->transnoentitiesnoconv("TotalHT"); $log .= ','.$langs->transnoentitiesnoconv("TotalHT");
@ -341,19 +382,24 @@ if ($result && $action == "dl" && !$error)
} }
} }
$log .= $file['item']; $log .= '"'.$langs->trans($file['item']).'"';
if (!empty($conf->multicompany->enabled) && is_object($mc))
{
$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();
@ -383,11 +429,13 @@ $form = new Form($db);
$userstatic = new User($db); $userstatic = new User($db);
$title = $langs->trans("ComptaFiles").' - '.$langs->trans("List"); $title = $langs->trans("ComptaFiles").' - '.$langs->trans("List");
$help_url = '';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
$h = 0; $h = 0;
$head[$h][0] = $_SERVER["PHP_SELF"].$varlink; $head = array();
$head[$h][0] = $_SERVER["PHP_SELF"];
$head[$h][1] = $langs->trans("AccountantFiles"); $head[$h][1] = $langs->trans("AccountantFiles");
$head[$h][2] = 'AccountancyFiles'; $head[$h][2] = 'AccountancyFiles';
@ -400,16 +448,38 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
print $langs->trans("ReportPeriod").': '.$form->selectDate($date_start, 'date_start', 0, 0, 0, "", 1, 1, 0); print $langs->trans("ReportPeriod").': '.$form->selectDate($date_start, 'date_start', 0, 0, 0, "", 1, 1, 0);
print ' - '.$form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0)."\n</a>"; print ' - '.$form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0)."\n</a>";
// Export is for current company only ! // Export is for current company only
if (!empty($conf->multicompany->enabled) && is_object($mc)) if (!empty($conf->multicompany->enabled) && is_object($mc))
{ {
$mc->getInfo($conf->entity);
print '<span class="marginleftonly marginrightonly">('.$langs->trans("Entity").' : '; print '<span class="marginleftonly marginrightonly">('.$langs->trans("Entity").' : ';
$mc->dao->getEntities(); print "<td>";
$mc->dao->fetch($conf->entity); if (!empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) {
print $mc->dao->label; print $mc->select_entities(GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $mc->id, 'search_entity', '', false, false, false, false, true);
} else {
print $mc->label;
}
print "</td>";
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";
@ -433,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

@ -183,10 +183,10 @@ class BankAccounts extends DolibarrApi
* *
* @status 201 * @status 201
* *
* @throws 401 Unauthorized: User does not have permission to configure bank accounts * @throws RestException 401 Unauthorized: User does not have permission to configure bank accounts
* @throws 404 Not Found: Either the source or the destination bankaccount for the provided id does not exist * @throws RestException 404 Not Found: Either the source or the destination bankaccount for the provided id does not exist
* @throws 422 Unprocessable Entity: Refer to detailed exception message for the cause * @throws RestException 422 Unprocessable Entity: Refer to detailed exception message for the cause
* @throws 500 Internal Server Error: Error(s) returned by the RDBMS * @throws RestException 500 Internal Server Error: Error(s) returned by the RDBMS
*/ */
public function transfer($bankaccount_from_id = 0, $bankaccount_to_id = 0, $date = null, $description = "", $amount = 0.0, $amount_to = 0.0) public function transfer($bankaccount_from_id = 0, $bankaccount_to_id = 0, $date = null, $description = "", $amount = 0.0, $amount_to = 0.0)
{ {

View File

@ -290,7 +290,10 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
if ($obj->family == 'invoice') { if ($obj->family == 'invoice') {
$mc->getInfo($obj->entity); $mc->getInfo($obj->entity);
print "<td>".$mc->label."</td>"; print "<td>".$mc->label."</td>";
}else print "<td></td>"; }
else {
print "<td></td>";
}
} }
print "<td>".$refcomp."</td>"; print "<td>".$refcomp."</td>";
if ($obj->total_ttc < 0) { print '<td class="nowrap right">'.price(abs($total_ttc))."</td><td>&nbsp;</td>"; }; if ($obj->total_ttc < 0) { print '<td class="nowrap right">'.price(abs($total_ttc))."</td><td>&nbsp;</td>"; };

View File

@ -101,6 +101,9 @@ $usehm = (!empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? $conf->global-
$object = new Facture($db); $object = new Facture($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
// Load object // Load object
if ($id > 0 || !empty($ref)) { if ($id > 0 || !empty($ref)) {
if ($action != 'add') { if ($action != 'add') {
@ -143,6 +146,7 @@ if(empty($conf->global->USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION)) {
$RetainedWarrantyInvoiceAvailableType = array( Facture::TYPE_SITUATION ); $RetainedWarrantyInvoiceAvailableType = array( Facture::TYPE_SITUATION );
} }
/* /*
* Actions * Actions
*/ */

View File

@ -242,10 +242,10 @@ class Invoices extends DolibarrApi
* @url POST /createfromorder/{orderid} * @url POST /createfromorder/{orderid}
* *
* @return int * @return int
* @throws 400 * @throws RestException 400
* @throws 401 * @throws RestException 401
* @throws 404 * @throws RestException 404
* @throws 405 * @throws RestException 405
*/ */
public function createInvoiceFromOrder($orderid) public function createInvoiceFromOrder($orderid)
{ {
@ -318,10 +318,9 @@ class Invoices extends DolibarrApi
* *
* @return array * @return array
* *
* @throws 200 * @throws RestException 304
* @throws 304 * @throws RestException 401
* @throws 401 * @throws RestException 404 Invoice not found
* @throws 404
*/ */
public function putLine($id, $lineid, $request_data = null) public function putLine($id, $lineid, $request_data = null)
{ {
@ -383,8 +382,9 @@ class Invoices extends DolibarrApi
* @url POST {id}/contact/{contactid}/{type} * @url POST {id}/contact/{contactid}/{type}
* *
* @return int * @return int
* @throws 401 *
* @throws 404 * @throws RestException 401
* @throws RestException 404
*/ */
public function postContact($id, $contactid, $type) public function postContact($id, $contactid, $type)
{ {
@ -424,9 +424,10 @@ class Invoices extends DolibarrApi
* @url DELETE {id}/contact/{rowid} * @url DELETE {id}/contact/{rowid}
* *
* @return array * @return array
* @throws 401 *
* @throws 404 * @throws RestException 401
* @throws 500 * @throws RestException 404
* @throws RestException 500
*/ */
public function deleteContact($id, $rowid) public function deleteContact($id, $rowid)
{ {
@ -463,10 +464,10 @@ class Invoices extends DolibarrApi
* *
* @return array * @return array
* *
* @throws 400 * @throws RestException 400
* @throws 401 * @throws RestException 401
* @throws 404 * @throws RestException 404
* @throws 405 * @throws RestException 405
*/ */
public function deleteLine($id, $lineid) public function deleteLine($id, $lineid)
{ {
@ -591,10 +592,9 @@ class Invoices extends DolibarrApi
* *
* @return int * @return int
* *
* @throws 200 * @throws RestException 401
* @throws 401 * @throws RestException 404
* @throws 404 * @throws RestException 400
* @throws 400
*/ */
public function postLine($id, $request_data = null) public function postLine($id, $request_data = null)
{ {
@ -673,11 +673,10 @@ class Invoices extends DolibarrApi
* *
* @return array * @return array
* *
* @throws 200 * @throws RestException 304
* @throws 304 * @throws RestException 401
* @throws 401 * @throws RestException 404
* @throws 404 * @throws RestException 500
* @throws 500
* *
*/ */
public function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0) public function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0)
@ -723,11 +722,10 @@ class Invoices extends DolibarrApi
* *
* @return array * @return array
* *
* @throws 200 * @throws RestException 304
* @throws 304 * @throws RestException 401
* @throws 401 * @throws RestException 404
* @throws 404 * @throws RestException 500
* @throws 500
* *
*/ */
public function settodraft($id, $idwarehouse = -1) public function settodraft($id, $idwarehouse = -1)
@ -827,11 +825,10 @@ class Invoices extends DolibarrApi
* *
* @return array An invoice object * @return array An invoice object
* *
* @throws 200 * @throws RestException 304
* @throws 304 * @throws RestException 401
* @throws 401 * @throws RestException 404
* @throws 404 * @throws RestException 500
* @throws 500
*/ */
public function settopaid($id, $close_code = '', $close_note = '') public function settopaid($id, $close_code = '', $close_note = '')
{ {
@ -878,11 +875,10 @@ class Invoices extends DolibarrApi
* *
* @return array An invoice object * @return array An invoice object
* *
* @throws 200 * @throws RestException 304
* @throws 304 * @throws RestException 401
* @throws 401 * @throws RestException 404
* @throws 404 * @throws RestException 500
* @throws 500
*/ */
public function settounpaid($id) public function settounpaid($id)
{ {
@ -927,11 +923,10 @@ class Invoices extends DolibarrApi
* *
* @return array An invoice object * @return array An invoice object
* *
* @throws 200 * @throws RestException 304
* @throws 304 * @throws RestException 401
* @throws 401 * @throws RestException 404
* @throws 404 * @throws RestException 500
* @throws 500
*/ */
public function markAsCreditAvailable($id) public function markAsCreditAvailable($id)
{ {
@ -1103,10 +1098,10 @@ class Invoices extends DolibarrApi
* @url POST {id}/usediscount/{discountid} * @url POST {id}/usediscount/{discountid}
* *
* @return int * @return int
* @throws 400 * @throws RestException 400
* @throws 401 * @throws RestException 401
* @throws 404 * @throws RestException 404
* @throws 405 * @throws RestException 405
*/ */
public function useDiscount($id, $discountid) public function useDiscount($id, $discountid)
{ {
@ -1149,10 +1144,10 @@ class Invoices extends DolibarrApi
* @url POST {id}/usecreditnote/{discountid} * @url POST {id}/usecreditnote/{discountid}
* *
* @return int * @return int
* @throws 400 * @throws RestException 400
* @throws 401 * @throws RestException 401
* @throws 404 * @throws RestException 404
* @throws 405 * @throws RestException 405
*/ */
public function useCreditNote($id, $discountid) public function useCreditNote($id, $discountid)
{ {
@ -1194,10 +1189,11 @@ class Invoices extends DolibarrApi
* @url GET {id}/payments * @url GET {id}/payments
* *
* @return array * @return array
* @throws 400 *
* @throws 401 * @throws RestException 400
* @throws 404 * @throws RestException 401
* @throws 405 * @throws RestException 404
* @throws RestException 405
*/ */
public function getPayments($id) public function getPayments($id)
{ {
@ -1243,9 +1239,9 @@ class Invoices extends DolibarrApi
* @url POST {id}/payments * @url POST {id}/payments
* *
* @return int Payment ID * @return int Payment ID
* @throws 400 * @throws RestException 400
* @throws 401 * @throws RestException 401
* @throws 404 * @throws RestException 404
*/ */
public function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '') public function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '')
{ {
@ -1362,10 +1358,10 @@ class Invoices extends DolibarrApi
* @url POST /paymentsdistributed * @url POST /paymentsdistributed
* *
* @return int Payment ID * @return int Payment ID
* @throws 400 * @throws RestException 400
* @throws 401 * @throws RestException 401
* @throws 403 * @throws RestException 403
* @throws 404 * @throws RestException 404
*/ */
public function addPaymentDistributed($arrayofamounts, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '') public function addPaymentDistributed($arrayofamounts, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '')
{ {

View File

@ -1253,6 +1253,14 @@ class Facture extends CommonInvoice
$line->date_start = $object->lines[$i]->date_start; $line->date_start = $object->lines[$i]->date_start;
$line->date_end = $object->lines[$i]->date_end; $line->date_end = $object->lines[$i]->date_end;
// Multicurrency
$line->fk_multicurrency = $object->lines[$i]->fk_multicurrency;
$line->multicurrency_code = $object->lines[$i]->multicurrency_code;
$line->multicurrency_subprice = $object->lines[$i]->multicurrency_subprice;
$line->multicurrency_total_ht = $object->lines[$i]->multicurrency_total_ht;
$line->multicurrency_total_tva = $object->lines[$i]->multicurrency_total_tva;
$line->multicurrency_total_ttc = $object->lines[$i]->multicurrency_total_ttc;
$line->fk_fournprice = $object->lines[$i]->fk_fournprice; $line->fk_fournprice = $object->lines[$i]->fk_fournprice;
$marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht); $marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht);
$line->pa_ht = $marginInfos[0]; $line->pa_ht = $marginInfos[0];
@ -1267,6 +1275,7 @@ class Facture extends CommonInvoice
$this->socid = $object->socid; $this->socid = $object->socid;
$this->fk_project = $object->fk_project; $this->fk_project = $object->fk_project;
$this->fk_account = $object->fk_account;
$this->cond_reglement_id = $object->cond_reglement_id; $this->cond_reglement_id = $object->cond_reglement_id;
$this->mode_reglement_id = $object->mode_reglement_id; $this->mode_reglement_id = $object->mode_reglement_id;
$this->availability_id = $object->availability_id; $this->availability_id = $object->availability_id;

View File

@ -97,6 +97,8 @@ if (empty($reshook))
$totalpayment = 0; $totalpayment = 0;
$multicurrency_totalpayment = 0; $multicurrency_totalpayment = 0;
$atleastonepaymentnotnull = 0; $atleastonepaymentnotnull = 0;
$formquestion = array();
$i = 0;
// Generate payment array and check if there is payment higher than invoice and payment date before invoice date // Generate payment array and check if there is payment higher than invoice and payment date before invoice date
$tmpinvoice = new Facture($db); $tmpinvoice = new Facture($db);
@ -216,7 +218,7 @@ if (empty($reshook))
{ {
$error = 0; $error = 0;
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $datepaye = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$db->begin(); $db->begin();
@ -262,8 +264,10 @@ if (empty($reshook))
$paiement->amounts = $amounts; // Array with all payments dispatching with invoice id $paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching $paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
$paiement->paiementid = dol_getIdFromCode($db, GETPOST('paiementcode'), 'c_paiement', 'code', 'id', 1); $paiement->paiementid = dol_getIdFromCode($db, GETPOST('paiementcode'), 'c_paiement', 'code', 'id', 1);
$paiement->num_paiement = GETPOST('num_paiement', 'alpha'); $paiement->num_payment = GETPOST('num_paiement', 'alpha');
$paiement->note = GETPOST('comment', 'alpha'); $paiement->note_private = GETPOST('comment', 'alpha');
$paiement->num_paiement = $paiement->num_payment; // For bacward compatibility
$paiement->note = $paiement->note_private; // For bacward compatibility
if (!$error) if (!$error)
{ {

View File

@ -57,7 +57,7 @@ class PaymentSocialContribution extends CommonObject
/** /**
* @deprecated * @deprecated
* @see amount * @see $amount
*/ */
public $total; public $total;

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016 Frédéric France <frederic.france@free.fr> * Copyright (C) 2016 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -29,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
if (!empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('compta', 'banks', 'bills')); $langs->loadLangs(array('compta', 'banks', 'bills'));
@ -52,6 +54,8 @@ $search_status = GETPOST('search_status', 'int');
$search_day_lim = GETPOST('search_day_lim', 'int'); $search_day_lim = GETPOST('search_day_lim', 'int');
$search_month_lim = GETPOST('search_month_lim', 'int'); $search_month_lim = GETPOST('search_month_lim', 'int');
$search_year_lim = GETPOST('search_year_lim', 'int'); $search_year_lim = GETPOST('search_year_lim', 'int');
$search_project_ref = GETPOST('search_project_ref', 'alpha');
$search_project = GETPOST('search_project', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');
@ -93,6 +97,8 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_day_lim = ''; $search_day_lim = '';
$search_year_lim = ''; $search_year_lim = '';
$search_month_lim = ''; $search_month_lim = '';
$search_project_ref = '';
$search_project = '';
$toselect = ''; $toselect = '';
$search_array_options = array(); $search_array_options = array();
} }
@ -106,21 +112,25 @@ $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
$formsocialcontrib = new FormSocialContrib($db); $formsocialcontrib = new FormSocialContrib($db);
$chargesociale_static = new ChargeSociales($db); $chargesociale_static = new ChargeSociales($db);
if (!empty($conf->projet->enabled)) $projectstatic = new Project($db);
llxHeader('', $langs->trans("SocialContributions")); llxHeader('', $langs->trans("SocialContributions"));
$sql = "SELECT cs.rowid as id, cs.fk_type as type, "; $sql = "SELECT cs.rowid as id, cs.fk_type as type, ";
$sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode,"; $sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode,";
if (!empty($conf->projet->enabled)) $sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
$sql .= " c.libelle as type_label,"; $sql .= " c.libelle as type_label,";
$sql .= " SUM(pc.amount) as alreadypayed"; $sql .= " SUM(pc.amount) as alreadypayed";
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,"; $sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
$sql .= " ".MAIN_DB_PREFIX."chargesociales as cs"; $sql .= " ".MAIN_DB_PREFIX."chargesociales as cs";
if (!empty($conf->projet->enabled)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = cs.fk_projet";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
$sql .= " WHERE cs.fk_type = c.id"; $sql .= " WHERE cs.fk_type = c.id";
$sql .= " AND cs.entity = ".$conf->entity; $sql .= " AND cs.entity = ".$conf->entity;
// Search criteria // Search criteria
if ($search_ref) $sql .= " AND cs.rowid=".$db->escape($search_ref); if ($search_ref) $sql .= " AND cs.rowid=".$db->escape($search_ref);
if ($search_label) $sql .= natural_search("cs.libelle", $search_label); if ($search_label) $sql .= natural_search("cs.libelle", $search_label);
if (!empty($conf->projet->enabled)) if ($search_project_ref != '') $sql .= natural_search("p.ref", $search_project_ref);
if ($search_amount) $sql .= natural_search("cs.amount", $search_amount, 1); if ($search_amount) $sql .= natural_search("cs.amount", $search_amount, 1);
if ($search_status != '' && $search_status >= 0) $sql .= " AND cs.paye = ".$db->escape($search_status); if ($search_status != '' && $search_status >= 0) $sql .= " AND cs.paye = ".$db->escape($search_status);
$sql .= dolSqlDateFilter("cs.periode", $search_day_lim, $search_month_lim, $search_year_lim); $sql .= dolSqlDateFilter("cs.periode", $search_day_lim, $search_month_lim, $search_year_lim);
@ -163,6 +173,7 @@ if ($resql)
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
if ($search_label) $param .= '&search_label='.urlencode($search_label); if ($search_label) $param .= '&search_label='.urlencode($search_label);
if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref);
if ($search_amount) $param .= '&search_amount='.urlencode($search_amount); if ($search_amount) $param .= '&search_amount='.urlencode($search_amount);
if ($search_typeid) $param .= '&search_typeid='.urlencode($search_typeid); if ($search_typeid) $param .= '&search_typeid='.urlencode($search_typeid);
if ($search_status != '' && $search_status != '-1') $param .= '&search_status='.urlencode($search_status); if ($search_status != '' && $search_status != '-1') $param .= '&search_status='.urlencode($search_status);
@ -217,6 +228,8 @@ if ($resql)
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
$formsocialcontrib->select_type_socialcontrib($search_typeid, 'search_typeid', 1, 0, 0, 'maxwidth100onsmartphone'); $formsocialcontrib->select_type_socialcontrib($search_typeid, 'search_typeid', 1, 0, 0, 'maxwidth100onsmartphone');
print '</td>'; print '</td>';
// Ref Project
if (!empty($conf->projet->enabled)) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.$search_project_ref.'"></td>';
// Date // Date
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
// Period end date // Period end date
@ -245,6 +258,7 @@ if ($resql)
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "id", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "id", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "cs.libelle", "", $param, 'class="left"', $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "cs.libelle", "", $param, 'class="left"', $sortfield, $sortorder);
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder); print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder);
if (!empty($conf->projet->enabled)) print_liste_field_titre('ProjectRef', $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "cs.date_ech", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "cs.date_ech", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "periode", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "periode", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "cs.amount", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "cs.amount", "", $param, 'class="right"', $sortfield, $sortorder);
@ -262,6 +276,11 @@ if ($resql)
$chargesociale_static->ref = $obj->id; $chargesociale_static->ref = $obj->id;
$chargesociale_static->label = $obj->label; $chargesociale_static->label = $obj->label;
$chargesociale_static->type_label = $obj->type_label; $chargesociale_static->type_label = $obj->type_label;
if (!empty($conf->projet->enabled)) {
$projectstatic->id = $obj->project_id;
$projectstatic->ref = $obj->project_ref;
$projectstatic->title = $obj->project_label;
}
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -277,6 +296,17 @@ if ($resql)
print "<td>".$obj->type_label."</td>\n"; print "<td>".$obj->type_label."</td>\n";
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
// Project Ref
if (!empty($conf->projet->enabled)) {
print '<td class="nowrap">';
if ($obj->project_id > 0)
{
print $projectstatic->getNomUrl(1);
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Date // Date
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>'; print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;

View File

@ -407,7 +407,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++)
print "<td>".dol_print_date(dol_mktime(12,0,0,$mois,1,2000),"%B")."</td>"; print "<td>".dol_print_date(dol_mktime(12,0,0,$mois,1,2000),"%B")."</td>";
for ($annee = $year_start ; $annee <= $year_end ; $annee++) for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{ {
$casenow = dol_print_date(mktime(),"%Y-%m"); $casenow = dol_print_date(dol_now(),"%Y-%m");
$case = dol_print_date(dol_mktime(1,1,1,$mois,1,$annee),"%Y-%m"); $case = dol_print_date(dol_mktime(1,1,1,$mois,1,$annee),"%Y-%m");
$caseprev = dol_print_date(dol_mktime(1,1,1,$mois,1,$annee-1),"%Y-%m"); $caseprev = dol_print_date(dol_mktime(1,1,1,$mois,1,$annee-1),"%Y-%m");

View File

@ -554,6 +554,8 @@ else
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
$object->fetchRoles();
// Show tabs // Show tabs
$head = contact_prepare_head($object); $head = contact_prepare_head($object);
@ -580,7 +582,7 @@ else
$object->country = $tmparray['label']; $object->country = $tmparray['label'];
} }
$title = $addcontact = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"));
$linkback = ''; $linkback = '';
print load_fiche_titre($title, $linkback, 'address'); print load_fiche_titre($title, $linkback, 'address');

View File

@ -314,9 +314,9 @@ class Contact extends CommonObject
// Clean parameters // Clean parameters
$this->lastname = $this->lastname ?trim($this->lastname) : trim($this->name); $this->lastname = $this->lastname ?trim($this->lastname) : trim($this->name);
$this->firstname = trim($this->firstname); $this->firstname = trim($this->firstname);
if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = ucwords($this->lastname); if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = ucwords(strtolower($this->lastname));
if (!empty($conf->global->MAIN_ALL_TO_UPPER)) $this->lastname = strtoupper($this->lastname); if (!empty($conf->global->MAIN_ALL_TO_UPPER)) $this->lastname = strtoupper($this->lastname);
if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = ucwords($this->firstname); if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = ucwords(strtolower($this->firstname));
if (empty($this->socid)) $this->socid = 0; if (empty($this->socid)) $this->socid = 0;
if (empty($this->priv)) $this->priv = 0; if (empty($this->priv)) $this->priv = 0;
if (empty($this->statut)) $this->statut = 0; // This is to convert '' into '0' to avoid bad sql request if (empty($this->statut)) $this->statut = 0; // This is to convert '' into '0' to avoid bad sql request
@ -427,9 +427,9 @@ class Contact extends CommonObject
$this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity); $this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity);
// Clean parameters // Clean parameters
if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = ucwords($this->lastname); if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = ucwords(strtolower($this->lastname));
if (!empty($conf->global->MAIN_ALL_TO_UPPER)) $this->lastname = strtoupper($this->lastname); if (!empty($conf->global->MAIN_ALL_TO_UPPER)) $this->lastname = strtoupper($this->lastname);
if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = ucwords($this->firstname); if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = ucwords(strtolower($this->firstname));
$this->lastname = trim($this->lastname) ?trim($this->lastname) : trim($this->lastname); $this->lastname = trim($this->lastname) ?trim($this->lastname) : trim($this->lastname);
$this->firstname = trim($this->firstname); $this->firstname = trim($this->firstname);
@ -802,20 +802,19 @@ class Contact extends CommonObject
/** /**
* Load object contact * Load object contact.
* *
* @param int $id id du contact * @param int $id Id of contact
* @param User $user Utilisateur (abonnes aux alertes) qui veut les alertes de ce contact * @param User $user Load also alerts of this user (subscribing to alerts) that want alerts about this contact
* @param string $ref_ext External reference, not given by Dolibarr * @param string $ref_ext External reference, not given by Dolibarr
* @param string $email Email * @param string $email Email
* @return int -1 if KO, 0 if OK but not found, 1 if OK * @param int $loadalsoroles Load also roles
* @return int >0 if OK, <0 if KO or if two records found for same ref or idprof, 0 if not found.
*/ */
public function fetch($id, $user = null, $ref_ext = '', $email = '') public function fetch($id, $user = null, $ref_ext = '', $email = '', $loadalsoroles = 0)
{ {
global $langs; global $langs;
$langs->load("dict");
dol_syslog(get_class($this)."::fetch id=".$id." ref_ext=".$ref_ext." email=".$email, LOG_DEBUG); dol_syslog(get_class($this)."::fetch id=".$id." ref_ext=".$ref_ext." email=".$email, LOG_DEBUG);
if (empty($id) && empty($ref_ext) && empty($email)) if (empty($id) && empty($ref_ext) && empty($email))
@ -824,7 +823,7 @@ class Contact extends CommonObject
return -1; return -1;
} }
$langs->load("companies"); $langs->loadLangs(array("dict", "companies"));
$sql = "SELECT c.rowid, c.entity, c.fk_soc, c.ref_ext, c.civility as civility_code, c.lastname, c.firstname,"; $sql = "SELECT c.rowid, c.entity, c.fk_soc, c.ref_ext, c.civility as civility_code, c.lastname, c.firstname,";
$sql .= " c.address, c.statut, c.zip, c.town,"; $sql .= " c.address, c.statut, c.zip, c.town,";
@ -861,7 +860,15 @@ class Contact extends CommonObject
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
if ($this->db->num_rows($resql)) $num = $this->db->num_rows($resql);
if ($num > 1)
{
$this->error = 'Fetch found several records. Rename one of contact to avoid duplicate.';
dol_syslog($this->error, LOG_ERR);
return 2;
}
elseif ($num) // $num = 1
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
@ -942,7 +949,11 @@ class Contact extends CommonObject
return -1; return -1;
} }
// Charge alertes du user // Retreive all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals();
// Load also alerts of this user
if ($user) if ($user)
{ {
$sql = "SELECT fk_user"; $sql = "SELECT fk_user";
@ -967,14 +978,13 @@ class Contact extends CommonObject
} }
} }
// Retreive all extrafield // Load also roles of this address
// fetch optionals attributes and labels if ($loadalsoroles) {
$this->fetch_optionals();
$resultRole = $this->fetchRoles(); $resultRole = $this->fetchRoles();
if ($resultRole < 0) { if ($resultRole < 0) {
return $resultRole; return $resultRole;
} }
}
return 1; return 1;
} }
@ -1587,7 +1597,7 @@ class Contact extends CommonObject
} }
/** /**
* Fetch Role for a contact * Fetch Roles for a contact
* *
* @return float|int * @return float|int
* @throws Exception * @throws Exception

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

@ -439,8 +439,9 @@ class Contracts extends DolibarrApi
* @url DELETE {id}/lines/{lineid} * @url DELETE {id}/lines/{lineid}
* *
* @return int * @return int
* @throws 401 *
* @throws 404 * @throws RestException 401
* @throws RestException 404
*/ */
public function deleteLine($id, $lineid) public function deleteLine($id, $lineid)
{ {

View File

@ -63,7 +63,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo price($totalcontrat); echo price($totalcontrat);
} ?></td> } ?></td>
<td class="right"><?php echo $objectlink->getLibStatut(7); ?></td> <td class="right"><?php echo $objectlink->getLibStatut(7); ?></td>
<td class="right"><a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td> <td class="right"><a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr> </tr>
<?php <?php
} }

View File

@ -95,7 +95,7 @@ class box_clients extends ModeleBoxes
$sql .= ", s.code_compta_fournisseur"; $sql .= ", s.code_compta_fournisseur";
$sql .= ", s.logo"; $sql .= ", s.logo";
$sql .= ", s.email"; $sql .= ", s.email";
$sql.= ", s.datec, s.tms, s.status"; $sql .= ", s.datec, s.tms, s.status, s.entity";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE s.client IN (1, 3)"; $sql .= " WHERE s.client IN (1, 3)";
@ -127,6 +127,7 @@ class box_clients extends ModeleBoxes
$thirdpartystatic->fournisseur = $objp->fournisseur; $thirdpartystatic->fournisseur = $objp->fournisseur;
$thirdpartystatic->logo = $objp->logo; $thirdpartystatic->logo = $objp->logo;
$thirdpartystatic->email = $objp->email; $thirdpartystatic->email = $objp->email;
$thirdpartystatic->entity = $objp->entity;
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => '', 'td' => '',

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2004-2006 Destailleur Laurent <eldy@users.sourceforge.net> /* Copyright (C) 2004-2006 Destailleur Laurent <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2019 Frederic France <frederic.france@free.fr> * Copyright (C) 2015-2019 Frederic France <frederic.france@free.fr>
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -86,7 +87,7 @@ class box_fournisseurs extends ModeleBoxes
{ {
$sql = "SELECT s.nom as name, s.rowid as socid, s.datec, s.tms, s.status,"; $sql = "SELECT s.nom as name, s.rowid as socid, s.datec, s.tms, s.status,";
$sql .= " s.code_fournisseur, s.email as semail,"; $sql .= " s.code_fournisseur, s.email as semail,";
$sql.= " s.logo"; $sql .= " s.logo, s.code_compta_fournisseur, s.entity";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE s.fournisseur = 1"; $sql .= " WHERE s.fournisseur = 1";
@ -112,6 +113,8 @@ class box_fournisseurs extends ModeleBoxes
$thirdpartytmp->email = $objp->semail; $thirdpartytmp->email = $objp->semail;
$thirdpartytmp->code_client = $objp->code_client; $thirdpartytmp->code_client = $objp->code_client;
$thirdpartytmp->logo = $objp->logo; $thirdpartytmp->logo = $objp->logo;
$thirdpartytmp->code_compta_fournisseur = $objp->code_compta_fournisseur;
$thirdpartytmp->entity = $objp->entity;
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => '', 'td' => '',

View File

@ -96,7 +96,7 @@ class box_project extends ModeleBoxes
$projectsListId=''; $projectsListId='';
if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid); if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
$sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public"; $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut as status, p.public";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql.= " WHERE p.entity IN (".getEntity('project').")"; // Only current entity or severals if permission ok $sql.= " WHERE p.entity IN (".getEntity('project').")"; // Only current entity or severals if permission ok
$sql.= " AND p.fk_statut = 1"; // Only open projects $sql.= " AND p.fk_statut = 1"; // Only open projects
@ -117,6 +117,7 @@ class box_project extends ModeleBoxes
$projectstatic->ref = $objp->ref; $projectstatic->ref = $objp->ref;
$projectstatic->title = $objp->title; $projectstatic->title = $objp->title;
$projectstatic->public = $objp->public; $projectstatic->public = $objp->public;
$projectstatic->statut = $objp->status;
$this->info_box_contents[$i][] = array( $this->info_box_contents[$i][] = array(
'td' => 'class="nowraponall"', 'td' => 'class="nowraponall"',
@ -152,6 +153,7 @@ class box_project extends ModeleBoxes
$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => round(0)); $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => round(0));
$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => "N/A&nbsp;"); $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => "N/A&nbsp;");
} }
$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => $projectstatic->getLibStatut(3));
$i++; $i++;
} }
@ -166,20 +168,24 @@ class box_project extends ModeleBoxes
// Add the sum à the bottom of the boxes // Add the sum à the bottom of the boxes
$this->info_box_contents[$i][] = array( $this->info_box_contents[$i][] = array(
'td' => '', 'td' => 'class="liste_total"',
'text' => $langs->trans("Total")."&nbsp;".$textHead, 'text' => $langs->trans("Total")."&nbsp;".$textHead,
'text' => "&nbsp;", 'text' => "&nbsp;",
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$i][] = array(
'td' => 'class="right" ', 'td' => 'class="right liste_total" ',
'text' => round($num, 0)."&nbsp;".$langs->trans("Projects"), 'text' => round($num, 0)."&nbsp;".$langs->trans("Projects"),
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$i][] = array(
'td' => 'class="right" ', 'td' => 'class="right liste_total" ',
'text' => (($max < $num) ? '' : (round($totalnbTask, 0)."&nbsp;".$langs->trans("Tasks"))), 'text' => (($max < $num) ? '' : (round($totalnbTask, 0)."&nbsp;".$langs->trans("Tasks"))),
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$i][] = array(
'td' => '', 'td' => 'class="liste_total"',
'text' => "&nbsp;",
);
$this->info_box_contents[$i][] = array(
'td' => 'class="liste_total"',
'text' => "&nbsp;", 'text' => "&nbsp;",
); );
} }

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2019 Frederic France <frederic.france@netlogic.fr> * Copyright (C) 2015-2019 Frederic France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -84,7 +85,7 @@ class box_propales extends ModeleBoxes
if ($user->rights->propale->lire) if ($user->rights->propale->lire)
{ {
$sql = "SELECT s.nom as name, s.rowid as socid, s.code_client, s.logo, s.email,"; $sql = "SELECT s.nom as name, s.rowid as socid, s.code_client, s.logo, s.entity, s.email,";
$sql .= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms"; $sql .= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."propal as p"; $sql .= ", ".MAIN_DB_PREFIX."propal as p";
@ -122,6 +123,7 @@ class box_propales extends ModeleBoxes
$societestatic->code_client = $objp->code_client; $societestatic->code_client = $objp->code_client;
$societestatic->logo = $objp->logo; $societestatic->logo = $objp->logo;
$societestatic->email = $objp->email; $societestatic->email = $objp->email;
$societestatic->entity = $objp->entity;
$late = ''; $late = '';
if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) { if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) {

View File

@ -144,6 +144,9 @@ class CMailFile
} }
} }
// Add autocopy to (Note: Adding bcc for specific modules are also done from pages)
if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) $addr_bcc .= ($addr_bcc ? ', ' : '').$conf->global->MAIN_MAIL_AUTOCOPY_TO;
$this->subject = $subject; $this->subject = $subject;
$this->addr_to = $to; $this->addr_to = $to;
$this->addr_from = $from; $this->addr_from = $from;
@ -267,9 +270,6 @@ class CMailFile
} }
} }
// Add autocopy to (Note: Adding bcc for specific modules are also done from pages)
if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) $addr_bcc .= ($addr_bcc ? ', ' : '').$conf->global->MAIN_MAIL_AUTOCOPY_TO;
// We set all data according to choosed sending method. // We set all data according to choosed sending method.
// We also set a value for ->msgid // We also set a value for ->msgid
if ($this->sendmode == 'mail') if ($this->sendmode == 'mail')

View File

@ -681,8 +681,6 @@ 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';

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

@ -2431,6 +2431,7 @@ class Form
$outlabel = $objp->label; $outlabel = $objp->label;
$outdesc = $objp->description; $outdesc = $objp->description;
$outbarcode = $objp->barcode; $outbarcode = $objp->barcode;
$outpbq = empty($objp->price_by_qty_rowid) ? '' : $objp->price_by_qty_rowid;
$outtype = $objp->fk_product_type; $outtype = $objp->fk_product_type;
$outdurationvalue = $outtype == Product::TYPE_SERVICE ?substr($objp->duration, 0, dol_strlen($objp->duration) - 1) : ''; $outdurationvalue = $outtype == Product::TYPE_SERVICE ?substr($objp->duration, 0, dol_strlen($objp->duration) - 1) : '';
@ -2478,7 +2479,7 @@ class Form
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; $opt .= ($objp->rowid == $selected) ? ' selected' : '';
if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0)
{ {
$opt .= ' pbq="'.$objp->price_by_qty_rowid.'" data-pbq="'.$objp->price_by_qty_rowid.'" data-pbqqty="'.$objp->price_by_qty_quantity.'" data-pbqpercent="'.$objp->price_by_qty_remise_percent.'"'; $opt .= ' pbq="'.$objp->price_by_qty_rowid.'" data-pbq="'.$objp->price_by_qty_rowid.'" data-pbqup="'.$objp->price_by_qty_unitprice.'" data-pbqbase="'.$objp->price_by_qty_price_base_type.'" data-pbqqty="'.$objp->price_by_qty_quantity.'" data-pbqpercent="'.$objp->price_by_qty_remise_percent.'"';
} }
if (!empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) if (!empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)))
{ {
@ -2664,7 +2665,7 @@ class Form
} }
$opt .= "</option>\n"; $opt .= "</option>\n";
$optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit); $optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'pbq'=>$outpbq);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

View File

@ -50,7 +50,7 @@ class FormAdmin
* @param string $selected Language pre-selected * @param string $selected Language pre-selected
* @param string $htmlname Name of HTML select * @param string $htmlname Name of HTML select
* @param int $showauto Show 'auto' choice * @param int $showauto Show 'auto' choice
* @param array $filter Array of keys to exclude in list * @param array $filter Array of keys to exclude in list (opposite of $onlykeys)
* @param string $showempty '1'=Add empty value or string to show * @param string $showempty '1'=Add empty value or string to show
* @param int $showwarning Show a warning if language is not complete * @param int $showwarning Show a warning if language is not complete
* @param int $disabled Disable edit of select * @param int $disabled Disable edit of select
@ -58,16 +58,18 @@ class FormAdmin
* @param int $showcode 1=Add language code into label at begining, 2=Add language code into label at end * @param int $showcode 1=Add language code into label at begining, 2=Add language code into label at end
* @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 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) 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='';
@ -94,19 +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;
} }
elseif ($selected == $key) if ($onlykeys && is_array($onlykeys) && ! array_key_exists($keytouse, $onlykeys)) {
continue;
}
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

@ -112,14 +112,7 @@ class FormMail extends Form
public $withfrom; public $withfrom;
/** /**
* @var int * @var int|string|array
* @deprecated Fill withto with array before calling method.
* @see $withto
*/
public $withtosocid;
/**
* @var int|int[]
*/ */
public $withto; // Show recipient emails public $withto; // Show recipient emails

View File

@ -53,6 +53,11 @@ class FormSms
public $withtopic; public $withtopic;
public $withbody; public $withbody;
/**
* @var int Id of company
*/
public $withtosocid;
public $withfromreadonly; public $withfromreadonly;
public $withreplytoreadonly; public $withreplytoreadonly;
public $withtoreadonly; public $withtoreadonly;

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

@ -1397,7 +1397,8 @@ class Ldap
//Parse flags to text //Parse flags to text
$retval = array(); $retval = array();
while (list($flag, $val) = each($flags)) { //while (list($flag, $val) = each($flags)) {
foreach ($flags as $flag => $val) {
if ($uacf >= $val) { if ($uacf >= $val) {
$uacf -= $val; $uacf -= $val;
$retval[$val] = $flag; $retval[$val] = $flag;

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

@ -107,6 +107,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
} }
} }
}); });
$("input#search_'.$htmlname.'").autocomplete({ $("input#search_'.$htmlname.'").autocomplete({
source: function( request, response ) { source: function( request, response ) {
$.get("'.$url.($urloption ? '?'.$urloption : '').'", { '.$htmlname.': request.term }, function(data){ $.get("'.$url.($urloption ? '?'.$urloption : '').'", { '.$htmlname.': request.term }, function(data){

View File

@ -297,7 +297,7 @@ function GETPOSTISSET($paramname)
* @param int $filter Filter to apply when $check is set to 'custom'. (See http://php.net/manual/en/filter.filters.php for détails) * @param int $filter Filter to apply when $check is set to 'custom'. (See http://php.net/manual/en/filter.filters.php for détails)
* @param mixed $options Options to pass to filter_var when $check is set to 'custom' * @param mixed $options Options to pass to filter_var when $check is set to 'custom'
* @param string $noreplace Force disable of replacement of __xxx__ strings. * @param string $noreplace Force disable of replacement of __xxx__ strings.
* @return string|string[] Value found (string or array), or '' if check fails * @return string|array Value found (string or array), or '' if check fails
*/ */
function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null, $options = null, $noreplace = 0) function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null, $options = null, $noreplace = 0)
{ {
@ -559,11 +559,9 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
case 'alpha': case 'alpha':
if (!is_array($out)) if (!is_array($out))
{ {
$out = trim($out);
// '"' is dangerous because param in url can close the href= or src= and add javascript functions. // '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals // '../' is dangerous because it allows dir transversals
if (preg_match('/"/', $out)) $out = ''; $out = str_replace(array('"', '../'), '', trim($out));
elseif (preg_match('/\.\.\//', $out)) $out = '';
} }
break; break;
case 'san_alpha': case 'san_alpha':
@ -593,17 +591,15 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
case 'array': case 'array':
if (!is_array($out) || empty($out)) $out = array(); if (!is_array($out) || empty($out)) $out = array();
break; break;
case 'nohtml': // Recommended for most scalar parameters case 'nohtml':
$out = dol_string_nohtmltag($out, 0); $out = dol_string_nohtmltag($out, 0);
break; break;
case 'alphanohtml': // Recommended for search parameters case 'alphanohtml': // Recommended for most scalar parameters and search parameters
if (!is_array($out)) if (!is_array($out))
{ {
$out = trim($out);
// '"' is dangerous because param in url can close the href= or src= and add javascript functions. // '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals // '../' is dangerous because it allows dir transversals
if (preg_match('/"/', $out)) $out = ''; $out = str_replace(array('"', '../'), '', trim($out));
elseif (preg_match('/\.\.\//', $out)) $out = '';
$out = dol_string_nohtmltag($out); $out = dol_string_nohtmltag($out);
} }
break; break;
@ -2106,8 +2102,6 @@ function dol_now($mode = 'gmt')
{ {
$ret = 0; $ret = 0;
// Note that gmmktime and mktime return same value (GMT) when used without parameters
//if ($mode == 'gmt') $ret=gmmktime(); // Strict Standards: gmmktime(): You should be using the time() function instead
if ($mode == 'gmt') $ret = time(); // Time for now at greenwich. if ($mode == 'gmt') $ret = time(); // Time for now at greenwich.
elseif ($mode == 'tzserver') // Time for now with PHP server timezone added elseif ($mode == 'tzserver') // Time for now with PHP server timezone added
{ {
@ -2123,7 +2117,7 @@ function dol_now($mode = 'gmt')
}*/ }*/
elseif ($mode == 'tzuser') // Time for now with user timezone added elseif ($mode == 'tzuser') // Time for now with user timezone added
{ {
//print 'time: '.time().'-'.mktime().'-'.gmmktime(); //print 'time: '.time();
$offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60;
$offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60; $offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60;
$ret = (int) (dol_now('gmt') + ($offsettz + $offsetdst)); $ret = (int) (dol_now('gmt') + ($offsettz + $offsetdst));

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

@ -2147,16 +2147,17 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder);
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{ {
if (!in_array('prospectionstatus', $hiddenfields)) print_liste_field_titre("OpportunityStatus", "", "", "", "", '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("OpportunityAmount", "", "", "", "", 'align="right"', $sortfield, $sortorder); print_liste_field_titre("OpportunityAmount", "", "", "", "", 'align="right"', $sortfield, $sortorder);
print_liste_field_titre('OpportunityWeightedAmount', '', '', '', '', 'align="right"', $sortfield, $sortorder); print_liste_field_titre('OpportunityWeightedAmount', '', '', '', '', 'align="right"', $sortfield, $sortorder);
} }
if (empty($conf->global->PROJECT_HIDE_TASKS)) if (empty($conf->global->PROJECT_HIDE_TASKS))
{ {
print_liste_field_titre("Tasks", "", "", "", "", 'align="right"', $sortfield, $sortorder); print_liste_field_titre("Tasks", "", "", "", "", 'align="right"', $sortfield, $sortorder);
if (!in_array('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload", "", "", "", "", 'align="right"', $sortfield, $sortorder); if (!in_array('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload", "", "", "", "", '', $sortfield, $sortorder, 'right ');
if (!in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared", "", "", "", "", 'align="right"', $sortfield, $sortorder); if (!in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared", "", "", "", "", '', $sortfield, $sortorder, 'right ');
} }
print_liste_field_titre("Status", "", "", "", "", 'align="right"', $sortfield, $sortorder); if (!in_array('projectstatus', $hiddenfields)) print_liste_field_titre("Status", "", "", "", "", '', $sortfield, $sortorder, 'right ');
print "</tr>\n"; print "</tr>\n";
$total_plannedworkload = 0; $total_plannedworkload = 0;
@ -2179,8 +2180,8 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
$projectstatic->datee = $db->jdate($objp->datee); $projectstatic->datee = $db->jdate($objp->datee);
$projectstatic->dateo = $db->jdate($objp->dateo); $projectstatic->dateo = $db->jdate($objp->dateo);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
print $projectstatic->getNomUrl(1); print $projectstatic->getNomUrl(1);
if (!in_array('projectlabel', $hiddenfields)) print '<br>'.dol_trunc($objp->title, 24); if (!in_array('projectlabel', $hiddenfields)) print '<br>'.dol_trunc($objp->title, 24);
@ -2194,8 +2195,35 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
print $thirdpartystatic->getNomUrl(1); print $thirdpartystatic->getNomUrl(1);
} }
print '</td>'; print '</td>';
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{ {
if (!in_array('prospectionstatus', $hiddenfields)) {
print '<td class="right">';
// Because color of prospection status has no meaning yet, it is used if hidden constant is set
if (empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) {
if ($langs->trans("OppStatus".$oppStatusCode) != "OppStatus".$oppStatusCode) {
print $langs->trans("OppStatus".$oppStatusCode);
}
} else {
if (isset($statusOppList[$objp->opp_status])) {
$oppStatusCode = $statusOppList[$objp->opp_status]['code'];
$oppStatusColor = $statusOppList[$objp->opp_status]['color'];
} else {
$oppStatusCode = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code');
$oppStatusColor = '';
}
if ($oppStatusCode) {
if (!empty($oppStatusColor)) {
print '<a href="'.dol_buildpath('/projet/list.php?search_opp_status='.$objp->opp_status, 1).'" style="display: inline-block; width: 4px; border: 5px solid rgb('.$oppStatusColor.'); border-radius: 2px;" title="'.$langs->trans("OppStatus".$oppStatusCode).'"></a>';
} else {
print '<a href="'.dol_buildpath('/projet/list.php?search_opp_status='.$objp->opp_status, 1).'" title="'.$langs->trans("OppStatus".$oppStatusCode).'">'.$oppStatusCode.'</a>';
}
}
}
print '</td>';
}
print '<td class="right">'; print '<td class="right">';
if ($objp->opp_amount) print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency); if ($objp->opp_amount) print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency);
print '</td>'; print '</td>';
@ -2207,6 +2235,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
} }
print '</td>'; print '</td>';
} }
if (empty($conf->global->PROJECT_HIDE_TASKS)) if (empty($conf->global->PROJECT_HIDE_TASKS))
{ {
print '<td class="right">'.$objp->nb.'</td>'; print '<td class="right">'.$objp->nb.'</td>';
@ -2228,23 +2257,12 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
} }
} }
if (!in_array('projectstatus', $hiddenfields)) {
print '<td class="right">'; print '<td class="right">';
//print $projectstatic->getLibStatut(3); print $projectstatic->getLibStatut(3);
if (isset($statusOppList[$objp->opp_status])) {
$oppStatusCode = $statusOppList[$objp->opp_status]['code'];
$oppStatusColor = $statusOppList[$objp->opp_status]['color'];
} else {
$oppStatusCode = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code');
$oppStatusColor = '';
}
if ($oppStatusCode) {
if (!empty($oppStatusColor)) {
print '<a href="' . dol_buildpath('/projet/list.php?search_opp_status=' . $objp->opp_status, 1) . '" style="display: inline-block; width: 4px; border: 5px solid rgb(' . $oppStatusColor . '); border-radius: 2px;" title="' . $langs->trans("OppStatus" . $oppStatusCode) . '"></a>';
} else {
print '<a href="' . dol_buildpath('/projet/list.php?search_opp_status=' . $objp->opp_status, 1) . '" title="' . $langs->trans("OppStatus".$oppStatusCode) . '">' . $oppStatusCode . '</a>';
}
}
print '</td>'; print '</td>';
}
print "</tr>\n"; print "</tr>\n";
$total_task = $total_task + $objp->nb; $total_task = $total_task + $objp->nb;
@ -2258,6 +2276,9 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
print '<td colspan="2">'.$langs->trans("Total")."</td>"; print '<td colspan="2">'.$langs->trans("Total")."</td>";
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{ {
if (!in_array('prospectionstatus', $hiddenfields)) {
print '<td class="liste_total"></td>';
}
print '<td class="liste_total right">'.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).'</td>'; print '<td class="liste_total right">'.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).'</td>';
print '<td class="liste_total right">'.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc"), 1).'</td>'; print '<td class="liste_total right">'.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc"), 1).'</td>';
} }
@ -2267,7 +2288,9 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
if (!in_array('plannedworkload', $hiddenfields)) print '<td class="liste_total right">'.($total_plannedworkload ?convertSecondToTime($total_plannedworkload) : '').'</td>'; if (!in_array('plannedworkload', $hiddenfields)) print '<td class="liste_total right">'.($total_plannedworkload ?convertSecondToTime($total_plannedworkload) : '').'</td>';
if (!in_array('declaredprogress', $hiddenfields)) print '<td class="liste_total right">'.($total_plannedworkload ?round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).'%' : '').'</td>'; if (!in_array('declaredprogress', $hiddenfields)) print '<td class="liste_total right">'.($total_plannedworkload ?round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).'%' : '').'</td>';
} }
if (!in_array('projectstatus', $hiddenfields)) {
print '<td class="liste_total"></td>'; print '<td class="liste_total"></td>';
}
print '</tr>'; print '</tr>';
$db->free($resql); $db->free($resql);

View File

@ -38,13 +38,10 @@ function takepos_prepare_head()
$head[$h][2] = 'setup'; $head[$h][2] = 'setup';
$h++; $h++;
if ($conf->global->TAKEPOS_CUSTOM_RECEIPT)
{
$head[$h][0] = DOL_URL_ROOT.'/takepos/admin/receipt.php'; $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/receipt.php';
$head[$h][1] = $langs->trans("Receipt"); $head[$h][1] = $langs->trans("Receipt");
$head[$h][2] = 'receipt'; $head[$h][2] = 'receipt';
$h++; $h++;
}
$numterminals = max(1, $conf->global->TAKEPOS_NUM_TERMINALS); $numterminals = max(1, $conf->global->TAKEPOS_NUM_TERMINALS);
for ($i = 1; $i <= $numterminals; $i++) for ($i = 1; $i <= $numterminals; $i++)

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

@ -1683,11 +1683,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
elseif ($conf->global->PROJECT_USE_OPPORTUNITIES == 1) elseif ($conf->global->PROJECT_USE_OPPORTUNITIES == 1)
{ {
$newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $showmode, '', 'project', 'list'); $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $showmode, '', 'project', 'list');
$newmenu->add('/projet/list.php?mainmenu=project&amp;leftmenu=list&search_opp_status=openedopp&search_status=99&contextpage=lead', $langs->trans("ListOpenLeads"), 2, $showmode); $newmenu->add('/projet/list.php?mainmenu=project&amp;leftmenu=list&search_usage_opportunity=1&search_status=99&contextpage=lead', $langs->trans("ListOpenLeads"), 2, $showmode);
$newmenu->add('/projet/list.php?mainmenu=project&amp;leftmenu=list&search_opp_status=notopenedopp&search_status=99&contextpage=project', $langs->trans("ListOpenProjects"), 2, $showmode); $newmenu->add('/projet/list.php?mainmenu=project&amp;leftmenu=list&search_opp_status=notopenedopp&search_status=99&contextpage=project', $langs->trans("ListOpenProjects"), 2, $showmode);
} }
elseif ($conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only elseif ($conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only
$newmenu->add('/projet/list.php?mainmenu=project&amp;leftmenu=list&search_opp_status=openedopp&search_status=99', $langs->trans("List"), 2, $showmode); $newmenu->add('/projet/list.php?mainmenu=project&amp;leftmenu=list&search_usage_opportunity=1&search_status=99', $langs->trans("List"), 2, $showmode);
} }
$newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire); $newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire);

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

@ -425,6 +425,7 @@ class ImportCsv extends ModeleImports
// New val can be an id or ref. If it start with id: it is forced to id, if it start with ref: it is forced to ref. It not, we try to guess. // New val can be an id or ref. If it start with id: it is forced to id, if it start with ref: it is forced to ref. It not, we try to guess.
$isidorref = 'id'; $isidorref = 'id';
if (!is_numeric($newval) && $newval != '' && !preg_match('/^id:/i', $newval)) $isidorref = 'ref'; if (!is_numeric($newval) && $newval != '' && !preg_match('/^id:/i', $newval)) $isidorref = 'ref';
$newval = preg_replace('/^(id|ref):/i', '', $newval); // Remove id: or ref: that was used to force if field is id or ref $newval = preg_replace('/^(id|ref):/i', '', $newval); // Remove id: or ref: that was used to force if field is id or ref
//print 'Val is now '.$newval.' and is type '.$isidorref."<br>\n"; //print 'Val is now '.$newval.' and is type '.$isidorref."<br>\n";
@ -448,8 +449,7 @@ class ImportCsv extends ModeleImports
$classinstance = new $class($this->db); $classinstance = new $class($this->db);
// Try the fetch from code or ref // Try the fetch from code or ref
$param_array = array('', $newval); $param_array = array('', $newval);
if ($class == 'AccountingAccount') if ($class == 'AccountingAccount') {
{
//var_dump($arrayrecord[0]['val']); //var_dump($arrayrecord[0]['val']);
/*include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancysystem.class.php'; /*include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancysystem.class.php';
$tmpchartofaccount = new AccountancySystem($this->db); $tmpchartofaccount = new AccountancySystem($this->db);
@ -464,6 +464,7 @@ class ImportCsv extends ModeleImports
}*/ }*/
$param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart.
} }
call_user_func_array(array($classinstance, $method), $param_array); call_user_func_array(array($classinstance, $method), $param_array);
// If not found, try the fetch from label // If not found, try the fetch from label
if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel') if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel')

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

@ -470,6 +470,25 @@ class modCategorie extends DolibarrModules
'cs.fk_soc'=>array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty') 'cs.fk_soc'=>array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty')
); );
$this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"Imported category", 'cs.fk_soc'=>"MyBigCompany"); $this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"Imported category", 'cs.fk_soc'=>"MyBigCompany");
// Contacts/Addresses
$r++;
$this->import_code[$r] = $this->rights_class.'_'.$r;
$this->import_label[$r] = "CatContactsLinks"; // Translation key
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r] = array('cs'=>MAIN_DB_PREFIX.'categorie_contact');
$this->import_fields_array[$r] = array('cs.fk_categorie'=>"Category*", 'cs.fk_socpeople'=>"Contact ID*");
$this->import_regex_array[$r] = array(
'cs.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=4'
//'cs.fk_socpeople'=>'rowid@'.MAIN_DB_PREFIX.'socpeople'
);
$this->import_convertvalue_array[$r] = array(
'cs.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category')
//'cs.fk_socpeople'=>array('rule'=>'fetchidfromref','classfile'=>'/contact/class/contact.class.php','class'=>'Contact','method'=>'fetch','element'=>'Contact')
);
$this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"Imported category", 'cs.fk_socpeople'=>"123");
} }
if (!empty($conf->fournisseur->enabled)) if (!empty($conf->fournisseur->enabled))

View File

@ -265,6 +265,10 @@ class modTakePos extends DolibarrModules
*/ */
public function init($options = '') public function init($options = '')
{ {
global $conf,$db;
dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", "browser", 'chaine', 0, '', $conf->entity);
$this->_load_tables('/takepos/sql/'); $this->_load_tables('/takepos/sql/');
$sql = array(); $sql = array();

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

@ -73,7 +73,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
//print $key.'-'.$enabled.'-'.$perms.'-'.$label.$_POST["options_" . $key].'<br>'."\n"; //print $key.'-'.$enabled.'-'.$perms.'-'.$label.$_POST["options_" . $key].'<br>'."\n";
if (empty($enabled)) continue; // 0 = Never visible field if (empty($enabled)) continue; // 0 = Never visible field
if (abs($enabled) != 1 && abs($enabled) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list if (abs($enabled) != 1 && abs($enabled) != 3 && abs($enabled) != 5) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
if (empty($perms)) continue; // 0 = Not visible if (empty($perms)) continue; // 0 = Not visible
// Load language if required // Load language if required
@ -135,7 +135,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
if ($object->element == 'productlot') $permok = $user->rights->stock->creer; if ($object->element == 'productlot') $permok = $user->rights->stock->creer;
if ($object->element == 'facturerec') $permok = $user->rights->facture->creer; if ($object->element == 'facturerec') $permok = $user->rights->facture->creer;
if (($object->statut == 0 || !empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key])) if (($object->statut == 0 || !empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key]))
&& $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key) && $permok && $enabled != 5 && ($action != 'edit_extras' || GETPOST('attribute') != $key)
&& empty($extrafields->attributes[$object->table_element]['computed'][$key])) && empty($extrafields->attributes[$object->table_element]['computed'][$key]))
{ {
$fieldid = 'id'; $fieldid = 'id';

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
@ -541,6 +541,7 @@ if (!empty($usemargins) && $user->rights->margins->creer)
else if (npRate == "np_markRate") else if (npRate == "np_markRate")
price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100)); price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100));
} }
$("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value $("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value
return true; return true;
@ -630,15 +631,24 @@ if (!empty($usemargins) && $user->rights->margins->creer)
if (empty($conf->global->MAIN_DISABLE_EDIT_PREDEF_PRICEHT) && empty($senderissupplier)) if (empty($conf->global->MAIN_DISABLE_EDIT_PREDEF_PRICEHT) && empty($senderissupplier))
{ {
?> ?>
var pbq = parseInt($('option:selected', this).attr('data-pbq'));
if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && ! isNaN(pbq) && pbq > 0)
{
console.log("We are in a price per qty context, we do not call ajax/product");
} else {
// Get the HT price for the product and display it // Get the HT price for the product and display it
console.log("Load price without tax and set it into #price_ht"); console.log("Load price without tax and set it into #price_ht for id="+$(this).val()+" socid=<?php print $object->socid; ?>");
$.post('<?php echo DOL_URL_ROOT; ?>/product/ajax/products.php?action=fetch', $.post('<?php echo DOL_URL_ROOT; ?>/product/ajax/products.php?action=fetch',
{ 'id': $(this).val(), 'socid': <?php print $object->socid; ?> }, { 'id': $(this).val(), 'socid': <?php print $object->socid; ?> },
function(data) { jQuery("#price_ht").val(data.price_ht); }, function(data) {
jQuery("#price_ht").val(data.price_ht);
},
'json' 'json'
); );
}
<?php <?php
} }
if (!empty($usemargins) && $user->rights->margins->creer) if (!empty($usemargins) && $user->rights->margins->creer)
{ {
$langs->load('stocks'); $langs->load('stocks');
@ -744,15 +754,20 @@ if (!empty($usemargins) && $user->rights->margins->creer)
} }
?> ?>
/* To process customer price per quantity */ /* To process customer price per quantity (CUSTOMER_PRICE_PER_QTY works only if combo product is not an ajax after x key pressed) */
var pbq = parseInt($('option:selected', this).attr('data-pbq')); var pbq = parseInt($('option:selected', this).attr('data-pbq'));
var pbqup = parseInt($('option:selected', this).attr('data-pbqup'));
var pbqbase = $('option:selected', this).attr('data-pbqbase');
var pbqqty = parseFloat($('option:selected', this).attr('data-pbqqty')); var pbqqty = parseFloat($('option:selected', this).attr('data-pbqqty'));
var pbqpercent = parseFloat($('option:selected', this).attr('data-pbqpercent')); var pbqpercent = parseFloat($('option:selected', this).attr('data-pbqpercent'));
if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && typeof pbq !== "undefined") if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && ! isNaN(pbq) && pbq > 0)
{ {
console.log("We choose a price by quanty price_by_qty id = "+pbq+" price_by_qty qty = "+pbqqty+" price_by_qty percent = "+pbqpercent); var pbqupht = pbqup; /* TODO support of price per qty TTC not yet available */
console.log("We choose a price by quanty price_by_qty id = "+pbq+" price_by_qty upht = "+pbqupht+" price_by_qty qty = "+pbqqty+" price_by_qty percent = "+pbqpercent);
jQuery("#pbq").val(pbq); jQuery("#pbq").val(pbq);
jQuery("#price_ht").val(pbqupht);
if (jQuery("#qty").val() < pbqqty) if (jQuery("#qty").val() < pbqqty)
{ {
jQuery("#qty").val(pbqqty); jQuery("#qty").val(pbqqty);
@ -809,7 +824,6 @@ if (!empty($usemargins) && $user->rights->margins->creer)
jQuery("#price_ht").val('').hide(); jQuery("#price_ht").val('').hide();
jQuery("#multicurrency_price_ht").val('').hide(); jQuery("#multicurrency_price_ht").val('').hide();
<?php } ?> <?php } ?>
jQuery("#price_ht").val('');
jQuery("#price_ttc, #fourn_ref, #tva_tx, #title_vat, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").hide(); jQuery("#price_ttc, #fourn_ref, #tva_tx, #title_vat, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").hide();
jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").hide(); jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").hide();
jQuery("#buying_price").show(); jQuery("#buying_price").show();

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

@ -284,10 +284,10 @@ class Donations extends DolibarrApi
* *
* @url POST {id}/validate * @url POST {id}/validate
* *
* @throws 304 * @throws RestException 304
* @throws 401 * @throws RestException 401
* @throws 404 * @throws RestException 404
* @throws 500 * @throws RestException 500
* *
* @return array * @return array
*/ */

View File

@ -812,9 +812,9 @@ class EmailCollector extends CommonObject
//var_dump($tmpproperty.' - '.$regexstring.' - '.$regexoptions.' - '.$sourcestring); //var_dump($tmpproperty.' - '.$regexstring.' - '.$regexoptions.' - '.$sourcestring);
if (preg_match('/'.$regexstring.'/'.$regexoptions, $sourcestring, $regforval)) if (preg_match('/'.$regexstring.'/'.$regexoptions, $sourcestring, $regforval))
{ {
//var_dump($regforval[1]);exit; //var_dump($regforval[count($regforval)-1]);exit;
// Overwrite param $tmpproperty // Overwrite param $tmpproperty
$object->$tmpproperty = isset($regforval[1]) ?trim($regforval[1]) : null; $object->$tmpproperty = isset($regforval[count($regforval)-1]) ?trim($regforval[count($regforval)-1]) : null;
} }
else else
{ {
@ -1423,9 +1423,9 @@ class EmailCollector extends CommonObject
//var_dump($regexstring);var_dump($sourcestring); //var_dump($regexstring);var_dump($sourcestring);
if (preg_match('/'.$regexstring.'/ms', $sourcestring, $regforval)) if (preg_match('/'.$regexstring.'/ms', $sourcestring, $regforval))
{ {
//var_dump($regforval[1]);exit; //var_dump($regforval[count($regforval)-1]);exit;
// Overwrite param $tmpproperty // Overwrite param $tmpproperty
$nametouseforthirdparty = isset($regforval[1]) ?trim($regforval[1]) : null; $nametouseforthirdparty = isset($regforval[count($regforval)-1]) ?trim($regforval[count($regforval)-1]) : null;
} }
else else
{ {

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

@ -373,8 +373,9 @@ class Shipments extends DolibarrApi
* @url DELETE {id}/lines/{lineid} * @url DELETE {id}/lines/{lineid}
* *
* @return int * @return int
* @throws 401 *
* @throws 404 * @throws RestException 401
* @throws RestException 404
*/ */
public function deleteLine($id, $lineid) public function deleteLine($id, $lineid)
{ {
@ -537,10 +538,10 @@ class Shipments extends DolibarrApi
// * // *
// * @return int // * @return int
// * // *
// * @throws 400 // * @throws RestException 400
// * @throws 401 // * @throws RestException 401
// * @throws 404 // * @throws RestException 404
// * @throws 405 // * @throws RestException 405
// */ // */
/* /*
public function setinvoiced($id) public function setinvoiced($id)
@ -574,10 +575,10 @@ class Shipments extends DolibarrApi
// * @url POST /createfromorder/{orderid} // * @url POST /createfromorder/{orderid}
// * // *
// * @return int // * @return int
// * @throws 400 // * @throws RestException 400
// * @throws 401 // * @throws RestException 401
// * @throws 404 // * @throws RestException 404
// * @throws 405 // * @throws RestException 405
// */ // */
/* /*
public function createShipmentFromOrder($orderid) public function createShipmentFromOrder($orderid)

View File

@ -1486,7 +1486,7 @@ class ExpenseReport extends CommonObject
{ {
// phpcs:enable // phpcs:enable
$error = 0; $error = 0;
$this->date_cancel = $this->db->idate(gmmktime()); $this->date_cancel = $this->db->idate(dol_now());
if ($this->fk_statut != self::STATUS_CANCELED) if ($this->fk_statut != self::STATUS_CANCELED)
{ {
$this->db->begin(); $this->db->begin();

View File

@ -353,7 +353,7 @@ if (empty($reshook))
$desc .= '<br>'; $desc .= '<br>';
$desc .= ' ('.$langs->trans('Quantity').': '.$lines[$i]->qty.')'; $desc .= ' ('.$langs->trans('Quantity').': '.$lines[$i]->qty.')';
$timearray = dol_getdate(mktime()); $timearray = dol_getdate(dol_now());
$date_intervention = dol_mktime(0, 0, 0, $timearray['mon'], $timearray['mday'], $timearray['year']); $date_intervention = dol_mktime(0, 0, 0, $timearray['mon'], $timearray['mday'], $timearray['year']);
if ($product_type == Product::TYPE_PRODUCT) { if ($product_type == Product::TYPE_PRODUCT) {

View File

@ -194,8 +194,8 @@ class SupplierInvoices extends DolibarrApi
* *
* @return int ID of supplier invoice * @return int ID of supplier invoice
* *
* @throws 401 * @throws RestException 401
* @throws 500 * @throws RestException 500
*/ */
public function post($request_data = null) public function post($request_data = null)
{ {
@ -226,8 +226,8 @@ class SupplierInvoices extends DolibarrApi
* *
* @return int * @return int
* *
* @throws 401 * @throws RestException 401
* @throws 404 * @throws RestException 404
*/ */
public function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
@ -262,9 +262,9 @@ class SupplierInvoices extends DolibarrApi
* *
* @return array * @return array
* *
* @throws 401 * @throws RestException 401
* @throws 404 * @throws RestException 404
* @throws 500 * @throws RestException 500
*/ */
public function delete($id) public function delete($id)
{ {
@ -304,11 +304,11 @@ class SupplierInvoices extends DolibarrApi
* *
* @return array * @return array
* *
* @throws 304 * @throws RestException 304
* @throws 401 * @throws RestException 401
* @throws 404 * @throws RestException 404
* @throws 405 * @throws RestException 405
* @throws 500 * @throws RestException 500
*/ */
public function validate($id, $idwarehouse = 0, $notrigger = 0) public function validate($id, $idwarehouse = 0, $notrigger = 0)
{ {
@ -348,10 +348,10 @@ class SupplierInvoices extends DolibarrApi
* @url GET {id}/payments * @url GET {id}/payments
* *
* @return array * @return array
* @throws 400 * @throws RestException 400
* @throws 401 * @throws RestException 401
* @throws 404 * @throws RestException 404
* @throws 405 * @throws RestException 405
*/ */
public function getPayments($id) public function getPayments($id)
{ {
@ -396,9 +396,9 @@ class SupplierInvoices extends DolibarrApi
* @url POST {id}/payments * @url POST {id}/payments
* *
* @return int Payment ID * @return int Payment ID
* @throws 400 * @throws RestException 400
* @throws 401 * @throws RestException 401
* @throws 404 * @throws RestException 404
*/ */
public function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '') public function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '')
{ {

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

@ -297,9 +297,13 @@ if (empty($reshook))
$paiement->datepaye = $datepaye; $paiement->datepaye = $datepaye;
$paiement->amounts = $amounts; // Array of amounts $paiement->amounts = $amounts; // Array of amounts
$paiement->multicurrency_amounts = $multicurrency_amounts; $paiement->multicurrency_amounts = $multicurrency_amounts;
$paiement->paiementid = $_POST['paiementid']; $paiement->paiementid = GETPOST('paiementid', 'int');
$paiement->num_paiement = $_POST['num_paiement'];
$paiement->note = $_POST['comment']; $paiement->num_payment = GETPOST('num_paiement', 'alpha');
$paiement->note_private = GETPOST('comment', 'alpha');
$paiement->num_paiement = $paiement->num_payment; // For bacward compatibility
$paiement->note = $paiement->note_private; // For bacward compatibility
if (!$error) if (!$error)
{ {
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices') == 'on' ? 1 : 0), $thirdparty); $paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices') == 'on' ? 1 : 0), $thirdparty);

Some files were not shown because too many files have changed in this diff Show More