This commit is contained in:
phf 2016-12-15 09:42:11 +01:00
commit 7376170f01
12 changed files with 94 additions and 54 deletions

View File

@ -106,7 +106,7 @@ $fsearch.=' <input type="text" name="min" id="min" value="'.$min.'" size="6">';
$calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local;
// Affiche en-tete du rapport
if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services
if ($calc==0 || $calc==1) // Calculate on invoice for goods and services
{
$nom=$langs->transcountry($local==1?"LT1ReportByCustomersInInputOutputMode":"LT2ReportByCustomersInInputOutputMode",$mysoc->country_code);
$calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT".$local."Rec");
@ -124,7 +124,7 @@ if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice
$productsup=$langs->trans("Description");
$amountsup=$langs->trans("AmountHT");
}
if ($conf->global->$calc==2) // Invoice for goods, payment for services
if ($calc==2) // Invoice for goods, payment for services
{
$nom=$langs->transcountry($local==1?"LT1ReportByCustomersInInputOutputMode":"LT2ReportByCustomersInInputOutputMode",$mysoc->country_code);
$calcmode=$langs->trans("CalcModeLT2Debt");
@ -149,7 +149,7 @@ $vatcust=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code);
$vatsup=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code);
// IRPF that the customer has retained me
if($conf->global->$calc ==0 || $conf->global->$calc == 2)
if($calc ==0 || $calc == 2)
{
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
@ -232,7 +232,7 @@ if($conf->global->$calc ==0 || $conf->global->$calc == 2)
}
// IRPF I retained my supplier
if($conf->global->$calc ==0 || $conf->global->$calc == 1){
if($calc ==0 || $calc == 1){
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print '<td align="left">'.$langs->trans("Num")."</td>";
@ -309,7 +309,7 @@ if($conf->global->$calc ==0 || $conf->global->$calc == 1){
}
}
if($conf->global->$calc ==0){
if($calc ==0){
// Total to pay
print '<br><br>';
print '<table class="noborder" width="100%">';

View File

@ -56,7 +56,7 @@ class Contrat extends CommonObject
* @var string
*/
var $ref_customer;
/**
* Supplier reference of the contract
* @var string
@ -536,7 +536,7 @@ class Contrat extends CommonObject
return -1;
}
}
/**
* Load a contract from database
*
@ -1134,6 +1134,16 @@ class Contrat extends CommonObject
}
}
// Removed extrafields
if (! $error) {
$result=$this->deleteExtraFields();
if ($result < 0)
{
$error++;
dol_syslog(get_class($this)."::delete error -3 ".$this->error, LOG_ERR);
}
}
if (! $error)
{
// We remove directory
@ -1333,7 +1343,7 @@ class Contrat extends CommonObject
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc);
$txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate.
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, 1,$mysoc, $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
@ -1356,9 +1366,9 @@ class Contrat extends CommonObject
if (empty($pa_ht)) $pa_ht=0;
// if buy price not defined, define buyprice as configured in margin admin
if ($this->pa_ht == 0)
if ($this->pa_ht == 0)
{
if (($result = $this->defineBuyPrice($pu_ht, $remise_percent, $fk_product)) < 0)
{
@ -1515,7 +1525,7 @@ class Contrat extends CommonObject
$localtaxes_type=getLocalTaxesFromRate($tvatx, 0, $this->societe, $mysoc);
$tvatx = preg_replace('/\s*\(.*\)/','',$tvatx); // Remove code into vatrate.
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, $mysoc, $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
@ -1539,7 +1549,7 @@ class Contrat extends CommonObject
if (empty($pa_ht)) $pa_ht=0;
// if buy price not defined, define buyprice as configured in margin admin
if ($this->pa_ht == 0)
if ($this->pa_ht == 0)
{
if (($result = $this->defineBuyPrice($pu_ht, $remise_percent)) < 0)
{
@ -2571,7 +2581,7 @@ class ContratLigne extends CommonObjectLine
if (empty($this->pa_ht)) $this->pa_ht=0;
// if buy price not defined, define buyprice as configured in margin admin
if ($this->pa_ht == 0)
if ($this->pa_ht == 0)
{
if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0)
{

View File

@ -729,7 +729,7 @@ class ExtraFields
}
elseif ($type == 'price')
{
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="6" value="'.price($value).'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="6" value="'.price2num($value).'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
}
elseif ($type == 'double')
{

View File

@ -1126,6 +1126,8 @@ class SMTPs
$host=preg_replace('@tcp://@i','',$host); // Remove prefix
$host=preg_replace('@ssl://@i','',$host); // Remove prefix
$host=dol_getprefix().'-'.$host;
//NOTE: Message-ID should probably contain the username of the user who sent the msg
$_header .= 'Subject: ' . $this->getSubject() . "\r\n";
$_header .= 'Date: ' . date("r") . "\r\n";

View File

@ -1,4 +1,4 @@
<?php
<?php
if (empty($keyforselect) || empty($keyforelement) || empty($keyforaliasextra))
{
@ -15,36 +15,38 @@ if ($resql) // This can fail when class is used on old database (during migra
{
while ($obj=$this->db->fetch_object($resql))
{
$fieldname=$keyforaliasextra.'.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
switch($obj->type)
{
case 'int':
case 'double':
case 'price':
$typeFilter="Numeric";
break;
case 'date':
case 'datetime':
$typeFilter="Date";
break;
case 'boolean':
$typeFilter="Boolean";
break;
case 'sellist':
$tmp='';
$tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
if ($tmpparam['options'] && is_array($tmpparam['options'])) {
$tmpkeys=array_keys($tmpparam['options']);
$tmp=array_shift($tmpkeys);
}
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp;
break;
if ($obj->type!='separate') {
$fieldname=$keyforaliasextra.'.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
switch($obj->type)
{
case 'int':
case 'double':
case 'price':
$typeFilter="Numeric";
break;
case 'date':
case 'datetime':
$typeFilter="Date";
break;
case 'boolean':
$typeFilter="Boolean";
break;
case 'sellist':
$tmp='';
$tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
if ($tmpparam['options'] && is_array($tmpparam['options'])) {
$tmpkeys=array_keys($tmpparam['options']);
$tmp=array_shift($tmpkeys);
}
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp;
break;
}
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]=$keyforelement;
}
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]=$keyforelement;
}
}
// End add axtra fields

View File

@ -290,8 +290,15 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL)
*/
function dol_getprefix()
{
global $conf;
if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"]))
{
if (! empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID))
{
if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID == 'SERVER_NAME') return $_SERVER["SERVER_NAME"];
return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID;
}
return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
// Use this for a "clear" cookie name
//return dol_sanitizeFileName($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT);

View File

@ -1202,7 +1202,7 @@ class FichinterLigne extends CommonObjectLine
// Mise a jour ligne en base
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinterdet SET";
$sql.= " description='".$this->db->escape($this->desc)."'";
$sql.= ",date=".$this->db->idate($this->datei);
$sql.= ",date='".$this->db->idate($this->datei)."'";
$sql.= ",duree=".$this->duration;
$sql.= ",rang='".$this->rang."'";
$sql.= " WHERE rowid = ".$this->rowid;

View File

@ -908,6 +908,22 @@ class Product extends CommonObject
// End call triggers
}
// Delete from product_batch on product delete
if (! $error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX.'product_batch';
$sql.= " WHERE fk_product_stock IN (";
$sql.= "SELECT rowid FROM ".MAIN_DB_PREFIX.'product_stock';
$sql.= " WHERE fk_product = ".$id.")";
dol_syslog(get_class($this).'::delete', LOG_DEBUG);
$result = $this->db->query($sql);
if (! $result)
{
$error++;
$this->errors[] = $this->db->lasterror();
}
}
// Delete all child tables
if (! $error)
{

View File

@ -5,7 +5,7 @@
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2014 Ion agorria <ion@agorria.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
@ -246,8 +246,8 @@ if (empty($reshook))
{
$obj = $db->fetch_object($resql);
$npr = $obj->recuperableonly;
$localtax1 = $obj->localtax1;
$localtax2 = $obj->localtax2;
$localtax1 = get_localtax($tva_tx,1);
$localtax2 = get_localtax($tva_tx,2);
$localtax1_type = $obj->localtax1_type;
$localtax2_type = $obj->localtax2_type;
}

View File

@ -115,8 +115,8 @@ if ($action == "correct_stock")
//$eatby=GETPOST('eatby');
//$sellby=GETPOST('sellby');
$eatby=dol_mktime(12, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear'));
$sellby=dol_mktime(12, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear'));
$eatby=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear'));
$sellby=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear'));
$result=$product->correct_stock_batch(
$user,

View File

@ -54,8 +54,8 @@ $stocklimit = GETPOST('seuil_stock_alerte');
$desiredstock = GETPOST('desiredstock');
$cancel = GETPOST('cancel');
$fieldid = isset($_GET["ref"])?'ref':'rowid';
$d_eatby=dol_mktime(12, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']);
$d_sellby=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']);
$d_eatby=dol_mktime(0, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']);
$d_sellby=dol_mktime(0, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']);
$pdluoid=GETPOST('pdluoid','int');
// Security check
@ -352,8 +352,8 @@ if ($action == 'updateline' && GETPOST('save') == $langs->trans('Save'))
}
else
{
$d_eatby=dol_mktime(12, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']);
$d_sellby=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']);
$d_eatby=dol_mktime(0, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']);
$d_sellby=dol_mktime(0, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']);
$pdluo->batch=GETPOST("batch_number",'san_alpha');
$pdluo->eatby=$d_eatby;
$pdluo->sellby=$d_sellby;

View File

@ -250,6 +250,7 @@ if ($type_element == 'supplier_invoice')
$tables_from = MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."facture_fourn_det as d";
$where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid;
$where.= " AND d.fk_facture_fourn = f.rowid";
$where.= " AND f.entity = ".$conf->entity;
$dateprint = 'f.datef';
$doc_number='f.ref';
$thirdTypeSelect='supplier';
@ -262,6 +263,7 @@ if ($type_element == 'supplier_order')
$tables_from = MAIN_DB_PREFIX."commande_fournisseur as c,".MAIN_DB_PREFIX."commande_fournisseurdet as d";
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid;
$where.= " AND d.fk_commande = c.rowid";
$where.= " AND c.entity = ".$conf->entity;
$dateprint = 'c.date_valid';
$doc_number='c.ref';
$thirdTypeSelect='supplier';
@ -275,6 +277,7 @@ if ($type_element == 'contract')
$tables_from = MAIN_DB_PREFIX."contrat as c,".MAIN_DB_PREFIX."contratdet as d";
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid;
$where.= " AND d.fk_contrat = c.rowid";
$where.= " AND c.entity = ".$conf->entity;
$dateprint = 'c.date_valid';
$doc_number='c.ref';
$thirdTypeSelect='customer';