Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop_ldap

This commit is contained in:
Regis Houssin 2017-09-25 06:47:34 +02:00
commit 92ff974c5b
38 changed files with 398 additions and 243 deletions

View File

@ -17,8 +17,48 @@ Following changes may create regressions for some external modules, but were nec
__PROPALREF__, ...)
***** ChangeLog for 6.0.1 compared to 6.0.* *****
FIX: #7000 Dashboard link for late pending payment supplier invoices do not work
FIX: #7325 Default VAT rate when editing template invoices is 0%
FIX: #7330
FIX: #7359
FIX: #7367
FIX: #7368
FIX: #7391
FIX: #7420
FIX: Add some missing attributes in Adherent:makeSubstitution (type, phone…
FIX: Bad const name
FIX: Bad link to unpayed suppliers invoices
FIX: Better protection to no send email when we change limit
FIX: Calculation in the activity box
FIX: Clean bad parameters when inserting line of template invoice
FIX: dateSelector was not taken into account
FIX: hidden option MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN
FIX: journalization for bank journal should not rely on a label.
FIX: menu enty when url is external link
FIX: missing supplier qty and supplier discount in available fields for product export.
FIX: multicompany better accuracy in rounding and with revenue stamp.
FIX: Must use pdf format page as default for merging PDF.
FIX: PDF output was sharing 2 different currencies in same total
FIX: Position of signature on strato template
FIX: Protection to avoid to apply credit note discount > remain to pay
FIX: Remove warning when using log into syslog
FIX: Responsive
FIX: Security fixes (filter onload js, less verbose error message in
FIX: SEPA recording payment must save one payment in bank per customer
FIX: Several problem with the last event box on project/tasks
FIX: Sign of amount in origin currency on credit note created from lines
FIX: Some page of admin were not responsive
FIX: SQL injection
FIX: time.php crashed without project id in param
FIX: transfer of line extrafields from order to invoice
FIX: Upgrade missing on field
FIX: View of timespent for another user
FIX: ODT generation
FIX: CVE-2017-9840, CVE-2017-14238, CVE-2017-14239, CVE-2017-14240, CVE-2017-14241,
CVE-2017-14242
***** ChangeLog for 6.0.0 compared to 5.0.* *****
NEW: Add experimental BlockeLog module (to log business events in a non reversible log file).
NEW: Add a payment module for Stripe.
NEW: Add module "Product variant" (like red, blue for the product shoes)

View File

@ -48,7 +48,7 @@ class DolibarrApi
*/
function __construct($db, $cachedir='', $refreshCache=false)
{
global $conf;
global $conf, $dolibarr_main_url_root;
if (empty($cachedir)) $cachedir = $conf->api->dir_temp;
Defaults::$cacheDirectory = $cachedir;
@ -56,7 +56,9 @@ class DolibarrApi
$this->db = $db;
$production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true );
$this->r = new Restler($production_mode, $refreshCache);
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
$this->r->setBaseUrls(DOL_MAIN_URL_ROOT, $urlwithroot);
$this->r->setAPIVersion(1);
}

View File

@ -824,7 +824,7 @@ if ($action == 'create')
// Description
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('note',(GETPOST('note')?GETPOST('note'):$object->note),'',180,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,'90%');
$doleditor=new DolEditor('note',(GETPOST('note','none')?GETPOST('note','none'):$object->note),'',180,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,'90%');
$doleditor->Create();
print '</td></tr>';

View File

@ -358,8 +358,8 @@ if (empty($reshook))
$object->fk_project = GETPOST('projectid');
$object->modelpdf = GETPOST('model');
$object->author = $user->id; // deprecated
$object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public');
$object->note_private = GETPOST('note_private','none');
$object->note_public = GETPOST('note_public','none');
$object->statut = Propal::STATUS_DRAFT;
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
@ -386,8 +386,8 @@ if (empty($reshook))
$object->fk_project = GETPOST('projectid');
$object->modelpdf = GETPOST('model');
$object->author = $user->id; // deprecated
$object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public');
$object->note_private = GETPOST('note_private','none');
$object->note_public = GETPOST('note_public','none');
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
@ -979,7 +979,7 @@ if (empty($reshook))
$info_bits |= 0x01;
// Clean parameters
$description = dol_htmlcleanlastbr(GETPOST('product_desc'));
$description = dol_htmlcleanlastbr(GETPOST('product_desc','none'));
// Define vat_rate
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);

View File

@ -292,7 +292,7 @@ if ($socid > 0)
print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$object);
print '</td></tr>';
print '<tr><td class="fieldrequired" >'.$langs->trans("NoteReason").'</td>';
print '<td><input type="text" class="quatrevingtpercent" name="desc" value="'.GETPOST('desc').'"></td></tr>';
print '<td><input type="text" class="quatrevingtpercent" name="desc" value="'.GETPOST('desc','none').'"></td></tr>';
print "</table>";
}

View File

@ -256,8 +256,8 @@ if (empty($reshook))
$db->begin();
$object->date_commande = $datecommande;
$object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public');
$object->note_private = GETPOST('note_private','none');
$object->note_public = GETPOST('note_public','none');
$object->source = GETPOST('source_id');
$object->fk_project = GETPOST('projectid');
$object->ref_client = GETPOST('ref_client');
@ -927,7 +927,7 @@ if (empty($reshook))
$date_end='';
$date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
$date_end=dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
$description=dol_htmlcleanlastbr(GETPOST('product_desc'));
$description=dol_htmlcleanlastbr(GETPOST('product_desc','none'));
$pu_ht=GETPOST('price_ht');
$vat_rate=(GETPOST('tva_tx')?GETPOST('tva_tx'):0);
$pu_ht_devise = GETPOST('multicurrency_subprice');

View File

@ -1414,6 +1414,7 @@ if (empty($reshook))
{
$line->origin = $object->origin;
$line->origin_id = $line->id;
$line->fetch_optionals($line->id);
}
}
@ -1435,7 +1436,21 @@ if (empty($reshook))
$object->situation_counter = $object->situation_counter + 1;
$id = $object->createFromCurrent($user);
if ($id <= 0) $mesg = $object->error;
if ($id <= 0)
{
$mesg = $object->error;
}
else
{
$nextSituationInvoice = new Facture($db);
$nextSituationInvoice->fetch($id);
// create extrafields with data from create form
$extralabels = $extrafields->fetch_name_optionals_label($nextSituationInvoice->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $nextSituationInvoice);
if ($ret > 0) {
$nextSituationInvoice->insertExtraFields();
}
}
}
}
@ -1801,7 +1816,7 @@ if (empty($reshook))
$date_end = '';
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
$description = dol_htmlcleanlastbr(GETPOST('product_desc') ? GETPOST('product_desc') : GETPOST('desc'));
$description = dol_htmlcleanlastbr(GETPOST('product_desc','none') ? GETPOST('product_desc','none') : GETPOST('desc','none'));
$pu_ht = GETPOST('price_ht');
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
$qty = GETPOST('qty');

View File

@ -192,7 +192,7 @@ class Invoices extends DolibarrApi
foreach($request_data as $field => $value) {
$this->invoice->$field = $value;
}
if(! array_keys($request_data,'date')) {
if(! array_key_exists('date', $request_data)) {
$this->invoice->date = dol_now();
}
/* We keep lines as an array
@ -276,6 +276,107 @@ class Invoices extends DolibarrApi
);
}
/**
* Get lines of a given invoice
*
* @param int $id Id of invoice
*
* @url GET {id}/lines
*
* @return array
*/
function getLines($id) {
if(! DolibarrApiAccess::$user->rights->facture->lire) {
throw new RestException(401);
}
$result = $this->invoice->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->invoice->getLinesArray();
$result = array();
foreach ($this->invoice->lines as $line) {
array_push($result,$this->_cleanObjectDatas($line));
}
return $result;
}
/**
* Add a line to a given invoice
*
* Exemple of POST query : { "desc": "Desc", "subprice": "1.00000000", "qty": "1", "tva_tx": "20.000", "localtax1_tx": "0.000", "localtax2_tx": "0.000", "fk_product": "1", "remise_percent": "0", "date_start": "", "date_end": "", "fk_code_ventilation": 0, "info_bits": "0", "fk_remise_except": null, "product_type": "1", "rang": "-1", "special_code": "0", "fk_parent_line": null, "fk_fournprice": null, "pa_ht": "0.00000000", "label": "", "array_options": [], "situation_percent": "100", "fk_prev_id": null, "fk_unit": null }
*
* @param int $id Id of invoice
* @param array $request_data Invoiceline data
*
* @url POST {id}/lines
*
* @return int
*/
function postLine($id, $request_data = NULL) {
if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401);
}
$result = $this->invoice->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$request_data = (object) $request_data;
// Reset fk_parent_line for no child products and special product
if (($request_data->product_type != 9 && empty($request_data->fk_parent_line)) || $request_data->product_type == 9) {
$request_data->fk_parent_line = 0;
}
$updateRes = $this->invoice->addline(
$request_data->desc,
$request_data->subprice,
$request_data->qty,
$request_data->tva_tx,
$request_data->localtax1_tx,
$request_data->localtax2_tx,
$request_data->fk_product,
$request_data->remise_percent,
$request_data->date_start,
$request_data->date_end,
$request_data->fk_code_ventilation,
$request_data->info_bits,
$request_data->fk_remise_except,
'HT',
0,
$request_data->product_type,
$request_data->rang,
$request_data->special_code,
'facture',
$id,
$request_data->fk_parent_line,
$request_data->fk_fournprice,
$request_data->pa_ht,
$request_data->label,
$request_data->array_options,
$request_data->situation_percent,
$request_data->fk_prev_id,
$request_data->fk_unit
);
if ($updateRes > 0) {
return $this->get($id)->line->rowid;
}
throw new RestException(400, 'Unable to insert the new line. Check your inputs.');
}
/**
* Validate an order
*

View File

@ -293,8 +293,8 @@ class Facture extends CommonInvoice
// Fields coming from GUI (priority on template). TODO Value of template should be used as default value on GUI so we can use here always value from GUI
$this->fk_project = GETPOST('projectid','int') > 0 ? GETPOST('projectid','int') : $_facrec->fk_project;
$this->note_public = GETPOST('note_public') ? GETPOST('note_public') : $_facrec->note_public;
$this->note_private = GETPOST('note_private') ? GETPOST('note_private') : $_facrec->note_private;
$this->note_public = GETPOST('note_public','none') ? GETPOST('note_public','none') : $_facrec->note_public;
$this->note_private = GETPOST('note_private','none') ? GETPOST('note_private','none') : $_facrec->note_private;
$this->modelpdf = GETPOST('model') ? GETPOST('model') : $_facrec->modelpdf;
$this->cond_reglement_id = GETPOST('cond_reglement_id') > 0 ? GETPOST('cond_reglement_id') : $_facrec->cond_reglement_id;
$this->mode_reglement_id = GETPOST('mode_reglement_id') > 0 ? GETPOST('mode_reglement_id') : $_facrec->mode_reglement_id;

View File

@ -209,8 +209,8 @@ if (empty($reshook))
if (! $error)
{
$object->titre = GETPOST('titre', 'alpha');
$object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public');
$object->note_private = GETPOST('note_private','none');
$object->note_public = GETPOST('note_public','none');
$object->usenewprice = GETPOST('usenewprice');
$object->frequency = $frequency;
@ -360,7 +360,7 @@ if (empty($reshook))
// For triggers
$line->id = $lineid;
if ($line->delete() > 0)
if ($line->delete($user) > 0)
{
$result=$object->update_price(1);
@ -723,7 +723,7 @@ if (empty($reshook))
$date_end = '';
//$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
//$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
$description = dol_htmlcleanlastbr(GETPOST('product_desc') ? GETPOST('product_desc') : GETPOST('desc'));
$description = dol_htmlcleanlastbr(GETPOST('product_desc','none') ? GETPOST('product_desc','none') : GETPOST('desc','none'));
$pu_ht = GETPOST('price_ht');
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
$qty = GETPOST('qty');
@ -965,8 +965,8 @@ if ($action == 'create')
print '<tr><td class="titlefieldcreate">'.$langs->trans("Customer").'</td><td>'.$object->thirdparty->getNomUrl(1,'customer').'</td>';
print '</tr>';
$note_public=GETPOST('note_public')?GETPOST('note_public'):$object->note_public;
$note_private=GETPOST('note_private')?GETPOST('note_private'):$object->note_private;
$note_public=GETPOST('note_public','none')?GETPOST('note_public','none'):$object->note_public;
$note_private=GETPOST('note_private','none')?GETPOST('note_private','none'):$object->note_private;
// Help of substitution key
$substitutionarray=array(

View File

@ -60,7 +60,7 @@ if ($action == 'setnote' && $user->rights->facture->paiement)
$db->begin();
$object->fetch($id);
$result = $object->update_note(GETPOST('note'));
$result = $object->update_note(GETPOST('note','none'));
if ($result > 0)
{
$db->commit();

View File

@ -676,7 +676,7 @@ if (empty($reshook))
$fk_unit = GETPOST('unit', 'alpha');
$objectline->description=GETPOST('product_desc');
$objectline->description=GETPOST('product_desc','none');
$objectline->price_ht=GETPOST('elprice');
$objectline->subprice=GETPOST('elprice');
$objectline->qty=GETPOST('elqty');

View File

@ -2987,12 +2987,12 @@ class Form
* Constant MAIN_DEFAULT_PAYMENT_TERM_ID can used to set default value but scope is all application, probably not what you want.
* See instead to force the default value by the caller.
*
* @param int $selected Id of payment term to preselect by default
* @param string $htmlname Nom de la zone select
* @param int $filtertype Not used
* @param int $selected Id of payment term to preselect by default
* @param string $htmlname Nom de la zone select
* @param int $filtertype Not used
* @param int $addempty Add an empty entry
* @param int $noadmininfo 0=Add admin info, 1=Disable admin info
* @param string $morecss Add more CSS on select tag
* @param int $noinfoadmin 0=Add admin info, 1=Disable admin info
* @param string $morecss Add more CSS on select tag
* @return void
*/
function select_conditions_paiements($selected=0, $htmlname='condid', $filtertype=-1, $addempty=0, $noinfoadmin=0, $morecss='')
@ -3277,7 +3277,7 @@ class Form
$return= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
$sql = 'SELECT rowid, label from '.MAIN_DB_PREFIX.'c_units';
$sql = 'SELECT rowid, label, code from '.MAIN_DB_PREFIX.'c_units';
$sql.= ' WHERE active > 0';
$resql = $this->db->query($sql);
@ -5215,15 +5215,16 @@ class Form
*/
static function selectArrayAjax($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0)
{
global $langs;
global $conf, $langs;
global $delayedhtmlcontent;
$tmpplugin='select2';
// TODO Use an internal dolibarr component instead of select2
if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && ! defined('REQUIRE_JQUERY_MULTISELECT')) return '';
$out='<input type="text" class="'.$htmlname.($morecss?' '.$morecss:'').'" '.($moreparam?$moreparam.' ':'').'name="'.$htmlname.'">';
// TODO Use an internal dolibarr component instead of select2
$outdelayed='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
$tmpplugin='select2';
$outdelayed="\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
<script type="text/javascript">
$(document).ready(function () {
@ -5325,7 +5326,7 @@ class Form
if (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))
{
$tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT;
$out.='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
$out.="\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
<script type="text/javascript">
function formatResult(record) {'."\n";
if ($elemtype == 'category')

View File

@ -44,6 +44,35 @@ top_httphead('text/javascript; charset=UTF-8');
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
else header('Cache-Control: no-cache');
?>
// Javascript libraries for Dolibarr ERP CRM (https://www.dolibarr.org)
/**
* Set select2 translations (if module was loaded).
*/
(function ($) {
"use strict";
if (typeof $.fn.select2 != "undefined") {
/* console.log($.fn.select2);
console.log("ok"); */
$.fn.select2.locales['xx'] = {
formatMatches: function (matches) { return matches + " <?php echo dol_escape_js($langs->trans("Select2ResultFoundUseArrows")); ?>"; },
formatNoMatches: function () { return "<?php echo dol_escape_js($langs->trans("Select2NotFound")); ?>"; },
formatInputTooShort: function (input, min) { var n = min - input.length;
if (n > 1) return "<?php echo dol_escape_js($langs->trans("Select2Enter")); ?> " + n + " <?php echo dol_escape_js($langs->trans("Select2MoreCharacters")); ?>";
else return "<?php echo dol_escape_js($langs->trans("Select2Enter")); ?> " + n + " <?php echo dol_escape_js($langs->trans("Select2MoreCharacter")); ?>"
},
formatLoadMore: function (pageNumber) { return "<?php echo dol_escape_js($langs->trans("Select2LoadingMoreResults")); ?>"; },
formatSearching: function () { return "<?php echo dol_escape_js($langs->trans("Select2SearchInProgress")); ?>"; }
};
$.extend($.fn.select2.defaults, $.fn.select2.locales['xx']);
}
})(jQuery);
/*
* =================================================================
@ -53,6 +82,7 @@ else header('Cache-Control: no-cache');
* SimpleDateFormat a utiliser pour retour
* ==================================================================
*/
/*
function showDP(base,dateFieldID,format,codelang)
{
// check to see if another box is already showing
@ -136,7 +166,7 @@ function resetDP(base,dateFieldID,format,codelang)
function loadMonth(base,month,year,ymd,codelang)
{
/* showDP.box.innerHTML="Loading..."; */
// showDP.box.innerHTML="Loading...";
// alert(codelang);
var theURL=base+"datepicker.php?cm=shw&lang="+codelang;
theURL+="&m="+encodeURIComponent(month);
@ -163,37 +193,6 @@ function closeDPBox()
showDP.datefieldID=null;
}
function dpChangeDay(dateFieldID,format)
{
showDP.datefieldID=dateFieldID;
console.log("Call dpChangeDay, we save date into detailed fields.");
var thefield=getObjectFromID(showDP.datefieldID);
var thefieldday=getObjectFromID(showDP.datefieldID+"day");
var thefieldmonth=getObjectFromID(showDP.datefieldID+"month");
var thefieldyear=getObjectFromID(showDP.datefieldID+"year");
var date=getDateFromFormat(thefield.value,format);
if (date)
{
thefieldday.value=date.getDate();
if(thefieldday.onchange) thefieldday.onchange.call(thefieldday);
thefieldmonth.value=date.getMonth()+1;
if(thefieldmonth.onchange) thefieldmonth.onchange.call(thefieldmonth);
thefieldyear.value=date.getFullYear();
if(thefieldyear.onchange) thefieldyear.onchange.call(thefieldyear);
}
else
{
thefieldday.value='';
if(thefieldday.onchange) thefieldday.onchange.call(thefieldday);
thefieldmonth.value='';
if(thefieldmonth.onchange) thefieldmonth.onchange.call(thefieldmonth);
thefieldyear.value='';
if(thefieldyear.onchange) thefieldyear.onchange.call(thefieldyear);
}
}
function dpClickDay(year,month,day,format)
{
var thefield=getObjectFromID(showDP.datefieldID);
@ -221,16 +220,6 @@ function dpHighlightDay(year,month,day,months){
displayinfo.innerHTML=months[month-1]+" "+day+", "+year;
}
// Returns an object given an id
function getObjectFromID(id){
var theObject;
if(document.getElementById)
theObject=document.getElementById(id);
else
theObject=document.all[id];
return theObject;
}
// This Function returns the top position of an object
function getTop(theitem){
var offsetTrail = theitem;
@ -257,6 +246,85 @@ function getLeft(theitem){
return offsetLeft;
}
// To hide/show select Boxes with IE6 (and only IE6 because IE6 has a bug and
// not put popup completely on the front)
// Used only bu popup calendar
function hideSelectBoxes() {
var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10);
if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE 6") > -1)
{
for(var i = 0; i < document.all.length; i++)
{
if(document.all[i].tagName)
if(document.all[i].tagName == "SELECT")
document.all[i].style.visibility="hidden";
}
}
}
// To hide/show select Boxes with IE6 (and only IE6 because IE6 has a bug and
// not put popup completely on the front)
// Used only bu popup calendar
function displaySelectBoxes() {
var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10);
if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE 6") > -1)
{
for(var i = 0; i < document.all.length; i++)
{
if(document.all[i].tagName)
if(document.all[i].tagName == "SELECT")
document.all[i].style.visibility="visible";
}
}
}
*/
// Returns an object given an id
function getObjectFromID(id){
var theObject;
if(document.getElementById)
theObject=document.getElementById(id);
else
theObject=document.all[id];
return theObject;
}
// Called after selection of a date to save details into detailed fields
function dpChangeDay(dateFieldID,format)
{
//showDP.datefieldID=dateFieldID;
console.log("Call dpChangeDay, we save date into detailed fields.");
var thefield=getObjectFromID(dateFieldID);
var thefieldday=getObjectFromID(dateFieldID+"day");
var thefieldmonth=getObjectFromID(dateFieldID+"month");
var thefieldyear=getObjectFromID(dateFieldID+"year");
var date=getDateFromFormat(thefield.value,format);
if (date)
{
thefieldday.value=date.getDate();
if(thefieldday.onchange) thefieldday.onchange.call(thefieldday);
thefieldmonth.value=date.getMonth()+1;
if(thefieldmonth.onchange) thefieldmonth.onchange.call(thefieldmonth);
thefieldyear.value=date.getFullYear();
if(thefieldyear.onchange) thefieldyear.onchange.call(thefieldyear);
}
else
{
thefieldday.value='';
if(thefieldday.onchange) thefieldday.onchange.call(thefieldday);
thefieldmonth.value='';
if(thefieldmonth.onchange) thefieldmonth.onchange.call(thefieldmonth);
thefieldyear.value='';
if(thefieldyear.onchange) thefieldyear.onchange.call(thefieldyear);
}
}
// Create XMLHttpRequest object and load url
// Used by calendar or other ajax processes
@ -316,40 +384,6 @@ function loadXMLDoc(url,readyStateFunction,async)
return req;
}
/* To hide/show select Boxes with IE6 (and only IE6 because IE6 has a bug and
* not put popup completely on the front)
* Used only bu popup calendar
*/
function hideSelectBoxes() {
var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10);
if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE 6") > -1)
{
for(var i = 0; i < document.all.length; i++)
{
if(document.all[i].tagName)
if(document.all[i].tagName == "SELECT")
document.all[i].style.visibility="hidden";
}
}
}
/* To hide/show select Boxes with IE6 (and only IE6 because IE6 has a bug and
* not put popup completely on the front)
* Used only bu popup calendar
*/
function displaySelectBoxes() {
var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10);
if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE 6") > -1)
{
for(var i = 0; i < document.all.length; i++)
{
if(document.all[i].tagName)
if(document.all[i].tagName == "SELECT")
document.all[i].style.visibility="visible";
}
}
}
/*
* =================================================================

View File

@ -1,67 +0,0 @@
<?php
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/js/select2_locale.js.php
* \brief File that include javascript functions for timepicker
*/
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
if (! defined('NOLOGIN')) define('NOLOGIN',1);
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
session_cache_limiter(FALSE);
require_once '../../main.inc.php';
// Define javascript type
top_httphead('text/javascript; charset=UTF-8');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
else header('Cache-Control: no-cache');
?>
/**
* Select2 French translation
*/
(function ($) {
"use strict";
$.fn.select2.locales['xx'] = {
formatMatches: function (matches) { return matches + " <?php echo dol_escape_js($langs->trans("Select2ResultFoundUseArrows")); ?>"; },
formatNoMatches: function () { return "<?php echo dol_escape_js($langs->trans("Select2NotFound")); ?>"; },
formatInputTooShort: function (input, min) { var n = min - input.length;
if (n > 1) return "<?php echo dol_escape_js($langs->trans("Select2Enter")); ?> " + n + " <?php echo dol_escape_js($langs->trans("Select2MoreCharacters")); ?>";
else return "<?php echo dol_escape_js($langs->trans("Select2Enter")); ?> " + n + " <?php echo dol_escape_js($langs->trans("Select2MoreCharacter")); ?>"
},
formatLoadMore: function (pageNumber) { return "<?php echo dol_escape_js($langs->trans("Select2LoadingMoreResults")); ?>"; },
formatSearching: function () { return "<?php echo dol_escape_js($langs->trans("Select2SearchInProgress")); ?>"; }
};
$.extend($.fn.select2.defaults, $.fn.select2.locales['xx']);
})(jQuery);
<?php
if (is_object($db)) $db->close();

View File

@ -396,14 +396,15 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
global $conf;
if (! empty($conf->browser->phone)) return ''; // select2 disabled for smartphones with standard browser (does not works, popup appears outside screen)
if (! empty($conf->dol_use_jmobile)) return ''; // select2 works with jmobile but it breaks the autosize feature of jmobile.
//if (! empty($conf->dol_use_jmobile)) return ''; // select2 works with jmobile but it breaks the autosize feature of jmobile.
if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return '';
if (empty($conf->use_javascript_ajax)) return '';
if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && ! defined('REQUIRE_JQUERY_MULTISELECT')) return '';
if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete=0;
$tmpplugin='select2';
$msg='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id = '.$htmlname.' -->
$msg="\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id = '.$htmlname.' -->
<script type="text/javascript">
$(document).ready(function () {
$(\''.(preg_match('/^\./',$htmlname)?$htmlname:'#'.$htmlname).'\').'.$tmpplugin.'({

View File

@ -184,7 +184,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
// Set cookie for timeout management
$prefix=dol_getprefix();
$sessiontimeout='DOLSESSTIMEOUT_'.$prefix;
if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", '', 0);
if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", null, false, true);
if (GETPOST('urlfrom','alpha')) $_SESSION["urlfrom"]=GETPOST('urlfrom','alpha');
else unset($_SESSION["urlfrom"]);

View File

@ -148,7 +148,7 @@ if ($action=='add')
$object->params=GETPOST('params');
$object->md5params=GETPOST('md5params');
$object->module_name=GETPOST('module_name','alpha');
$object->note=GETPOST('note');
$object->note=GETPOST('note','none');
$object->datestart=dol_mktime(GETPOST('datestarthour','int'), GETPOST('datestartmin','int'), 0, GETPOST('datestartmonth','int'), GETPOST('datestartday','int'), GETPOST('datestartyear','int'));
$object->dateend=dol_mktime(GETPOST('dateendhour','int'), GETPOST('dateendmin','int'), 0, GETPOST('dateendmonth','int'), GETPOST('dateendday','int'), GETPOST('dateendyear','int'));
$object->datenextrun=dol_mktime(GETPOST('datenextrunhour','int'), GETPOST('datenextrunmin','int'), 0, GETPOST('datenextrunmonth','int'), GETPOST('datenextrunday','int'), GETPOST('datenextrunyear','int'));
@ -184,7 +184,7 @@ if ($action=='update')
$object->params=GETPOST('params');
$object->md5params=GETPOST('md5params');
$object->module_name=GETPOST('module_name','alpha');
$object->note=GETPOST('note');
$object->note=GETPOST('note','none');
$object->datestart=dol_mktime(GETPOST('datestarthour','int'), GETPOST('datestartmin','int'), 0, GETPOST('datestartmonth','int'), GETPOST('datestartday','int'), GETPOST('datestartyear','int'));
$object->dateend=dol_mktime(GETPOST('dateendhour','int'), GETPOST('dateendmin','int'), 0, GETPOST('dateendmonth','int'), GETPOST('dateendday','int'), GETPOST('dateendyear','int'));
$object->datenextrun=dol_mktime(GETPOST('datenextrunhour','int'), GETPOST('datenextrunmin','int'), 0, GETPOST('datenextrunmonth','int'), GETPOST('datenextrunday','int'), GETPOST('datenextrunyear','int'));

View File

@ -219,8 +219,8 @@ if (empty($reshook))
$object->shipping_method_id = GETPOST('shipping_method_id','int');
$object->tracking_number = GETPOST('tracking_number','alpha');
$object->ref_int = GETPOST('ref_int','alpha');
$object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public');
$object->note_private = GETPOST('note_private','none');
$object->note_public = GETPOST('note_public','none');
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
@ -780,9 +780,15 @@ if ($action == 'create')
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
print $object->showOptionals($extrafields, 'edit');
}
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
// copy from order
$orderExtrafields = new Extrafields($db);
$orderExtrafieldLabels = $orderExtrafields->fetch_name_optionals_label($object->table_element);
if ($object->fetch_optionals($object->id, $orderExtrafieldLabels) > 0) {
$expe->array_options = array_merge($expe->array_options, $object->array_options);
}
print $object->showOptionals($extrafields, 'edit');
}
// Incoterms
@ -1304,8 +1310,13 @@ if ($action == 'create')
if (is_array($extralabelslines) && count($extralabelslines)>0)
{
$colspan=5;
$orderLineExtrafields = new Extrafields($db);
$orderLineExtrafieldLabels = $orderLineExtrafields->fetch_name_optionals_label($object->table_element_line);
$srcLine = new OrderLine($db);
$srcLine->fetch_optionals($line->id,$orderLineExtrafieldLabels); // fetch extrafields also available in orderline
$line = new ExpeditionLigne($db);
$line->fetch_optionals($object->id,$extralabelslines);
$line->array_options = array_merge($line->array_options, $srcLine->array_options);
print '<tr class="oddeven">';
print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan),$indiceAsked);
print '</tr>';

View File

@ -213,8 +213,8 @@ if (empty($reshook))
$object->fk_statut = 1;
$object->fk_c_paiement = GETPOST('fk_c_paiement','int');
$object->fk_user_validator = GETPOST('fk_user_validator','int');
$object->note_public = GETPOST('note_public');
$object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public','none');
$object->note_private = GETPOST('note_private','none');
// Fill array 'array_options' with data from add form
if (! $error)
{
@ -264,8 +264,8 @@ if (empty($reshook))
}
$object->fk_c_paiement = GETPOST('fk_c_paiement','int');
$object->note_public = GETPOST('note_public');
$object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public','none');
$object->note_private = GETPOST('note_private','none');
$object->fk_user_modif = $user->id;
$result = $object->update($user);

View File

@ -64,7 +64,7 @@ $confirm = GETPOST('confirm','alpha');
$mesg = GETPOST('msg','alpha');
$origin=GETPOST('origin','alpha');
$originid=(GETPOST('originid','int')?GETPOST('originid','int'):GETPOST('origin_id','int')); // For backward compatibility
$note_public = GETPOST('note_public');
$note_public = GETPOST('note_public','none');
$lineid = GETPOST('line_id','int');
//PDF
@ -208,8 +208,8 @@ if (empty($reshook))
$object->description = GETPOST('description');
$object->ref = $ref;
$object->modelpdf = GETPOST('model','alpha');
$object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public');
$object->note_private = GETPOST('note_private','none');
$object->note_public = GETPOST('note_public','none');
if ($object->socid > 0)
{
@ -877,8 +877,8 @@ if ($action == 'create')
$soc = $objectsrc->client;
$note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : GETPOST('note_private')));
$note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : GETPOST('note_public'));
$note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : GETPOST('note_private','none')));
$note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : GETPOST('note_public','none'));
// Object source contacts list
$srccontactslist = $objectsrc->liste_contact(-1,'external',1);

View File

@ -417,7 +417,7 @@ if (empty($reshook))
$localtax1_tx,
$localtax2_tx,
$idprod,
$productsupplier->id,
$productsupplier->product_fourn_price_id,
$productsupplier->fourn_ref,
$remise_percent,
'HT',
@ -988,8 +988,8 @@ if (empty($reshook))
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_account = GETPOST('fk_account', 'int');
$object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public');
$object->note_private = GETPOST('note_private','none');
$object->note_public = GETPOST('note_public','none');
$object->date_livraison = $datelivraison;
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
@ -1534,7 +1534,7 @@ if ($action=='create')
print '<tr><td>'.$langs->trans('NotePublic').'</td>';
print '<td>';
$doleditor = new DolEditor('note_public', isset($note_public) ? $note_public : GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_public', isset($note_public) ? $note_public : GETPOST('note_public','none'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1);
print '</td>';
//print '<textarea name="note_public" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea>';
@ -1542,7 +1542,7 @@ if ($action=='create')
print '<tr><td>'.$langs->trans('NotePrivate').'</td>';
print '<td>';
$doleditor = new DolEditor('note_private', isset($note_private) ? $note_private : GETPOST('note_private'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_private', isset($note_private) ? $note_private : GETPOST('note_private','none'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1);
print '</td>';
//print '<td><textarea name="note_private" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>';

View File

@ -155,8 +155,8 @@ if (($action == 'create' || $action == 'add') && ! $error) {
$object->libelle = GETPOST('libelle');
$object->date = $datefacture;
$object->date_echeance = $datedue;
$object->note_public = GETPOST('note_public');
$object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public','none');
$object->note_private = GETPOST('note_private','none');
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$projectid = GETPOST('projectid');

View File

@ -443,8 +443,8 @@ if (empty($reshook))
$object->libelle = GETPOST('label');
$object->date = $datefacture;
$object->date_echeance = $datedue;
$object->note_public = GETPOST('note_public');
$object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public','none');
$object->note_private = GETPOST('note_private','none');
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_account = GETPOST('fk_account', 'int');
@ -507,8 +507,8 @@ if (empty($reshook))
$object->libelle = $_POST['label'];
$object->date = $datefacture;
$object->date_echeance = $datedue;
$object->note_public = GETPOST('note_public');
$object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public','none');
$object->note_private = GETPOST('note_private','none');
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_account = GETPOST('fk_account', 'int');
@ -616,8 +616,8 @@ if (empty($reshook))
$object->libelle = $_POST['label'];
$object->date = $datefacture;
$object->date_echeance = $datedue;
$object->note_public = GETPOST('note_public');
$object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public','none');
$object->note_private = GETPOST('note_private','none');
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_account = GETPOST('fk_account', 'int');

View File

@ -57,7 +57,7 @@ if ($action == 'setnote' && $user->rights->fournisseur->facture->creer)
$db->begin();
$object->fetch($id);
$result = $object->update_note(GETPOST('note'));
$result = $object->update_note(GETPOST('note','none'));
if ($result > 0)
{
$db->commit();

View File

@ -158,7 +158,7 @@ ErrorPriceExpression22=Negative result '%s'
ErrorPriceExpressionInternal=Internal error '%s'
ErrorPriceExpressionUnknown=Unknown error '%s'
ErrorSrcAndTargetWarehouseMustDiffers=Source and target warehouses must differs
ErrorTryToMakeMoveOnProductRequiringBatchData=Error, trying to make a stock movement without lot/serial information, on a product requiring lot/serial information
ErrorTryToMakeMoveOnProductRequiringBatchData=Error, trying to make a stock movement without lot/serial information, on product '%s' requiring lot/serial information
ErrorCantSetReceptionToTotalDoneWithReceptionToApprove=All recorded receptions must first be verified (approved or denied) before being allowed to do this action
ErrorCantSetReceptionToTotalDoneWithReceptionDenied=All recorded receptions must first be verified (approved) before being allowed to do this action
ErrorGlobalVariableUpdater0=HTTP request failed with error '%s'

View File

@ -565,6 +565,14 @@ else
}
// Other attributes
if ($action = 'create_delivery') {
// copy from expedition
$expeditionExtrafields = new Extrafields($db);
$expeditionExtrafieldLabels = $expeditionExtrafields->fetch_name_optionals_label($expedition->table_element);
if ($expedition->fetch_optionals($object->origin_id, $expeditionExtrafieldLabels) > 0) {
$object->array_options = array_merge($object->array_options, $expedition->array_options);
}
}
$cols = 2;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
@ -665,6 +673,13 @@ else
$mode = ($object->statut == 0) ? 'edit' : 'view';
$line = new LivraisonLigne($db);
$line->fetch_optionals($object->lines[$i]->id,$extralabelslines);
if ($action = 'create_delivery') {
$srcLine = new ExpeditionLigne($db);
$expeditionLineExtrafields = new Extrafields($db);
$expeditionLineExtrafieldLabels = $expeditionLineExtrafields->fetch_name_optionals_label($srcLine->table_element);
$srcLine->fetch_optionals($expedition->lines[$i]->id,$expeditionLineExtrafieldLabels);
$line->array_options = array_merge($line->array_options, $srcLine->array_options);
}
print '<tr class="oddeven">';
print $line->showOptionals($extrafieldsline, $mode, array('style'=>$bc[$var], 'colspan'=>$colspan),$i);
print '</tr>';

View File

@ -133,8 +133,8 @@ if (empty($reshook))
$object->dateend = $dateend;
$object->nbterm = GETPOST('nbterm');
$object->rate = $rate;
$object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public');
$object->note_private = GETPOST('note_private','none');
$object->note_public = GETPOST('note_public','none');
$object->fk_project = GETPOST('projectid','int');
$accountancy_account_capital = GETPOST('accountancy_account_capital');

View File

@ -101,8 +101,8 @@ if ($action == 'add_payment')
$payment->amount_interest = GETPOST('amount_interest');
$payment->paymenttype = GETPOST('paymenttype');
$payment->num_payment = GETPOST('num_payment');
$payment->note_private = GETPOST('note_private');
$payment->note_public = GETPOST('note_public');
$payment->note_private = GETPOST('note_private','none');
$payment->note_public = GETPOST('note_public','none');
if (! $error)
{

View File

@ -179,7 +179,9 @@ if (! empty($_SERVER['DOCUMENT_ROOT']) && substr($_SERVER['DOCUMENT_ROOT'], -6)
// Include the conf.php and functions.lib.php
require_once 'filefunc.inc.php';
// If there is a POST parameter to tell to save automatically some POST parameters into cookies, we do it
// If there is a POST parameter to tell to save automatically some POST parameters into cookies, we do it.
// This is used for example by form of boxes to save personalization of some options.
// DOL_AUTOSET_COOKIE=cookiename:val1,val2 and cookiename_val1=aaa cookiename_val2=bbb will set cookie_name with value json_encode(array('val1'=> , ))
if (! empty($_POST["DOL_AUTOSET_COOKIE"]))
{
$tmpautoset=explode(':',$_POST["DOL_AUTOSET_COOKIE"],2);
@ -194,7 +196,7 @@ if (! empty($_POST["DOL_AUTOSET_COOKIE"]))
$cookiename=$tmpautoset[0];
$cookievalue=json_encode($cookiearrayvalue);
//var_dump('setcookie cookiename='.$cookiename.' cookievalue='.$cookievalue);
setcookie($cookiename, empty($cookievalue)?'':$cookievalue, empty($cookievalue)?0:(time()+(86400*354)), '/'); // keep cookie 1 year
setcookie($cookiename, empty($cookievalue)?'':$cookievalue, empty($cookievalue)?0:(time()+(86400*354)), '/', null, false, true); // keep cookie 1 year and add tag httponly
if (empty($cookievalue)) unset($_COOKIE[$cookiename]);
}
@ -204,7 +206,7 @@ $sessionname='DOLSESSID_'.$prefix;
$sessiontimeout='DOLSESSTIMEOUT_'.$prefix;
if (! empty($_COOKIE[$sessiontimeout])) ini_set('session.gc_maxlifetime',$_COOKIE[$sessiontimeout]);
session_name($sessionname);
session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie
session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
// This create lock released until session_write_close() or end of page.
// We need this lock as long as we read/write $_SESSION ['vars']. We can close released when finished.
if (! defined('NOSESSION'))
@ -1279,7 +1281,6 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
{
$tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT;
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/'.$tmpplugin.'/'.$tmpplugin.'.min.js'.($ext?'?'.$ext:'').'"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/select2_locale.js.php?lang='.$langs->defaultlang.($ext?'&amp;'.$ext:'').'"></script>'."\n";
}
}
@ -1319,7 +1320,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
// Global js function
print '<!-- Includes JS of Dolibarr -->'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/lib_head.js.php'.($ext?'?'.$ext:'').'"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/lib_head.js.php?lang='.$langs->defaultlang.($ext?'&amp;'.$ext:'').'"></script>'."\n";
// Add datepicker default options
/*if (! defined('DISABLE_DATE_PICKER'))

View File

@ -281,9 +281,9 @@ if (empty($reshook))
$object->barcode_type_coder = $stdobject->barcode_type_coder;
$object->barcode_type_label = $stdobject->barcode_type_label;
$object->description = dol_htmlcleanlastbr(GETPOST('desc'));
$object->description = dol_htmlcleanlastbr(GETPOST('desc','none'));
$object->url = GETPOST('url');
$object->note_private = dol_htmlcleanlastbr(GETPOST('note_private'));
$object->note_private = dol_htmlcleanlastbr(GETPOST('note_private','none'));
$object->note = $object->note_private; // deprecated
$object->customcode = GETPOST('customcode');
$object->country_id = GETPOST('country_id');
@ -370,11 +370,11 @@ if (empty($reshook))
$object->ref = $ref;
$object->label = GETPOST('label');
$object->description = dol_htmlcleanlastbr(GETPOST('desc'));
$object->description = dol_htmlcleanlastbr(GETPOST('desc','none'));
$object->url = GETPOST('url');
if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB))
{
$object->note_private = dol_htmlcleanlastbr(GETPOST('note_private'));
$object->note_private = dol_htmlcleanlastbr(GETPOST('note_private','none'));
$object->note = $object->note_private;
}
$object->customcode = GETPOST('customcode');
@ -977,7 +977,7 @@ else
// Description (used in invoice, propal...)
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td colspan="3">';
$doleditor = new DolEditor('desc', GETPOST('desc'), '', 160, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_4, '90%');
$doleditor = new DolEditor('desc', GETPOST('desc','none'), '', 160, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_4, '90%');
$doleditor->Create();
print "</td></tr>";
@ -1092,7 +1092,7 @@ else
print '<tr><td class="tdtop">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="3">';
// We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF.
$doleditor = new DolEditor('note_private', GETPOST('note_private'), '', 140, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_8, '90%');
$doleditor = new DolEditor('note_private', GETPOST('note_private','none'), '', 140, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_8, '90%');
$doleditor->Create();
print "</td></tr>";

View File

@ -1532,6 +1532,7 @@ class Product extends CommonObject
$obj->price = $price_result;
}
}
$this->product_fourn_price_id = $obj->rowid;
$this->buyprice = $obj->price; // deprecated
$this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product of supplier
$this->fourn_price_base_type = 'HT'; // Price base type
@ -1577,6 +1578,7 @@ class Product extends CommonObject
$obj->price = $price_result;
}
}
$this->product_fourn_price_id = $obj->rowid;
$this->buyprice = $obj->price; // deprecated
$this->fourn_qty = $obj->quantity; // min quantity for price for a virtual supplier
$this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product for a virtual supplier

View File

@ -96,6 +96,7 @@ class MouvementStock extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php';
$langs->load("errors");
$error = 0;
dol_syslog(get_class($this)."::_create start userid=$user->id, fk_product=$fk_product, warehouse_id=$entrepot_id, qty=$qty, type=$type, price=$price, label=$label, inventorycode=$inventorycode, datem=".$datem.", eatby=".$eatby.", sellby=".$sellby.", batch=".$batch.", skip_batch=".$skip_batch);
@ -141,7 +142,7 @@ class MouvementStock extends CommonObject
{
if (empty($batch))
{
$this->errors[]=$langs->trans("ErrorTryToMakeMoveOnProductRequiringBatchData", $product->name);
$this->errors[]=$langs->trans("ErrorTryToMakeMoveOnProductRequiringBatchData", $product->ref);
dol_syslog("Try to make a movement of a product with status_batch on without any batch data");
$this->db->rollback();

View File

@ -572,7 +572,7 @@ foreach($extrafields->attribute_label as $key=>$value)
// Comments
print '<tr>';
print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
print '<td class="tdtop"><textarea name="note_private" id="note_private" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('note_private')).'</textarea></td>';
print '<td class="tdtop"><textarea name="note_private" id="note_private" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('note_private','none')).'</textarea></td>';
print '</tr>'."\n";
// Add specific fields used by Dolibarr foundation for example

View File

@ -237,7 +237,7 @@ print "</tr>\n";
print '<tr class="liste_titre">';
if (! empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'],$_SERVER["PHP_SELF"],"t.ref","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['ty.label']['checked'])) print_liste_field_titre($arrayfields['ty.label']['label'],$_SERVER["PHP_SELF"],"t.code","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['ty.label']['checked'])) print_liste_field_titre($arrayfields['ty.label']['label'],$_SERVER["PHP_SELF"],"ty.label","",$param,"",$sortfield,$sortorder);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{

View File

@ -268,7 +268,7 @@ if (empty($reshook))
$object->fk_project = GETPOST('projectid');
$object->modelpdf = GETPOST('model');
$object->author = $user->id; // deprecated
$object->note = GETPOST('note');
$object->note = GETPOST('note','none');
$object->statut = SupplierProposal::STATUS_DRAFT;
$id = $object->create_from($user);
@ -286,7 +286,7 @@ if (empty($reshook))
$object->fk_project = GETPOST('projectid');
$object->modelpdf = GETPOST('model');
$object->author = $user->id; // deprecated
$object->note = GETPOST('note');
$object->note = GETPOST('note','none');
$object->origin = GETPOST('origin');
$object->origin_id = GETPOST('originid');
@ -465,7 +465,7 @@ if (empty($reshook))
} else {
// prevent browser refresh from closing proposal several times
if ($object->statut == SupplierProposal::STATUS_VALIDATED) {
$object->cloture($user, GETPOST('statut'), GETPOST('note'));
$object->cloture($user, GETPOST('statut'), GETPOST('note','none'));
}
}
}
@ -774,7 +774,7 @@ if (empty($reshook))
$info_bits |= 0x01;
// Clean parameters
$description = dol_htmlcleanlastbr(GETPOST('product_desc'));
$description = dol_htmlcleanlastbr(GETPOST('product_desc','none'));
// Define vat_rate
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);

View File

@ -65,7 +65,7 @@ if (empty($reshook)) {
if ($action == 'update' && $user->rights->user->user->creer && !$_POST["cancel"]) {
$db->begin();
$res = $object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES));
$res = $object->update_note(dol_html_entity_decode(GETPOST('note_private','none'), ENT_QUOTES));
if ($res < 0) {
$mesg = '<div class="error">'.$adh->error.'</div>';
$db->rollback();

View File

@ -196,7 +196,6 @@ class AdherentTest extends PHPUnit_Framework_TestCase
$result=$localobject->fetch($id);
print __METHOD__." id=".$id." result=".$result."\n";
$this->assertLessThan($result, 0);
return $localobject;
}
@ -318,14 +317,13 @@ class AdherentTest extends PHPUnit_Framework_TestCase
$langs=$this->savlangs;
$db=$this->savdb;
$template = '%DOL_MAIN_URL_ROOT%,%ID%,%CIVILITY%,%FIRSTNAME%,%LASTNAME%,%FULLNAME%,%COMPANY%,'.
'%ADDRESS%,%ZIP%,%TOWN%,%COUNTRY%,%EMAIL%,%BIRTH%,%PHOTO%,%LOGIN%,%PASSWORD%,%PRENOM%,'.
'%NOM%,%SOCIETE%,%ADDRESS%,%ZIP%,%TOWN%,%COUNTRY%';
$template = '__CIVILITY__,__FIRSTNAME__,__LASTNAME__,__FULLNAME__,__COMPANY__,'.
'__ADDRESS__,__ZIP__,__TOWN__,__COUNTRY__,__EMAIL__,__BIRTH__,__PHOTO__,__LOGIN__';
// If option to store clear password has been set, we get 'dolibspec' into PASSWORD field.
$expected = DOL_MAIN_URL_ROOT.','.$localobject->id.',,New firstname,New name,New firstname New name,'.
$expected = ',New firstname,New name,New firstname New name,'.
'New company,New address,New zip,New town,Belgium,newemail@newemail.com,'.dol_print_date($localobject->birth,'day').',,'.
'newlogin,dolibspec,New firstname,New name,New company,New address,New zip,New town,Belgium';
'newlogin';
$result = $localobject->makeSubstitution($template);
print __METHOD__." result=".$result."\n";