Merge remote-tracking branch 'origin/3.4' into develop

Conflicts:
	ChangeLog
	htdocs/comm/propal.php
	htdocs/commande/fiche.php
	htdocs/compta/facture.php
	htdocs/fichinter/class/fichinter.class.php
	htdocs/fichinter/fiche.php
This commit is contained in:
Laurent Destailleur 2013-05-20 21:21:03 +02:00
commit 12681994ea
24 changed files with 1132 additions and 1052 deletions

View File

@ -69,6 +69,7 @@ For users:
- New: [ task #741 ] Add intervention box.
- New: [ task #826 ] Optionnal increase stock when deleting an invoice already validated.
- New: [ task #823 ] Shipping_validate email notification.
- New: [ task #900 ] Review code of ficheinter.class.php
For translators:
- Update language files.
@ -112,6 +113,7 @@ WARNING: If you used external modules, some of them may need to be upgraded due
- Fix: Can't reset payment due date
- Fix: Orderstoinvoice didn't act as expected when no order was checked
- Fix: Bad link to all proposals into Third party card if customer is prospect
- Fix: Some bugs on withdrawal rejects
- Fix: [ bug #774 ] Bug on creating event with box "all day" crossed
- Fix: [ bug #787 ] Invoice supplier box incorrect tooltip when delay on payment
- Fix: [ bug #789 ] VAT not being calculated in POS
@ -131,7 +133,7 @@ WARNING: If you used external modules, some of them may need to be upgraded due
- Fix: [ bug #865 ] Dolibarr navigation array in project/task do not work
- Fix: [ bug #866 ] Standing order from an invoice suggests invoice total amount instead of remaining to pay
- Fix: [ bug #788 ] Date of linked interventions are not shown
- Fix: external users should not see costprice and margin infos
***** ChangeLog for 3.3.1 compared to 3.3 *****

View File

@ -455,7 +455,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_SUPPLIER_ORDER_FREE_TEXT">';
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnInvoices").' ('.$langs->trans("AddCRIfTooLong").')<br>';
print $langs->trans("FreeLegalTextOnOrders").' ('.$langs->trans("AddCRIfTooLong").')<br>';
print '<textarea name="SUPPLIER_ORDER_FREE_TEXT" class="flat" cols="120">'.$conf->global->SUPPLIER_ORDER_FREE_TEXT.'</textarea>';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';

View File

@ -1,34 +1,34 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/comm/propal.php
* \ingroup propale
* \brief Page of commercial proposals card and list
*/
* \ingroup propale
* \brief Page of commercial proposals card and list
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
@ -638,6 +638,7 @@ else if ($action == "addline" && $user->rights->propal->creer)
$product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):(GETPOST('dp_desc')?GETPOST('dp_desc'):'')));
$price_ht = GETPOST('price_ht');
$tva_tx = (GETPOST('tva_tx')?GETPOST('tva_tx'):0);
$predef=((! empty($idprod) && $conf->global->MAIN_FEATURES_LEVEL < 2) ? '_predef' : '');
if (empty($idprod) && GETPOST('type') < 0)
{
@ -1968,7 +1969,7 @@ else
// Show object lines
$result = $object->getLinesArray();
if (! empty($object->lines))
$ret=$object->printObjectLines($action,$mysoc,$soc,$lineid);
$ret=$object->printObjectLines($action,$mysoc,$soc,$lineid,1);
// Form to add new line
if ($object->statut == 0 && $user->rights->propal->creer)

View File

@ -26,6 +26,7 @@
include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php';
include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
/**
@ -49,14 +50,14 @@ class PropaleStats extends Stats
*
* @param DoliDB $db Database handler
* @param int $socid Id third party
* @param int $userid Id user for filter
* @param int $userid Id user for filter (creation user)
*/
function __construct($db, $socid=0, $userid=0)
{
global $user, $conf;
$this->db = $db;
$this->socid = $socid;
$this->socid = ($socid > 0 ? $socid : 0);
$this->userid = $userid;
$object=new Propal($this->db);
@ -66,7 +67,7 @@ class PropaleStats extends Stats
$this->field='total_ht';
$this->where.= " fk_statut > 0";
$this->where.= " p.fk_statut > 0";
$this->where.= " AND p.fk_soc = s.rowid AND p.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$user->societe_id) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
if($this->socid)
@ -79,7 +80,7 @@ class PropaleStats extends Stats
/**
* Return propals number by month for a year
*
*
* @param int $year year for stats
* @return array array with number by month
*/
@ -90,7 +91,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(p.datep,'%m') as dm, count(*)";
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(p.datep,'%Y') = '".$year."'";
$sql.= " WHERE p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
@ -100,7 +101,7 @@ class PropaleStats extends Stats
/**
* Return propals number by year
*
*
* @return array array with number by year
*
*/
@ -117,7 +118,7 @@ class PropaleStats extends Stats
return $this->_getNbByYear($sql);
}
/**
* Return the propals amount by month for a year
*
@ -131,14 +132,14 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(p.datep,'%m') as dm, sum(p.".$this->field.")";
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(p.datep,'%Y') = '".$year."'";
$sql.= " WHERE p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
return $this->_getAmountByMonth($year, $sql);
}
/**
* Return the propals amount average by month for a year
*
@ -152,7 +153,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(p.datep,'%m') as dm, avg(p.".$this->field.")";
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(p.datep,'%Y') = '".$year."'";
$sql.= " WHERE p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
@ -162,7 +163,7 @@ class PropaleStats extends Stats
/**
* Return nb, total and average
*
*
* @return array Array of values
*/
function getAllByYear()

View File

@ -31,8 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
$userid=GETPOST('userid','int'); if ($userid < 0) $userid=0;
$socid=GETPOST('socid','int'); if ($socid < 0) $socid=0;
$userid=GETPOST('userid','int');
$socid=GETPOST('socid','int');
// Security check
if ($user->societe_id > 0)
{
@ -63,7 +63,7 @@ $dir=$conf->propal->dir_temp;
dol_mkdir($dir);
$stats = new PropaleStats($db, $socid, $userid);
$stats = new PropaleStats($db, $socid, ($userid>0?$userid:0));
// Build graphic number of object
$data = $stats->getNbByMonthWithPrevYear($endyear,$startyear);
@ -233,12 +233,13 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
print $form->select_company($socid,'socid',$filter,1);
print '</td></tr>';
// User
print '<tr><td align="left">'.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").'</td><td align="left">';
print '<tr><td align="left">'.$langs->trans("CreatedBy").'</td><td align="left">';
print $form->select_users($userid,'userid',1);
print '</td></tr>';
// Year
print '<tr><td align="left">'.$langs->trans("Year").'</td><td align="left">';
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
if (! in_array($nowyear,$arrayyears)) $arrayyears[$nowyear]=$nowyear;
arsort($arrayyears);
print $form->selectarray('year',$arrayyears,$year,0);
print '</td></tr>';

View File

@ -26,6 +26,7 @@
include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php';
include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
/**
@ -49,7 +50,7 @@ class CommandeStats extends Stats
* @param DoliDB $db Database handler
* @param int $socid Id third party for filter
* @param string $mode Option
* @param int $userid Id user for filter
* @param int $userid Id user for filter (creation user)
*/
function __construct($db, $socid, $mode, $userid=0)
{
@ -57,7 +58,7 @@ class CommandeStats extends Stats
$this->db = $db;
$this->socid = $socid;
$this->socid = ($socid > 0 ? $socid : 0);
$this->userid = $userid;
if ($mode == 'customer')
@ -100,7 +101,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%m') as dm, count(*) nb";
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(c.date_commande,'%Y') = '".$year."'";
$sql.= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
@ -143,7 +144,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%m') as dm, sum(c.".$this->field.")";
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(c.date_commande,'%Y') = '".$year."'";
$sql.= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
@ -165,7 +166,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%m') as dm, avg(c.".$this->field.")";
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(c.date_commande,'%Y') = '".$year."'";
$sql.= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');

View File

@ -36,8 +36,8 @@ $mode=GETPOST("mode")?GETPOST("mode"):'customer';
if ($mode == 'customer' && ! $user->rights->commande->lire) accessforbidden();
if ($mode == 'supplier' && ! $user->rights->fournisseur->commande->lire) accessforbidden();
$userid=GETPOST('userid','int'); if ($userid < 0) $userid=0;
$socid=GETPOST('socid','int'); if ($socid < 0) $socid=0;
$userid=GETPOST('userid','int');
$socid=GETPOST('socid','int');
// Security check
if ($user->societe_id > 0)
{
@ -77,7 +77,7 @@ print_fiche_titre($title);
dol_mkdir($dir);
$stats = new CommandeStats($db, $socid, $mode, $userid);
$stats = new CommandeStats($db, $socid, $mode, ($userid>0?$userid:0));
// Build graphic number of object
$data = $stats->getNbByMonthWithPrevYear($endyear,$startyear);
@ -255,12 +255,13 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
print $form->select_company($socid,'socid',$filter,1);
print '</td></tr>';
// User
print '<tr><td align="left">'.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").'</td><td align="left">';
print '<tr><td align="left">'.$langs->trans("CreatedBy").'</td><td align="left">';
print $form->select_users($userid,'userid',1);
print '</td></tr>';
// Year
print '<tr><td align="left">'.$langs->trans("Year").'</td><td align="left">';
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
if (! in_array($nowyear,$arrayyears)) $arrayyears[$nowyear]=$nowyear;
arsort($arrayyears);
print $form->selectarray('year',$arrayyears,$year,0);
print '</td></tr>';

View File

@ -3292,7 +3292,7 @@ else if ($id > 0 || ! empty($ref))
foreach($extrafields->attribute_label as $key=>$label)
{
if ($action == 'edit_extras') {
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
} else {
$value=$object->array_options["options_".$key];
}

View File

@ -48,12 +48,12 @@ class FactureStats extends Stats
* @param DoliDB $db Database handler
* @param int $socid Id third party
* @param string $mode Option
* @param int $userid Id user for filter
* @param int $userid Id user for filter (creation user)
* @return FactureStats
*/
function __construct($db, $socid, $mode, $userid=0)
{
global $conf;
global $user, $conf;
$this->db = $db;
$this->socid = ($socid > 0 ? $socid : 0);
@ -62,41 +62,25 @@ class FactureStats extends Stats
if ($mode == 'customer')
{
$object=new Facture($this->db);
$this->from = MAIN_DB_PREFIX.$object->table_element;
$this->from = MAIN_DB_PREFIX.$object->table_element." as f";
$this->field='total';
}
if ($mode == 'supplier')
{
$object=new FactureFournisseur($this->db);
$this->from = MAIN_DB_PREFIX.$object->table_element;
$this->from = MAIN_DB_PREFIX.$object->table_element." as f";
$this->field='total_ht';
}
$this->where = " fk_statut > 0";
$this->where.= " AND entity = ".$conf->entity;
if ($mode == 'customer') $this->where.=" AND (fk_statut <> 3 OR close_code <> 'replaced')"; // Exclude replaced invoices as they are duplicated (we count closed invoices for other reasons)
$this->where = " f.fk_statut > 0";
$this->where.= " AND f.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$user->societe_id) $this->where .= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($mode == 'customer') $this->where.=" AND (f.fk_statut <> 3 OR f.close_code <> 'replaced')"; // Exclude replaced invoices as they are duplicated (we count closed invoices for other reasons)
if ($this->socid)
{
$this->where.=" AND fk_soc = ".$this->socid;
$this->where.=" AND f.fk_soc = ".$this->socid;
}
if ($this->userid > 0) $this->where.=' AND fk_user_author = '.$this->userid;
}
/**
* Renvoie le nombre de facture par annee
*
* @return array Array of values
*/
function getNbByYear()
{
$sql = "SELECT YEAR(datef) as dm, COUNT(*)";
$sql.= " FROM ".$this->from;
$sql.= " WHERE ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
return $this->_getNbByYear($sql);
if ($this->userid > 0) $this->where.=' AND f.fk_user_author = '.$this->userid;
}
@ -108,9 +92,10 @@ class FactureStats extends Stats
*/
function getNbByMonth($year)
{
$sql = "SELECT MONTH(datef) as dm, COUNT(*)";
$sql = "SELECT MONTH(f.datef) as dm, COUNT(*)";
$sql.= " FROM ".$this->from;
$sql.= " WHERE datef BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
@ -121,6 +106,24 @@ class FactureStats extends Stats
}
/**
* Renvoie le nombre de facture par annee
*
* @return array Array of values
*/
function getNbByYear()
{
$sql = "SELECT YEAR(f.datef) as dm, COUNT(*)";
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
return $this->_getNbByYear($sql);
}
/**
* Renvoie le montant de facture par mois pour une annee donnee
*
@ -129,9 +132,10 @@ class FactureStats extends Stats
*/
function getAmountByMonth($year)
{
$sql = "SELECT date_format(datef,'%m') as dm, SUM(".$this->field.")";
$sql = "SELECT date_format(datef,'%m') as dm, SUM(f.".$this->field.")";
$sql.= " FROM ".$this->from;
$sql.= " WHERE date_format(datef,'%Y') = '".$year."'";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
@ -149,9 +153,10 @@ class FactureStats extends Stats
*/
function getAverageByMonth($year)
{
$sql = "SELECT date_format(datef,'%m') as dm, AVG(".$this->field.")";
$sql = "SELECT date_format(datef,'%m') as dm, AVG(f.".$this->field.")";
$sql.= " FROM ".$this->from;
$sql.= " WHERE datef BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
@ -166,8 +171,9 @@ class FactureStats extends Stats
*/
function getAllByYear()
{
$sql = "SELECT date_format(datef,'%Y') as year, COUNT(*) as nb, SUM(".$this->field.") as total, AVG(".$this->field.") as avg";
$sql = "SELECT date_format(datef,'%Y') as year, COUNT(*) as nb, SUM(f.".$this->field.") as total, AVG(f.".$this->field.") as avg";
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE ".$this->where;
$sql.= " GROUP BY year";
$sql.= $this->db->order('year','DESC');

View File

@ -233,12 +233,13 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
print $form->select_company($socid,'socid',$filter,1);
print '</td></tr>';
// User
print '<tr><td>'.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").'</td><td>';
print '<tr><td>'.$langs->trans("CreatedBy").'</td><td>';
print $form->select_users($userid,'userid',1);
print '</td></tr>';
// Year
print '<tr><td>'.$langs->trans("Year").'</td><td>';
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
if (! in_array($nowyear,$arrayyears)) $arrayyears[$nowyear]=$nowyear;
arsort($arrayyears);
print $form->selectarray('year',$arrayyears,$year,0);
print '</td></tr>';

View File

@ -44,7 +44,7 @@ abstract class CommonObject
public $civility_id;
public $array_options=array();
public $linkedObjectsIds;
public $linkedObjects;
@ -2027,7 +2027,7 @@ abstract class CommonObject
$optionsArray = $extrafields->fetch_name_optionals_label($this->table_element);
}
// Request to get complementary values
if (count($optionsArray) > 0)
{
@ -2057,7 +2057,7 @@ abstract class CommonObject
}
}
}
$this->db->free($resql);
}
else
@ -2712,7 +2712,7 @@ abstract class CommonObject
*/
function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0)
{
global $conf,$langs,$hookmanager;
global $conf,$langs,$user,$hookmanager;
print '<tr class="liste_titre nodrag nodrop">';
@ -2735,7 +2735,8 @@ abstract class CommonObject
// Reduction short
print '<td align="right" width="50">'.$langs->trans('ReductionShort').'</td>';
if (! empty($conf->margin->enabled)) {
if (! empty($conf->margin->enabled) && empty($user->societe_id))
{
if ($conf->global->MARGIN_TYPE == "1")
print '<td align="right" width="80">'.$langs->trans('BuyingPrice').'</td>';
else
@ -3159,11 +3160,16 @@ abstract class CommonObject
}
/**
* displayMarginInfos
*
* @param string $force_price
* @param string $force_price Force price
* @return void
*/
function displayMarginInfos($force_price=false) {
global $langs, $conf;
function displayMarginInfos($force_price=false)
{
global $langs, $conf, $user;
if (! empty($user->societe_id)) return;
$marginInfo = $this->getMarginInfos($force_price);
@ -3215,6 +3221,5 @@ abstract class CommonObject
print '</tr>';
print '</table>';
}
}
?>

View File

@ -80,7 +80,7 @@ class modMargin extends DolibarrModules
// New pages on tabs
$this->tabs = array(
'product:+margin:Margins:margins:$conf->margin->enabled:/margin/tabs/productMargins.php?id=__ID__',
'thirdparty:+margin:Margins:margins:$conf->margin->enabled:/margin/tabs/thirdpartyMargins.php?socid=__ID__'
'thirdparty:+margin:Margins:margins:$conf->margin->enabled && empty($user->societe_id):/margin/tabs/thirdpartyMargins.php?socid=__ID__'
);

View File

@ -26,7 +26,7 @@
$usemargins=0;
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1;
?>
<!-- BEGIN PHP TEMPLATE freeproductline_create.tpl.php -->
@ -118,13 +118,13 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
<td align="center" valign="middle" colspan="<?php echo $colspan; ?>"><input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline"></td>
</tr>
<?php
if (! empty($conf->service->enabled) && $dateSelector)
<?php
if (! empty($conf->service->enabled) && $dateSelector)
{
if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) $colspan = 10;
else $colspan = 9;
if (! empty($usemargins))
if (! empty($usemargins))
{
$colspan++; // For the buying price
if($conf->global->DISPLAY_MARGIN_RATES) $colspan++;
@ -142,7 +142,7 @@ if (! empty($conf->service->enabled) && $dateSelector)
$form->select_date('',"date_end_sl",$usehm,$usehm,1,"addline_sl");
}
else
{
{
echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
echo $form->select_date('','date_start',empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,1,"addproduct");
echo ' '.$langs->trans('to').' ';
@ -151,9 +151,9 @@ if (! empty($conf->service->enabled) && $dateSelector)
?>
</td>
</tr>
<?php
<?php
}
?>
</form>
<!-- END PHP TEMPLATE freeproductline_create.tpl.php -->
<!-- END PHP TEMPLATE freeproductline_create.tpl.php -->

View File

@ -136,22 +136,19 @@ if ($forgetpasslink || $helpcenterlink)
if ($forgetpasslink) {
echo '<a class="alogin" href="'.DOL_URL_ROOT.'/user/passwordforgotten.php'.$moreparam.'">(';
echo $langs->trans('PasswordForgotten');
if (! $helpcenterlink) {
echo ')';
}
if (! $helpcenterlink) echo ')';
echo '</a>';
}
if ($forgetpasslink && $helpcenterlink) echo '&nbsp;-&nbsp;';
if ($helpcenterlink) {
$url=DOL_URL_ROOT.'/support/index.php'.$moreparam;
if (! empty($conf->global->MAIN_HELPCENTER_LINKTOUSE)) $url=$conf->global->MAIN_HELPCENTER_LINKTOUSE;
echo '<a class="alogin" href="'.dol_escape_htmltag($url).'" target="_blank">';
if ($forgetpasslink) {
echo '&nbsp;-&nbsp;';
} else {
echo '(';
}
echo $langs->trans('NeedHelpCenter').')</a>';
if (! $forgetpasslink) echo '(';
echo $langs->trans('NeedHelpCenter');
echo ')</a>';
}
echo '</div>';
}

View File

@ -119,7 +119,7 @@
<td>&nbsp;</td>
<?php }
if (! empty($conf->margin->enabled)) {
if (! empty($conf->margin->enabled) && empty($user->societe_id)) {
?>
<td align="right" class="nowrap"><?php echo price($line->pa_ht); ?></td>
<?php if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {?>

View File

@ -60,7 +60,7 @@ jQuery(document).ready(function() {
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
<?php
$colspan = 4;
if (! empty($usemargins))
if (! empty($usemargins))
{
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
@ -74,7 +74,7 @@ if (! empty($usemargins))
?>
</td>
<?php
}
}
?>
<td colspan="<?php echo $colspan; ?>">&nbsp;</td>
</tr>
@ -110,7 +110,7 @@ if (! empty($usemargins))
<td align="right" nowrap><input type="text" size="1" class="flat" name="remise_percent" value="<?php echo $buyer->remise_client; ?>"><span class="hideonsmartphone">%</span></td>
<?php
$colspan = 4;
if (! empty($usemargins))
if (! empty($usemargins))
{
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
@ -127,8 +127,8 @@ if (! empty($usemargins))
</td>
</tr>
<?php
if (! empty($conf->service->enabled) && $dateSelector)
<?php
if (! empty($conf->service->enabled) && $dateSelector)
{
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) $colspan = 10;
else $colspan = 9;
@ -148,7 +148,7 @@ if (! empty($conf->service->enabled) && $dateSelector)
print $langs->trans("DateStartPlanned").' ';
$form->select_date('',"date_start",$usehm,$usehm,1,"addline");
print ' &nbsp; '.$langs->trans("DateEndPlanned").' ';
$form->select_date('',"date_end",$usehm,$usehm,1,"addline");
$form->select_date('',"date_end",$usehm,$usehm,1,"addline");
}
else
{
@ -161,13 +161,13 @@ if (! empty($conf->service->enabled) && $dateSelector)
</td>
</tr>
<?php
}
}
?>
</form>
<?php
if (! empty($usemargins))
if (! empty($usemargins))
{
?>
<script type="text/javascript">
@ -204,6 +204,6 @@ if (! empty($usemargins))
});
</script>
<?php
}
}
?>
<!-- END PHP TEMPLATE predefinedproductline_create.tpl.php -->
<!-- END PHP TEMPLATE predefinedproductline_create.tpl.php -->

View File

@ -1,28 +1,28 @@
<?php
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/fichinter/class/fichinter.class.php
* \ingroup ficheinter
* \brief Fichier de la classe des gestion des fiches interventions
*/
* \ingroup ficheinter
* \brief Fichier de la classe des gestion des fiches interventions
*/
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
@ -61,7 +61,7 @@ class Fichinter extends CommonObject
* Constructor
*
* @param DoliDB $db Database handler
*/
*/
function __construct($db)
{
$this->db = $db;
@ -160,22 +160,23 @@ class Fichinter extends CommonObject
if ($result)
{
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."fichinter");
if ($this->id)
{
$this->ref='(PROV'.$this->id.')';
$sql = 'UPDATE '.MAIN_DB_PREFIX."fichinter SET ref='".$this->ref."' WHERE rowid=".$this->id;
dol_syslog(get_class($this)."::create sql=".$sql);
$resql=$this->db->query($sql);
if (! $resql) $error++;
}
// Add linked object
if (! $error && $this->origin && $this->origin_id)
{
$ret = $this->add_object_linked();
if (! $ret) dol_print_error($this->db);
}
// Add linked object
if (! $error && $this->origin && $this->origin_id)
{
$ret = $this->add_object_linked();
if (! $ret) dol_print_error($this->db);
}
if (! $notrigger)
{
@ -240,7 +241,7 @@ class Fichinter extends CommonObject
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql))
{
if (! $notrigger)
{
// Appel des triggers
@ -252,7 +253,7 @@ class Fichinter extends CommonObject
}
// Fin appel triggers
}
$this->db->commit();
return 1;
}
@ -318,7 +319,7 @@ class Fichinter extends CommonObject
/*
* Lines
*/
*/
$result=$this->fetch_lines();
if ($result < 0)
{
@ -389,7 +390,7 @@ class Fichinter extends CommonObject
$this->db->begin();
$now=dol_now();
// Define new ref
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref)))
{
@ -669,8 +670,8 @@ class Fichinter extends CommonObject
$this->db->begin();
// Delete linked object
$res = $this->deleteObjectLinked();
if ($res < 0) $error++;
$res = $this->deleteObjectLinked();
if ($res < 0) $error++;
// Delete linked contacts
$res = $this->delete_linked_contact();
@ -735,8 +736,9 @@ class Fichinter extends CommonObject
if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers
// Fin appel triggers
}
$this->db->commit();
return 1;
}
@ -865,11 +867,11 @@ class Fichinter extends CommonObject
/**
* Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
* Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/
function initAsSpecimen()
{
@ -894,7 +896,7 @@ class Fichinter extends CommonObject
$line->desc=$langs->trans("Description")." ".$xnbp;
$line->datei=($now-3600*(1+$xnbp));
$line->duration=600;
$line->fk_fichinter=0;
$line->fk_fichinter=0;
$this->lines[$xnbp]=$line;
$xnbp++;
@ -1021,7 +1023,7 @@ class FichinterLigne
function insert($user, $notrigger=0)
{
global $langs,$conf;
dol_syslog("FichinterLigne::insert rang=".$this->rang);
$this->db->begin();
@ -1064,7 +1066,7 @@ class FichinterLigne
if ($result > 0)
{
$this->rang=$rangToUse;
if (! $notrigger)
{
// Appel des triggers
@ -1077,7 +1079,7 @@ class FichinterLigne
// Fin appel triggers
}
}
if (!$error) {
$this->db->commit();
return $result;
@ -1108,7 +1110,7 @@ class FichinterLigne
function update($user,$notrigger=0)
{
global $langs,$conf;
$this->db->begin();
// Mise a jour ligne en base
@ -1126,7 +1128,7 @@ class FichinterLigne
$result=$this->update_total();
if ($result > 0)
{
if (! $notrigger)
{
// Appel des triggers
@ -1139,9 +1141,9 @@ class FichinterLigne
// Fin appel triggers
}
}
if (!$error)
{
{
$this->db->commit();
return $result;
}
@ -1224,7 +1226,7 @@ class FichinterLigne
function deleteline($user,$notrigger=0)
{
global $langs,$conf;
if ($this->statut == 0)
{
dol_syslog(get_class($this)."::deleteline lineid=".$this->rowid);
@ -1240,7 +1242,7 @@ class FichinterLigne
if ($result > 0)
{
$this->db->commit();
if (! $notrigger)
{
// Appel des triggers
@ -1252,7 +1254,7 @@ class FichinterLigne
}
// Fin appel triggers
}
return $result;
}
else

File diff suppressed because it is too large Load Diff

View File

@ -358,7 +358,7 @@ INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) V
-- Provinces Greece (id country=102)
INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('66', 10201, NULL, NULL, NULL, 'Αθήνα', 1);
INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('00', 10205, NULL, NULL, NULL, 'Δράμα', 1);
INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('67', 10205, NULL, NULL, NULL, 'Δράμα', 1);
INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('01', 10205, NULL, NULL, NULL, 'Έβρος', 1);
INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('02', 10205, NULL, NULL, NULL, 'Θάσος', 1);
INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('03', 10205, NULL, NULL, NULL, 'Καβάλα', 1);

View File

@ -101,6 +101,15 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 5
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 54, 5, '5.5','0','USt. Forst', 0);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 55, 5, '10.7','0','USt. Landwirtschaft', 0);
-- GREECE (id country=102)
insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (2462, 102, 23, 0, '0', 0, '0', 0, 'Κανονικός Φ.Π.Α.', 1);
insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (2463, 102, 0, 0, '0', 0, '0', 0, 'Μηδενικό Φ.Π.Α.', 1);
insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (2464, 102, 13, 0, '0', 0, '0', 0, 'Μειωμένος Φ.Π.Α.', 1);
insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (2465, 102, 6.5, 0, '0', 0, '0', 0, 'Υπερμειωμένος Φ.Π.Α.', 1);
insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (2466, 102, 16, 0, '0', 0, '0', 0, 'Νήσων κανονικός Φ.Π.Α.', 1);
insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (2467, 102, 9, 0, '0', 0, '0', 0, 'Νήσων μειωμένος Φ.Π.Α.', 1);
insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (2468, 102, 5, 0, '0', 0, '0', 0, 'Νήσων υπερμειωμένος Φ.Π.Α.', 1);
-- ICELAND (id country=116)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1161, 116,'25.5','0','VAT standard rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1162, 116, '7','0','VAT reduced rate',1);

View File

@ -393,6 +393,7 @@ AllCompletelyPayedInvoiceWillBeClosed=All invoice with no remain to pay will be
ToMakePayment=Pay
ToMakePaymentBack=Pay back
ListOfYourUnpaidInvoices=List of unpaid invoices
NoteListOfYourUnpaidInvoices=Note: This list contains only invoices for third parties you are linked to as a sale representative.
RevenueStamp=Revenue stamp
##### Types de contacts #####
TypeContact_facture_internal_SALESREPFOLL=Representative following-up customer invoice

View File

@ -390,6 +390,7 @@ AllCompletelyPayedInvoiceWillBeClosed=Toutes les factures avec un reste à payer
ToMakePayment=Payer
ToMakePaymentBack=Rembourser
ListOfYourUnpaidInvoices=Liste des factures impayées
NoteListOfYourUnpaidInvoices=Remarque: Cette liste ne contient que les factures des Tiers pour lesquels vous êtes le commercial affecté.
RevenueStamp=Timbre fiscal
##### Types de contacts #####
TypeContact_facture_internal_SALESREPFOLL=Responsable suivi facture client

View File

@ -43,10 +43,10 @@ MargeBrute=Marge brute
MargeNette=Marge nette
MARGIN_TYPE_DETAILS=Marge brute : Prix de vente HT - Prix d'achat HT<br/>Marge nette : Prix de vente HT - Coût de revient
CostPrice=Prix d'achat
BuyingCost=Coût de revient
BuyingPrice=Prix d'achat
CostPrice=Prix de revient
UnitCharges=Charge unitaire
Charges=Charges
AgentContactType=Type de contact commissionné
AgentContactTypeDetails=Permet de définir le type de contact associé aux factures qui sera associé aux agents commerciaux
AgentContactTypeDetails=Permet de définir le type de contact associé aux factures qui sera associé aux agents commerciaux

View File

@ -207,7 +207,7 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldsalerepresenta
else
{
$allmessage.= $newlangs->transnoentities("ListOfYourUnpaidInvoices").($usehtml?"<br>\n":"\n").($usehtml?"<br>\n":"\n");
$allmessage.= "Note: This list contains only invoices for third parties you are linked to as a sale representative.".($usehtml?"<br>\n":"\n");
$allmessage.= $newlangs->transnoentities("NoteListOfYourUnpaidInvoices").($usehtml?"<br>\n":"\n");
}
$allmessage.= $message.($usehtml?"<br>\n":"\n");
$allmessage.= $langs->trans("Total")." = ".price($total).($usehtml?"<br>\n":"\n");