Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2012-06-08 20:37:14 +02:00
commit 85f31fc0cb
9 changed files with 120 additions and 103 deletions

View File

@ -1232,13 +1232,11 @@ class Commande extends CommonObject
$sql.= ', cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc';
$sql.= ', ca.code as availability_code';
$sql.= ', dr.code as demand_reason_code';
$sql.= ', el.fk_source';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON (c.fk_cond_reglement = cr.rowid)';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON (c.fk_mode_reglement = p.id)';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON (c.fk_availability = ca.rowid)';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON (c.fk_demand_reason = ca.rowid)';
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = c.rowid AND el.targettype = '".$this->element."'";
$sql.= " WHERE c.entity = ".$conf->entity;
if ($id) $sql.= " AND c.rowid=".$id;
if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'";
@ -1290,7 +1288,6 @@ class Commande extends CommonObject
$this->demand_reason_code = $obj->demand_reason_code;
$this->date_livraison = $this->db->jdate($obj->date_livraison);
$this->fk_delivery_address = $obj->fk_adresse_livraison;
$this->propale_id = $obj->fk_source;
$this->extraparams = (array) json_decode($obj->extraparams, true);
@ -1300,22 +1297,6 @@ class Commande extends CommonObject
$this->db->free();
if ($this->propale_id)
{
$sqlp = "SELECT ref";
$sqlp.= " FROM ".MAIN_DB_PREFIX."propal";
$sqlp.= " WHERE rowid = ".$this->propale_id;
$resqlprop = $this->db->query($sqlp);
if ($resqlprop)
{
$objp = $this->db->fetch_object($resqlprop);
$this->propale_ref = $objp->ref;
$this->db->free($resqlprop);
}
}
/*
* Lines
*/

View File

@ -2217,8 +2217,6 @@ class Form
$more.='</table>'."\n";
}
$formconfirm.= "\n<!-- begin form_confirm page=".$page." -->\n";
if ($useajax && $conf->use_javascript_ajax)
{
$autoOpen=true;
@ -2244,83 +2242,12 @@ class Form
}
// New code using jQuery only
$formconfirm.= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">';
if (! empty($more)) $formconfirm.= '<p>'.$more.'</p>';
$formconfirm.= img_help('','').' '.$question;
$formconfirm.= '</div>'."\n";
$formconfirm.= '<script type="text/javascript">
var choice=\'ko\';
var inputok='.json_encode($inputok).';
var inputko='.json_encode($inputko).';
var pageyes=\''.dol_escape_js($pageyes?$pageyes:'').'\';
var pageno=\''.dol_escape_js($pageno?$pageno:'').'\';
/* Warning: This function is loaded once and not overwritten if loaded by another ajax page */
$(function() {
$( "#'.$dialogconfirm.'" ).dialog({
autoOpen: '.($autoOpen?'true':'false').',
resizable: false,
height:'.$height.',
width:'.$width.',
modal: true,
closeOnEscape: false,
close: function(event, ui) {
if (choice == \'ok\') {
var options="";
if (inputok.length>0) {
$.each(inputok, function() {
var inputname = this; var more = \'\';
if ($("#" + this).attr("type") == \'checkbox\') { more = \':checked\'; }
var inputvalue = $("#" + this + more).val();
if (typeof inputvalue == \'undefined\') { inputvalue=\'\'; }
options += \'&\' + inputname + \'=\' + inputvalue;
});
}
var urljump=pageyes + (pageyes.indexOf(\'?\')<0?\'?\':\'\') + options;
//alert(urljump);
if (pageyes.length > 0) { location.href=urljump; }
}
if (choice == \'ko\') {
var options="";
if (inputko.length>0) {
$.each(inputko, function() {
var inputname = this; var more = \'\';
if ($("#" + this).attr("type") == \'checkbox\') { more = \':checked\'; }
var inputvalue = $("#" + this + more).val();
if (typeof inputvalue == \'undefined\') { inputvalue=\'\'; }
options += \'&\' + inputname + \'=\' + inputvalue;
});
}
var urljump=pageno + (pageno.indexOf(\'?\')<0?\'?\':\'\') + options;
//alert(urljump);
if (pageno.length > 0) { location.href=urljump; }
}
},
buttons: {
\''.dol_escape_js($langs->transnoentities("Yes")).'\': function() {
choice=\'ok\';
$(this).dialog(\'close\');
},
\''.dol_escape_js($langs->transnoentities("No")).'\': function() {
choice=\'ko\';
$(this).dialog(\'close\');
}
}
});
var button=\''.$button.'\';
if (button.length > 0) {
$( "#" + button ).click(function() {
$("#'.$dialogconfirm.'").dialog(\'open\');
});
}
});
</script>';
$formconfirm.= "\n";
include(DOL_DOCUMENT_ROOT.'/core/tpl/ajax/formconfirm.tpl.php');
}
else
{
$formconfirm.= "\n<!-- begin form_confirm page=".$page." -->\n";
$formconfirm.= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n";
$formconfirm.= '<input type="hidden" name="action" value="'.$action.'">';
$formconfirm.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
@ -2352,9 +2279,10 @@ class Form
$formconfirm.= "</form>\n";
$formconfirm.= '<br>';
$formconfirm.= "<!-- end form_confirm -->\n";
}
$formconfirm.= "<!-- end form_confirm -->\n";
return $formconfirm;
}

View File

@ -661,7 +661,7 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0,$objec
//print "x".$file." ".$disableglob;
$ok=true;
$file_osencoded=dol_osencode($file); // New filename encoded in OS filesystem encoding charset
if (empty($disableglob))
if (empty($disableglob) && ! empty($file_osencoded))
{
foreach (glob($file_osencoded) as $filename)
{

View File

@ -44,6 +44,8 @@ $(function () {
// Options
$('#fileupload').fileupload('option', {
// Enable iframe cross-domain access via redirect option
redirect: window.location.href.replace(/\/[^\/]*$/,'<?php echo DOL_URL_ROOT; ?>/includes/jquery/plugins/fileupload/cors/result.html?%s'),
maxFileSize: '<?php echo $max_file_size; ?>'
});

View File

@ -0,0 +1,84 @@
<?php
/* Copyright (C) 2011-2012 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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/>.
*
*/
?>
<!-- START TEMPLATE FORMCONFIRM PAGE="<?php echo $page; ?>" -->
<div id="<?php echo $dialogconfirm; ?>" title="<?php echo dol_escape_htmltag($title); ?>" style="display: none;">
<?php if (! empty($more)) { ?>
<p><?php echo $more; ?></p>
<?php } ?>
<?php echo img_help('','').' '.$question; ?>
</div>
<script type="text/javascript">
$(function() {
$( "#<?php echo $dialogconfirm; ?>" ).dialog({
autoOpen: <?php echo ($autoOpen ? 'true' : 'false'); ?>,
resizable: false,
height: '<?php echo $height; ?>',
width: '<?php echo $width; ?>',
modal: true,
closeOnEscape: false,
buttons: {
'<?php echo dol_escape_js($langs->transnoentities("Yes")); ?>': function() {
var options="";
var inputok = <?php echo json_encode($inputok); ?>;
var pageyes = '<?php echo dol_escape_js($pageyes?$pageyes:''); ?>';
if (inputok.length>0) {
$.each(inputok, function(i, inputname) {
var more = '';
if ($("#" + inputname).attr("type") == 'checkbox') { more = ':checked'; }
var inputvalue = $("#" + inputname + more).val();
if (typeof inputvalue == 'undefined') { inputvalue=''; }
options += '&' + inputname + '=' + inputvalue;
});
}
var urljump = pageyes + (pageyes.indexOf('?') < 0 ? '?' : '') + options;
//alert(urljump);
if (pageyes.length > 0) { location.href = urljump; }
$(this).dialog('close');
},
'<?php echo dol_escape_js($langs->transnoentities("No")); ?>': function() {
var options = '';
var inputko = <?php echo json_encode($inputko); ?>;
var pageno='<?php echo dol_escape_js($pageno?$pageno:''); ?>';
if (inputko.length>0) {
$.each(inputko, function(i, inputname) {
var more = '';
if ($("#" + inputname).attr("type") == 'checkbox') { more = ':checked'; }
var inputvalue = $("#" + inputname + more).val();
if (typeof inputvalue == 'undefined') { inputvalue=''; }
options += '&' + inputname + '=' + inputvalue;
});
}
var urljump=pageno + (pageno.indexOf('?') < 0 ? '?' : '') + options;
//alert(urljump);
if (pageno.length > 0) { location.href = urljump; }
$(this).dialog('close');
}
}
});
var button = '<?php echo $button; ?>';
if (button.length > 0) {
$( "#" + button ).click(function() {
$("#<?php echo $dialogconfirm; ?>").dialog('open');
});
}
});
</script>
<!-- END TEMPLATE FORM CONFIRM -->

View File

@ -0,0 +1,20 @@
<!DOCTYPE HTML>
<!--
/*
* jQuery Iframe Transport Plugin Redirect Page 2.0
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
-->
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery Iframe Transport Plugin Redirect Page</title>
</head>
<body><script>document.body.innerHTML=decodeURIComponent(window.location.search.slice(1));</script></body>
</html>

View File

@ -1,5 +1,5 @@
/*
* jQuery File Upload User Interface Plugin 6.9
* jQuery File Upload User Interface Plugin 6.9.1
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
@ -530,8 +530,8 @@
},
_forceReflow: function (node) {
this._reflow = $.support.transition &&
node.length && node[0].offsetWidth;
return $.support.transition && node.length &&
node[0].offsetWidth;
},
_transition: function (node) {

View File

@ -989,11 +989,13 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD))
{
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/template/tmpl.min.js"></script>'."\n";
//print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/jquery.iframe-transport.js"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/jquery.iframe-transport.js"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/jquery.fileupload.js"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/jquery.fileupload-fp.js"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/jquery.fileupload-ui.js"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/jquery.fileupload-jui.js"></script>'."\n";
print '<!-- The XDomainRequest Transport is included for cross-domain file deletion for IE8+ -->'."\n";
'<!--[if gte IE 8]><script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/cors/jquery.xdr-transport.js"></script><![endif]-->'."\n";
}
// jQuery DataTables
if (! empty($conf->global->MAIN_USE_JQUERY_DATATABLES))

View File

@ -1092,10 +1092,10 @@ class Product extends CommonObject
$this->db->free($resql);
// multilangs
if ($conf->global->MAIN_MULTILANGS) $this->getMultiLangs();
if (! empty($conf->global->MAIN_MULTILANGS)) $this->getMultiLangs();
// Load multiprices array
if ($conf->global->PRODUIT_MULTIPRICES)
if (! empty($conf->global->PRODUIT_MULTIPRICES))
{
for ($i=1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++)
{