Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
ebf002d79e
@ -6,6 +6,7 @@ English Dolibarr ChangeLog
|
||||
For users:
|
||||
- New: Some performance enhancements.
|
||||
- New: Can attach files onto trip and expenses modules.
|
||||
- New: Add option MAIN_PDF_TITLE_BACKGROUND_COLOR
|
||||
|
||||
For developers:
|
||||
- System of menu managers has been rewritten to reduce code to do same things.
|
||||
|
||||
@ -35,7 +35,7 @@ $rowid=GETPOST('rowid','int');
|
||||
$entity=GETPOST('entity','int');
|
||||
$action=GETPOST('action','alpha');
|
||||
$update=GETPOST('update','alpha');
|
||||
$delete=GETPOST('delete','alpha');
|
||||
$delete=GETPOST('delete'); // Do not use alpha here
|
||||
$debug=GETPOST('debug','int');
|
||||
$consts=GETPOST('const');
|
||||
$constname=GETPOST('constname','alpha');
|
||||
@ -47,6 +47,7 @@ $typeconst=array('yesno' => 'yesno', 'texte' => 'texte', 'chaine' => 'chaine');
|
||||
$mesg='';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -68,46 +69,70 @@ if ($action == 'add')
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (dolibarr_set_const($db, $constname, $constvalue, $typeconst[$consttype], 1, $constnote, $entity) < 0)
|
||||
if (dolibarr_set_const($db, $constname, $constvalue, $typeconst[$consttype], 1, $constnote, $entity) >= 0)
|
||||
{
|
||||
setEventMessage($langs->trans("RecordSaved"));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($consts) && $update == $langs->trans("Modify"))
|
||||
// Mass update
|
||||
if (! empty($consts) && $action == 'update')
|
||||
{
|
||||
$nbmodified=0;
|
||||
foreach($consts as $const)
|
||||
{
|
||||
if (! empty($const["check"]))
|
||||
{
|
||||
if (dolibarr_set_const($db, $const["name"], $const["value"], $const["type"], 1, $const["note"], $const["entity"]) < 0)
|
||||
if (dolibarr_set_const($db, $const["name"], $const["value"], $const["type"], 1, $const["note"], $const["entity"]) >= 0)
|
||||
{
|
||||
$nbmodified++;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($nbmodified > 0) setEventMessage($langs->trans("RecordSaved"));
|
||||
$action='';
|
||||
}
|
||||
|
||||
// Delete several lines at once
|
||||
if (! empty($consts) && $delete == $langs->trans("Delete"))
|
||||
// Mass delete
|
||||
if (! empty($consts) && $action == 'delete')
|
||||
{
|
||||
|
||||
$nbdeleted=0;
|
||||
foreach($consts as $const)
|
||||
{
|
||||
if (! empty($const["check"])) // Is checkbox checked
|
||||
{
|
||||
if (dolibarr_del_const($db, $const["rowid"], -1) < 0)
|
||||
if (dolibarr_del_const($db, $const["rowid"], -1) >= 0)
|
||||
{
|
||||
$nbdeleted++;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($nbdeleted > 0) setEventMessage($langs->trans("RecordDeleted"));
|
||||
$action='';
|
||||
}
|
||||
|
||||
// Delete line from delete picto
|
||||
if ($action == 'delete')
|
||||
{
|
||||
if (dolibarr_del_const($db, $rowid, $entity) < 0)
|
||||
if (dolibarr_del_const($db, $rowid, $entity) >= 0)
|
||||
{
|
||||
setEventMessage($langs->trans("RecordDeleted"));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
@ -130,11 +155,13 @@ jQuery(document).ready(function() {
|
||||
jQuery("#delconst").hide();
|
||||
jQuery(".checkboxfordelete").click(function() {
|
||||
jQuery("#delconst").show();
|
||||
jQuery("#action").val('delete');
|
||||
});
|
||||
jQuery(".inputforupdate").keypress(function() {
|
||||
var field_id = jQuery(this).attr("id");
|
||||
var row_num = field_id.split("_");
|
||||
jQuery("#updateconst").show();
|
||||
jQuery("#action").val('update');
|
||||
jQuery("#check_" + row_num[1]).attr("checked",true);
|
||||
});
|
||||
});
|
||||
@ -195,7 +222,8 @@ print '</form>';
|
||||
print "\n";
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && $debug)?'?debug=1':'').'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" id="action" name="action" value="">';
|
||||
|
||||
// Show constants
|
||||
$sql = "SELECT";
|
||||
|
||||
@ -1829,6 +1829,8 @@ class Facture extends CommonInvoice
|
||||
|
||||
if ($error == 0)
|
||||
{
|
||||
$this->brouillon = 1;
|
||||
$this->statut = 0;
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.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
|
||||
@ -27,7 +28,7 @@
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/margin/lib/margins.lib.php");
|
||||
|
||||
/**
|
||||
* Class to manage contracts
|
||||
@ -402,7 +403,7 @@ class Contrat extends CommonObject
|
||||
|
||||
// Selectionne les lignes contrats liees a un produit
|
||||
$sql = "SELECT p.label, p.description as product_desc, p.ref,";
|
||||
$sql.= " d.rowid, d.fk_contrat, d.statut, d.description, d.price_ht, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.remise_percent, d.subprice,";
|
||||
$sql.= " d.rowid, d.fk_contrat, d.statut, d.description, d.price_ht, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.remise_percent, d.subprice, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht,";
|
||||
$sql.= " d.total_ht,";
|
||||
$sql.= " d.total_tva,";
|
||||
$sql.= " d.total_localtax1,";
|
||||
@ -451,6 +452,10 @@ class Contrat extends CommonObject
|
||||
$line->fk_product = $objp->fk_product;
|
||||
$line->info_bits = $objp->info_bits;
|
||||
|
||||
$line->fk_fournprice = $objp->fk_fournprice;
|
||||
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht);
|
||||
$line->pa_ht = $marginInfos[0];
|
||||
|
||||
$line->fk_user_author = $objp->fk_user_author;
|
||||
$line->fk_user_ouverture= $objp->fk_user_ouverture;
|
||||
$line->fk_user_cloture = $objp->fk_user_cloture;
|
||||
@ -856,7 +861,7 @@ class Contrat extends CommonObject
|
||||
* @param int $info_bits Bits de type de lignes
|
||||
* @return int <0 si erreur, >0 si ok
|
||||
*/
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0, $info_bits=0)
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0)
|
||||
{
|
||||
global $user, $langs, $conf;
|
||||
|
||||
@ -875,6 +880,7 @@ class Contrat extends CommonObject
|
||||
if (! $pu_ttc) $pu_ttc=0;
|
||||
$pu_ht=price2num($pu_ht);
|
||||
$pu_ttc=price2num($pu_ttc);
|
||||
$pa_ht=price2num($pa_ht);
|
||||
$txtva=price2num($txtva);
|
||||
$txlocaltax1=price2num($txlocaltax1);
|
||||
$txlocaltax2=price2num($txlocaltax2);
|
||||
@ -908,13 +914,21 @@ class Contrat extends CommonObject
|
||||
$price = $pu_ht - $remise;
|
||||
}
|
||||
|
||||
if (empty($pa_ht)) $pa_ht=0;
|
||||
|
||||
// si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente
|
||||
if ($pa_ht == 0) {
|
||||
if ($pu_ht > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1))
|
||||
$pa_ht = $pu_ht * (1 - $remise_percent / 100);
|
||||
}
|
||||
|
||||
// Insertion dans la base
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contratdet";
|
||||
$sql.= " (fk_contrat, label, description, fk_product, qty, tva_tx,";
|
||||
$sql.= " localtax1_tx, localtax2_tx, remise_percent, subprice,";
|
||||
$sql.= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc,";
|
||||
$sql.= " info_bits,";
|
||||
$sql.= " price_ht, remise"; // TODO A virer
|
||||
$sql.= " price_ht, remise, fk_product_fournisseur_price, buy_price_ht";
|
||||
if ($date_start > 0) { $sql.= ",date_ouverture_prevue"; }
|
||||
if ($date_end > 0) { $sql.= ",date_fin_validite"; }
|
||||
$sql.= ") VALUES ($this->id, '', '" . $this->db->escape($desc) . "',";
|
||||
@ -926,7 +940,11 @@ class Contrat extends CommonObject
|
||||
$sql.= " ".price2num($remise_percent).",".price2num($pu_ht).",";
|
||||
$sql.= " ".price2num($total_ht).",".price2num($total_tva).",".price2num($total_localtax1).",".price2num($total_localtax2).",".price2num($total_ttc).",";
|
||||
$sql.= " '".$info_bits."',";
|
||||
$sql.= " ".price2num($price).",".price2num($remise); // TODO A virer
|
||||
$sql.= " ".price2num($price).",".price2num($remise).",";
|
||||
if (isset($fk_fournprice)) $sql.= ' '.$fk_fournprice.',';
|
||||
else $sql.= ' null,';
|
||||
if (isset($pa_ht)) $sql.= ' '.price2num($pa_ht);
|
||||
else $sql.= ' null';
|
||||
if ($date_start > 0) { $sql.= ",'".$this->db->idate($date_start)."'"; }
|
||||
if ($date_end > 0) { $sql.= ",'".$this->db->idate($date_end)."'"; }
|
||||
$sql.= ")";
|
||||
@ -983,7 +1001,7 @@ class Contrat extends CommonObject
|
||||
* @param int $info_bits Bits de type de lignes
|
||||
* @return int < 0 si erreur, > 0 si ok
|
||||
*/
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0, $localtax2tx=0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0)
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0, $localtax2tx=0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0)
|
||||
{
|
||||
global $user, $conf, $langs;
|
||||
|
||||
@ -995,6 +1013,7 @@ class Contrat extends CommonObject
|
||||
$tvatx = price2num($tvatx);
|
||||
$localtax1tx = price2num($localtax1tx);
|
||||
$localtax2tx = price2num($localtax2tx);
|
||||
$pa_ht=price2num($pa_ht);
|
||||
|
||||
$subprice = $price;
|
||||
$remise = 0;
|
||||
@ -1016,7 +1035,7 @@ class Contrat extends CommonObject
|
||||
// qty, pu, remise_percent et txtva
|
||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $localtaxtx1, $txlocaltaxtx2, 0, $price_base_type, $info_bits, 1);
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtaxtx1, $txlocaltaxtx2, 0, $price_base_type, $info_bits, 1);
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
@ -1032,6 +1051,14 @@ class Contrat extends CommonObject
|
||||
$price = $pu_ht - $remise;
|
||||
}
|
||||
|
||||
if (empty($pa_ht)) $pa_ht=0;
|
||||
|
||||
// si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente
|
||||
if ($pa_ht == 0) {
|
||||
if ($pu_ht > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1))
|
||||
$pa_ht = $pu_ht * (1 - $remise_percent / 100);
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet set description='".$this->db->escape($desc)."'";
|
||||
$sql.= ",price_ht='" . price2num($price)."'";
|
||||
$sql.= ",subprice='" . price2num($subprice)."'";
|
||||
@ -1046,6 +1073,8 @@ class Contrat extends CommonObject
|
||||
$sql.= ", total_localtax1='".price2num($total_localtax1)."'";
|
||||
$sql.= ", total_localtax2='".price2num($total_localtax2)."'";
|
||||
$sql.= ", total_ttc='". price2num($total_ttc)."'";
|
||||
$sql.= ", fk_product_fournisseur_price='".$fk_fournprice."'";
|
||||
$sql.= ", buy_price_ht='".price2num($pa_ht)."'";
|
||||
if ($date_start > 0) { $sql.= ",date_ouverture_prevue='".$this->db->idate($date_start)."'"; }
|
||||
else { $sql.=",date_ouverture_prevue=null"; }
|
||||
if ($date_end > 0) { $sql.= ",date_fin_validite='".$this->db->idate($date_end)."'"; }
|
||||
@ -1610,6 +1639,9 @@ class ContratLigne
|
||||
var $total_localtax2;
|
||||
var $total_ttc;
|
||||
|
||||
var $fk_fournprice;
|
||||
var $pa_ht;
|
||||
|
||||
var $info_bits;
|
||||
var $fk_user_author;
|
||||
var $fk_user_ouverture;
|
||||
@ -1769,6 +1801,8 @@ class ContratLigne
|
||||
$sql.= " t.total_localtax1,";
|
||||
$sql.= " t.total_localtax2,";
|
||||
$sql.= " t.total_ttc,";
|
||||
$sql.= " t.fk_product_fournisseur_price as fk_fournprice,";
|
||||
$sql.= " t.buy_price_ht as pa_ht,";
|
||||
$sql.= " t.info_bits,";
|
||||
$sql.= " t.fk_user_author,";
|
||||
$sql.= " t.fk_user_ouverture,";
|
||||
@ -1819,6 +1853,9 @@ class ContratLigne
|
||||
$this->fk_user_ouverture = $obj->fk_user_ouverture;
|
||||
$this->fk_user_cloture = $obj->fk_user_cloture;
|
||||
$this->commentaire = $obj->commentaire;
|
||||
$this->fk_fournprice = $obj->fk_fournprice;
|
||||
$marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->fk_fournprice, $obj->pa_ht);
|
||||
$this->pa_ht = $marginInfos[0];
|
||||
|
||||
}
|
||||
$this->db->free($resql);
|
||||
@ -1887,6 +1924,14 @@ class ContratLigne
|
||||
$this->total_localtax1= $tabprice[9];
|
||||
$this->total_localtax2= $tabprice[10];
|
||||
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
// si prix d'achat non renseigné et utilisé pour calcul des marges alors prix achat = prix vente
|
||||
if ($this->pa_ht == 0) {
|
||||
if ($this->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1))
|
||||
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
|
||||
}
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET";
|
||||
$sql.= " fk_contrat='".$this->fk_contrat."',";
|
||||
@ -1913,6 +1958,8 @@ class ContratLigne
|
||||
$sql.= " total_localtax1='".$this->total_localtax1."',";
|
||||
$sql.= " total_localtax2='".$this->total_localtax2."',";
|
||||
$sql.= " total_ttc='".$this->total_ttc."',";
|
||||
$sql.= " fk_product_fournisseur_price='".$this->fk_fournprice."',";
|
||||
$sql.= " buy_price_ht='".price2num($this->pa_ht)."',";
|
||||
$sql.= " info_bits='".$this->info_bits."',";
|
||||
$sql.= " fk_user_author=".($this->fk_user_author >= 0?$this->fk_user_author:"NULL").",";
|
||||
$sql.= " fk_user_ouverture=".($this->fk_user_ouverture > 0?$this->fk_user_ouverture:"NULL").",";
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.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
|
||||
@ -305,6 +306,13 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
|
||||
$localtax1_tx=get_localtax($tva_tx,1,$object->societe);
|
||||
$localtax2_tx=get_localtax($tva_tx,2,$object->societe);
|
||||
|
||||
// ajout prix achat
|
||||
$fk_fournprice = $_POST['fournprice'];
|
||||
if ( ! empty($_POST['buying_price']) )
|
||||
$pa_ht = $_POST['buying_price'];
|
||||
else
|
||||
$pa_ht = null;
|
||||
|
||||
$info_bits=0;
|
||||
if ($tva_npr) $info_bits |= 0x01;
|
||||
|
||||
@ -329,7 +337,9 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
|
||||
$date_end,
|
||||
$price_base_type,
|
||||
$pu_ttc,
|
||||
$info_bits
|
||||
$info_bits,
|
||||
$fk_fournprice,
|
||||
$pa_ht
|
||||
);
|
||||
}
|
||||
|
||||
@ -353,13 +363,18 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
|
||||
}
|
||||
*/
|
||||
|
||||
unset($_POST['qty']);
|
||||
unset($_POST['type']);
|
||||
unset($_POST['idprod']);
|
||||
unset($_POST['remise_percent']);
|
||||
unset($_POST['price_ht']);
|
||||
unset($_POST['tva_tx']);
|
||||
unset($_POST['dp_desc']);
|
||||
unset($_POST['qty']);
|
||||
unset($_POST['type']);
|
||||
unset($_POST['idprod']);
|
||||
unset($_POST['remise_percent']);
|
||||
unset($_POST['price_ht']);
|
||||
unset($_POST['price_ttc']);
|
||||
unset($_POST['tva_tx']);
|
||||
unset($_POST['product_ref']);
|
||||
unset($_POST['product_label']);
|
||||
unset($_POST['product_desc']);
|
||||
unset($_POST['fournprice']);
|
||||
unset($_POST['buying_price']);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -389,6 +404,13 @@ else if ($action == 'updateligne' && $user->rights->contrat->creer && ! GETPOST(
|
||||
$localtax1_tx=get_localtax(GETPOST('eltva_tx'),1,$object->thirdparty);
|
||||
$localtax2_tx=get_localtax(GETPOST('eltva_tx'),2,$object->thirdparty);
|
||||
|
||||
// ajout prix d'achat
|
||||
$fk_fournprice = $_POST['fournprice'];
|
||||
if ( ! empty($_POST['buying_price']) )
|
||||
$pa_ht = $_POST['buying_price'];
|
||||
else
|
||||
$pa_ht = null;
|
||||
|
||||
$objectline->description=GETPOST('product_desc');
|
||||
$objectline->price_ht=GETPOST('elprice');
|
||||
$objectline->subprice=GETPOST('elprice');
|
||||
@ -402,6 +424,8 @@ else if ($action == 'updateligne' && $user->rights->contrat->creer && ! GETPOST(
|
||||
$objectline->date_fin_validite=$date_end_update;
|
||||
$objectline->date_cloture=$date_end_real_update;
|
||||
$objectline->fk_user_cloture=$user->id;
|
||||
$objectline->fk_fournprice=$fk_fournprice;
|
||||
$objectline->pa_ht=$pa_ht;
|
||||
|
||||
// TODO verifier price_min si fk_product et multiprix
|
||||
|
||||
@ -872,7 +896,7 @@ else
|
||||
$sql.= " cd.tva_tx, cd.remise_percent, cd.info_bits, cd.subprice,";
|
||||
$sql.= " cd.date_ouverture_prevue as date_debut, cd.date_ouverture as date_debut_reelle,";
|
||||
$sql.= " cd.date_fin_validite as date_fin, cd.date_cloture as date_fin_reelle,";
|
||||
$sql.= " cd.commentaire as comment,";
|
||||
$sql.= " cd.commentaire as comment, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht,";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
@ -889,6 +913,8 @@ else
|
||||
print '<td width="50" align="right">'.$langs->trans("PriceUHT").'</td>';
|
||||
print '<td width="30" align="center">'.$langs->trans("Qty").'</td>';
|
||||
print '<td width="50" align="right">'.$langs->trans("ReductionShort").'</td>';
|
||||
if ($conf->margin->enabled)
|
||||
print '<td width="50" align="right">'.$langs->trans("BuyingPrice").'</td>';
|
||||
print '<td width="30"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -932,6 +958,10 @@ else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
if ($conf->margin->enabled)
|
||||
print '<td align="right" nowrap="nowrap">'.price($objp->pa_ht).'</td>';
|
||||
|
||||
// Icon move, update et delete (statut contrat 0=brouillon,1=valide,2=ferme)
|
||||
print '<td align="right" nowrap="nowrap">';
|
||||
if ($user->rights->contrat->creer && count($arrayothercontracts) && ($object->statut >= 0))
|
||||
@ -967,7 +997,7 @@ else
|
||||
if ($objp->subprice >= 0)
|
||||
{
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td colspan="6">';
|
||||
print '<td colspan="'.($conf->margin->enabled?7:6).'">';
|
||||
|
||||
// Date planned
|
||||
print $langs->trans("DateStartPlanned").': ';
|
||||
@ -998,6 +1028,8 @@ else
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="updateligne">';
|
||||
print '<input type="hidden" name="elrowid" value="'.GETPOST('rowid').'">';
|
||||
print '<input type="hidden" name="idprod" value="'.($objp->fk_product?$objp->fk_product:'0').'">';
|
||||
print '<input type="hidden" name="fournprice" value="'.($objp->fk_fournprice?$objp->fk_fournprice:'0').'">';
|
||||
// Ligne carac
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>';
|
||||
@ -1030,12 +1062,18 @@ else
|
||||
print '<td align="right"><input size="5" type="text" name="elprice" value="'.price($objp->subprice).'"></td>';
|
||||
print '<td align="center"><input size="2" type="text" name="elqty" value="'.$objp->qty.'"></td>';
|
||||
print '<td align="right" nowrap="nowrap"><input size="1" type="text" name="elremise_percent" value="'.$objp->remise_percent.'">%</td>';
|
||||
if ($conf->margin->enabled) {
|
||||
print '<td align="right">';
|
||||
if ($objp->fk_product)
|
||||
print '<select id="fournprice" name="fournprice"></select>';
|
||||
print '<input id="buying_price" type="text" size="5" name="buying_price" value="'.price($objp->pa_ht,0,'',0).'"></td>';
|
||||
}
|
||||
print '<td align="center" rowspan="2" valign="middle"><input type="submit" class="button" name="save" value="'.$langs->trans("Modify").'">';
|
||||
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td>';
|
||||
// Ligne dates prevues
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td colspan="5">';
|
||||
print '<td colspan="'.($conf->margin->enabled?6:5).'">';
|
||||
print $langs->trans("DateStartPlanned").' ';
|
||||
$form->select_date($db->jdate($objp->date_debut),"date_start_update",$usehm,$usehm,($db->jdate($objp->date_debut)>0?0:1),"update");
|
||||
print '<br>'.$langs->trans("DateEndPlanned").' ';
|
||||
@ -1056,7 +1094,7 @@ else
|
||||
if ($object->statut > 0)
|
||||
{
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<td colspan="6"><hr></td>';
|
||||
print '<td colspan="'.($conf->margin->enabled?7:6).'"><hr></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
@ -1213,7 +1251,7 @@ else
|
||||
|
||||
print '</tr>';
|
||||
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("Comment").'</td><td colspan="3"><input size="80" type="text" name="comment" value="'.GETPOST('comment').'"></td></tr>';
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("Comment").'</td><td colspan="'.($conf->margin->enabled?4:3).'"><input size="80" type="text" name="comment" value="'.$_POST["comment"].'"></td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -1395,3 +1433,59 @@ llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
<?php
|
||||
if ($conf->margin->enabled) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
<?php if ($action == 'editline') { ?>
|
||||
$(document).ready(function() {
|
||||
var idprod = $("input[name='idprod']").val();
|
||||
var fournprice = $("input[name='fournprice']").val();
|
||||
if (idprod > 0) {
|
||||
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': idprod}, function(data) {
|
||||
if (data.length > 0) {
|
||||
var options = '';
|
||||
var trouve=false;
|
||||
$(data).each(function() {
|
||||
options += '<option value="'+this.id+'" price="'+this.price+'"';
|
||||
if (fournprice > 0) {
|
||||
if (this.id == fournprice) {
|
||||
options += ' selected';
|
||||
$("#buying_price").val(this.price);
|
||||
trouve = true;
|
||||
}
|
||||
}
|
||||
options += '>'+this.label+'</option>';
|
||||
});
|
||||
options += '<option value=null'+(trouve?'':' selected')+'><?php echo $langs->trans("InputPrice"); ?></option>';
|
||||
$("#fournprice").html(options);
|
||||
if (trouve) {
|
||||
$("#buying_price").hide();
|
||||
$("#fournprice").show();
|
||||
}
|
||||
else {
|
||||
$("#buying_price").show();
|
||||
}
|
||||
$("#fournprice").change(function() {
|
||||
var selval = $(this).find('option:selected').attr("price");
|
||||
if (selval)
|
||||
$("#buying_price").val(selval).hide();
|
||||
else
|
||||
$('#buying_price').show();
|
||||
});
|
||||
}
|
||||
else {
|
||||
$("#fournprice").hide();
|
||||
$('#buying_price').show();
|
||||
}
|
||||
},
|
||||
'json');
|
||||
}
|
||||
else {
|
||||
$("#fournprice").hide();
|
||||
$('#buying_price').show();
|
||||
}
|
||||
});
|
||||
<?php } ?>
|
||||
</script>
|
||||
<?php } ?>
|
||||
|
||||
@ -1180,7 +1180,7 @@ class Form
|
||||
$sql.= ", pl.label as label_translated";
|
||||
}
|
||||
// Price by quantity
|
||||
if (! empty($conf->global->PRODUIT_PRICE_BY_QTY))
|
||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))
|
||||
{
|
||||
$sql.= ", (SELECT pp.rowid FROM ".MAIN_DB_PREFIX."product_price as pp WHERE pp.fk_product = p.rowid";
|
||||
if ($price_level >= 1) $sql.= " AND price_level=".$price_level;
|
||||
|
||||
@ -972,6 +972,9 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
|
||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
|
||||
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
|
||||
|
||||
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
|
||||
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
|
||||
}
|
||||
|
||||
$pdf->SetDrawColor(128,128,128);
|
||||
|
||||
@ -1126,6 +1126,9 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
|
||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
|
||||
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
|
||||
|
||||
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
|
||||
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
|
||||
}
|
||||
|
||||
$pdf->SetDrawColor(128,128,128);
|
||||
|
||||
@ -1015,6 +1015,9 @@ class pdf_azur extends ModelePDFPropales
|
||||
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
|
||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
|
||||
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
|
||||
|
||||
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
|
||||
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
|
||||
}
|
||||
|
||||
$pdf->SetDrawColor(128,128,128);
|
||||
|
||||
@ -664,6 +664,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
|
||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
|
||||
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
|
||||
|
||||
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
|
||||
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
|
||||
}
|
||||
|
||||
$pdf->SetDrawColor(128,128,128);
|
||||
|
||||
@ -843,6 +843,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
|
||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
|
||||
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
|
||||
|
||||
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
|
||||
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
|
||||
}
|
||||
|
||||
$pdf->SetDrawColor(128,128,128);
|
||||
|
||||
@ -75,8 +75,8 @@ insert into llx_cond_reglement(rowid, code, sortorder, active, libelle, libelle_
|
||||
|
||||
alter table llx_cond_reglement add (decalage smallint(6) default 0);
|
||||
|
||||
alter table llx_commande add fk_cond_reglement int(11) DEFAULT NULL;
|
||||
alter table llx_commande add fk_mode_reglement int(11) DEFAULT NULL;
|
||||
alter table llx_commande add fk_cond_reglement integer DEFAULT NULL;
|
||||
alter table llx_commande add fk_mode_reglement integer DEFAULT NULL;
|
||||
|
||||
|
||||
alter table llx_categorie drop column fk_statut;
|
||||
|
||||
@ -143,8 +143,8 @@ alter table llx_categorie ADD type int not null default '0';
|
||||
-- V4 ALTER TABLE llx_categorie DROP INDEX uk_categorie_ref;
|
||||
|
||||
create table `llx_categorie_societe` (
|
||||
`fk_categorie` int(11) not null,
|
||||
`fk_societe` int(11) not null,
|
||||
`fk_categorie` integer not null,
|
||||
`fk_societe` integer not null,
|
||||
UNIQUE KEY `fk_categorie` (`fk_categorie`,`fk_societe`),
|
||||
KEY `fk_societe` (`fk_societe`)
|
||||
) ENGINE=innodb;
|
||||
@ -154,8 +154,8 @@ alter table `llx_categorie_societe` add constraint `fk_categorie_societe_categor
|
||||
alter table `llx_categorie_societe` add constraint `fk_categorie_societe_fk_soc` foreign key(`fk_societe`) REFERENCES `llx_societe` (`rowid`);
|
||||
|
||||
create table `llx_categorie_product` (
|
||||
`fk_categorie` int(11) not null,
|
||||
`fk_product` int(11) not null,
|
||||
`fk_categorie` integer not null,
|
||||
`fk_product` integer not null,
|
||||
PRIMARY KEY (`fk_categorie`,`fk_product`),
|
||||
KEY `idx_categorie_product_fk_categorie` (`fk_categorie`),
|
||||
KEY `idx_categorie_product_fk_product` (`fk_product`)
|
||||
@ -169,24 +169,24 @@ alter table `llx_categorie_product`
|
||||
-- Ajout gestion du droit de pret
|
||||
drop table if exists `llx_droitpret_rapport`;
|
||||
create table `llx_droitpret_rapport` (
|
||||
`rowid` int(11) NOT NULL auto_increment,
|
||||
`rowid` integer NOT NULL auto_increment,
|
||||
`date_envoie` datetime NOT NULL,
|
||||
`format` varchar(10) NOT NULL,
|
||||
`date_debut` datetime NOT NULL,
|
||||
`date_fin` datetime NOT NULL,
|
||||
`fichier` varchar(255) NOT NULL,
|
||||
`nbfact` int(11) NOT NULL,
|
||||
`nbfact` integer NOT NULL,
|
||||
PRIMARY KEY (`rowid`)
|
||||
) ENGINE=innodb;
|
||||
|
||||
|
||||
-- Gestion des menu
|
||||
CREATE TABLE `llx_menu` (
|
||||
`rowid` int(11) NOT NULL,
|
||||
`rowid` integer NOT NULL,
|
||||
`menu_handler` varchar(16) NOT NULL default 'auguria',
|
||||
`type` enum('top','left') NOT NULL default 'left',
|
||||
`mainmenu` varchar(100) NOT NULL,
|
||||
`fk_menu` int(11) NOT NULL,
|
||||
`fk_menu` integer NOT NULL,
|
||||
`order` tinyint(4) NOT NULL,
|
||||
`url` varchar(255) NOT NULL,
|
||||
`target` varchar(100) NULL,
|
||||
@ -200,15 +200,15 @@ CREATE TABLE `llx_menu` (
|
||||
) ENGINE=innodb;
|
||||
|
||||
create table `llx_menu_constraint` (
|
||||
`rowid` int(11) NOT NULL,
|
||||
`rowid` integer NOT NULL,
|
||||
`action` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`rowid`)
|
||||
) ENGINE=innodb;
|
||||
|
||||
create table `llx_menu_const` (
|
||||
`rowid` int(11) NOT NULL auto_increment,
|
||||
`fk_menu` int(11) NOT NULL,
|
||||
`fk_constraint` int(11) NOT NULL,
|
||||
`rowid` integer NOT NULL auto_increment,
|
||||
`fk_menu` integer NOT NULL,
|
||||
`fk_constraint` integer NOT NULL,
|
||||
`user` tinyint(4) NOT NULL default '2',
|
||||
PRIMARY KEY (`rowid`)
|
||||
) ENGINE=innodb;
|
||||
|
||||
@ -33,3 +33,6 @@ UPDATE llx_const set value='smartphone_menu.php' where value='smartphone_frontof
|
||||
|
||||
ALTER TABLE llx_user add COLUMN fk_user integer;
|
||||
|
||||
-- margin on contracts
|
||||
alter table llx_contratdet add column fk_product_fournisseur_price integer after info_bits;
|
||||
alter table llx_contratdet add column buy_price_ht double(24,8) DEFAULT 0 after fk_product_fournisseur_price;
|
||||
@ -52,7 +52,9 @@ create table llx_contratdet
|
||||
total_localtax1 double(24,8) DEFAULT 0, -- Total Local tax 1 de la ligne
|
||||
total_localtax2 double(24,8) DEFAULT 0, -- Total Local tax 2 de la ligne
|
||||
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
|
||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||
fk_product_fournisseur_price integer DEFAULT NULL, -- supplier price id
|
||||
buy_price_ht double(24,8) DEFAULT NULL, -- buying price
|
||||
|
||||
fk_user_author integer NOT NULL DEFAULT 0,
|
||||
fk_user_ouverture integer,
|
||||
|
||||
@ -59,6 +59,7 @@ NbOfEntries=Nb of entries
|
||||
GoToWikiHelpPage=Read online help (need Internet access)
|
||||
GoToHelpPage=Read help
|
||||
RecordSaved=Record saved
|
||||
RecordDeleted=Record deleted
|
||||
LevelOfFeature=Level of features
|
||||
NotDefined=Not defined
|
||||
DefinedAndHasThisValue=Defined and value to
|
||||
|
||||
@ -59,6 +59,7 @@ NbOfEntries=Nb d'entrées
|
||||
GoToWikiHelpPage=Consulter l'aide (nécessite un accès internet)
|
||||
GoToHelpPage=Consulter l'aide
|
||||
RecordSaved=Enregistrement sauvegardé
|
||||
RecordDeleted=Enregistrement supprimé
|
||||
LevelOfFeature=Niveau de fonctionnalités
|
||||
NotDefined=Non défini
|
||||
DolibarrInHttpAuthenticationSoPasswordUseless=Dolibarr est configuré en mode authentification <b>%s</b> dans son fichier de configuration <b>conf.php</b>.<br>Cela signifie que la base des mots de passe est externe à Dolibarr, aussi toute modification de ce champ peut s'avérer sans effet.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user