Merge remote-tracking branch 'origin/3.5' into 3.6
Conflicts: build/debian/control htdocs/compta/bank/account.php htdocs/fourn/paiement/fiche.php htdocs/product/class/product.class.php htdocs/product/fiche.php
This commit is contained in:
commit
05f3a47018
@ -151,6 +151,12 @@ Fix: [ bug #1544 ] Can remove date from invoice.
|
||||
Fix: list event view lost type event filter.
|
||||
Fix: Add code save on create event.
|
||||
Fix: SQL injection.
|
||||
Fix: [ bug #1589 ] Menu type in "Edit menu" page is not translated
|
||||
Fix: [ bug #1591 ] Linked object block shows Total HT/TTC even if not having permission to read them
|
||||
Fix: [ bug #1577 ] When creating new Private individual third, selected third type is ignored
|
||||
Fix: [ bug #1555 ] Update accountancy code of products does not throw PRODUCT_MODIFY trigger
|
||||
Fix: [ bug #1548 ] Supplier payment card shows type in French
|
||||
Fix: [ bug #1546 ] Incorrect page number when searching in the list of bank transactions
|
||||
|
||||
***** ChangeLog for 3.5.4 compared to 3.5.3 *****
|
||||
Fix: Hide title of event when agenda module disabled.
|
||||
|
||||
@ -39,7 +39,7 @@ Description: Web based software to manage a company or foundation
|
||||
It's a web software you can install as a standalone program or on any web
|
||||
hosting provider to use it from anywhere with any web browser.
|
||||
.
|
||||
Dolibarr was designed to be easy to use. Only the features that you need
|
||||
Dolibarr was designed to be easy to use. Only the features that you need
|
||||
are visible, depending on which modules were activated.
|
||||
.
|
||||
This is an example of most common used modules:
|
||||
|
||||
@ -61,7 +61,7 @@ License: GPL-3+
|
||||
Files: htdocs/includes/adodbtime/*
|
||||
Copyright: 2003-2005, John Lim
|
||||
unknown, jackbbs
|
||||
License: BSD
|
||||
License: BSD-3-Clause
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
@ -272,7 +272,7 @@ Comment:
|
||||
|
||||
Files: htdocs/includes/jquery/plugins/flot/*
|
||||
Copyright: Flot team
|
||||
License: Public Domain
|
||||
License: Public-Domain
|
||||
This work is not subject to copyright in any jurisdiction
|
||||
Comment:
|
||||
Those files are not shipped in the binary package because we configure
|
||||
|
||||
@ -8,16 +8,20 @@ echo "tmpdir = $tmpdir"
|
||||
if [ -n "$1" ]; then
|
||||
uscan_opts="--download-version=$1"
|
||||
fi
|
||||
uscan --noconf --force-download --no-symlink --verbose --destdir=$tmpdir $uscan_opts
|
||||
#uscan --noconf --force-download --no-symlink --verbose --destdir=$tmpdir $uscan_opts
|
||||
|
||||
cd $tmpdir
|
||||
|
||||
# Other method to download (comment uscan if you use this)
|
||||
wget http://www.dolibarr.org/files/stable/standard/dolibarr-3.5.4.tgz
|
||||
|
||||
# Rename file to add +dfsg
|
||||
tgzfile=$(echo *.tgz)
|
||||
version=$(echo "$tgzfile" | perl -pi -e 's/^dolibarr-//; s/\.tgz$//; s/_/./g; s/\+nmu1//; ')
|
||||
|
||||
cd - >/dev/null
|
||||
|
||||
mv $tmpdir/dolibarr-${version}.tgz ../
|
||||
echo "File ../dolibarr-${version}.tgz is ready for git-import"
|
||||
echo "File ../dolibarr-${version}.tgz is ready for git-import-orig"
|
||||
|
||||
rm -rf $tmpdir
|
||||
|
||||
@ -317,7 +317,7 @@ if ($action == 'create')
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Type').'</td><td>';
|
||||
if ($parent_rowid)
|
||||
{
|
||||
print 'Left';
|
||||
print $langs->trans('Left');
|
||||
print '<input type="hidden" name="type" value="left">';
|
||||
}
|
||||
else
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.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
|
||||
@ -27,6 +28,8 @@
|
||||
|
||||
<?php
|
||||
|
||||
global $user;
|
||||
|
||||
$langs = $GLOBALS['langs'];
|
||||
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
@ -52,17 +55,23 @@ foreach($linkedObjectBlock as $object)
|
||||
<a href="<?php echo DOL_URL_ROOT.'/comm/propal.php?id='.$object->id ?>"><?php echo img_object($langs->trans("ShowPropal"),"propal").' '.$object->ref; ?></a></td>
|
||||
<td><?php echo $object->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($object->date,'day'); ?></td>
|
||||
<td align="right"><?php echo price($object->total_ht); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->propale->lire) {
|
||||
$total = $total + $object->total_ht;
|
||||
echo price($object->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $object->getLibStatut(3); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$total = $total + $object->total_ht;
|
||||
}
|
||||
|
||||
?>
|
||||
<tr class="liste_total">
|
||||
<td align="left" colspan="3"><?php echo $langs->trans('TotalHT'); ?></td>
|
||||
<td align="right"><?php echo price($total); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->propale->lire) {
|
||||
echo price($total);
|
||||
} ?></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.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
|
||||
@ -22,6 +23,8 @@
|
||||
|
||||
<?php
|
||||
|
||||
global $user;
|
||||
|
||||
$langs = $GLOBALS['langs'];
|
||||
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
@ -47,17 +50,23 @@ foreach($linkedObjectBlock as $object)
|
||||
<tr <?php echo $GLOBALS['bc'][$var]; ?> ><td>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/commande/fiche.php?id='.$object->id ?>"><?php echo img_object($langs->trans("ShowOrder"),"order").' '.$object->ref; ?></a></td>
|
||||
<td align="center"><?php echo dol_print_date($object->date,'day'); ?></td>
|
||||
<td align="right"><?php echo price($object->total_ht); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->commande->lire) {
|
||||
$total = $total + $object->total_ht;
|
||||
echo price($object->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $object->getLibStatut(3); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$total = $total + $object->total_ht;
|
||||
}
|
||||
|
||||
?>
|
||||
<tr class="liste_total">
|
||||
<td align="left" colspan="2"><?php echo $langs->trans('TotalHT'); ?></td>
|
||||
<td align="right"><?php echo price($total); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->commande->lire) {
|
||||
echo price($total);
|
||||
} ?></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@@2byte.es>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012-2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -259,17 +259,22 @@ if ($id > 0 || ! empty($ref))
|
||||
//Total pages
|
||||
$totalPages = ceil($total_lines/$viewline);
|
||||
|
||||
if ($page > 0)
|
||||
{
|
||||
$limitsql = ($totalPages - $page) * $viewline;
|
||||
if ($limitsql < $viewline) $limitsql = $viewline;
|
||||
$nbline = $limitsql;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($totalPages == 0) {
|
||||
$page = 0;
|
||||
$limitsql = $nbline;
|
||||
} else {
|
||||
|
||||
if ($page > 0) {
|
||||
$limitsql = ($totalPages - $page) * $viewline;
|
||||
if ($limitsql < $viewline) {
|
||||
$limitsql = $viewline;
|
||||
}
|
||||
$nbline = $limitsql;
|
||||
} else {
|
||||
$page = 0;
|
||||
$limitsql = $nbline;
|
||||
}
|
||||
}
|
||||
|
||||
//print $limitsql.'-'.$page.'-'.$viewline;
|
||||
|
||||
// Onglets
|
||||
@ -467,7 +472,7 @@ if ($id > 0 || ! empty($ref))
|
||||
// VAT
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='payment_vat'";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."tva as t ON bu2.url_id = t.rowid";
|
||||
|
||||
|
||||
// Salary payment
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment_salary'";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."payment_salary as sal ON bu3.url_id = sal.rowid";
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.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
|
||||
@ -22,6 +23,8 @@
|
||||
|
||||
<?php
|
||||
|
||||
global $user;
|
||||
|
||||
$langs = $GLOBALS['langs'];
|
||||
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
@ -47,16 +50,22 @@ foreach($linkedObjectBlock as $object)
|
||||
<tr <?php echo $GLOBALS['bc'][$var]; ?> ><td>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/compta/facture.php?facid='.$object->id ?>"><?php echo img_object($langs->trans("ShowBill"),"bill").' '.$object->ref; ?></a></td>
|
||||
<td align="center"><?php echo dol_print_date($object->date,'day'); ?></td>
|
||||
<td align="right"><?php echo price($object->total_ht); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->facture->lire) {
|
||||
$total = $total + $object->total_ht;
|
||||
echo price($object->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $object->getLibStatut(3); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$total = $total + $object->total_ht;
|
||||
}
|
||||
?>
|
||||
<tr class="liste_total">
|
||||
<td align="left" colspan="2"><?php echo $langs->trans("TotalHT"); ?></td>
|
||||
<td align="right"><?php echo price($total); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->facture->lire) {
|
||||
echo price($total);
|
||||
} ?></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -1089,7 +1089,6 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save a new position (field rang) for details lines.
|
||||
* You can choose to set position for lines with already a position or lines without any position defined.
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.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
|
||||
@ -21,6 +22,8 @@
|
||||
|
||||
<?php
|
||||
|
||||
global $user;
|
||||
|
||||
$langs = $GLOBALS['langs'];
|
||||
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
@ -47,17 +50,23 @@ foreach($linkedObjectBlock as $object)
|
||||
<a href="<?php echo DOL_URL_ROOT.'/expedition/fiche.php?id='.$object->id ?>"><?php echo img_object($langs->trans("ShowShipping"),"sending").' '.$object->ref; ?></a></td>
|
||||
<td align="center"><?php echo dol_print_date($object->date_creation,'day'); ?></td>
|
||||
<td align="center"><?php echo dol_print_date($object->date_delivery,'day'); ?></td>
|
||||
<td align="right"><?php echo price($object->total_ht); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->expedition->lire) {
|
||||
$total = $total + $object->total_ht;
|
||||
echo price($object->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $object->getLibStatut(3); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$total = $total + $object->total_ht;
|
||||
}
|
||||
|
||||
?>
|
||||
<tr class="liste_total">
|
||||
<td align="left" colspan="3"><?php echo $langs->trans('TotalHT'); ?></td>
|
||||
<td align="right"><?php echo price($total); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->expedition->lire) {
|
||||
echo price($total);
|
||||
} ?></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.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
|
||||
@ -55,6 +56,18 @@ class PaiementFourn extends Paiement
|
||||
// fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...)
|
||||
// fk_paiement dans llx_paiement_facture est le rowid du paiement
|
||||
|
||||
/**
|
||||
* Label of payment type
|
||||
* @var string
|
||||
*/
|
||||
public $type_libelle;
|
||||
|
||||
/**
|
||||
* Code of Payment type
|
||||
* @var string
|
||||
*/
|
||||
public $type_code;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -74,7 +87,7 @@ class PaiementFourn extends Paiement
|
||||
function fetch($id)
|
||||
{
|
||||
$sql = 'SELECT p.rowid, p.datep as dp, p.amount, p.statut, p.fk_bank,';
|
||||
$sql.= ' c.libelle as paiement_type,';
|
||||
$sql.= ' c.code as paiement_code, c.libelle as paiement_type,';
|
||||
$sql.= ' p.num_paiement, p.note, b.fk_account';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiementfourn as p';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid ';
|
||||
@ -95,6 +108,7 @@ class PaiementFourn extends Paiement
|
||||
$this->bank_line = $obj->fk_bank;
|
||||
$this->montant = $obj->amount;
|
||||
$this->note = $obj->note;
|
||||
$this->type_code = $obj->paiement_code;
|
||||
$this->type_libelle = $obj->paiement_type;
|
||||
$this->statut = $obj->statut;
|
||||
$error = 1;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.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
|
||||
@ -21,6 +22,8 @@
|
||||
|
||||
<?php
|
||||
|
||||
global $user;
|
||||
|
||||
$langs = $GLOBALS['langs'];
|
||||
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
@ -44,17 +47,23 @@ foreach($linkedObjectBlock as $object)
|
||||
<tr <?php echo $bc[$var]; ?> ><td>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/fourn/commande/fiche.php?id='.$object->id ?>"><?php echo img_object($langs->trans("ShowOrder"),"order").' '.$object->ref; ?></a></td>
|
||||
<td align="center"><?php echo dol_print_date($object->date,'day'); ?></td>
|
||||
<td align="right"><?php echo price($object->total_ht); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->fournisseur->commande->lire) {
|
||||
$total = $total + $object->total_ht;
|
||||
echo price($object->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $object->getLibStatut(3); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$total = $total + $object->total_ht;
|
||||
}
|
||||
|
||||
?>
|
||||
<tr class="liste_total">
|
||||
<td align="left" colspan="2"><?php echo $langs->trans('TotalHT'); ?></td>
|
||||
<td align="right"><?php echo price($total); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->fournisseur->commande->lire) {
|
||||
echo price($total);
|
||||
} ?></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.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
|
||||
@ -21,6 +22,8 @@
|
||||
|
||||
<?php
|
||||
|
||||
global $user;
|
||||
|
||||
$langs = $GLOBALS['langs'];
|
||||
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
@ -45,16 +48,22 @@ foreach($linkedObjectBlock as $object)
|
||||
<tr <?php echo $bc[$var]; ?> ><td>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$object->id ?>"><?php echo img_object($langs->trans("ShowBill"),"bill").' '.$object->ref; ?></a></td>
|
||||
<td align="center"><?php echo dol_print_date($object->date,'day'); ?></td>
|
||||
<td align="right"><?php echo price($object->total_ht); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->fournisseur->facture->lire) {
|
||||
$total = $total + $object->total_ht;
|
||||
echo price($object->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $object->getLibStatut(3); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$total = $total + $object->total_ht;
|
||||
}
|
||||
?>
|
||||
<tr class="liste_total">
|
||||
<td align="left" colspan="2"><?php echo $langs->trans("TotalHT"); ?></td>
|
||||
<td align="right"><?php echo price($total); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->fournisseur->facture->lire) {
|
||||
echo price($total);
|
||||
} ?></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.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
|
||||
@ -180,7 +180,8 @@ if ($result > 0)
|
||||
print '</td></tr>';
|
||||
|
||||
// Payment mode
|
||||
print '<tr><td valign="top" colspan="2">'.$langs->trans('PaymentMode').'</td><td colspan="3">'.$object->type_libelle.'</td></tr>';
|
||||
$labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->type_libelle;
|
||||
print '<tr><td valign="top" colspan="2">'.$langs->trans('PaymentMode').'</td><td colspan="3">'.$labeltype.'</td></tr>';
|
||||
|
||||
// Payment numero
|
||||
print '<tr><td valign="top" colspan="2">'.$form->editfieldkey("Numero",'num_paiement',$object->numero,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td colspan="3">';
|
||||
|
||||
@ -4,10 +4,16 @@
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2007-2011 Jean Heimburger <jean@tiaris.info>
|
||||
<<<<<<< HEAD
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013-2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
=======
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2013-2014 Marcos García <marcosgdf@gmail.com>
|
||||
>>>>>>> refs/remotes/origin/3.5
|
||||
*
|
||||
* 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
|
||||
@ -602,7 +608,7 @@ class Product extends CommonObject
|
||||
foreach ($this->stock_warehouse as $idW => $ObjW)
|
||||
{
|
||||
$qty_batch = 0;
|
||||
foreach ($ObjW->detail_batch as $detail)
|
||||
foreach ($ObjW->detail_batch as $detail)
|
||||
{
|
||||
$qty_batch += $detail->qty;
|
||||
}
|
||||
@ -615,12 +621,12 @@ class Product extends CommonObject
|
||||
$ObjBatch->qty = $ObjW->real - $qty_batch;
|
||||
$ObjBatch->fk_product_stock = $ObjW->id;
|
||||
if ($ObjBatch->create($user,1) < 0)
|
||||
{
|
||||
{
|
||||
$error++;
|
||||
$this->errors=$ObjBatch->errors;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// For automatic creation
|
||||
if ($this->barcode == -1) $this->barcode = $this->get_barcode($this,$this->barcode_type_code);
|
||||
@ -994,6 +1000,62 @@ class Product extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets an accountancy code for a product.
|
||||
* Also calls PRODUCT_MODIFY trigger when modified
|
||||
*
|
||||
* @param string $type It can be 'buy' or 'sell'
|
||||
* @param string $value Accountancy code
|
||||
* @return int <0 KO >0 OK
|
||||
*/
|
||||
public function setAccountancyCode($type, $value)
|
||||
{
|
||||
global $user, $langs, $conf;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if ($type == 'buy') {
|
||||
$field = 'accountancy_code_buy';
|
||||
} elseif ($type == 'sell') {
|
||||
$field = 'accountancy_code_sell';
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET ";
|
||||
$sql.= "$field = '".$this->db->escape($value)."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::".__FUNCTION__." sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
// Call triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('PRODUCT_MODIFY',$this,$user,$langs,$conf);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->errors=$interface->errors;
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
// End call triggers
|
||||
|
||||
$this->$field = $value;
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load array this->multilangs
|
||||
*
|
||||
@ -1426,8 +1488,8 @@ class Product extends CommonObject
|
||||
$this->entity = $obj->entity;
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
|
||||
|
||||
|
||||
// Retreive all extrafield for thirdparty
|
||||
// fetch optionals attributes and labels
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||
@ -1794,7 +1856,7 @@ class Product extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Charge tableau des stats contrat pour le produit/service
|
||||
*
|
||||
@ -2977,7 +3039,7 @@ class Product extends CommonObject
|
||||
function load_virtual_stock()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT))
|
||||
{
|
||||
$stock_commande_client=$stock_commande_fournisseur=0;
|
||||
@ -3000,7 +3062,7 @@ class Product extends CommonObject
|
||||
$result=$this->load_stats_commande_fournisseur(0,'3');
|
||||
if ($result < 0) dol_print_error($db,$this->error);
|
||||
$stock_commande_fournisseur=$this->stats_commande_fournisseur['qty'];
|
||||
|
||||
|
||||
$result=$this->load_stats_reception(0,'3');
|
||||
if ($result < 0) dol_print_error($db,$this->error);
|
||||
$stock_reception_fournisseur=$this->stats_reception['qty'];
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2006 Auguria SARL <info@auguria.org>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2013-2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2014 Cédric Gross <c.gross@kreiz-it.fr>
|
||||
@ -145,20 +145,18 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setaccountancy_code_buy')
|
||||
{
|
||||
$result = $object->setValueFrom('accountancy_code_buy', GETPOST('accountancy_code_buy'));
|
||||
if ($action == 'setaccountancy_code_buy') {
|
||||
|
||||
$result = $object->setAccountancyCode('buy', GETPOST('accountancy_code_buy'));
|
||||
if ($result < 0) setEventMessage(join(',',$object->errors), 'errors');
|
||||
else $object->accountancy_code_buy=GETPOST('accountancy_code_buy');
|
||||
$action="";
|
||||
}
|
||||
|
||||
if ($action == 'setaccountancy_code_sell')
|
||||
{
|
||||
$result = $object->setValueFrom('accountancy_code_sell', GETPOST('accountancy_code_sell'));
|
||||
if ($result < 0) setEventMessage(join(',',$object->errors), 'errors');
|
||||
else $object->accountancy_code_sell=GETPOST('accountancy_code_sell');
|
||||
$action="";
|
||||
$result = $object->setAccountancyCode('sell', GETPOST('accountancy_code_sell'));
|
||||
if ($result < 0) setEventMessage(join(',',$object->errors), 'errors');
|
||||
$action="";
|
||||
}
|
||||
|
||||
// Add a product or service
|
||||
@ -221,7 +219,7 @@ if (empty($reshook))
|
||||
$object->barcode_type_code = $stdobject->barcode_type_code;
|
||||
$object->barcode_type_coder = $stdobject->barcode_type_coder;
|
||||
$object->barcode_type_label = $stdobject->barcode_type_label;
|
||||
|
||||
|
||||
$object->description = dol_htmlcleanlastbr(GETPOST('desc'));
|
||||
$object->url = GETPOST('url');
|
||||
$object->note = dol_htmlcleanlastbr(GETPOST('note'));
|
||||
@ -335,7 +333,7 @@ if (empty($reshook))
|
||||
$object->barcode_type_code = $stdobject->barcode_type_code;
|
||||
$object->barcode_type_coder = $stdobject->barcode_type_coder;
|
||||
$object->barcode_type_label = $stdobject->barcode_type_label;
|
||||
|
||||
|
||||
$object->accountancy_code_sell = GETPOST('accountancy_code_sell');
|
||||
$object->accountancy_code_buy = GETPOST('accountancy_code_buy');
|
||||
|
||||
@ -1329,7 +1327,7 @@ else
|
||||
if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) $nblignes+=2;
|
||||
if ($object->isservice()) $nblignes++;
|
||||
else $nblignes+=4;
|
||||
|
||||
|
||||
// Photo
|
||||
if ($showphoto || $showbarcode)
|
||||
{
|
||||
@ -1339,7 +1337,7 @@ else
|
||||
if ($showbarcode) print $form->showbarcode($object);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
print '</tr>';
|
||||
|
||||
// Type
|
||||
@ -1351,7 +1349,7 @@ else
|
||||
print $form->editfieldval("Type",'fk_product_type',$object->type,$object,$user->rights->produit->creer||$user->rights->service->creer,$typeformat);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
if ($showbarcode)
|
||||
{
|
||||
// Barcode type
|
||||
|
||||
@ -160,14 +160,7 @@ if (empty($reshook))
|
||||
|
||||
$object->forme_juridique_code = GETPOST('forme_juridique_code');
|
||||
$object->effectif_id = GETPOST('effectif_id');
|
||||
if (GETPOST("private") == 1)
|
||||
{
|
||||
$object->typent_id = dol_getIdFromCode($db,'TE_PRIVATE','c_typent');
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->typent_id = GETPOST('typent_id');
|
||||
}
|
||||
$object->typent_id = GETPOST('typent_id');
|
||||
|
||||
$object->client = GETPOST('client');
|
||||
$object->fournisseur = GETPOST('fournisseur');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user