Skip to content

Commit

Permalink
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
eldy committed Jun 20, 2019
2 parents 001da8b + 2c0d43a commit a264a47
Show file tree
Hide file tree
Showing 48 changed files with 964 additions and 95 deletions.
5 changes: 3 additions & 2 deletions htdocs/adherents/class/adherent.class.php
Expand Up @@ -11,6 +11,7 @@
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -2460,8 +2461,8 @@ private function _load_ldap_dn($info, $mode = 0)


// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Initialise tableau info (tableau des attributs LDAP)
*
* @return array Tableau info des attributs
Expand Down
15 changes: 12 additions & 3 deletions htdocs/adherents/index.php
@@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -29,6 +30,11 @@
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';

$hookmanager = new HookManager($db);

// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('membersindex'));

// Load translation files required by the page
$langs->loadLangs(array("companies","members"));

Expand Down Expand Up @@ -435,6 +441,9 @@

print '</div></div></div>';

$parameters = array('user' => $user);
$reshook = $hookmanager->executeHooks('dashboardMembers', $parameters, $object); // Note that $action and $object may have been modified by hook

// End of page
llxFooter();
$db->close();
5 changes: 5 additions & 0 deletions htdocs/admin/stock.php
Expand Up @@ -27,6 +27,7 @@
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php';

// Load translation files required by the page
$langs->loadLangs(array("admin", "stocks"));
Expand Down Expand Up @@ -77,6 +78,10 @@
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("StockSetup"), $linkback, 'title_setup');

$head = stock_admin_prepare_head();

dol_fiche_head($head, 'general', $langs->trans("StockSetup"), -1, 'stock');

$form=new Form($db);


Expand Down
61 changes: 61 additions & 0 deletions htdocs/api/class/api_setup.class.php
Expand Up @@ -4,6 +4,7 @@
* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2017 Neil Orley <neil.orley@oeris.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
*
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -707,6 +708,66 @@ public function getPaymentTerms($sortfield = "sortorder", $sortorder = 'ASC', $l
return $list;
}

/**
* Get the list of measuring units.
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Number of items per page
* @param int $page Page number (starting from zero)
* @param int $active Payment term is active or not {@min 0} {@max 1}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return List of events types
*
* @url GET dictionary/units
*
* @throws RestException
*/
public function getListOfMeasuringUnits($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
$list = array();
//TODO link with multicurrency module
$sql = "SELECT t.rowid, t.code, t.label,t.short_label, t.active, t.scale, t.unit_type";
$sql.= " FROM ".MAIN_DB_PREFIX."c_units as t";
$sql.= " WHERE t.active = ".$active;
// Add sql filters
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}


$sql.= $this->db->order($sortfield, $sortorder);

if ($limit) {
if ($page < 0) {
$page = 0;
}
$offset = $limit * $page;

$sql .= $this->db->plimit($limit, $offset);
}

$result = $this->db->query($sql);

if ($result) {
$num = $this->db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
for ($i = 0; $i < $min; $i++) {
$list[] = $this->db->fetch_object($result);
}
} else {
throw new RestException(503, 'Error when retrieving list of measuring units: '.$this->db->lasterror());
}

return $list;
}

/**
* Get the list of tickets categories.
*
Expand Down
9 changes: 9 additions & 0 deletions htdocs/comm/index.php
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -37,6 +38,11 @@

if (! $user->rights->societe->lire) accessforbidden();

$hookmanager = new HookManager($db);

// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('commercialindex'));

// Load translation files required by the page
$langs->loadLangs(array("commercial", "propal"));

Expand Down Expand Up @@ -897,6 +903,9 @@

print '</div></div></div>';

$parameters = array('user' => $user);
$reshook = $hookmanager->executeHooks('dashboardCommercials', $parameters, $object); // Note that $action and $object may have been modified by hook

// End of page
llxFooter();
$db->close();
9 changes: 9 additions & 0 deletions htdocs/comm/mailing/index.php
Expand Up @@ -2,6 +2,7 @@
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -27,6 +28,11 @@
require_once DOL_DOCUMENT_ROOT .'/comm/mailing/class/mailing.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';

$hookmanager = new HookManager($db);

// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('mailingindex'));

// Load translation files required by the page
$langs->loadLangs(array('commercial', 'orders'));

Expand Down Expand Up @@ -207,6 +213,9 @@
print '<br>';
}

$parameters = array('user' => $user);
$reshook = $hookmanager->executeHooks('dashboardEmailings', $parameters, $object); // Note that $action and $object may have been modified by hook

// End of page
llxFooter();
$db->close();
9 changes: 9 additions & 0 deletions htdocs/comm/propal/index.php
Expand Up @@ -2,6 +2,7 @@
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -27,6 +28,11 @@
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT .'/comm/propal/class/propal.class.php';

$hookmanager = new HookManager($db);

// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('proposalindex'));

// Load translation files required by the page
$langs->loadLangs(array('propal', 'companies'));

Expand Down Expand Up @@ -540,6 +546,9 @@
//print '</td></tr></table>';
print '</div></div></div>';

$parameters = array('user' => $user);
$reshook = $hookmanager->executeHooks('dashboardPropals', $parameters, $object); // Note that $action and $object may have been modified by hook

// End of page
llxFooter();
$db->close();
60 changes: 60 additions & 0 deletions htdocs/comm/propal/list.php
Expand Up @@ -162,6 +162,8 @@
'p.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
'p.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0),
'p.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
'p.total_ht_invoiced'=>array('label'=>$langs->trans("AmountInvoicedHT"), 'checked'=>0, 'enabled'=>$conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT),
'p.total_invoiced'=>array('label'=>$langs->trans("AmountInvoicedTTC"), 'checked'=>0, 'enabled'=>$conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT),
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10),
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>1),
'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
Expand Down Expand Up @@ -644,6 +646,18 @@
print '<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).'">';
print '</td>';
}
if (! empty($arrayfields['p.total_ht_invoiced']['checked']))
{
// Amount invoiced
print '<td class="liste_titre right">';
print '</td>';
}
if (! empty($arrayfields['p.total_invoiced']['checked']))
{
// Amount invoiced
print '<td class="liste_titre right">';
print '</td>';
}
if (! empty($arrayfields['u.login']['checked']))
{
// Author
Expand Down Expand Up @@ -709,6 +723,8 @@
if (! empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'], $_SERVER["PHP_SELF"], 'p.tva', '', $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['p.total_ht_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['p.total_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder);
// Extra fields
Expand Down Expand Up @@ -933,6 +949,48 @@
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
$totalarray['totalttc'] += $obj->total_ttc;
}
// Amount invoiced
if(! empty($arrayfields['p.total_ht_invoiced']['checked'])) {
$totalInvoiced = 0;
$p = new Propal($db);
$TInvoiceData = $p->InvoiceArrayList($obj->rowid);

if(! empty($TInvoiceData)) {
foreach($TInvoiceData as $invoiceData) {
$invoice = new Facture($db);
$invoice->fetch($invoiceData->facid);

if(! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $invoice->type == Facture::TYPE_DEPOSIT) continue;
$totalInvoiced += $invoice->total_ht;
}
}

print '<td class="right">'.price($totalInvoiced)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalhtinvoicedfield']=$totalarray['nbfield'];
$totalarray['totalhtinvoiced'] += $totalInvoiced;
}
// Amount invoiced
if(! empty($arrayfields['p.total_invoiced']['checked'])) {
$totalInvoiced = 0;
$p = new Propal($db);
$TInvoiceData = $p->InvoiceArrayList($obj->rowid);

if(! empty($TInvoiceData)) {
foreach($TInvoiceData as $invoiceData) {
$invoice = new Facture($db);
$invoice->fetch($invoiceData->facid);

if(! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $invoice->type == Facture::TYPE_DEPOSIT) continue;
$totalInvoiced += $invoice->total_ttc;
}
}

print '<td class="right">'.price($totalInvoiced)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalinvoicedfield']=$totalarray['nbfield'];
$totalarray['totalinvoiced'] += $totalInvoiced;
}

$userstatic->id=$obj->fk_user_author;
$userstatic->login=$obj->login;
Expand Down Expand Up @@ -1059,6 +1117,8 @@
elseif ($totalarray['totalhtfield'] == $i) print '<td class="right">'.price($totalarray['totalht']).'</td>';
elseif ($totalarray['totalvatfield'] == $i) print '<td class="right">'.price($totalarray['totalvat']).'</td>';
elseif ($totalarray['totalttcfield'] == $i) print '<td class="right">'.price($totalarray['totalttc']).'</td>';
elseif ($totalarray['totalhtinvoicedfield'] == $i) print '<td class="right">'.price($totalarray['totalhtinvoiced']).'</td>';
elseif ($totalarray['totalinvoicedfield'] == $i) print '<td class="right">'.price($totalarray['totalinvoiced']).'</td>';
elseif ($totalarray['totalizable']) {
$printed = false;
foreach ($totalarray['totalizable'] as $totalizable) {
Expand Down
8 changes: 8 additions & 0 deletions htdocs/commande/index.php
Expand Up @@ -2,6 +2,7 @@
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -31,6 +32,11 @@

if (!$user->rights->commande->lire) accessforbidden();

$hookmanager = new HookManager($db);

// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('ordersindex'));

// Load translation files required by the page
$langs->loadLangs(array('orders', 'bills'));

Expand Down Expand Up @@ -478,6 +484,8 @@

print '</div></div></div>';

$parameters = array('user' => $user);
$reshook = $hookmanager->executeHooks('dashboardOrders', $parameters, $object); // Note that $action and $object may have been modified by hook

// End of page
llxFooter();
Expand Down
12 changes: 11 additions & 1 deletion htdocs/compta/charges/index.php
Expand Up @@ -3,8 +3,9 @@
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -34,6 +35,12 @@
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';


$hookmanager = new HookManager($db);

// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('specialexpensesindex'));

// Load translation files required by the page
$langs->loadLangs(array('compta', 'bills'));

Expand Down Expand Up @@ -568,6 +575,9 @@

print '</form>';

$parameters = array('user' => $user);
$reshook = $hookmanager->executeHooks('dashboardSpecialBills', $parameters, $object); // Note that $action and $object may have been modified by hook

// End of page
llxFooter();
$db->close();

0 comments on commit a264a47

Please sign in to comment.