This commit is contained in:
phf 2016-11-18 14:44:49 +01:00
commit e4ded18477
71 changed files with 530 additions and 344 deletions

View File

@ -11,7 +11,6 @@ during migration.
Upgrading to any other version or any other database system is abolutely required BEFORE trying Upgrading to any other version or any other database system is abolutely required BEFORE trying
make a Dolibarr upgrade. make a Dolibarr upgrade.
***** ChangeLog for 3.9.3 compared to 3.9.2 ***** ***** ChangeLog for 3.9.3 compared to 3.9.2 *****
FIX: #4383 $userid not defined FIX: #4383 $userid not defined
FIX: #4448 $filebonprev is not used, $this->filename now FIX: #4448 $filebonprev is not used, $this->filename now
@ -311,7 +310,68 @@ This is list of hooks modified:
- Remove deprecated Product::hidden property - Remove deprecated Product::hidden property
***** ChangeLog for 3.8.5 compared to 3.8.4 *****
FIX: #3815 Call to undefined function local_by_date().
FIX: #4424 Missing email of user popup in supplier orders area
FIX: #4442 Missing translation in Banks menu
FIX: #4448 $filebonprev is not used, $this->filename now
FIX: #4455
FIX: #4737 Bank transacion type selector translation is cropped
FIX: #4742 Able to delete a supplier invoice with a registered payment
FIX: #4743 UI glitch in project summary page
FIX: #4747 Missing UI background when registering a supplier invoice payment
FIX: #4748 Supplier invoice payment confirmation amount is not translated
FIX: #4749
FIX: #4756
FIX: #4766 VAT not shown in supplier invoice popup
FIX: #4809 - Duplicate functions with different content
FIX: #4851 Project selector in supplier invoices shows the project label twice
FIX: #4870
FIX: #5008 SQL error when editing the reference of a supplier invoice that already exists
FIX: #5048 Product supplier list display only one produc
FIX: #5170 tva sign with INVOICE_POSITIVE_CREDIT_NOTE option
FIX: #5203
FIX: #5207
FIX: #5338 use of not initialized var $aphour, $apmin, etc
FIX: #5380
FIX: #5383 bad object id on don delete
FIX: #5474 Country_id of "Don" object is still empty
FIX: Accountancy - 3.8 - Chart of accounts are limited on only one country
FIX: Bad include and param for project numbering module call
FIX: Box disabled because bugged
FIX: bug on email template
FIX: Can correct stock of lot using eatby or sell by date
FIX: Can make a movement on "out of sell" products
FIX: Can't create thirdparty or validate invoice if profid is mandatory and profid does not exists for other countries
FIX: can't fetch by siret or siren because of first "if"
FIX: Check stock of product by warehouse if $entrepot_id defined on shippings
FIX: correct display of minimum buying price
FIX: Creation of thumb image for size "small" was not done.
FIX: Direction of movement lost if an error occurs
FIX: dont retrieve new buying price on margin display
FIX: Duplicate records into export
FIX: Email templates not compatible with Multicompany
FIX: end of select when no fournprice
FIX: finished parameters not used
FIX: hook on group card called but not initialized
FIX: It doesn't check if there is enough stock to update the lines of orders/invoices
FIX: large expense note
FIX: missing column when module was installed before standard integration
FIX: Missing database escaping on supplier price insert/update
FIX: Not filtering correctly when come from dashboard
FIX: PROPAL_MERGE_PDF with PRODUCT_USE_OLD_PATH
FIX: real min buying price
FIX: receiving link never works
FIX: same page added several times on mergepropal option
FIX: search on date into supplier invoice list dont work because of status -1
FIX: Search supplier ref on contract
FIX: SQL error function on getAvailableDiscounts function, on bill create mode if socid is empty
FIX: systematic rounding causes prices to be updated without reason
FIX: task ODT company object not correctly retrieved
FIX: Template email must take care of positino column
FIX: VAT rate can be negative. Example spain selling to morroco.
***** ChangeLog for 3.8.4 compared to 3.8.3 ***** ***** ChangeLog for 3.8.4 compared to 3.8.3 *****
FIX: #3694 FIX: #3694
FIX: #3798 #2519 Cron jobs would never be executed FIX: #3798 #2519 Cron jobs would never be executed

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com> * Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
@ -624,7 +624,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$i=0; $i=0;
foreach ($listfieldinsert as $f => $value) foreach ($listfieldinsert as $f => $value)
{ {
if ($value == 'price' || preg_match('/^amount/i',$value) || preg_match('/^localtax/i',$value) || $value == 'taux') { if ($value == 'price' || preg_match('/^amount/i',$value) || $value == 'taux') {
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
} }
else if ($value == 'entity') { else if ($value == 'entity') {
@ -672,7 +672,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$i = 0; $i = 0;
foreach ($listfieldmodify as $field) foreach ($listfieldmodify as $field)
{ {
if ($field == 'price' || preg_match('/^amount/i',$field) || preg_match('/^localtax/i',$field) || $field == 'taux') { if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') {
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
} }
else if ($field == 'entity') { else if ($field == 'entity') {
@ -1290,23 +1290,12 @@ if ($id)
$valuetoshow = ''; $valuetoshow = '';
$align="center"; $align="center";
} }
else if ($fieldlist[$field]=='localtax1') { else if ($fieldlist[$field]=='taux') {
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0); $valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
if ($obj->localtax1 == 0) if ($obj->localtax1 == 0)
$valuetoshow = ''; $valuetoshow = '';
$align="right"; $align="right";
} }
else if ($fieldlist[$field]=='localtax2') {
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
if ($obj->localtax2 == 0)
$valuetoshow = '';
$align="right";
}
else if (in_array($fieldlist[$field],array('taux','localtax1','localtax2')))
{
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
$align="right";
}
else if (in_array($fieldlist[$field],array('recuperableonly'))) else if (in_array($fieldlist[$field],array('recuperableonly')))
{ {
$align="center"; $align="center";

View File

@ -167,7 +167,7 @@ if ($action == 'edit') // Edit
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Multilangual GUI // Multilingual GUI
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("EnableMultilangInterface").'</td><td>'; print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("EnableMultilangInterface").'</td><td>';
print $form->selectyesno('main_multilangs',$conf->global->MAIN_MULTILANGS,1); print $form->selectyesno('main_multilangs',$conf->global->MAIN_MULTILANGS,1);
@ -181,7 +181,7 @@ if ($action == 'edit') // Edit
show_theme(null,1); show_theme(null,1);
print '<br>'; print '<br>';
// Liste des zone de recherche permanantes supportees // List of permanent supported search box
if (! empty($searchform)) if (! empty($searchform))
{ {
print '<table summary="search" class="noborder" width="100%">'; print '<table summary="search" class="noborder" width="100%">';

View File

@ -5,7 +5,7 @@
* Copyright (C) 2006-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2006-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
@ -602,17 +602,19 @@ class Categorie extends CommonObject
{ {
if ($this->db->num_rows($resql) > 0) if ($this->db->num_rows($resql) > 0)
{ {
$objparent = $this->db->fetch_object($resql); $objparent = $this->db->fetch_object($resql);
if (!empty($objparent->fk_parent)) if (!empty($objparent->fk_parent))
{ {
$cat = new Categorie($this->db); $cat = new Categorie($this->db);
$cat->id=$objparent->fk_parent; $cat->id = $objparent->fk_parent;
$result=$cat->add_type($obj, $type); if (!$cat->containsObject($type, $obj->id)) {
if ($result < 0) $result = $cat->add_type($obj, $type);
{ if ($result < 0)
$this->error=$cat->error; {
$error++; $this->error = $cat->error;
$error++;
}
} }
} }
} }

View File

@ -69,7 +69,7 @@ if (! empty($conf->propal->enabled)) $propalstatic=new Propal($db);
if (! empty($conf->commande->enabled)) $orderstatic=new Commande($db); if (! empty($conf->commande->enabled)) $orderstatic=new Commande($db);
if (! empty($conf->fournisseur->enabled)) $supplierorderstatic=new CommandeFournisseur($db); if (! empty($conf->fournisseur->enabled)) $supplierorderstatic=new CommandeFournisseur($db);
llxHeader(); llxHeader("",$langs->trans("CommercialArea"));
print load_fiche_titre($langs->trans("CommercialArea"),'','title_commercial.png'); print load_fiche_titre($langs->trans("CommercialArea"),'','title_commercial.png');

View File

@ -2734,20 +2734,33 @@ class Propal extends CommonObject
*/ */
function getNomUrl($withpicto=0,$option='', $get_params='') function getNomUrl($withpicto=0,$option='', $get_params='')
{ {
global $langs, $conf; global $langs, $conf, $user;
$result=''; $result='';
$label = '<u>' . $langs->trans("ShowPropal") . '</u>'; $label = '';
if (! empty($this->ref))
$label.= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; if ($user->rights->propal->lire) {
if (! empty($this->ref_client)) $label .= '<u>'.$langs->trans("ShowPropal").'</u>';
$label.= '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_client; if (!empty($this->ref)) {
if (! empty($this->total_ht)) $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
$label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); }
if (! empty($this->total_tva)) if (!empty($this->ref_client)) {
$label.= '<br><b>' . $langs->trans('VAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); $label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_client;
if (! empty($this->total_ttc)) }
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); if (!empty($this->total_ht)) {
$label .= '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1,
$conf->currency);
}
if (!empty($this->total_tva)) {
$label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1,
$conf->currency);
}
if (!empty($this->total_ttc)) {
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1,
$conf->currency);
}
}
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
if ($option == '') { if ($option == '') {
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose; $link = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;

View File

@ -10,6 +10,7 @@
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -255,6 +256,7 @@ if ($result)
} }
$param='&socid='.$socid.'&viewstatut='.$viewstatut; $param='&socid='.$socid.'&viewstatut='.$viewstatut;
if ($sall) $param.='&sall='.$sall;
if ($month) $param.='&month='.$month; if ($month) $param.='&month='.$month;
if ($year) $param.='&year='.$year; if ($year) $param.='&year='.$year;
if ($search_ref) $param.='&search_ref=' .$search_ref; if ($search_ref) $param.='&search_ref=' .$search_ref;

View File

@ -3071,7 +3071,7 @@ class Commande extends CommonOrder
*/ */
function getNomUrl($withpicto=0,$option=0,$max=0,$short=0) function getNomUrl($withpicto=0,$option=0,$max=0,$short=0)
{ {
global $conf, $langs; global $conf, $langs, $user;
$result=''; $result='';
@ -3081,17 +3081,29 @@ class Commande extends CommonOrder
if ($short) return $url; if ($short) return $url;
$picto = 'order'; $picto = 'order';
$label = '<u>' . $langs->trans("ShowOrder") . '</u>'; $label = '';
if (! empty($this->ref))
$label .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; if ($user->rights->commande->lire) {
if (! empty($this->ref_client)) $label = '<u>'.$langs->trans("ShowOrder").'</u>';
$label.= '<br><b>' . $langs->trans('RefCustomer') . ':</b> ' . $this->ref_client; if (!empty($this->ref)) {
if (! empty($this->total_ht)) $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
$label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); }
if (! empty($this->total_tva)) if (!empty($this->ref_client)) {
$label.= '<br><b>' . $langs->trans('VAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); $label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_client;
if (! empty($this->total_ttc)) }
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); if (!empty($this->total_ht)) {
$label .= '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1,
$conf->currency);
}
if (!empty($this->total_tva)) {
$label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1,
$conf->currency);
}
if (!empty($this->total_ttc)) {
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1,
$conf->currency);
}
}
$linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>'; $linkend='</a>';

View File

@ -259,6 +259,7 @@ if ($resql)
$title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill'); $title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
$param=''; $param='';
if ($sall) $param.='&sall='.$sall;
if ($socid > 0) $param.='&socid='.$socid; if ($socid > 0) $param.='&socid='.$socid;
if ($viewstatut != '') $param.='&viewstatut='.$viewstatut; if ($viewstatut != '') $param.='&viewstatut='.$viewstatut;
if ($orderday) $param.='&orderday='.$orderday; if ($orderday) $param.='&orderday='.$orderday;
@ -587,10 +588,13 @@ if ($resql)
print dol_print_date($db->jdate($objp->date_commande), 'day'); print dol_print_date($db->jdate($objp->date_commande), 'day');
print '</td>'; print '</td>';
// Delivery date if (empty($conf->global->ORDER_DISABLE_DELIVERY_DATE))
print '<td align="center">'; {
print dol_print_date($db->jdate($objp->date_delivery), 'day'); // Delivery date
print '</td>'; print '<td align="center">';
print dol_print_date($db->jdate($objp->date_delivery), 'day');
print '</td>';
}
// Amount HT // Amount HT
print '<td align="right" class="nowrap">'.price($objp->total_ht).'</td>'; print '<td align="right" class="nowrap">'.price($objp->total_ht).'</td>';

View File

@ -66,7 +66,6 @@ if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
if (! empty($conf->margin->enabled)) if (! empty($conf->margin->enabled))
$langs->load('margins'); $langs->load('margins');
$sall = trim(GETPOST('sall'));
$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
$id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility $id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility

View File

@ -530,7 +530,7 @@ if ($search_user > 0)
} }
if (! $sall) if (! $sall)
{ {
$sql.= ' GROUP BY f.rowid, f.facnumber, ref_client, f.type, f.note_private, f.note_public, f.increment, f.total, f.tva, f.total_ttc,'; $sql.= ' GROUP BY f.rowid, f.facnumber, ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total, f.tva, f.total_ttc,';
$sql.= ' f.datef, f.date_lim_reglement,'; $sql.= ' f.datef, f.date_lim_reglement,';
$sql.= ' f.paye, f.fk_statut,'; $sql.= ' f.paye, f.fk_statut,';
$sql.= ' s.nom, s.rowid, s.code_client, s.client'; $sql.= ' s.nom, s.rowid, s.code_client, s.client';
@ -568,6 +568,7 @@ if ($resql)
} }
$param='&socid='.$socid; $param='&socid='.$socid;
if ($sall) $param.='&sall='.$sall;
if ($day) $param.='&day='.$day; if ($day) $param.='&day='.$day;
if ($month) $param.='&month='.$month; if ($month) $param.='&month='.$month;
if ($year) $param.='&year=' .$year; if ($year) $param.='&year=' .$year;

View File

@ -273,7 +273,8 @@ $sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND f.datev >= '".$db->idate(dol_get_first_day($y,1,false))."'"; $sql.= " AND f.datev >= '".$db->idate(dol_get_first_day($y,1,false))."'";
$sql.= " AND f.datev <= '".$db->idate(dol_get_last_day($y,12,false))."'"; $sql.= " AND f.datev <= '".$db->idate(dol_get_last_day($y,12,false))."'";
$sql.= " AND localtaxtype=".$localTaxType; $sql.= " AND localtaxtype=".$localTaxType;
$sql.= " GROUP BY dm ASC"; $sql.= " GROUP BY dm";
$sql.= " ORDER BY dm ASC";
pt($db, $sql,$langs->trans("Year")." $y"); pt($db, $sql,$langs->trans("Year")." $y");

View File

@ -3,7 +3,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2014-2016 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -919,7 +919,7 @@ class BonPrelevement extends CommonObject
$dir=$conf->prelevement->dir_output.'/receipts'; $dir=$conf->prelevement->dir_output.'/receipts';
if (! is_dir($dir)) dol_mkdir($dir); if (! is_dir($dir)) dol_mkdir($dir);
$this->filename = $dir.'/receipts/'.$ref.'.xml'; $this->filename = $dir.'/'.$ref.'.xml';
// Create withdraw receipt in database // Create withdraw receipt in database
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";
@ -1558,7 +1558,7 @@ class BonPrelevement extends CommonObject
$XML_DEBITOR =''; $XML_DEBITOR ='';
$XML_DEBITOR .=' <DrctDbtTxInf>'.$CrLf; $XML_DEBITOR .=' <DrctDbtTxInf>'.$CrLf;
$XML_DEBITOR .=' <PmtId>'.$CrLf; $XML_DEBITOR .=' <PmtId>'.$CrLf;
$XML_DEBITOR .=' <EndToEndId>'.('AS-'.$row_facnumber.'-'.$Rowing).'</EndToEndId>'.$CrLf; $XML_DEBITOR .=' <EndToEndId>'.('AS-'.dol_trunc($row_facnumber,20).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
$XML_DEBITOR .=' </PmtId>'.$CrLf; $XML_DEBITOR .=' </PmtId>'.$CrLf;
$XML_DEBITOR .=' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf; $XML_DEBITOR .=' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
$XML_DEBITOR .=' <DrctDbtTx>'.$CrLf; $XML_DEBITOR .=' <DrctDbtTx>'.$CrLf;
@ -1673,8 +1673,9 @@ class BonPrelevement extends CommonObject
* @return string String with SEPA Sender * @return string String with SEPA Sender
*/ */
function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n') function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n')
{ // SEPA INITIALISATION {
global $confs; // SEPA INITIALISATION
global $conf;
$dateTime_YMD = dol_print_date($ladate, '%Y%m%d'); $dateTime_YMD = dol_print_date($ladate, '%Y%m%d');
$dateTime_ETAD = dol_print_date($ladate, '%Y-%m-%d'); $dateTime_ETAD = dol_print_date($ladate, '%Y-%m-%d');

View File

@ -141,7 +141,7 @@ if ($prev_id)
print price($row[0]); print price($row[0]);
print '</td><td align="right">'; print '</td><td align="right">';
print round($row[0]/$bon->amount*100,2)." %"; if ($bon->amount) print round($row[0]/$bon->amount*100,2)." %";
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -364,6 +364,7 @@ if ($result)
$param ='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall); $param ='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall);
$param.='&type='.urlencode($type).'&view='.urlencode($view).'&search_lastname='.urlencode($search_lastname).'&search_firstname='.urlencode($search_firstname).'&search_societe='.urlencode($search_societe).'&search_email='.urlencode($search_email); $param.='&type='.urlencode($type).'&view='.urlencode($view).'&search_lastname='.urlencode($search_lastname).'&search_firstname='.urlencode($search_firstname).'&search_societe='.urlencode($search_societe).'&search_email='.urlencode($search_email);
if (!empty($search_categ)) $param.='&search_categ='.urlencode($search_categ); if (!empty($search_categ)) $param.='&search_categ='.urlencode($search_categ);
if ($sall != '') $param.='&amp;sall='.urlencode($sall);
if ($search_lastname != '') $param.='&amp;search_lastname='.urlencode($search_lastname); if ($search_lastname != '') $param.='&amp;search_lastname='.urlencode($search_lastname);
if ($search_firstname != '') $param.='&amp;search_firstname='.urlencode($search_firstname); if ($search_firstname != '') $param.='&amp;search_firstname='.urlencode($search_firstname);
if ($search_zip != '') $param.='&amp;search_zip='.urlencode($search_zip); if ($search_zip != '') $param.='&amp;search_zip='.urlencode($search_zip);

View File

@ -6,6 +6,7 @@
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop> * Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -222,6 +223,7 @@ if ($resql)
$param.='&search_name='.$search_name; $param.='&search_name='.$search_name;
$param.='&search_ref_supplier='.$search_ref_supplier; $param.='&search_ref_supplier='.$search_ref_supplier;
$param.='&search_sale=' .$search_sale; $param.='&search_sale=' .$search_sale;
if ($sall != '') $param.='&sall='.$sall;
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($optioncss != '') $param.='&optioncss='.$optioncss;
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder);

View File

@ -80,11 +80,11 @@ if(! empty($_POST['removAll']))
{ {
$pathtodelete = $value; $pathtodelete = $value;
$filetodelete = $listofnames[$key]; $filetodelete = $listofnames[$key];
$result = dol_delete_file($pathtodelete,1); // Delete uploded Files $result = dol_delete_file($pathtodelete,1); // Delete uploded Files
$langs->load("other"); $langs->load("other");
setEventMessages($langs->trans("FileWasRemoved",$filetodelete), null, 'mesgs'); setEventMessages($langs->trans("FileWasRemoved",$filetodelete), null, 'mesgs');
$formmail->remove_attached_files($key); // Update Session $formmail->remove_attached_files($key); // Update Session
} }
} }
@ -117,29 +117,29 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$dolimail = new Dolimail($db); $dolimail = new Dolimail($db);
$possibleaccounts=$dolimail->get_societe_by_email($_POST['sendto'],"1"); $possibleaccounts=$dolimail->get_societe_by_email($_POST['sendto'],"1");
$possibleuser=$dolimail->get_from_user_by_mail($_POST['sendto'],"1"); // suche in llx_societe and socpeople $possibleuser=$dolimail->get_from_user_by_mail($_POST['sendto'],"1"); // suche in llx_societe and socpeople
if (!$possibleaccounts && !$possibleuser) if (!$possibleaccounts && !$possibleuser)
{ {
setEventMessages($langs->trans('ErrorFailedToFindSocieteRecord',$_POST['sendto']), null, 'errors'); setEventMessages($langs->trans('ErrorFailedToFindSocieteRecord',$_POST['sendto']), null, 'errors');
} }
elseif (count($possibleaccounts)>1) elseif (count($possibleaccounts)>1)
{ {
$sendtosocid=$possibleaccounts[1]['id']; $sendtosocid=$possibleaccounts[1]['id'];
$result=$object->fetch($sendtosocid); $result=$object->fetch($sendtosocid);
setEventMessages($langs->trans('ErrorFoundMoreThanOneRecordWithEmail',$_POST['sendto'],$object->name), null, 'mesgs'); setEventMessages($langs->trans('ErrorFoundMoreThanOneRecordWithEmail',$_POST['sendto'],$object->name), null, 'mesgs');
} }
else else
{ {
if($possibleaccounts){ if($possibleaccounts){
$sendtosocid=$possibleaccounts[1]['id']; $sendtosocid=$possibleaccounts[1]['id'];
$result=$object->fetch($sendtosocid); $result=$object->fetch($sendtosocid);
}elseif($possibleuser){ }elseif($possibleuser){
$sendtosocid=$possibleuser[0]['id']; $sendtosocid=$possibleuser[0]['id'];
$result=$uobject->fetch($sendtosocid); $result=$uobject->fetch($sendtosocid);
$object=$uobject; $object=$uobject;
} }
} }
} }
} }
@ -236,35 +236,35 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$mailboxconfig = new IMAP($db); $mailboxconfig = new IMAP($db);
$mailboxconfig->fetch($mbid); $mailboxconfig->fetch($mbid);
if ($mailboxconfig->mailbox_imap_host) $ref=$mailboxconfig->get_ref(); if ($mailboxconfig->mailbox_imap_host) $ref=$mailboxconfig->get_ref();
$mailboxconfig->folder_id=$mailboxconfig->mailbox_imap_outbox; $mailboxconfig->folder_id=$mailboxconfig->mailbox_imap_outbox;
$mailboxconfig->userfolder_fetch(); $mailboxconfig->userfolder_fetch();
if ($mailboxconfig->mailbox_save_sent_mails == 1) if ($mailboxconfig->mailbox_save_sent_mails == 1)
{ {
$folder=str_replace($ref, '', $mailboxconfig->folder_cache_key); $folder=str_replace($ref, '', $mailboxconfig->folder_cache_key);
if (!$folder) $folder = "Sent"; // Default Sent folder if (!$folder) $folder = "Sent"; // Default Sent folder
$mailboxconfig->mbox = imap_open($mailboxconfig->get_connector_url().$folder, $mailboxconfig->mailbox_imap_login, $mailboxconfig->mailbox_imap_password); $mailboxconfig->mbox = imap_open($mailboxconfig->get_connector_url().$folder, $mailboxconfig->mailbox_imap_login, $mailboxconfig->mailbox_imap_password);
if (FALSE === $mailboxconfig->mbox) if (FALSE === $mailboxconfig->mbox)
{ {
$info = FALSE; $info = FALSE;
$err = $langs->trans('Error3_Imap_Connection_Error'); $err = $langs->trans('Error3_Imap_Connection_Error');
setEventMessages($err,$mailboxconfig->element, null, 'errors'); setEventMessages($err,$mailboxconfig->element, null, 'errors');
} }
else else
{ {
$mailboxconfig->mailboxid=$_POST['frommail']; $mailboxconfig->mailboxid=$_POST['frommail'];
$mailboxconfig->foldername=$folder; $mailboxconfig->foldername=$folder;
$from = $mailfromid[0] . $mailfromid[2]; $from = $mailfromid[0] . $mailfromid[2];
$imap=1; $imap=1;
} }
} }
} }
} }
// Send mail // Send mail
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid); $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid);
@ -278,7 +278,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
if ($result) if ($result)
{ {
$error=0; $error=0;
// FIXME This must be moved into a trigger for action $trigger_name // FIXME This must be moved into a trigger for action $trigger_name
if (! empty($conf->dolimail->enabled)) if (! empty($conf->dolimail->enabled))
{ {
@ -289,13 +289,13 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$dolimail=new DoliMail($db); $dolimail=new DoliMail($db);
$dolimail->id = $mid; $dolimail->id = $mid;
$res=$dolimail->set_prop($user, 'answered',1); $res=$dolimail->set_prop($user, 'answered',1);
} }
if ($imap==1) if ($imap==1)
{ {
// write mail to IMAP Server // write mail to IMAP Server
$movemail = $mailboxconfig->putMail($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$folder,$deliveryreceipt,$mailfile); $movemail = $mailboxconfig->putMail($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$folder,$deliveryreceipt,$mailfile);
if ($movemail) setEventMessages($langs->trans("MailMovedToImapFolder",$folder), null, 'mesgs'); if ($movemail) setEventMessages($langs->trans("MailMovedToImapFolder",$folder), null, 'mesgs');
else setEventMessages($langs->trans("MailMovedToImapFolder_Warning",$folder), null, 'warnings'); else setEventMessages($langs->trans("MailMovedToImapFolder_Warning",$folder), null, 'warnings');
} }
} }
@ -313,7 +313,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$interface=new Interfaces($db); $interface=new Interfaces($db);
$result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf); $result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf);
if ($result < 0) { if ($result < 0) {
$error++; $this->errors=$interface->errors; $error++; $errors=$interface->errors;
} }
// End call of triggers // End call of triggers
@ -327,8 +327,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
// This avoid sending mail twice if going out and then back to page // This avoid sending mail twice if going out and then back to page
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
setEventMessages($mesg, null, 'mesgs'); setEventMessages($mesg, null, 'mesgs');
if($conf->dolimail->enabled) header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id.'&'.($paramname2?$paramname2:'mid').'='.$parm2val); if ($conf->dolimail->enabled) header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id.'&'.($paramname2?$paramname2:'mid').'='.$parm2val);
else header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id); else header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id);
exit; exit;
} }
} }

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2012-2014 Charles-François BENKE <charles.fr@benke.fr> /* Copyright (C) 2012-2014 Charles-François BENKE <charles.fr@benke.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2016 Juan José Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -79,8 +80,10 @@ class box_project extends ModeleBoxes
$sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut "; $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut ";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
if($user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc";
$sql.= " WHERE p.entity = ".$conf->entity; $sql.= " WHERE p.entity = ".$conf->entity;
$sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
$sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts
$sql.= " ORDER BY p.datec DESC"; $sql.= " ORDER BY p.datec DESC";
$sql.= $db->plimit($max, 0); $sql.= $db->plimit($max, 0);

View File

@ -35,8 +35,8 @@ abstract class CommonDocGenerator
{ {
var $error=''; var $error='';
protected $db; protected $db;
/** /**
* Constructor * Constructor
* *
@ -59,6 +59,8 @@ abstract class CommonDocGenerator
{ {
global $conf; global $conf;
$logotouse=$conf->user->dir_output.'/'.get_exdir($user->id, 2, 0, 1, $user, 'user').'/'.$user->photo;
return array( return array(
'myuser_lastname'=>$user->lastname, 'myuser_lastname'=>$user->lastname,
'myuser_firstname'=>$user->firstname, 'myuser_firstname'=>$user->firstname,
@ -75,7 +77,7 @@ abstract class CommonDocGenerator
'myuser_fax'=>$user->office_fax, 'myuser_fax'=>$user->office_fax,
'myuser_mobile'=>$user->user_mobile, 'myuser_mobile'=>$user->user_mobile,
'myuser_email'=>$user->email, 'myuser_email'=>$user->email,
'myuser_logo'=>$user->photo, 'myuser_logo'=>$logotouse,
'myuser_job'=>$user->job, 'myuser_job'=>$user->job,
'myuser_web'=>'' // url not exist in $user object 'myuser_web'=>'' // url not exist in $user object
); );
@ -390,7 +392,7 @@ abstract class CommonDocGenerator
// Add vat by rates // Add vat by rates
foreach ($object->lines as $line) foreach ($object->lines as $line)
{ {
// $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility // $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility
if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0; if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0;
$resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva; $resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva;
$resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]); $resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]);
@ -430,7 +432,7 @@ abstract class CommonDocGenerator
'line_fulldesc'=>doc_getlinedesc($line,$outputlangs), 'line_fulldesc'=>doc_getlinedesc($line,$outputlangs),
'line_product_ref'=>$line->product_ref, 'line_product_ref'=>$line->product_ref,
'line_product_label'=>$line->product_label, 'line_product_label'=>$line->product_label,
'line_product_type'=>$line->product_type, 'line_product_type'=>$line->product_type,
'line_desc'=>$line->desc, 'line_desc'=>$line->desc,
'line_vatrate'=>vatrate($line->tva_tx,true,$line->info_bits), 'line_vatrate'=>vatrate($line->tva_tx,true,$line->info_bits),
'line_up'=>price2num($line->subprice), 'line_up'=>price2num($line->subprice),
@ -444,9 +446,9 @@ abstract class CommonDocGenerator
'line_price_ttc_locale'=>price($line->total_ttc, 0, $outputlangs), 'line_price_ttc_locale'=>price($line->total_ttc, 0, $outputlangs),
'line_price_vat_locale'=>price($line->total_tva, 0, $outputlangs), 'line_price_vat_locale'=>price($line->total_tva, 0, $outputlangs),
'line_date_start'=>$line->date_start, 'line_date_start'=>$line->date_start,
'line_date_start_rfc'=>dol_print_date($line->date_start,'rfc'), 'line_date_start_rfc'=>dol_print_date($line->date_start,'dayrfc'),
'line_date_end'=>$line->date_end, 'line_date_end'=>$line->date_end,
'line_date_end_rfc'=>dol_print_date($line->date_end,'rfc') 'line_date_end_rfc'=>dol_print_date($line->date_end,'dayrfc')
); );
// Retrieve extrafields // Retrieve extrafields
@ -582,7 +584,7 @@ abstract class CommonDocGenerator
$object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]]; $object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]];
} }
else if($extrafields->attribute_type[$key] == 'date') else if($extrafields->attribute_type[$key] == 'date')
{ {
if (strlen($object->array_options['options_'.$key])>0) if (strlen($object->array_options['options_'.$key])>0)
{ {
$object->array_options['options_'.$key] = dol_print_date($object->array_options['options_'.$key],'day'); // using company output language $object->array_options['options_'.$key] = dol_print_date($object->array_options['options_'.$key],'day'); // using company output language

View File

@ -448,7 +448,7 @@ abstract class CommonObject
global $conf, $langs; global $conf, $langs;
$countriesusingstate=array('AU','US','IN','GB','ES','UK','TR'); // See also option MAIN_FORCE_STATE_INTO_ADDRESS $countriesusingstate=array('AU','US','IN','GB','ES','UK','TR'); // See also option MAIN_FORCE_STATE_INTO_ADDRESS
$contactid=0; $contactid=0;
$thirdpartyid=0; $thirdpartyid=0;
if ($this->element == 'societe') if ($this->element == 'societe')
@ -465,12 +465,12 @@ abstract class CommonObject
$contactid=$this->contact_id; $contactid=$this->contact_id;
$thirdpartyid=$object->fk_soc; $thirdpartyid=$object->fk_soc;
} }
$out='<!-- BEGIN part to show address block -->'; $out='<!-- BEGIN part to show address block -->';
$outdone=0; $outdone=0;
$coords = $this->getFullAddress(1,', '); $coords = $this->getFullAddress(1,', ');
if ($coords) if ($coords)
{ {
if (! empty($conf->use_javascript_ajax)) if (! empty($conf->use_javascript_ajax))
{ {
@ -485,7 +485,7 @@ abstract class CommonObject
} }
if (! in_array($this->country_code,$countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS) // If MAIN_FORCE_STATE_INTO_ADDRESS is on, state is already returned previously with getFullAddress if (! in_array($this->country_code,$countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS) // If MAIN_FORCE_STATE_INTO_ADDRESS is on, state is already returned previously with getFullAddress
&& empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state) && empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state)
{ {
$out.=($outdone?' - ':'').$this->state; $out.=($outdone?' - ':'').$this->state;
$outdone++; $outdone++;
@ -516,15 +516,15 @@ abstract class CommonObject
if (! empty($this->office_fax)) { if (! empty($this->office_fax)) {
$out.=dol_print_phone($this->fax,$this->country_code,$contactid,$thirdpartyid,'AC_FAX','&nbsp;','fax',$langs->trans("Fax")); $outdone++; $out.=dol_print_phone($this->fax,$this->country_code,$contactid,$thirdpartyid,'AC_FAX','&nbsp;','fax',$langs->trans("Fax")); $outdone++;
} }
$out.='<div style="clear: both;"></div>'; $out.='<div style="clear: both;"></div>';
$outdone=0; $outdone=0;
if (! empty($this->email)) if (! empty($this->email))
{ {
$out.=dol_print_email($this->email,$this->id,$object->id,'AC_EMAIL',0,0,1); $out.=dol_print_email($this->email,$this->id,$object->id,'AC_EMAIL',0,0,1);
$outdone++; $outdone++;
} }
if (! empty($this->url)) if (! empty($this->url))
{ {
$out.=dol_print_url($this->url,'',0,1); $out.=dol_print_url($this->url,'',0,1);
$outdone++; $outdone++;
@ -535,12 +535,12 @@ abstract class CommonObject
if ($this->skype) $out.=dol_print_skype($this->skype,$this->id,$object->id,'AC_SKYPE'); if ($this->skype) $out.=dol_print_skype($this->skype,$this->id,$object->id,'AC_SKYPE');
$outdone++; $outdone++;
} }
$out.='<!-- END Part to show address block -->'; $out.='<!-- END Part to show address block -->';
return $out; return $out;
} }
/** /**
* Add a link between element $this->element and a contact * Add a link between element $this->element and a contact
* *
@ -595,50 +595,56 @@ abstract class CommonObject
} }
} }
$datecreate = dol_now();
$this->db->begin();
// Insertion dans la base
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact";
$sql.= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) ";
$sql.= " VALUES (".$this->id.", ".$fk_socpeople." , " ;
$sql.= "'".$this->db->idate($datecreate)."'";
$sql.= ", 4, '". $id_type_contact . "' ";
$sql.= ")";
dol_syslog(get_class($this)."::add_contact", LOG_DEBUG);
$resql=$this->db->query($sql); if(! empty($id_type_contact)) {
if ($resql)
{ $datecreate = dol_now();
if (! $notrigger)
{ $this->db->begin();
$result=$this->call_trigger(strtoupper($this->element).'_ADD_CONTACT', $user);
if ($result < 0) // Insertion dans la base
{ $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact";
$this->db->rollback(); $sql.= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) ";
$sql.= " VALUES (".$this->id.", ".$fk_socpeople." , " ;
$sql.= "'".$this->db->idate($datecreate)."'";
$sql.= ", 4, ". $id_type_contact . " ";
$sql.= ")";
dol_syslog(get_class($this)."::add_contact", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
if (! $notrigger)
{
$result=$this->call_trigger(strtoupper($this->element).'_ADD_CONTACT', $user);
if ($result < 0)
{
$this->db->rollback();
return -1;
}
}
$this->db->commit();
return 1;
}
else
{
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$this->error=$this->db->errno();
$this->db->rollback();
return -2;
}
else
{
$this->error=$this->db->error();
$this->db->rollback();
return -1; return -1;
} }
} }
$this->db->commit();
return 1;
}
else
{
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$this->error=$this->db->errno();
$this->db->rollback();
return -2;
}
else
{
$this->error=$this->db->error();
$this->db->rollback();
return -1;
}
} }
return 1;
} }
/** /**
@ -1196,7 +1202,7 @@ abstract class CommonObject
if (!empty($id) && !empty($field) && !empty($table)) { if (!empty($id) && !empty($field) && !empty($table)) {
$sql = "SELECT ".$field." FROM ".MAIN_DB_PREFIX.$table; $sql = "SELECT ".$field." FROM ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE rowid = ".$id; $sql.= " WHERE rowid = ".$id;
dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG); dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
@ -2275,8 +2281,8 @@ abstract class CommonObject
* - all parameters empty -> we look all link to current object (current object can be source or target) * - all parameters empty -> we look all link to current object (current object can be source or target)
* - one couple id+type is provided -> this will set $justsource or $justtarget * - one couple id+type is provided -> this will set $justsource or $justtarget
* - one couple id+type is provided and other type is provided -> this will set $justsource or $justtarget + criteria on other type * - one couple id+type is provided and other type is provided -> this will set $justsource or $justtarget + criteria on other type
* *
* *
* @param int $sourceid Object source id (if not defined, id of object) * @param int $sourceid Object source id (if not defined, id of object)
* @param string $sourcetype Object source type (if not defined, element name of object) * @param string $sourcetype Object source type (if not defined, element name of object)
* @param int $targetid Object target id (if not defined, id of object) * @param int $targetid Object target id (if not defined, id of object)
@ -3223,7 +3229,7 @@ abstract class CommonObject
$text.= ' - '.(! empty($line->label)?$line->label:$label); $text.= ' - '.(! empty($line->label)?$line->label:$label);
$description.=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($line->description)); // Description is what to show on popup. We shown nothing if already into desc. $description.=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($line->description)); // Description is what to show on popup. We shown nothing if already into desc.
} }
$line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU'); $line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU');
// Output template part (modules that overwrite templates must declare this into descriptor) // Output template part (modules that overwrite templates must declare this into descriptor)
@ -3662,7 +3668,7 @@ abstract class CommonObject
return -1; return -1;
} }
} }
// We save charset_output to restore it because write_file can change it if needed for // We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8. // output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output; $sav_charset_output=$outputlangs->charset_output;
@ -3726,13 +3732,13 @@ abstract class CommonObject
/* For default values */ /* For default values */
/** /**
* Return the default value to use for a field when showing the create form of object. * Return the default value to use for a field when showing the create form of object.
* Return values in this order: * Return values in this order:
* 1) If parameter is available into POST, we return it first. * 1) If parameter is available into POST, we return it first.
* 2) If not but an alternate value was provided as parameter of function, we return it. * 2) If not but an alternate value was provided as parameter of function, we return it.
* 3) If not but a constant $conf->global->OBJECTELEMENT_FIELDNAME is set, we return it (It is better to use the dedicated table). * 3) If not but a constant $conf->global->OBJECTELEMENT_FIELDNAME is set, we return it (It is better to use the dedicated table).
* 4) Return value found into database (TODO No yet implemented) * 4) Return value found into database (TODO No yet implemented)
* *
* @param string $fieldname Name of field * @param string $fieldname Name of field
* @param string $alternatevalue Alternate value to use * @param string $alternatevalue Alternate value to use
* @return string Default value * @return string Default value
@ -3743,27 +3749,27 @@ abstract class CommonObject
// If param is has been posted with use this value first. // If param is has been posted with use this value first.
if (isset($_POST[$fieldname])) return GETPOST($fieldname, 2); if (isset($_POST[$fieldname])) return GETPOST($fieldname, 2);
if (isset($alternatevalue)) return $alternatevalue; if (isset($alternatevalue)) return $alternatevalue;
$newelement=$this->element; $newelement=$this->element;
if ($newelement == 'facture') $newelement='invoice'; if ($newelement == 'facture') $newelement='invoice';
if ($newelement == 'commande') $newelement='order'; if ($newelement == 'commande') $newelement='order';
if (empty($newelement)) if (empty($newelement))
{ {
dol_syslog("Ask a default value using common method getDefaultCreateValueForField on an object with no property ->element defined. Return empty string.", LOG_WARNING); dol_syslog("Ask a default value using common method getDefaultCreateValueForField on an object with no property ->element defined. Return empty string.", LOG_WARNING);
return ''; return '';
} }
$keyforfieldname=strtoupper($newelement.'_DEFAULT_'.$fieldname); $keyforfieldname=strtoupper($newelement.'_DEFAULT_'.$fieldname);
//var_dump($keyforfieldname); //var_dump($keyforfieldname);
if (isset($conf->global->$keyforfieldname)) return $conf->global->$keyforfieldname; if (isset($conf->global->$keyforfieldname)) return $conf->global->$keyforfieldname;
// TODO Ad here a scan into table llx_overwrite_default with a filter on $this->element and $fieldname // TODO Ad here a scan into table llx_overwrite_default with a filter on $this->element and $fieldname
} }
/* For triggers */ /* For triggers */
@ -3963,7 +3969,7 @@ abstract class CommonObject
{ {
$res=$object->fetch(0,$value); $res=$object->fetch(0,$value);
if ($res > 0) $this->array_options[$key]=$object->id; if ($res > 0) $this->array_options[$key]=$object->id;
else else
{ {
$this->error="Ref '".$value."' for object '".$object->element."' not found"; $this->error="Ref '".$value."' for object '".$object->element."' not found";
$this->db->rollback(); $this->db->rollback();
@ -4196,25 +4202,25 @@ abstract class CommonObject
return true; return true;
} }
/** /**
* define buy price if not defined * define buy price if not defined
* set buy price = sell price if ForceBuyingPriceIfNull configured, * set buy price = sell price if ForceBuyingPriceIfNull configured,
* else if calculation MARGIN_TYPE = 'pmp' and pmp is calculated, set pmp as buyprice * else if calculation MARGIN_TYPE = 'pmp' and pmp is calculated, set pmp as buyprice
* else set min buy price as buy price * else set min buy price as buy price
* *
* @param float $unitPrice product unit price * @param float $unitPrice product unit price
* @param float $discountPercent line discount percent * @param float $discountPercent line discount percent
* @param int $fk_product product id * @param int $fk_product product id
* *
* @return float <0 if ko, buyprice if ok * @return float <0 if ko, buyprice if ok
*/ */
public function defineBuyPrice($unitPrice = 0, $discountPercent = 0, $fk_product = 0) public function defineBuyPrice($unitPrice = 0, $discountPercent = 0, $fk_product = 0)
{ {
global $conf; global $conf;
$buyPrice = 0; $buyPrice = 0;
if (($unitPrice > 0) && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) if (($unitPrice > 0) && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1))
{ {
$buyPrice = $unitPrice * (1 - $discountPercent / 100); $buyPrice = $unitPrice * (1 - $discountPercent / 100);

View File

@ -108,7 +108,7 @@ class DolEditor
// Dolibarr utilise toujours liens avec modulepart='fckeditor' quelque soit modulepart. // Dolibarr utilise toujours liens avec modulepart='fckeditor' quelque soit modulepart.
// Ou se trouve donc cette valeur /viewimage.php?modulepart=fckeditor&file=' ? // Ou se trouve donc cette valeur /viewimage.php?modulepart=fckeditor&file=' ?
$modulepart='fckeditor'; $modulepart='fckeditor';
$this->editor->Config['UserFilesPath'] = '/viewimage.php?modulepart='.$modulepart.'&file='; $this->editor->Config['UserFilesPath'] = '/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&file=';
$this->editor->Config['UserFilesAbsolutePath'] = DOL_DATA_ROOT.'/'.$modulepart.'/' ; $this->editor->Config['UserFilesAbsolutePath'] = DOL_DATA_ROOT.'/'.$modulepart.'/' ;
$this->editor->Config['LinkBrowser']=($uselocalbrowser?'true':'false'); $this->editor->Config['LinkBrowser']=($uselocalbrowser?'true':'false');

View File

@ -675,7 +675,7 @@ class ExtraFields
if ($showsize > 48) $showsize=48; if ($showsize > 48) $showsize=48;
} }
} }
if (in_array($type,array('date','datetime'))) if (in_array($type,array('date','datetime')))
{ {
$tmp=explode(',',$size); $tmp=explode(',',$size);
@ -812,7 +812,7 @@ class ExtraFields
if (strpos($InfoFieldList[4], '$SEL$')!==false) { if (strpos($InfoFieldList[4], '$SEL$')!==false) {
$InfoFieldList[4]=str_replace('$SEL$','SELECT',$InfoFieldList[4]); $InfoFieldList[4]=str_replace('$SEL$','SELECT',$InfoFieldList[4]);
} }
// current object id can be use into filter // current object id can be use into filter
if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) { if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) {
$InfoFieldList[4]=str_replace('$ID$',$objectid,$InfoFieldList[4]); $InfoFieldList[4]=str_replace('$ID$',$objectid,$InfoFieldList[4]);
@ -830,14 +830,14 @@ class ExtraFields
$sqlwhere.= ' WHERE '.$InfoFieldList[4]; $sqlwhere.= ' WHERE '.$InfoFieldList[4];
} }
} }
else else
{ {
$sqlwhere.= ' WHERE 1=1'; $sqlwhere.= ' WHERE 1=1';
} }
// Some tables may have field, some other not. For the moment we disable it. // Some tables may have field, some other not. For the moment we disable it.
if (in_array($InfoFieldList[0],array('tablewithentity'))) if (in_array($InfoFieldList[0],array('tablewithentity')))
{ {
$sqlwhere.= ' AND entity = '.$conf->entity; $sqlwhere.= ' AND entity = '.$conf->entity;
} }
$sql.=$sqlwhere; $sql.=$sqlwhere;
//print $sql; //print $sql;
@ -996,19 +996,19 @@ class ExtraFields
$sql = 'SELECT ' . $keyList; $sql = 'SELECT ' . $keyList;
$sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0]; $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0];
if (! empty($InfoFieldList[4])) { if (! empty($InfoFieldList[4])) {
// can use SELECT request // can use SELECT request
if (strpos($InfoFieldList[4], '$SEL$')!==false) { if (strpos($InfoFieldList[4], '$SEL$')!==false) {
$InfoFieldList[4]=str_replace('$SEL$','SELECT',$InfoFieldList[4]); $InfoFieldList[4]=str_replace('$SEL$','SELECT',$InfoFieldList[4]);
} }
// current object id can be use into filter // current object id can be use into filter
if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) { if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) {
$InfoFieldList[4]=str_replace('$ID$',$objectid,$InfoFieldList[4]); $InfoFieldList[4]=str_replace('$ID$',$objectid,$InfoFieldList[4]);
} else { } else {
$InfoFieldList[4]=str_replace('$ID$','0',$InfoFieldList[4]); $InfoFieldList[4]=str_replace('$ID$','0',$InfoFieldList[4]);
} }
// We have to join on extrafield table // We have to join on extrafield table
if (strpos($InfoFieldList[4], 'extra') !== false) { if (strpos($InfoFieldList[4], 'extra') !== false) {
$sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra'; $sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra';
@ -1020,13 +1020,13 @@ class ExtraFields
$sqlwhere .= ' WHERE 1=1'; $sqlwhere .= ' WHERE 1=1';
} }
// Some tables may have field, some other not. For the moment we disable it. // Some tables may have field, some other not. For the moment we disable it.
if (in_array($InfoFieldList[0], array ('tablewithentity'))) if (in_array($InfoFieldList[0], array ('tablewithentity')))
{ {
$sqlwhere .= ' AND entity = ' . $conf->entity; $sqlwhere .= ' AND entity = ' . $conf->entity;
} }
// $sql.=preg_replace('/^ AND /','',$sqlwhere); // $sql.=preg_replace('/^ AND /','',$sqlwhere);
// print $sql; // print $sql;
$sql .= $sqlwhere; $sql .= $sqlwhere;
dol_syslog(get_class($this) . '::showInputField type=chkbxlst',LOG_DEBUG); dol_syslog(get_class($this) . '::showInputField type=chkbxlst',LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -1232,7 +1232,14 @@ class ExtraFields
{ {
$sql.= ' as main'; $sql.= ' as main';
} }
$sql.= " WHERE ".$selectkey."='".$this->db->escape($value)."'"; if ($selectkey=='rowid' && empty($value)) {
$sql.= " WHERE ".$selectkey."=0";
} elseif ($selectkey=='rowid') {
$sql.= " WHERE ".$selectkey."=".$this->db->escape($value);
}else {
$sql.= " WHERE ".$selectkey."='".$this->db->escape($value)."'";
}
//$sql.= ' AND entity = '.$conf->entity; //$sql.= ' AND entity = '.$conf->entity;
dol_syslog(get_class($this).':showOutputField:$type=sellist', LOG_DEBUG); dol_syslog(get_class($this).':showOutputField:$type=sellist', LOG_DEBUG);
@ -1391,10 +1398,10 @@ class ExtraFields
$showsize=round($size); $showsize=round($size);
if ($showsize > 48) $showsize=48; if ($showsize > 48) $showsize=48;
} }
//print $type.'-'.$size; //print $type.'-'.$size;
$out=$value; $out=$value;
return $out; return $out;
} }
@ -1411,7 +1418,7 @@ class ExtraFields
$type=$this->attribute_type[$key]; $type=$this->attribute_type[$key];
$align=''; $align='';
if ($type == 'date') if ($type == 'date')
{ {
$align="center"; $align="center";
@ -1440,10 +1447,10 @@ class ExtraFields
{ {
$align="center"; $align="center";
} }
return $align; return $align;
} }
/** /**
* Return HTML string to print separator extrafield * Return HTML string to print separator extrafield
* *
@ -1523,7 +1530,7 @@ class ExtraFields
return 0; return 0;
} }
} }
/** /**
* return array_options array for object by extrafields value (using for data send by forms) * return array_options array for object by extrafields value (using for data send by forms)
* *

View File

@ -1093,7 +1093,7 @@ class DoliDBPgsql extends DoliDB
*/ */
function DDLDropField($table,$field_name) function DDLDropField($table,$field_name)
{ {
$sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`"; $sql= "ALTER TABLE ".$table." DROP COLUMN ".$field_name;
dol_syslog($sql,LOG_DEBUG); dol_syslog($sql,LOG_DEBUG);
if (! $this->query($sql)) if (! $this->query($sql))
{ {

View File

@ -44,7 +44,8 @@ $Config['Enabled'] = true ;
// Path to user files relative to the document root. // Path to user files relative to the document root.
$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=fckeditor&file=' ; $extEntity=(empty($entity) ? 1 : $entity); // For multicompany with external access
$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=fckeditor&entity='.$extEntity.'&file=' ;
// Fill the following value it you prefer to specify the absolute path for the // Fill the following value it you prefer to specify the absolute path for the
// user files directory. Useful if you are using a virtual directory, symbolic // user files directory. Useful if you are using a virtual directory, symbolic

View File

@ -1012,6 +1012,9 @@ function getParameterByName(name, valueifnotfound)
} }
})(); })();
// Another solution, easier, to build a javascript rounding function
function dolroundjs(number, decimals) { return +(Math.round(number + "e+" + decimals) + "e-" + decimals); }
/** /**
* Function similar to PHP price2num() * Function similar to PHP price2num()
@ -1024,7 +1027,7 @@ function price2numjs(amount) {
if (amount == '') return ''; if (amount == '') return '';
<?php <?php
$dec = ','; $dec = ',';
$thousand = ' '; $thousand = ' ';
if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") { if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") {
$dec = $langs->transnoentitiesnoconv("SeparatorDecimal"); $dec = $langs->transnoentitiesnoconv("SeparatorDecimal");
@ -1032,6 +1035,7 @@ function price2numjs(amount) {
if ($langs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") { if ($langs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") {
$thousand = $langs->transnoentitiesnoconv("SeparatorThousand"); $thousand = $langs->transnoentitiesnoconv("SeparatorThousand");
} }
if ($thousand == 'Space') $thousand=' ';
print "var dec='" . dol_escape_js($dec) . "'; var thousand='" . dol_escape_js($thousand) . "';\n"; // Set var in javascript print "var dec='" . dol_escape_js($dec) . "'; var thousand='" . dol_escape_js($thousand) . "';\n"; // Set var in javascript
?> ?>
@ -1050,11 +1054,15 @@ function price2numjs(amount) {
if (nbdec > rounding) rounding = nbdec; if (nbdec > rounding) rounding = nbdec;
// If rounding higher than max shown // If rounding higher than max shown
if (rounding > main_max_dec_shown) rounding = main_max_dec_shown; if (rounding > main_max_dec_shown) rounding = main_max_dec_shown;
if (thousand != ',' && thousand != '.') amount = amount.replace(',', '.'); if (thousand != ',' && thousand != '.') amount = amount.replace(',', '.');
amount = amount.replace(' ', ''); // To avoid spaces amount = amount.replace(' ', ''); // To avoid spaces
amount = amount.replace(thousand, ''); // Replace of thousand before replace of dec to avoid pb if thousand is . amount = amount.replace(thousand, ''); // Replace of thousand before replace of dec to avoid pb if thousand is .
amount = amount.replace(dec, '.'); amount = amount.replace(dec, '.');
//console.log("amount before="+amount+" rouding="+rounding)
return Math.round10(amount, rounding); var res = Math.round10(amount, - rounding);
// Other solution is
// var res = dolroundjs(amount, rounding)
console.log("res="+res)
return res;
} }

View File

@ -7,7 +7,7 @@
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr>
@ -3336,7 +3336,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
$vatratecleaned = $vatrate; $vatratecleaned = $vatrate;
if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "xx (yy)" if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "xx (yy)"
{ {
$vatratecleaned = $reg[1]; $vatratecleaned = trim($reg[1]);
$vatratecode = $reg[2]; $vatratecode = $reg[2];
} }
@ -3350,7 +3350,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
{ {
if ($local == 1) if ($local == 1)
{ {
if (! $mysoc->localtax1_assuj) return 0; if (! $mysoc->localtax1_assuj || (string) $vatratecleaned == "0") return 0;
if ($thirdparty_seller->id == $mysoc->id) if ($thirdparty_seller->id == $mysoc->id)
{ {
if (! $thirdparty_buyer->localtax1_assuj) return 0; if (! $thirdparty_buyer->localtax1_assuj) return 0;
@ -3363,7 +3363,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
if ($local == 2) if ($local == 2)
{ {
if (! $mysoc->localtax2_assuj) return 0; if (! $mysoc->localtax2_assuj || (string) $vatratecleaned == "0") return 0;
if ($thirdparty_seller->id == $mysoc->id) if ($thirdparty_seller->id == $mysoc->id)
{ {
if (! $thirdparty_buyer->localtax2_assuj) return 0; if (! $thirdparty_buyer->localtax2_assuj) return 0;
@ -5195,7 +5195,7 @@ function printCommonFooter($zone='private')
print 'window.console && console.log("'; print 'window.console && console.log("';
if (! empty($conf->global->MEMCACHED_SERVER)) print 'MEMCACHED_SERVER='.$conf->global->MEMCACHED_SERVER.' - '; if (! empty($conf->global->MEMCACHED_SERVER)) print 'MEMCACHED_SERVER='.$conf->global->MEMCACHED_SERVER.' - ';
print 'MAIN_OPTIMIZE_SPEED='.(isset($conf->global->MAIN_OPTIMIZE_SPEED)?$conf->global->MAIN_OPTIMIZE_SPEED:'off'); print 'MAIN_OPTIMIZE_SPEED='.(isset($conf->global->MAIN_OPTIMIZE_SPEED)?$conf->global->MAIN_OPTIMIZE_SPEED:'off');
if ($micro_start_time) if (! empty($micro_start_time)) // Works only if MAIN_SHOW_TUNING_INFO is defined at $_SERVER level. Not in global variable.
{ {
$micro_end_time = microtime(true); $micro_end_time = microtime(true);
print ' - Build time: '.ceil(1000*($micro_end_time-$micro_start_time)).' ms'; print ' - Build time: '.ceil(1000*($micro_end_time-$micro_start_time)).' ms';

View File

@ -1493,7 +1493,8 @@ function getListOfModels($db,$type,$maxfilenamelength=0)
/** /**
* This function evaluates a string that should be a valid IPv4 * This function evaluates a string that should be a valid IPv4
* * Note: For ip 169.254.0.0, it returns 0 with some PHP (5.6.24) and 2 with some minor patchs of PHP (5.6.25). See https://github.com/php/php-src/pull/1954.
*
* @param string $ip IP Address * @param string $ip IP Address
* @return int 0 if not valid or reserved range, 1 if valid and public IP, 2 if valid and private range IP * @return int 0 if not valid or reserved range, 1 if valid and public IP, 2 if valid and private range IP
*/ */

View File

@ -278,7 +278,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
} }
dol_syslog(get_class($this).'::verif_syntax codefortest='.$codefortest." typefortest=".$typefortest); dol_syslog(get_class($this).'::verif_syntax codefortest='.$codefortest." typefortest=".$typefortest);
$newcodefortest=$codefortest; $newcodefortest=$codefortest;
// Special case, if mask is on 12 digits instead of 13, we remove last char into code to test // Special case, if mask is on 12 digits instead of 13, we remove last char into code to test
@ -290,7 +290,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
dol_syslog(get_class($this).'::verif_syntax newcodefortest='.$newcodefortest); dol_syslog(get_class($this).'::verif_syntax newcodefortest='.$newcodefortest);
} }
} }
$result=check_value($mask,$newcodefortest); $result=check_value($mask,$newcodefortest);
return $result; return $result;

View File

@ -87,11 +87,11 @@ abstract class ModeleNumRefBarCode
/** /**
* Return next value available * Return next value available
* *
* @param Societe $objsoc Object thirdparty * @param Societe $objproduct Object Product
* @param int $type Type * @param int $type Type
* @return string Value * @return string Value
*/ */
function getNextValue($objsoc=0,$type=-1) function getNextValue($objproduct,$type='')
{ {
global $langs; global $langs;
return $langs->trans("Function_getNextValue_InModuleNotWorking"); return $langs->trans("Function_getNextValue_InModuleNotWorking");

View File

@ -100,7 +100,8 @@ class pdf_merou extends ModelePdfExpedition
$outputlangs->load("propal"); $outputlangs->load("propal");
$outputlangs->load("deliveries"); $outputlangs->load("deliveries");
$outputlangs->load("sendings"); $outputlangs->load("sendings");
$outputlangs->load("productbatch");
if ($conf->expedition->dir_output) if ($conf->expedition->dir_output)
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();

View File

@ -110,7 +110,8 @@ class pdf_rouget extends ModelePdfExpedition
$outputlangs->load("propal"); $outputlangs->load("propal");
$outputlangs->load("deliveries"); $outputlangs->load("deliveries");
$outputlangs->load("sendings"); $outputlangs->load("sendings");
$outputlangs->load("productbatch");
$nblignes = count($object->lines); $nblignes = count($object->lines);
// Loop on each lines to detect if there is at least one image to show // Loop on each lines to detect if there is at least one image to show

View File

@ -167,7 +167,7 @@ class pdf_crabe extends ModelePDFFactures
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{ {
global $user,$langs,$conf,$mysoc,$db,$hookmanager; global $user,$langs,$conf,$mysoc,$db,$hookmanager;
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
@ -252,7 +252,7 @@ class pdf_crabe extends ModelePDFFactures
// Set nblignes with the new facture lines content after hook // Set nblignes with the new facture lines content after hook
$nblignes = count($object->lines); $nblignes = count($object->lines);
// Create pdf instance // Create pdf instance
$pdf=pdf_getInstance($this->format); $pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
@ -337,6 +337,11 @@ class pdf_crabe extends ModelePDFFactures
$height_incoterms = 0; $height_incoterms = 0;
if ($conf->incoterm->enabled) if ($conf->incoterm->enabled)
{ {
if (is_object($object->thirdparty))
{
$object->fk_incoterms=$object->thirdparty->fk_incoterms;
$object->location_incoterms=$object->thirdparty->location_incoterms;
}
$desc_incoterms = $object->getIncotermsForPDF(); $desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) if ($desc_incoterms)
{ {
@ -550,7 +555,7 @@ class pdf_crabe extends ModelePDFFactures
} else { } else {
$tvaligne = $sign * $object->lines[$i]->total_tva; $tvaligne = $sign * $object->lines[$i]->total_tva;
} }
$localtax1ligne=$object->lines[$i]->total_localtax1; $localtax1ligne=$object->lines[$i]->total_localtax1;
$localtax2ligne=$object->lines[$i]->total_localtax2; $localtax2ligne=$object->lines[$i]->total_localtax2;
$localtax1_rate=$object->lines[$i]->localtax1_tx; $localtax1_rate=$object->lines[$i]->localtax1_tx;
@ -1557,7 +1562,7 @@ class pdf_crabe extends ModelePDFFactures
$posy=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42; $posy=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
$posx=$this->marge_gauche; $posx=$this->marge_gauche;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
$hautcadre=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40; $hautcadre=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40;
$widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82; $widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82;

View File

@ -504,6 +504,10 @@ class ImportCsv extends ModeleImports
} }
if (empty($newval)) $arrayrecord[($key-1)]['type']=-1; // If we get empty value, we will use "null" if (empty($newval)) $arrayrecord[($key-1)]['type']=-1; // If we get empty value, we will use "null"
} }
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='numeric')
{
$newval = price2num($newval);
}
//print 'Val to use as insert is '.$newval.'<br>'; //print 'Val to use as insert is '.$newval.'<br>';
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org> /* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2005-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -302,6 +302,7 @@ class modCategorie extends DolibarrModules
$this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as u, '.MAIN_DB_PREFIX . 'categorie_contact as cp, '.MAIN_DB_PREFIX . 'socpeople as p'; $this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as u, '.MAIN_DB_PREFIX . 'categorie_contact as cp, '.MAIN_DB_PREFIX . 'socpeople as p';
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as country ON p.fk_pays = country.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as country ON p.fk_pays = country.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc'; $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc';
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'socpeople_extrafields as extra ON extra.fk_object = p.rowid';
$this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_socpeople = p.rowid AND u.entity IN ('.getEntity('category',1).')'; $this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_socpeople = p.rowid AND u.entity IN ('.getEntity('category',1).')';
$this->export_sql_end[$r] .= ' AND u.type = 4'; // contact categories $this->export_sql_end[$r] .= ' AND u.type = 4'; // contact categories

View File

@ -69,7 +69,7 @@ class modProductBatch extends DolibarrModules
$this->config_page_url = array(); $this->config_page_url = array();
// Dependencies // Dependencies
$this->depends = array("modProduct","modStock","modExpedition","modSupplier"); // List of modules id that must be enabled if this module is enabled. modExpedition is required to manage batch exit (by manual stock decrease on shipment), modSupplier to manage batch entry (after supplier order). $this->depends = array("modProduct","modStock","modExpedition","modFournisseur"); // List of modules id that must be enabled if this module is enabled. modExpedition is required to manage batch exit (by manual stock decrease on shipment), modSupplier to manage batch entry (after supplier order).
$this->requiredby = array(); // List of modules id to disable if this one is disabled $this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->phpmin = array(5,0); // Minimum version of PHP required by module $this->phpmin = array(5,0); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module $this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module

View File

@ -405,7 +405,8 @@ class modSociete extends DolibarrModules
's.code_client'=>array('rule'=>'getcustomercodeifauto'), 's.code_client'=>array('rule'=>'getcustomercodeifauto'),
's.code_fournisseur'=>array('rule'=>'getsuppliercodeifauto'), 's.code_fournisseur'=>array('rule'=>'getsuppliercodeifauto'),
's.code_compta'=>array('rule'=>'getcustomeraccountancycodeifauto'), 's.code_compta'=>array('rule'=>'getcustomeraccountancycodeifauto'),
's.code_compta_fournisseur'=>array('rule'=>'getsupplieraccountancycodeifauto') 's.code_compta_fournisseur'=>array('rule'=>'getsupplieraccountancycodeifauto'),
's.capital'=>array('rule'=>'numeric')
); );
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
$this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.fk_typent'=>'id@'.MAIN_DB_PREFIX.'c_typent','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'); $this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.fk_typent'=>'id@'.MAIN_DB_PREFIX.'c_typent','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$');

View File

@ -211,7 +211,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$hookmanager->initHooks(array('pdfgeneration')); $hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action; global $action;
$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
$nblignes = count($object->lines); $nblignes = count($object->lines);

View File

@ -99,7 +99,7 @@ $coldisplay=-1; // We remove first td
$doleditor=new DolEditor('product_desc',$line->description,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%'); $doleditor=new DolEditor('product_desc',$line->description,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%');
$doleditor->Create(); $doleditor->Create();
} else { } else {
print '<textarea id="desc" class="flat" name="desc" readonly style="width: 200px; height:80px;">' . $line->description . '</textarea>'; print '<textarea id="product_desc" class="flat" name="product_desc" readonly style="width: 200px; height:80px;">' . $line->description . '</textarea>';
} }
?> ?>
</td> </td>

View File

@ -1023,21 +1023,21 @@ class Cronjob extends CommonObject
} }
if (! empty($conf->global->MAIN_UMASK)) @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); if (! empty($conf->global->MAIN_UMASK)) @chmod($outputfile, octdec($conf->global->MAIN_UMASK));
} }
}
dol_syslog(get_class($this)."::run_jobs output_arr:".var_export($output_arr,true), LOG_DEBUG); dol_syslog(get_class($this)."::run_jobs output_arr:".var_export($output_arr,true), LOG_DEBUG);
// Update with result
// Update with result $this->lastoutput='';
$this->lastoutput=''; if (is_array($output_arr) && count($output_arr)>0)
if (is_array($output_arr) && count($output_arr)>0)
{
foreach($output_arr as $val)
{ {
$this->lastoutput.=$val."\n"; foreach($output_arr as $val)
{
$this->lastoutput.=$val."\n";
}
} }
$this->lastresult=$retval;
} }
$this->lastresult=$retval;
$this->datelastresult=dol_now(); $this->datelastresult=dol_now();
$result = $this->update($user); $result = $this->update($user);
if ($result < 0) if ($result < 0)

View File

@ -712,7 +712,7 @@ if (! empty($id) && $action != 'edit')
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=valid_promesse">'.$langs->trans("ValidPromess").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=valid_promesse">'.$langs->trans("ValidPromess").'</a></div>';
} }
if (($object->statut == 0 || $object->statut == 1) && $remaintopay == 0 && $object->paye == 0) if (($object->statut == 0 || $object->statut == 1) && $remaintopay == 0 && $object->paid == 0)
{ {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=set_cancel">'.$langs->trans("ClassifyCanceled")."</a></div>"; print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=set_cancel">'.$langs->trans("ClassifyCanceled")."</a></div>";
} }

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -124,6 +125,7 @@ if ($resql)
$expedition = new Expedition($db); $expedition = new Expedition($db);
$param=""; $param="";
if ($sall) $param.= "&amp;sall=".$sall;
if ($search_ref_exp) $param.= "&amp;search_ref_exp=".$search_ref_exp; if ($search_ref_exp) $param.= "&amp;search_ref_exp=".$search_ref_exp;
if ($search_ref_liv) $param.= "&amp;search_ref_liv=".$search_ref_liv; if ($search_ref_liv) $param.= "&amp;search_ref_liv=".$search_ref_liv;
if ($search_company) $param.= "&amp;search_company=".$search_company; if ($search_company) $param.= "&amp;search_company=".$search_company;

View File

@ -193,6 +193,7 @@ if ($resql)
$i = 0; $i = 0;
$param=""; $param="";
if ($sall) $param.="&sall=".$sall;
if ($search_ref) $param.="&search_ref=".$search_ref; if ($search_ref) $param.="&search_ref=".$search_ref;
if ($search_user) $param.="&search_user=".$search_user; if ($search_user) $param.="&search_user=".$search_user;
if ($search_amount_ht) $param.="&search_amount_ht=".$search_amount_ht; if ($search_amount_ht) $param.="&search_amount_ht=".$search_amount_ht;

View File

@ -139,6 +139,7 @@ if ($result)
$num = $db->num_rows($result); $num = $db->num_rows($result);
$urlparam=''; $urlparam='';
if ($sall) $urlparam.="&sall=".$sall;
if ($socid) $urlparam.="&socid=".$socid; if ($socid) $urlparam.="&socid=".$socid;
if ($search_ref) $urlparam.="&search_ref=".urlencode($search_ref); if ($search_ref) $urlparam.="&search_ref=".urlencode($search_ref);
if ($search_company) $urlparam.="&search_company=".urlencode($search_company); if ($search_company) $urlparam.="&search_company=".urlencode($search_company);

View File

@ -31,7 +31,7 @@
*/ */
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
if (! defined('DOL_VERSION')) define('DOL_VERSION','3.9.3'); if (! defined('DOL_VERSION')) define('DOL_VERSION','3.9.4');
if (! defined('EURO')) define('EURO',chr(128)); if (! defined('EURO')) define('EURO',chr(128));

View File

@ -383,7 +383,6 @@ if ($object->id > 0)
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p "; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p ";
$sql.= " WHERE p.fk_soc =".$object->id; $sql.= " WHERE p.fk_soc =".$object->id;
$sql.= " AND p.entity =".$conf->entity; $sql.= " AND p.entity =".$conf->entity;
$sql.= " ORDER BY p.date_commande DESC";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -65,7 +65,7 @@ class CommandeFournisseur extends CommonOrder
// -> 9=Refused -> (reopen) 1=Validated // -> 9=Refused -> (reopen) 1=Validated
// Note: billed or not is on another field "billed" // Note: billed or not is on another field "billed"
var $statuts; // List of status var $statuts; // List of status
var $socid; var $socid;
var $fourn_id; var $fourn_id;
var $date; var $date;
@ -254,6 +254,8 @@ class CommandeFournisseur extends CommonOrder
$this->fetchObjectLinked(); $this->fetchObjectLinked();
$this->lines=array();
$sql = "SELECT l.rowid, l.ref as ref_supplier, l.fk_product, l.product_type, l.label, l.description,"; $sql = "SELECT l.rowid, l.ref as ref_supplier, l.fk_product, l.product_type, l.label, l.description,";
$sql.= " l.qty,"; $sql.= " l.qty,";
$sql.= " l.tva_tx, l.remise_percent, l.subprice,"; $sql.= " l.tva_tx, l.remise_percent, l.subprice,";
@ -517,7 +519,7 @@ class CommandeFournisseur extends CommonOrder
$billedtext=''; $billedtext='';
//if ($statut==5 && $this->billed == 1) $statut = 8; //if ($statut==5 && $this->billed == 1) $statut = 8;
if ($billed == 1) $billedtext=$langs->trans("Billed"); if ($billed == 1) $billedtext=$langs->trans("Billed");
// List of language codes for status // List of language codes for status
$statutshort[0] = 'StatusOrderDraftShort'; $statutshort[0] = 'StatusOrderDraftShort';
$statutshort[1] = 'StatusOrderValidatedShort'; $statutshort[1] = 'StatusOrderValidatedShort';
@ -991,6 +993,8 @@ class CommandeFournisseur extends CommonOrder
$this->date_commande = $this->db->idate($date); $this->date_commande = $this->db->idate($date);
$result = 1; $result = 1;
$this->log($user, 3, $date, $comment); $this->log($user, 3, $date, $comment);
$this->date_commande = $date;
$this->methode_commande = $methode;
} }
else else
{ {
@ -1356,7 +1360,7 @@ class CommandeFournisseur extends CommonOrder
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc,$this->thirdparty); $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc,$this->thirdparty);
$txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. $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, $product_type, $this->thirdparty, $localtaxes_type); $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $this->thirdparty, $localtaxes_type);
$total_ht = $tabprice[0]; $total_ht = $tabprice[0];
$total_tva = $tabprice[1]; $total_tva = $tabprice[1];
@ -2115,7 +2119,7 @@ class CommandeFournisseur extends CommonOrder
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc, $this->thirdparty); $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc, $this->thirdparty);
$txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. $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, $type, $this->thirdparty, $localtaxes_type); $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type);
$total_ht = $tabprice[0]; $total_ht = $tabprice[0];
$total_tva = $tabprice[1]; $total_tva = $tabprice[1];
@ -2533,10 +2537,10 @@ class CommandeFournisseur extends CommonOrder
public function hasDelay() public function hasDelay()
{ {
global $conf; global $conf;
$now = dol_now(); $now = dol_now();
$date_to_test = empty($this->date_livraison) ? $this->date_commande : $this->date_livraison; $date_to_test = empty($this->date_livraison) ? $this->date_commande : $this->date_livraison;
return ($this->statut != 3) && $date_to_test && $date_to_test < ($now - $conf->commande->fournisseur->warning_delay); return ($this->statut != 3) && $date_to_test && $date_to_test < ($now - $conf->commande->fournisseur->warning_delay);
} }
} }

View File

@ -5,6 +5,7 @@
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -208,6 +209,7 @@ if ($resql)
$i = 0; $i = 0;
$param=""; $param="";
if ($sall) $param.="&search_all=".$sall;
if ($search_ref) $param.="&search_ref=".$search_ref; if ($search_ref) $param.="&search_ref=".$search_ref;
if ($search_company) $param.="&search_company=".$search_company; if ($search_company) $param.="&search_company=".$search_company;
if ($search_user) $param.="&search_user=".$search_user; if ($search_user) $param.="&search_user=".$search_user;

View File

@ -296,6 +296,7 @@ if ($resql)
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"fac.ref,fac.rowid","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"fac.ref,fac.rowid","",$param,"",$sortfield,$sortorder);
if (empty($conf->global->SUPPLIER_INVOICE_HIDE_REF_SUPPLIER)) print_liste_field_titre($langs->trans("RefSupplier"),$_SERVER["PHP_SELF"],"ref_supplier","",$param,"",$sortfield,$sortorder); if (empty($conf->global->SUPPLIER_INVOICE_HIDE_REF_SUPPLIER)) print_liste_field_titre($langs->trans("RefSupplier"),$_SERVER["PHP_SELF"],"ref_supplier","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fac.datef,fac.rowid","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fac.datef,fac.rowid","",$param,'align="center"',$sortfield,$sortorder);

View File

@ -22,7 +22,7 @@
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_ENABLE_LOG_TO_HTML','0','chaine','If this option is set to 1, it is possible to see log output at end of HTML sources by adding paramater logtohtml=1 on URL',1,0); insert into llx_const (name, value, type, note, visible, entity) values (__ENCRYPT('MAIN_ENABLE_LOG_TO_HTML')__,__ENCRYPT('0')__,'chaine','If this option is set to 1, it is possible to see log output at end of HTML sources by adding paramater logtohtml=1 on URL',1,0);
-- Was done into a 3.8 fix, so we must do it also in 3.9 -- Was done into a 3.8 fix, so we must do it also in 3.9
@ -61,7 +61,7 @@ update llx_opensurvey_sondage set format = 'D' where format = 'D+';
update llx_opensurvey_sondage set format = 'A' where format = 'A+'; update llx_opensurvey_sondage set format = 'A' where format = 'A+';
INSERT INTO llx_const (name, value, type, note, visible) values (__ENCRYPT('MAIN_DELAY_EXPENSEREPORTS_TO_PAY')__,__ENCRYPT('31')__,'chaine','Tolérance de retard avant alerte (en jours) sur les notes de frais impayées',0); INSERT INTO llx_const (name, value, type, note, visible) values (__ENCRYPT('MAIN_DELAY_EXPENSEREPORTS_TO_PAY')__,__ENCRYPT('31')__,'chaine','Tolérance de retard avant alerte (en jours) sur les notes de frais impayées',0);
INSERT INTO llx_const (name, value, type, note, visible) values ('MAIN_SIZE_SHORTLISTE_LIMIT','4','chaine','Longueur maximum des listes courtes (fiche client)',0); INSERT INTO llx_const (name, value, type, note, visible) values (__ENCRYPT('MAIN_SIZE_SHORTLISTE_LIMIT')__,__ENCRYPT('4')__,'chaine','Longueur maximum des listes courtes (fiche client)',0);
ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32); ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32);
ALTER TABLE llx_accountingaccount MODIFY COLUMN fk_pcg_version varchar(32); ALTER TABLE llx_accountingaccount MODIFY COLUMN fk_pcg_version varchar(32);

View File

@ -92,7 +92,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_cronjob FOR EACH ROW
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_deplacement FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_deplacement FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_directories FOR EACH ROW EXECUTE PROCEDURE update_modified_column_date_u(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_directories FOR EACH ROW EXECUTE PROCEDURE update_modified_column_date_m();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_element_resources FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_element_resources FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_entrepot FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_entrepot FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_events FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_events FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();

View File

@ -585,6 +585,7 @@ TextUsedInTheMessageBody=Email body
SendAcknowledgementByMail=Send Ack. by email SendAcknowledgementByMail=Send Ack. by email
EMail=E-mail EMail=E-mail
NoEMail=No email NoEMail=No email
Email=Email
NoMobilePhone=No mobile phone NoMobilePhone=No mobile phone
Owner=Owner Owner=Owner
DetectedVersion=Detected version DetectedVersion=Detected version

View File

@ -184,6 +184,12 @@ ProfId3FR=Id. prof. 3 (NAF-APE)
ProfId4FR=Id. prof. 4 (RCS/RM) ProfId4FR=Id. prof. 4 (RCS/RM)
ProfId5FR=- ProfId5FR=-
ProfId6FR=- ProfId6FR=-
ProfId1GA=Id. prof. 1 (NIF)
ProfId2GA=Id. prof. 2 (RCCM)
ProfId3GA=Id. prof. 3 (CAE)
ProfId4GA=Id. prof. 4
ProfId5GA=-
ProfId6GA=-
ProfId1GB=Numéro d'enregistrement ProfId1GB=Numéro d'enregistrement
ProfId2GB=- ProfId2GB=-
ProfId3GB=SIC ProfId3GB=SIC

View File

@ -157,7 +157,7 @@ if ($socid > 0)
$sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; $sql.= ", ".MAIN_DB_PREFIX."facturedet as d";
$sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.fk_statut > 0"; $sql.= " AND f.fk_statut > 0";
$sql.= " AND s.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND d.fk_facture = f.rowid";
$sql.= " AND f.fk_soc = $socid"; $sql.= " AND f.fk_soc = $socid";
$sql.= " AND d.buy_price_ht IS NOT NULL"; $sql.= " AND d.buy_price_ht IS NOT NULL";

View File

@ -7,6 +7,7 @@
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -109,7 +110,7 @@ if ($action == 'setModuleOptions')
} }
} }
if ($action == 'other' && GETPOST('value_PRODUIT_LIMIT_SIZE') > 0) if ($action == 'other' && GETPOST('value_PRODUIT_LIMIT_SIZE') >= 0)
{ {
$res = dolibarr_set_const($db, "PRODUIT_LIMIT_SIZE", GETPOST('value_PRODUIT_LIMIT_SIZE'),'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "PRODUIT_LIMIT_SIZE", GETPOST('value_PRODUIT_LIMIT_SIZE'),'chaine',0,'',$conf->entity);
} }

View File

@ -3690,11 +3690,11 @@ class Product extends CommonObject
if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight) if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight)
{ {
$return.= '<!-- Show thumb -->'; $return.= '<!-- Show thumb -->';
$return.= '<img class="photo photowithmargin" border="0" '.($conf->dol_use_jmobile?'max-height':'height').'="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">'; $return.= '<img class="photo photowithmargin" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
} }
else { else {
$return.= '<!-- Show original file -->'; $return.= '<!-- Show original file -->';
$return.= '<img class="photo photowithmargin" border="0" '.($conf->dol_use_jmobile?'max-height':'height').'="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">'; $return.= '<img class="photo photowithmargin" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
} }
if (empty($nolink)) $return.= '</a>'; if (empty($nolink)) $return.= '</a>';

View File

@ -10,6 +10,7 @@
* Copyright (C) 2014 Ion agorria <ion@agorria.com> * Copyright (C) 2014 Ion agorria <ion@agorria.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -96,8 +97,6 @@ if (empty($reshook))
{ {
$tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 $tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5
$tva_tx_txt;
// We must define tva_tx, npr and local taxes // We must define tva_tx, npr and local taxes
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot $tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0; $npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
@ -203,6 +202,7 @@ if (empty($reshook))
} }
$tva_tx_txt = $newvattx[$i]; $tva_tx_txt = $newvattx[$i];
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
$npr = $newvatnpr[$i]; $npr = $newvatnpr[$i];
$localtax1 = $newlocaltax1_tx[$i]; $localtax1 = $newlocaltax1_tx[$i];
$localtax1_type = $newlocaltax1_type[$i]; $localtax1_type = $newlocaltax1_type[$i];

View File

@ -239,24 +239,29 @@ if ($resql)
print '</div>'; print '</div>';
} }
$param='';
$param="&tosell=$tosell&tobuy=$tobuy".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref"; if ($tosell) $param.="&tosell=".$tosell;
if ($tobuy) $param.="&tobuy=".$tobuy;
if ($type) $param.="&type=".$type;
if ($fourn_id) $param.="&fourn_id=".$fourn_id;
if ($snom) $param.="&snom=".$snom;
if ($sref) $param.="&sref=".$sref;
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';
// Lignes des titres // Lignes des titres
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label","",$param,"",$sortfield,$sortorder);
if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder); if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("StockLimit"), $_SERVER["PHP_SELF"], "p.seuil_stock_alerte",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("StockLimit"), $_SERVER["PHP_SELF"], "p.seuil_stock_alerte","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DesiredStock"), $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DesiredStock"), $_SERVER["PHP_SELF"], "p.desiredstock","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stock_physique",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stock_physique","",$param,'align="right"',$sortfield,$sortorder);
// TODO Add info of running suppliers/customers orders // TODO Add info of running suppliers/customers orders
//print_liste_field_titre($langs->trans("TheoreticalStock"),$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder); //print_liste_field_titre($langs->trans("TheoreticalStock"),$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre(''); print_liste_field_titre('');
print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"], "p.tosell","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"], "p.tobuy","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n"; print "</tr>\n";
// Lignes des champs de filtre // Lignes des champs de filtre

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -247,28 +248,37 @@ if ($resql)
print $hookmanager->resPrint; print $hookmanager->resPrint;
print '</div>'; print '</div>';
} }
$param="&tosell=$tosell&tobuy=$tobuy".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref&batch=$batch&eatby=$eatby&sellby=$sellby";
$param='';
if ($tosell) $param.="&tosell=".$tosell;
if ($tobuy) $param.="&tobuy=".$tobuy;
if ($type) $param.="&type=".$type;
if ($fourn_id) $param.="&fourn_id=".$fourn_id;
if ($snom) $param.="&snom=".$snom;
if ($sref) $param.="&sref=".$sref;
if ($search_batch) $param.="&search_batch=".$search_batch;
/*if ($eatby) $param.="&eatby=".$eatby;
if ($sellby) $param.="&sellby=".$sellby;*/
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';
// Lignes des titres // Lignes des titres
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label","",$param,"",$sortfield,$sortorder);
if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder); if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Warehouse"), $_SERVER["PHP_SELF"], "",$param,"",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Warehouse"), $_SERVER["PHP_SELF"], "","",$param,'',$sortfield,$sortorder);
//print_liste_field_titre($langs->trans("DesiredStock"), $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder); //print_liste_field_titre($langs->trans("DesiredStock"), $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Batch"), $_SERVER["PHP_SELF"], "pb.batch",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Batch"), $_SERVER["PHP_SELF"], "pb.batch","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("l_eatby"), $_SERVER["PHP_SELF"], "pb.eatby",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("l_eatby"), $_SERVER["PHP_SELF"], "pb.eatby","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("l_sellby"), $_SERVER["PHP_SELF"], "pb.sellby",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("l_sellby"), $_SERVER["PHP_SELF"], "pb.sellby","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stock_physique",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stock_physique","",$param,'align="right"',$sortfield,$sortorder);
// TODO Add info of running suppliers/customers orders // TODO Add info of running suppliers/customers orders
//print_liste_field_titre($langs->trans("TheoreticalStock"),$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder); //print_liste_field_titre($langs->trans("TheoreticalStock"),$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre(''); print_liste_field_titre('');
print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"], "p.tosell","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"], "p.tobuy","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n"; print "</tr>\n";
// Lignes des champs de filtre // Lignes des champs de filtre

View File

@ -137,17 +137,26 @@ class MouvementStock extends CommonObject
while ($i < $num) while ($i < $num)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
if ($this->db->jdate($obj->eatby) != $eatby) // only check date values
$tmparray=dol_getdate($eatby, true);
$eatby=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']);
$tmparray=dol_getdate($sellby, true);
$sellby=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']);
$tmparray=dol_getdate($this->db->jdate($obj->eatby), true);
$dbEatby=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']);
$tmparray=dol_getdate($this->db->jdate($obj->sellby), true);
$dbSellby=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']);
if ($dbEatby != $eatby)
{ {
$this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby)); $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($dbEatby), dol_print_date($eatby));
dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby)), LOG_ERR); dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($dbEatby), dol_print_date($eatby)), LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -3; return -3;
} }
if ($this->db->jdate($obj->sellby) != $sellby) if ($dbSellby != $sellby)
{ {
$this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)); $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($dbSellby), dol_print_date($sellby));
dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)), LOG_ERR); dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($dbSellby), dol_print_date($sellby)), LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -3; return -3;
} }

View File

@ -107,7 +107,13 @@ if ($result)
$help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks'; $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
llxHeader("",$langs->trans("ListOfWarehouses"),$help_url); llxHeader("",$langs->trans("ListOfWarehouses"),$help_url);
print_barre_liste($langs->trans("ListOfWarehouses"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num, $totalnboflines); $param = '';
if ($search_ref) $param.="&search_ref=".$search_ref;
if ($search_label) $param.="&search_label=".$search_label;
if ($search_status) $param.="&search_status=".$search_status;
if ($sall) $param.="&sall=".$sall;
print_barre_liste($langs->trans("ListOfWarehouses"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -122,17 +128,17 @@ if ($result)
} }
$moreforfilter=''; $moreforfilter='';
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">'; print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"], "e.label","","","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"], "e.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("LocationSummary"),$_SERVER["PHP_SELF"], "e.lieu","","","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("LocationSummary"),$_SERVER["PHP_SELF"], "e.lieu","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stockqty",'','','align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stockqty",'',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EstimatedStockValue"), $_SERVER["PHP_SELF"], "e.valo_pmp",'','','align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("EstimatedStockValue"), $_SERVER["PHP_SELF"], "e.valo_pmp",'',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EstimatedStockValueSell"), $_SERVER["PHP_SELF"], "",'','','align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("EstimatedStockValueSell"), $_SERVER["PHP_SELF"], "",'',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"], "e.statut",'','','align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"], "e.statut",'',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'',$param,'',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
// Lignes des champs de filtre // Lignes des champs de filtre

View File

@ -50,7 +50,7 @@ $cancel=GETPOST('cancel');
$id=GETPOST('id', 'int'); $id=GETPOST('id', 'int');
$ref=GETPOST('ref', 'alpha'); $ref=GETPOST('ref', 'alpha');
$stocklimit = GETPOST('stocklimit'); $stocklimit = GETPOST('seuil_stock_alerte');
$desiredstock = GETPOST('desiredstock'); $desiredstock = GETPOST('desiredstock');
$cancel = GETPOST('cancel'); $cancel = GETPOST('cancel');
$fieldid = isset($_GET["ref"])?'ref':'rowid'; $fieldid = isset($_GET["ref"])?'ref':'rowid';
@ -70,7 +70,7 @@ $result=restrictedArea($user,'produit&stock',$id,'product&product','','',$fieldi
if ($cancel) $action=''; if ($cancel) $action='';
// Set stock limit // Set stock limit
if ($action == 'setstocklimit') if ($action == 'setseuil_stock_alerte')
{ {
$object = new Product($db); $object = new Product($db);
$result=$object->fetch($id); $result=$object->fetch($id);

View File

@ -339,7 +339,7 @@ class Resource extends CommonObject
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources";
$sql.= " WHERE element_type='resource' AND resource_id ='".$this->db->escape($rowid)."'"; $sql.= " WHERE element_type='resource' AND resource_id =".$this->db->escape($rowid);
dol_syslog(get_class($this)."::delete", LOG_DEBUG); dol_syslog(get_class($this)."::delete", LOG_DEBUG);
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
@ -393,7 +393,6 @@ class Resource extends CommonObject
} }
} }
} }
$sql.= " GROUP BY t.rowid";
$sql.= $this->db->order($sortfield,$sortorder); $sql.= $this->db->order($sortfield,$sortorder);
$this->num_all = 0; $this->num_all = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
@ -410,10 +409,10 @@ class Resource extends CommonObject
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
if ($num) if ($num)
{ {
$i = 0; $this->lines=array();
while ($i < $num) while ($obj = $this->db->fetch_object($resql))
{ {
$obj = $this->db->fetch_object($resql);
$line = new Resource($this->db); $line = new Resource($this->db);
$line->id = $obj->rowid; $line->id = $obj->rowid;
$line->ref = $obj->ref; $line->ref = $obj->ref;
@ -421,8 +420,7 @@ class Resource extends CommonObject
$line->fk_code_type_resource = $obj->fk_code_type_resource; $line->fk_code_type_resource = $obj->fk_code_type_resource;
$line->type_label = $obj->type_label; $line->type_label = $obj->type_label;
$this->lines[$i] = $line; $this->lines[] = $line;
$i++;
} }
$this->db->free($resql); $this->db->free($resql);
} }
@ -473,7 +471,6 @@ class Resource extends CommonObject
} }
} }
} }
$sql.= " GROUP BY t.rowid";
$sql.= $this->db->order($sortfield,$sortorder); $sql.= $this->db->order($sortfield,$sortorder);
if ($limit) $sql.= $this->db->plimit($limit+1,$offset); if ($limit) $sql.= $this->db->plimit($limit+1,$offset);
dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG);
@ -484,10 +481,9 @@ class Resource extends CommonObject
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
if ($num) if ($num)
{ {
$i = 0; $this->lines=array();
while ($i < $num) while ($obj = $this->db->fetch_object($resql))
{ {
$obj = $this->db->fetch_object($resql);
$line = new Resource($this->db); $line = new Resource($this->db);
$line->id = $obj->rowid; $line->id = $obj->rowid;
$line->resource_id = $obj->resource_id; $line->resource_id = $obj->resource_id;
@ -502,9 +498,8 @@ class Resource extends CommonObject
$line->objresource = fetchObjectByElement($obj->resource_id,$obj->resource_type); $line->objresource = fetchObjectByElement($obj->resource_id,$obj->resource_type);
if($obj->element_id && $obj->element_type) if($obj->element_id && $obj->element_type)
$line->objelement = fetchObjectByElement($obj->element_id,$obj->element_type); $line->objelement = fetchObjectByElement($obj->element_id,$obj->element_type);
$this->lines[$i] = $line; $this->lines[] = $line;
$i++;
} }
$this->db->free($resql); $this->db->free($resql);
} }
@ -559,7 +554,6 @@ class Resource extends CommonObject
} }
} }
} }
$sql.= " GROUP BY t.resource_id";
$sql.= $this->db->order($sortfield,$sortorder); $sql.= $this->db->order($sortfield,$sortorder);
if ($limit) $sql.= $this->db->plimit($limit+1,$offset); if ($limit) $sql.= $this->db->plimit($limit+1,$offset);
dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG);
@ -570,10 +564,9 @@ class Resource extends CommonObject
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
if ($num) if ($num)
{ {
$i = 0; $this->lines=array();
while ($i < $num) while ($obj = $this->db->fetch_object($resql))
{ {
$obj = $this->db->fetch_object($resql);
$line = new Resource($this->db); $line = new Resource($this->db);
$line->id = $obj->rowid; $line->id = $obj->rowid;
$line->resource_id = $obj->resource_id; $line->resource_id = $obj->resource_id;
@ -584,9 +577,7 @@ class Resource extends CommonObject
$line->mandatory = $obj->mandatory; $line->mandatory = $obj->mandatory;
$line->fk_user_create = $obj->fk_user_create; $line->fk_user_create = $obj->fk_user_create;
$this->lines[$i] = fetchObjectByElement($obj->resource_id,$obj->resource_type); $this->lines[] = fetchObjectByElement($obj->resource_id,$obj->resource_type);
$i++;
} }
$this->db->free($resql); $this->db->free($resql);
} }
@ -757,10 +748,13 @@ class Resource extends CommonObject
} }
/* /**
* Return an array with resources linked to the element * Return an array with resources linked to the element
* *
* * @param string $element Element
* @param int $element_id Id
* @param string $resource_type Type
* @return array Aray of resources
*/ */
function getElementResources($element,$element_id,$resource_type='') function getElementResources($element,$element_id,$resource_type='')
{ {
@ -768,7 +762,7 @@ class Resource extends CommonObject
// Links beetween objects are stored in this table // Links beetween objects are stored in this table
$sql = 'SELECT rowid, resource_id, resource_type, busy, mandatory'; $sql = 'SELECT rowid, resource_id, resource_type, busy, mandatory';
$sql.= ' FROM '.MAIN_DB_PREFIX.'element_resources'; $sql.= ' FROM '.MAIN_DB_PREFIX.'element_resources';
$sql.= " WHERE element_id='".$element_id."' AND element_type='".$element."'"; $sql.= " WHERE element_id=".$element_id." AND element_type='".$this->db->escape($element)."'";
if($resource_type) if($resource_type)
$sql.=" AND resource_type LIKE '%".$resource_type."%'"; $sql.=" AND resource_type LIKE '%".$resource_type."%'";
$sql .= ' ORDER BY resource_type'; $sql .= ' ORDER BY resource_type';

View File

@ -1936,11 +1936,10 @@ class Societe extends CommonObject
{ {
global $langs; global $langs;
$contact_emails = $this->contact_property_array('email'); $contact_emails = $this->contact_property_array('email',1);
if ($this->email && $addthirdparty) if ($this->email && $addthirdparty)
{ {
if (empty($this->name)) $this->name=$this->nom; if (empty($this->name)) $this->name=$this->nom;
// TODO: Tester si email non deja present dans tableau contact
$contact_emails['thirdparty']=$langs->trans("ThirdParty").': '.dol_trunc($this->name,16)." &lt;".$this->email."&gt;"; $contact_emails['thirdparty']=$langs->trans("ThirdParty").': '.dol_trunc($this->name,16)." &lt;".$this->email."&gt;";
} }
return $contact_emails; return $contact_emails;

View File

@ -5,6 +5,7 @@
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -165,7 +166,7 @@ $arrayfields=array(
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attribute_label as $key => $val)
{ {
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
} }
@ -341,6 +342,7 @@ $sql.= " st.libelle as stcomm, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.p
$sql.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4, s.fk_pays,"; $sql.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4, s.fk_pays,";
$sql.= " s.tms as date_update, s.datec as date_creation,"; $sql.= " s.tms as date_update, s.datec as date_creation,";
$sql.= " typent.code as typent_code"; $sql.= " typent.code as typent_code";
$sql.= " ,s.code_compta,s.code_compta_fournisseur";
// We'll need these fields in order to filter by sale (including the case where the user can only see his prospects) // We'll need these fields in order to filter by sale (including the case where the user can only see his prospects)
if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user"; if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user";
// We'll need these fields in order to filter by categ // We'll need these fields in order to filter by categ
@ -402,7 +404,7 @@ foreach ($search_array_options as $key => $val)
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }
@ -429,7 +431,7 @@ if ($resql)
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
if ($sall != '') $param = "&amp;sall=".urlencode($sall); if ($search_all != '') $param = "&amp;sall=".urlencode($search_all);
if ($search_categ != '') $param.='&amp;search_categ='.urlencode($search_categ); if ($search_categ != '') $param.='&amp;search_categ='.urlencode($search_categ);
if ($search_sale > 0) $param.='&amp;search_sale='.urlencode($search_sale); if ($search_sale > 0) $param.='&amp;search_sale='.urlencode($search_sale);
if ($search_nom != '') $param.= "&amp;search_nom=".urlencode($search_nom); if ($search_nom != '') $param.= "&amp;search_nom=".urlencode($search_nom);
@ -461,8 +463,8 @@ if ($resql)
$crit=$val; $crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
} }
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies'); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies');
// Show delete result message // Show delete result message
@ -490,13 +492,13 @@ if ($resql)
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
if ($search_all) if ($search_all)
{ {
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall);
} }
// Filter on categories // Filter on categories
$moreforfilter=''; $moreforfilter='';
if ($type == 'c' || $type == 'p') if ($type == 'c' || $type == 'p')
@ -541,7 +543,7 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">'; print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -567,9 +569,9 @@ if ($resql)
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attribute_label as $key => $val)
{ {
if (! empty($arrayfields["ef.".$key]['checked'])) if (! empty($arrayfields["ef.".$key]['checked']))
{ {
$align=$extrafields->getAlignFlag($key); $align=$extrafields->getAlignFlag($key);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
@ -700,7 +702,7 @@ if ($resql)
print '<input class="flat searchstring" size="4" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).'">'; print '<input class="flat searchstring" size="4" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).'">';
print '</td>'; print '</td>';
} }
// Type (customer/prospect/supplier) // Type (customer/prospect/supplier)
print '<td class="liste_titre maxwidthonsmartphone" align="middle">'; print '<td class="liste_titre maxwidthonsmartphone" align="middle">';
print '<select class="flat" name="search_type">'; print '<select class="flat" name="search_type">';
@ -711,7 +713,7 @@ if ($resql)
print '<option value="4"'.($search_type=='4'?' selected':'').'>'.$langs->trans('Supplier').'</option>'; print '<option value="4"'.($search_type=='4'?' selected':'').'>'.$langs->trans('Supplier').'</option>';
print '<option value="0"'.($search_type=='0'?' selected':'').'>'.$langs->trans('Others').'</option>'; print '<option value="0"'.($search_type=='0'?' selected':'').'>'.$langs->trans('Others').'</option>';
print '</select></td>'; print '</select></td>';
if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) if (! empty($arrayfields['s.fk_prospectlevel']['checked']))
{ {
// Prospect level // Prospect level
@ -731,15 +733,15 @@ if ($resql)
$options_to .= $langs->trans($tab_level_label); $options_to .= $langs->trans($tab_level_label);
$options_to .= '</option>'; $options_to .= '</option>';
} }
// Print these two select // Print these two select
print $langs->trans("From").' <select class="flat" name="search_level_from">'.$options_from.'</select>'; print $langs->trans("From").' <select class="flat" name="search_level_from">'.$options_from.'</select>';
print ' '; print ' ';
print $langs->trans("to").' <select class="flat" name="search_level_to">'.$options_to.'</select>'; print $langs->trans("to").' <select class="flat" name="search_level_to">'.$options_to.'</select>';
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['s.fk_stcomm']['checked'])) if (! empty($arrayfields['s.fk_stcomm']['checked']))
{ {
// Prospect status // Prospect status
@ -755,9 +757,9 @@ if ($resql)
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attribute_label as $key => $val)
{ {
if (! empty($arrayfields["ef.".$key]['checked'])) if (! empty($arrayfields["ef.".$key]['checked']))
{ {
$align=$extrafields->getAlignFlag($key); $align=$extrafields->getAlignFlag($key);
$typeofextrafield=$extrafields->attribute_type[$key]; $typeofextrafield=$extrafields->attribute_type[$key];
@ -813,7 +815,7 @@ if ($resql)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$var=!$var; $var=!$var;
$companystatic->id=$obj->rowid; $companystatic->id=$obj->rowid;
$companystatic->name=$obj->name; $companystatic->name=$obj->name;
$companystatic->canvas=$obj->canvas; $companystatic->canvas=$obj->canvas;
@ -824,7 +826,7 @@ if ($resql)
$companystatic->code_fournisseur=$obj->code_fournisseur; $companystatic->code_fournisseur=$obj->code_fournisseur;
$companystatic->fk_prospectlevel=$obj->fk_prospectlevel; $companystatic->fk_prospectlevel=$obj->fk_prospectlevel;
$companystatic->name_alias=$obj->name_alias; $companystatic->name_alias=$obj->name_alias;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
@ -866,7 +868,7 @@ if ($resql)
if (! empty($arrayfields['s.zip']['checked'])) if (! empty($arrayfields['s.zip']['checked']))
{ {
print "<td>".$obj->zip."</td>\n"; print "<td>".$obj->zip."</td>\n";
} }
// Country // Country
if (! empty($arrayfields['country.code_iso']['checked'])) if (! empty($arrayfields['country.code_iso']['checked']))
{ {
@ -956,9 +958,9 @@ if ($resql)
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attribute_label as $key => $val)
{ {
if (! empty($arrayfields["ef.".$key]['checked'])) if (! empty($arrayfields["ef.".$key]['checked']))
{ {
print '<td'; print '<td';
$align=$extrafields->getAlignFlag($key); $align=$extrafields->getAlignFlag($key);

View File

@ -285,7 +285,7 @@ if (empty($reshook))
$object->name_alias = GETPOST('name_alias'); $object->name_alias = GETPOST('name_alias');
} }
$object->address = GETPOST('address', 'alpha'); $object->address = GETPOST('address');
$object->zip = GETPOST('zipcode', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha');
$object->town = GETPOST('town', 'alpha'); $object->town = GETPOST('town', 'alpha');
$object->country_id = GETPOST('country_id', 'int'); $object->country_id = GETPOST('country_id', 'int');

View File

@ -9,7 +9,8 @@
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* * Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
@ -238,6 +239,7 @@ if ($result)
} }
$param='&socid='.$socid.'&viewstatut='.$viewstatut; $param='&socid='.$socid.'&viewstatut='.$viewstatut;
if ($sall) $param.='&sall='.$sall;
if ($month) $param.='&month='.$month; if ($month) $param.='&month='.$month;
if ($year) $param.='&year='.$year; if ($year) $param.='&year='.$year;
if ($search_ref) $param.='&search_ref=' .$search_ref; if ($search_ref) $param.='&search_ref=' .$search_ref;

View File

@ -522,8 +522,8 @@ div.myavailability {
} }
.checkallactions { .checkallactions {
vertical-align: top; vertical-align: top;
margin-top: 6px; margin-top: 6px;
margin-left: 4px; margin-left: 4px;
} }
.selectlimit { .selectlimit {
margin-right: 10px !important; margin-right: 10px !important;
@ -718,11 +718,11 @@ img.photoref {
/* ============================================================================== */ /* ============================================================================== */
<?php <?php
$minwidthtmenu=66; /* minimul widht for one top menu entry */ $minwidthtmenu=66; /* minimum width for one top menu entry */
$heightmenu=46; /* height of top menu, part with image */ $heightmenu=46; /* height of top menu, part with image */
$heightmenu2=48; /* height of top menu, part with login */ $heightmenu2=48; /* height of top menu, part with login */
$disableimages = 0; $disableimages = 0;
$maxwidthloginblock = 110; $maxwidthloginblock = 130;
if (! empty($conf->global->THEME_ELDY_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = 180; } if (! empty($conf->global->THEME_ELDY_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = 180; }
?> ?>
@ -1133,6 +1133,7 @@ div.login a:hover {
} }
div.login_block_user { div.login_block_user {
display: inline-block; display: inline-block;
min-width: 120px;
} }
div.login_block_other { div.login_block_other {
display: inline-block; display: inline-block;
@ -1142,7 +1143,7 @@ div.login_block_other { padding-top: 3px; text-align: right; }
.login_block_elem { .login_block_elem {
float: right; float: right;
vertical-align: top; vertical-align: top;
padding: 0px 0px 0px 4px !important; padding: 0px 3px 0px 4px !important;
height: 16px; height: 16px;
} }
.atoplogin, .atoplogin:hover { .atoplogin, .atoplogin:hover {
@ -4026,7 +4027,7 @@ img.demothumb {
/* nboftopmenuentries = <?php echo $nbtopmenuentries ?>, fontsize=<?php echo $fontsize ?> */ /* nboftopmenuentries = <?php echo $nbtopmenuentries ?>, fontsize=<?php echo $fontsize ?> */
/* rule to reduce top menu - 1st reduction */ /* rule to reduce top menu - 1st reduction */
@media only screen and (max-width: <?php echo round($nbtopmenuentries * $fontsize * 6.7, 0) + 8; ?>px) @media only screen and (max-width: <?php echo round($nbtopmenuentries * $fontsize * 6.9, 0) + 8; ?>px)
{ {
div.tmenucenter { div.tmenucenter {
max-width: <?php echo round($fontsize * 4); ?>px; /* size of viewport */ max-width: <?php echo round($fontsize * 4); ?>px; /* size of viewport */
@ -4084,10 +4085,16 @@ img.demothumb {
padding-<?php echo $right; ?>: 78px; padding-<?php echo $right; ?>: 78px;
<?php } ?> <?php } ?>
} }
div.login_block_user {
min-width: 0;
}
div.login_block { div.login_block {
top: 4px; top: 4px;
max-width: 82px; max-width: 82px;
} }
.login_block_elem {
padding: 0 !important;
}
li.tmenu, li.tmenusel { li.tmenu, li.tmenusel {
min-width: 30px; min-width: 30px;
} }

View File

@ -36,6 +36,12 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
if (! defined('NOREQUIREHOOK')) define('NOREQUIREHOOK','1'); // Disable "main.inc.php" hooks if (! defined('NOREQUIREHOOK')) define('NOREQUIREHOOK','1'); // Disable "main.inc.php" hooks
// Pour autre que companylogo, on charge environnement + info issus de logon comme le user // Pour autre que companylogo, on charge environnement + info issus de logon comme le user
if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'companylogo') && ! defined("NOLOGIN")) define("NOLOGIN",'1'); if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'companylogo') && ! defined("NOLOGIN")) define("NOLOGIN",'1');
if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'fckeditor') && ! defined("NOLOGIN")) {
define("NOLOGIN",'1');
// For multicompany
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_numeric($entity)) define("DOLENTITY", $entity);
}
/** /**
* Header empty * Header empty

View File

@ -660,7 +660,7 @@ function updateContact($authentication,$contact)
$object->civility_id=$contact['civility_id']; $object->civility_id=$contact['civility_id'];
$object->poste=$contact['poste']; $object->poste=$contact['poste'];
$object->statut=$contact['statut']; $object->statut=$contact['status'];
//Retreive all extrafield for contact //Retreive all extrafield for contact

View File

@ -935,7 +935,7 @@ function updateOrder($authentication,$order)
if (isset($order['billed'])) if (isset($order['billed']))
{ {
if ($order['billed']) $result=$object->classifyBilled($fuser); if ($order['billed']) $result=$object->classifyBilled($fuser);
if (! $order['billed']) $result=$object->classifyBilled($fuser); if (! $order['billed']) $result=$object->classifyUnBilled($fuser);
} }
//Retreive all extrafield for object //Retreive all extrafield for object

View File

@ -223,7 +223,7 @@ class Functions2LibTest extends PHPUnit_Framework_TestCase
$ip='169.254.0.0'; $ip='169.254.0.0';
$result=is_ip($ip); $result=is_ip($ip);
print __METHOD__." for ".$ip." result=".$result."\n"; print __METHOD__." for ".$ip." result=".$result."\n";
$this->assertEquals(0,$result,$ip); //$this->assertEquals(2,$result,$ip); // Assertion disabled because returned value differs between PHP patch version
$ip='1.2.3.4'; $ip='1.2.3.4';
$result=is_ip($ip); $result=is_ip($ip);