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

This commit is contained in:
Laurent Destailleur 2018-10-24 02:00:56 +02:00
commit f10cb76597
15 changed files with 125 additions and 54 deletions

View File

@ -4,6 +4,7 @@
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -88,7 +89,7 @@ if ($result < 0)
}
$form = new Form($db);
$BookKeeping = new lettering($db);
$BookKeeping = new Lettering($db);
$formaccounting = new FormAccounting($db);
/*

View File

@ -4,6 +4,7 @@
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -21,7 +22,7 @@
*/
/**
* \file accountancy/bookkeeping/thirdparty_lettrage_supplier.php
* \file htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php
* \ingroup Advanced accountancy
* \brief Tab to setup lettering
*/
@ -92,7 +93,7 @@ if ($result<0)
}
$form = new Form($db);
$BookKeeping = new lettering($db);
$BookKeeping = new Lettering($db);
$formaccounting = new FormAccounting($db);
/*

View File

@ -1,7 +1,8 @@
<?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -18,7 +19,7 @@
*/
/**
* \file accountancy/class/bookkeeping.class.php
* \file htdocs/accountancy/class/lettering.class.php
* \ingroup Advanced accountancy
* \brief File of class for lettering
*/
@ -27,9 +28,9 @@ include_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php";
include_once DOL_DOCUMENT_ROOT . "/core/lib/date.lib.php";
/**
* Class lettering
* Class Lettering
*/
class lettering extends BookKeeping
class Lettering extends BookKeeping
{
/**
* lettrageTiers
@ -47,6 +48,7 @@ class lettering extends BookKeeping
$object->id = $socid;
$object->fetch($socid);
if ($object->code_compta == '411CUSTCODE') {
$object->code_compta = '';
}

View File

@ -122,7 +122,7 @@ class Setup extends DolibarrApi
* @param string $filter To filter the countries by name
* @param string $lang Code of the language the label of the countries must be translated to
* @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 countries
* @return array List of countries
*
* @url GET dictionary/countries
*

View File

@ -47,11 +47,21 @@ if ($action == 'print_file' && $user->rights->printing->read) {
{
$printerfound++;
$subdir=(GETPOST('printer', 'alpha')=='expedition'?'sending':'');
$subdir='';
$module = GETPOST('printer', 'alpha');
if ($module =='commande_fournisseur') {
$module = 'fournisseur';
$subdir = 'commande';
switch ($module )
{
case 'livraison' :
$subdir = 'receipt';
$module = 'expedition';
break;
case 'expedition' :
$subdir = 'sending';
break;
case 'commande_fournisseur' :
$module = 'fournisseur';
$subdir = 'commande';
break;
}
try {
$ret = $printer->printFile(GETPOST('file', 'alpha'), $module, $subdir);

View File

@ -6203,6 +6203,7 @@ abstract class CommonObject
$InfoFieldList = explode(":", $param_list[0]);
$classname=$InfoFieldList[0];
$classpath=$InfoFieldList[1];
$getnomurlparam=(empty($InfoFieldList[2]) ? 3 : $InfoFieldList[2]);
if (! empty($classpath))
{
dol_include_once($InfoFieldList[1]);
@ -6210,7 +6211,7 @@ abstract class CommonObject
{
$object = new $classname($this->db);
$object->fetch($value);
$value=$object->getNomUrl(3);
$value=$object->getNomUrl($getnomurlparam);
}
}
else
@ -6219,6 +6220,7 @@ abstract class CommonObject
return 'Error bad setup of extrafield';
}
}
else $value='';
}
elseif ($type == 'text' || $type == 'html')
{

View File

@ -2071,6 +2071,12 @@ class Form
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.fk_product = p.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e on ps.fk_entrepot = e.rowid";
}
// include search in supplier ref
if(!empty($conf->global->MAIN_SEARCH_PRODUCT_BY_FOURN_REF))
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
}
//Price by customer
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
@ -2124,6 +2130,7 @@ class Form
if ($i > 0) $sql.=" AND ";
$sql.="(p.ref LIKE '".$db->escape($prefix.$crit)."%' OR p.label LIKE '".$db->escape($prefix.$crit)."%'";
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.=" OR pl.label LIKE '".$db->escape($prefix.$crit)."%'";
if (! empty($conf->global->MAIN_SEARCH_PRODUCT_BY_FOURN_REF)) $sql.=" OR pfp.ref_fourn LIKE '".$db->escape($prefix.$crit)."%'";
$sql.=")";
$i++;
}

View File

@ -310,7 +310,7 @@ class FormFile
$param.= 'entity='.(!empty($object->entity)?$object->entity:$conf->entity);
$printer=0;
if (in_array($modulepart,array('facture','supplier_proposal','propal','proposal','order','commande','expedition', 'commande_fournisseur', 'expensereport'))) // The direct print feature is implemented only for such elements
if (in_array($modulepart,array('facture','supplier_proposal','propal','proposal','order','commande','expedition', 'commande_fournisseur', 'expensereport','livraison'))) // The direct print feature is implemented only for such elements
{
$printer = (!empty($user->rights->printing->read) && !empty($conf->printing->enabled))?true:false;
}

View File

@ -145,7 +145,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$this->atleastonediscount=0;
}
/**
/** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
* Function to build pdf onto disk
*
* @param Object $object Object to generate
@ -158,6 +158,7 @@ class pdf_eratosthene extends ModelePDFCommandes
*/
function write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
{
// phpcs:enable
global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblignes;
if (! is_object($outputlangs)) $outputlangs=$langs;
@ -711,7 +712,7 @@ class pdf_eratosthene extends ModelePDFCommandes
}
}
/**
/** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
* Show payments table
*
* @param TCPDF $pdf Object PDF
@ -722,11 +723,12 @@ class pdf_eratosthene extends ModelePDFCommandes
*/
function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
}
/**
/** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
* Show miscellaneous information (payment mode, payment term, ...)
*
* @param TCPDF $pdf Object PDF
@ -737,6 +739,7 @@ class pdf_eratosthene extends ModelePDFCommandes
*/
function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);
@ -912,7 +915,7 @@ class pdf_eratosthene extends ModelePDFCommandes
}
/**
/** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
* Show total to pay
*
* @param TCPDF $pdf Object PDF
@ -924,6 +927,7 @@ class pdf_eratosthene extends ModelePDFCommandes
*/
function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
@ -1485,7 +1489,8 @@ class pdf_eratosthene extends ModelePDFCommandes
* @param int $hideref Do not show ref
* @return null
*/
function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0){
function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0)
{
global $conf, $hookmanager;

View File

@ -159,7 +159,7 @@ class pdf_sponge extends ModelePDFFactures
}
/**
/** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
* Function to build pdf onto disk
*
* @param Object $object Object to generate
@ -172,6 +172,7 @@ class pdf_sponge extends ModelePDFFactures
*/
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{
// phpcs:enable
global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes;
if (! is_object($outputlangs)) $outputlangs=$langs;
@ -846,7 +847,7 @@ class pdf_sponge extends ModelePDFFactures
}
/**
/** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
* Show payments table
*
* @param PDF $pdf Object PDF
@ -857,6 +858,7 @@ class pdf_sponge extends ModelePDFFactures
*/
function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
$sign=1;
@ -986,7 +988,7 @@ class pdf_sponge extends ModelePDFFactures
}
/**
/** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
* Show miscellaneous information (payment mode, payment term, ...)
*
* @param PDF $pdf Object PDF
@ -997,6 +999,7 @@ class pdf_sponge extends ModelePDFFactures
*/
function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);
@ -1143,7 +1146,7 @@ class pdf_sponge extends ModelePDFFactures
}
/**
/** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
* Show total to pay
*
* @param PDF $pdf Object PDF
@ -1155,6 +1158,7 @@ class pdf_sponge extends ModelePDFFactures
*/
function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
$sign=1;
@ -1838,7 +1842,8 @@ class pdf_sponge extends ModelePDFFactures
* @param int $hideref Do not show ref
* @return null
*/
function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0){
function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0)
{
global $conf, $hookmanager;

View File

@ -117,7 +117,7 @@ class pdf_cyan extends ModelePDFPropales
$this->atleastonediscount=0;
}
/**
/** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
* Function to build pdf onto disk
*
* @param Object $object Object to generate
@ -130,6 +130,7 @@ class pdf_cyan extends ModelePDFPropales
*/
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{
// phpcs:enable
global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes;
if (! is_object($outputlangs)) $outputlangs=$langs;
@ -872,7 +873,7 @@ class pdf_cyan extends ModelePDFPropales
}
}
/**
/** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
* Show payments table
*
* @param TCPDF $pdf Object PDF
@ -883,11 +884,11 @@ class pdf_cyan extends ModelePDFPropales
*/
function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
}
/**
/** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
* Show miscellaneous information (payment mode, payment term, ...)
*
* @param TCPDF $pdf Object PDF
@ -898,6 +899,7 @@ class pdf_cyan extends ModelePDFPropales
*/
function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);
@ -1701,7 +1703,8 @@ class pdf_cyan extends ModelePDFPropales
* @param int $hideref Do not show ref
* @return null
*/
function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0){
function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0)
{
global $conf, $hookmanager;

View File

@ -331,6 +331,7 @@ NbProducts=No. of products
ParentProduct=Parent product
HideChildProducts=Hide variant products
ShowChildProducts=Show variant products
NoEditVariants=Go to Parent product card and edit variants price impact in the variants tab
ConfirmCloneProductCombinations=Would you like to copy all the product variants to the other parent product with the given reference?
CloneDestinationReference=Destination product reference
ErrorCopyProductCombinations=There was an error while copying the product variants

View File

@ -292,6 +292,7 @@ elseif ($action == 'remove_file')
}
*/
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
/*
* View

View File

@ -3529,6 +3529,36 @@ class Product extends CommonObject
return $nb;
}
/**
* Return if loaded product is a variant
*
* @return int
*/
function isVariant()
{
global $conf;
if (!empty($conf->variants->enabled)) {
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "product_attribute_combination WHERE fk_product_child = " . $this->id . " AND entity IN (" . getEntity('product') . ")";
$query = $this->db->query($sql);
if ($query) {
if (!$this->db->num_rows($query)) {
return false;
}
return true;
} else {
dol_print_error($this->db);
return -1;
}
} else {
return false;
}
}
/**
* Return all parent products for current product (first level only)
*

View File

@ -5,7 +5,7 @@
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014-2018 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2014 Ion agorria <ion@agorria.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
@ -1109,30 +1109,33 @@ if (! $action || $action == 'delete' || $action == 'showlog_customer_price' || $
{
print "\n" . '<div class="tabsAction">' . "\n";
if (empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
{
if ($user->rights->produit->creer || $user->rights->service->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_price&amp;id=' . $object->id . '">' . $langs->trans("UpdateDefaultPrice") . '</a></div>';
}
}
if ($object->isVariant()) {
if ($user->rights->produit->creer || $user->rights->service->creer) {
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoEditVariants")).'">'.$langs->trans("UpdateDefaultPrice").'</a></div>';
}
} else {
if (empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
if ($user->rights->produit->creer || $user->rights->service->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_price&amp;id=' . $object->id . '">' . $langs->trans("UpdateDefaultPrice") . '</a></div>';
}
}
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{
if ($user->rights->produit->creer || $user->rights->service->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=add_customer_price&amp;id=' . $object->id . '">' . $langs->trans("AddCustomerPrice") . '</a></div>';
}
}
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
if ($user->rights->produit->creer || $user->rights->service->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=add_customer_price&amp;id=' . $object->id . '">' . $langs->trans("AddCustomerPrice") . '</a></div>';
}
}
if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
{
if ($user->rights->produit->creer || $user->rights->service->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_vat&amp;id=' . $object->id . '">' . $langs->trans("UpdateVAT") . '</a></div>';
}
if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
if ($user->rights->produit->creer || $user->rights->service->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_vat&amp;id=' . $object->id . '">' . $langs->trans("UpdateVAT") . '</a></div>';
}
if ($user->rights->produit->creer || $user->rights->service->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_price&amp;id=' . $object->id . '">' . $langs->trans("UpdateLevelPrices") . '</a></div>';
}
}
if ($user->rights->produit->creer || $user->rights->service->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_price&amp;id=' . $object->id . '">' . $langs->trans("UpdateLevelPrices") . '</a></div>';
}
}
}
print "\n</div>\n";
}