Merge remote-tracking branch 'origin/3.9' into develop

Conflicts:
	htdocs/core/lib/files.lib.php
This commit is contained in:
Laurent Destailleur 2016-01-23 11:51:56 +01:00
commit 4df584e57b
21 changed files with 37 additions and 18 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -70,7 +70,9 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
} }
if ($action == 'update') $bookmark->fetch($_POST["id"]); if ($action == 'update') $bookmark->fetch($_POST["id"]);
$bookmark->fk_user=$userid; // Check if null because user not admin can't set an user and send empty value here.
if(!empty($userid))
$bookmark->fk_user=$userid;
$bookmark->title=$title; $bookmark->title=$title;
$bookmark->url=$url; $bookmark->url=$url;
$bookmark->target=$target; $bookmark->target=$target;

View File

@ -194,6 +194,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
} }
else else
{ {
$var=!$var;
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoProposal").'</td></tr>'; print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoProposal").'</td></tr>';
} }
print "</table><br>"; print "</table><br>";
@ -273,6 +274,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
} }
else else
{ {
$var=!$var;
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoOrder").'</td></tr>'; print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoOrder").'</td></tr>';
} }
print "</table><br>"; print "</table><br>";
@ -353,6 +355,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande
} }
else else
{ {
$var=!$var;
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoSupplierOrder").'</td></tr>'; print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoSupplierOrder").'</td></tr>';
} }
print "</table><br>"; print "</table><br>";

View File

@ -1890,7 +1890,7 @@ class Form
$sql.= " WHERE fk_product='".$objp->rowid."'"; $sql.= " WHERE fk_product='".$objp->rowid."'";
$sql.= " AND entity IN (".getEntity('productprice', 1).")"; $sql.= " AND entity IN (".getEntity('productprice', 1).")";
$sql.= " AND price_level=".$price_level; $sql.= " AND price_level=".$price_level;
$sql.= " ORDER BY date_price"; $sql.= " ORDER BY date_price, rowid";
$sql.= " DESC LIMIT 1"; $sql.= " DESC LIMIT 1";
dol_syslog(get_class($this).'::constructProductListOption search price for level '.$price_level.'', LOG_DEBUG); dol_syslog(get_class($this).'::constructProductListOption search price for level '.$price_level.'', LOG_DEBUG);

View File

@ -1466,6 +1466,8 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
$resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destpath, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles); $resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destpath, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles);
if (is_numeric($resupload) && $resupload > 0) if (is_numeric($resupload) && $resupload > 0)
{ {
global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini;
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
if (empty($donotupdatesession)) if (empty($donotupdatesession))
{ {
@ -1477,10 +1479,10 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
{ {
// Create small thumbs for image (Ratio is near 16/9) // Create small thumbs for image (Ratio is near 16/9)
// Used on logon for example // Used on logon for example
$imgThumbSmall = vignette($destpath, 160, 120, '_small', 50, "thumbs"); $imgThumbSmall = vignette($destpath, $maxwidthsmall, $maxheigthsmall, '_small', 50, "thumbs");
// Create mini thumbs for image (Ratio is near 16/9) // Create mini thumbs for image (Ratio is near 16/9)
// Used on menu or for setup page for example // Used on menu or for setup page for example
$imgThumbMini = vignette($destpath, 160, 120, '_mini', 50, "thumbs"); $imgThumbMini = vignette($destpath, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs");
} }
setEventMessages($langs->trans("FileTransferComplete"), null, 'mesgs'); setEventMessages($langs->trans("FileTransferComplete"), null, 'mesgs');

View File

@ -3963,7 +3963,9 @@ function get_exdir($num,$level,$alpha,$withoutslash,$object,$modulepart)
$path = ''; $path = '';
if (! empty($level) && in_array($modulepart, array('cheque','user','category','holiday','shipment', 'member','don','donation','supplier_invoice','invoice_supplier','mailing'))) $arrayforoldpath=array('cheque','user','category','holiday','shipment', 'member','don','donation','supplier_invoice','invoice_supplier','mailing');
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[]='product';
if (! empty($level) && in_array($modulepart, $arrayforoldpath))
{ {
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided // This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided
if (empty($alpha)) $num = preg_replace('/([^0-9])/i','',$num); if (empty($alpha)) $num = preg_replace('/([^0-9])/i','',$num);

View File

@ -254,7 +254,7 @@ class pdf_strato extends ModelePDFContract
{ {
$objectligne = $object->lines[$i]; $objectligne = $object->lines[$i];
$valide = $objectligne->id ? $objectligne->fetch($objectligne->id) : 0; $valide = $objectligne->id ? 1 : 0;
if ($valide > 0 || $object->specimen) if ($valide > 0 || $object->specimen)
{ {

View File

@ -335,9 +335,11 @@ if ($resql)
print "</form>"; print "</form>";
/*
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a href="'.dol_buildpath('/expensereport/card.php',1).'?action=create" class="butAction">'.$langs->trans("NewTrip").'</a>'; print '<a href="'.dol_buildpath('/expensereport/card.php',1).'?action=create" class="butAction">'.$langs->trans("NewTrip").'</a>';
print '</div>'; print '</div>';
*/
$db->free($resql); $db->free($resql);
} }

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2004-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2006 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 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2016 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) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
@ -722,7 +722,8 @@ if (empty($reshook))
$result = $object->commande($user, $_REQUEST["datecommande"], $_REQUEST["methode"], $_REQUEST['comment']); $result = $object->commande($user, $_REQUEST["datecommande"], $_REQUEST["methode"], $_REQUEST['comment']);
if ($result > 0) if ($result > 0)
{ {
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');

View File

@ -136,6 +136,8 @@ if ($action == 'create')
$result = 0; $result = 0;
$result = 0;
if (! $error) if (! $error)
{ {
$cp->fk_user = $userid; $cp->fk_user = $userid;
@ -300,8 +302,10 @@ if ($action == 'confirm_send')
$cp = new Holiday($db); $cp = new Holiday($db);
$cp->fetch($id); $cp->fetch($id);
$canedit=(($user->id == $cp->fk_user && $user->rights->holiday->write) || ($user->id != $cp->fk_user && $user->rights->holiday->write_all));
// Si brouillon et créateur // Si brouillon et créateur
if($cp->statut == 1 && $user->id == $cp->fk_user) if($cp->statut == 1 && $canedit)
{ {
$cp->statut = 2; $cp->statut = 2;
@ -955,7 +959,7 @@ else
} }
// Si envoi en validation // Si envoi en validation
if ($action == 'sendToValidate' && $cp->statut == 1 && $user->id == $cp->fk_user) if ($action == 'sendToValidate' && $cp->statut == 1)
{ {
print $form->formconfirm("card.php?id=".$id,$langs->trans("TitleToValidCP"),$langs->trans("ConfirmToValidCP"),"confirm_send", '', 1, 1); print $form->formconfirm("card.php?id=".$id,$langs->trans("TitleToValidCP"),$langs->trans("ConfirmToValidCP"),"confirm_send", '', 1, 1);
} }

View File

@ -191,7 +191,6 @@ if (!empty($sall))
if (empty($user->rights->holiday->read_all)) $filter.=' AND cp.fk_user IN ('.join(',',$childids).')'; if (empty($user->rights->holiday->read_all)) $filter.=' AND cp.fk_user IN ('.join(',',$childids).')';
// Récupération de l'ID de l'utilisateur // Récupération de l'ID de l'utilisateur
$user_id = $user->id; $user_id = $user->id;
@ -436,13 +435,13 @@ if($holiday_payes == '2')
print '</table>'; print '</table>';
print '</form>'; print '</form>';
if ($user_id == $user->id) /*if ($user_id == $user->id)
{ {
print '<br>'; print '<br>';
print '<div style="float: right; margin-top: 8px;">'; print '<div style="float: right; margin-top: 8px;">';
print '<a href="./card.php?action=request" class="butAction">'.$langs->trans('AddCP').'</a>'; print '<a href="./card.php?action=request" class="butAction">'.$langs->trans('AddCP').'</a>';
print '</div>'; print '</div>';
} }*/
llxFooter(); llxFooter();

View File

@ -1675,7 +1675,7 @@ class Product extends CommonObject
$sql.= " WHERE entity IN (".getEntity('productprice', 1).")"; $sql.= " WHERE entity IN (".getEntity('productprice', 1).")";
$sql.= " AND price_level=".$i; $sql.= " AND price_level=".$i;
$sql.= " AND fk_product = '".$this->id."'"; $sql.= " AND fk_product = '".$this->id."'";
$sql.= " ORDER BY date_price DESC"; $sql.= " ORDER BY date_price, rowid DESC";
$sql.= " LIMIT 1"; $sql.= " LIMIT 1";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
@ -1736,7 +1736,7 @@ class Product extends CommonObject
$sql.= " price_base_type, tva_tx, tosell, price_by_qty, rowid"; $sql.= " price_base_type, tva_tx, tosell, price_by_qty, rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."product_price"; $sql.= " FROM ".MAIN_DB_PREFIX."product_price";
$sql.= " WHERE fk_product = '".$this->id."'"; $sql.= " WHERE fk_product = '".$this->id."'";
$sql.= " ORDER BY date_price DESC"; $sql.= " ORDER BY date_price, rowid DESC";
$sql.= " LIMIT 1"; $sql.= " LIMIT 1";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)

View File

@ -1026,7 +1026,7 @@ $sql .= " WHERE fk_product = " . $object->id;
$sql .= " AND p.entity IN (" . getEntity('productprice', 1) . ")"; $sql .= " AND p.entity IN (" . getEntity('productprice', 1) . ")";
$sql .= " AND p.fk_user_author = u.rowid"; $sql .= " AND p.fk_user_author = u.rowid";
if (! empty($socid) && ! empty($conf->global->PRODUIT_MULTIPRICES)) $sql .= " AND p.price_level = " . $soc->price_level; if (! empty($socid) && ! empty($conf->global->PRODUIT_MULTIPRICES)) $sql .= " AND p.price_level = " . $soc->price_level;
$sql .= " ORDER BY p.date_price DESC, p.price_level ASC, p.rowid DESC"; $sql .= " ORDER BY p.date_price, p.rowid DESC, p.price_level ASC";
// $sql .= $db->plimit(); // $sql .= $db->plimit();
$result = $db->query($sql); $result = $db->query($sql);

View File

@ -1786,7 +1786,7 @@ else
// Photo // Photo
print '<td align="center" valign="middle" width="25%" rowspan="'.$rowspan.'">'; print '<td align="center" valign="middle" width="25%" rowspan="'.$rowspan.'">';
print $form->showphoto('userphoto',$object,100,0,$caneditfield); print $form->showphoto('userphoto',$object,100,0,$caneditfield,'photowithmargin','small');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -296,6 +296,10 @@ class User extends CommonObject
$this->fk_member = $obj->fk_member; $this->fk_member = $obj->fk_member;
$this->fk_user = $obj->fk_user; $this->fk_user = $obj->fk_user;
// Protection when module multicompany was set, admin was set to first entity and the module disabled,
// then this admin user must be admin for all entities.
if (empty($conf->multicompany->enabled) && $this->admin && $this->entity == 1) $this->entity = 0;
// Retreive all extrafield for thirdparty // Retreive all extrafield for thirdparty
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');