diff --git a/dev/initdata/img/comapnycorp1company.png b/dev/initdata/img/comapnycorp1company.png new file mode 100644 index 00000000000..7d45cad6258 Binary files /dev/null and b/dev/initdata/img/comapnycorp1company.png differ diff --git a/dev/initdata/img/companycorp2company.png b/dev/initdata/img/companycorp2company.png new file mode 100644 index 00000000000..18917afb66d Binary files /dev/null and b/dev/initdata/img/companycorp2company.png differ diff --git a/dev/initdata/img/compxp4523product.jpg b/dev/initdata/img/compxp4523product.jpg new file mode 100644 index 00000000000..aefbdd9b0f7 Binary files /dev/null and b/dev/initdata/img/compxp4523product.jpg differ diff --git a/dev/initdata/img/ldestailleur_200x200.jpg b/dev/initdata/img/ldestailleur_200x200.jpg new file mode 100644 index 00000000000..df68aa5f64f Binary files /dev/null and b/dev/initdata/img/ldestailleur_200x200.jpg differ diff --git a/dev/initdata/img/magicfoodstorecompany.png b/dev/initdata/img/magicfoodstorecompany.png new file mode 100644 index 00000000000..ec54049d984 Binary files /dev/null and b/dev/initdata/img/magicfoodstorecompany.png differ diff --git a/dev/initdata/img/mybigcompany.png b/dev/initdata/img/mybigcompany.png index 7b9747e073b..62a96380acc 100644 Binary files a/dev/initdata/img/mybigcompany.png and b/dev/initdata/img/mybigcompany.png differ diff --git a/dev/initdata/img/valeencompany.png b/dev/initdata/img/valeencompany.png new file mode 100644 index 00000000000..7970901c038 Binary files /dev/null and b/dev/initdata/img/valeencompany.png differ diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index c7f47649efa..67e01bcb773 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -70,7 +70,9 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update') } 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->url=$url; $bookmark->target=$target; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 62ebd0589c0..2cae46ad05c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1890,7 +1890,7 @@ class Form $sql.= " WHERE fk_product='".$objp->rowid."'"; $sql.= " AND entity IN (".getEntity('productprice', 1).")"; $sql.= " AND price_level=".$price_level; - $sql.= " ORDER BY date_price"; + $sql.= " ORDER BY date_price, rowid"; $sql.= " DESC LIMIT 1"; dol_syslog(get_class($this).'::constructProductListOption search price for level '.$price_level.'', LOG_DEBUG); diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index db6582ba332..3728644a401 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1454,6 +1454,8 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio if (is_numeric($resupload) && $resupload > 0) { include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; + global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini; + if (empty($donotupdatesession)) { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; @@ -1464,10 +1466,10 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio { // Create small thumbs for image (Ratio is near 16/9) // 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) // 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'); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f7f1ae3541b..0b0615b69c8 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3959,7 +3959,9 @@ function get_exdir($num,$level,$alpha,$withoutslash,$object,$modulepart) $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 if (empty($alpha)) $num = preg_replace('/([^0-9])/i','',$num); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 42d9b8bc99e..3b1fa498336 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2006 Rodolphe Quiedeville * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2016 Regis Houssin * Copyright (C) 2010-2015 Juanjo Menent * Copyright (C) 2011-2015 Philippe Grand * Copyright (C) 2012 Marcos García @@ -722,7 +722,8 @@ if (empty($reshook)) $result = $object->commande($user, $_REQUEST["datecommande"], $_REQUEST["methode"], $_REQUEST['comment']); if ($result > 0) { - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { $outputlangs = $langs; $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 0b3bcf469d5..59c920c26ca 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -136,6 +136,8 @@ if ($action == 'create') $result = 0; + $result = 0; + if (! $error) { $cp->fk_user = $userid; @@ -300,8 +302,10 @@ if ($action == 'confirm_send') $cp = new Holiday($db); $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 - if($cp->statut == 1 && $user->id == $cp->fk_user) + if($cp->statut == 1 && $canedit) { $cp->statut = 2; @@ -955,7 +959,7 @@ else } // 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); } diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index be4d981bdac..a92945ce502 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -191,7 +191,6 @@ if (!empty($sall)) if (empty($user->rights->holiday->read_all)) $filter.=' AND cp.fk_user IN ('.join(',',$childids).')'; - // Récupération de l'ID de l'utilisateur $user_id = $user->id; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 8c744fbb6d3..2188293a1ba 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1673,7 +1673,7 @@ class Product extends CommonObject $sql.= " WHERE entity IN (".getEntity('productprice', 1).")"; $sql.= " AND price_level=".$i; $sql.= " AND fk_product = '".$this->id."'"; - $sql.= " ORDER BY date_price DESC"; + $sql.= " ORDER BY date_price, rowid DESC"; $sql.= " LIMIT 1"; $resql = $this->db->query($sql); if ($resql) @@ -1734,7 +1734,7 @@ class Product extends CommonObject $sql.= " price_base_type, tva_tx, tosell, price_by_qty, rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product_price"; $sql.= " WHERE fk_product = '".$this->id."'"; - $sql.= " ORDER BY date_price DESC"; + $sql.= " ORDER BY date_price, rowid DESC"; $sql.= " LIMIT 1"; $resql = $this->db->query($sql); if ($resql) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 9b63b91ece6..4e0079b491d 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1026,7 +1026,7 @@ $sql .= " WHERE fk_product = " . $object->id; $sql .= " AND p.entity IN (" . getEntity('productprice', 1) . ")"; $sql .= " AND p.fk_user_author = u.rowid"; 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(); $result = $db->query($sql); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 374aaf51fbb..dd424a9e0e6 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1786,7 +1786,7 @@ else // Photo print ''; - print $form->showphoto('userphoto',$object,100,0,$caneditfield); + print $form->showphoto('userphoto',$object,100,0,$caneditfield,'photowithmargin','small'); print ''; print ''; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 955753a73a3..7307590016a 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -296,6 +296,10 @@ class User extends CommonObject $this->fk_member = $obj->fk_member; $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 // fetch optionals attributes and labels require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');