From e326c4d57980c9e01b4958eaa65e5ba02e0ed862 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Mar 2019 10:48:10 +0100 Subject: [PATCH] Look and feel v10 --- htdocs/categories/photos.php | 98 +++++++++++++++++--------------- htdocs/categories/viewcat.php | 68 ++++++++++++---------- htdocs/core/lib/security.lib.php | 2 +- htdocs/holiday/card.php | 3 +- htdocs/holiday/document.php | 4 +- 5 files changed, 93 insertions(+), 82 deletions(-) diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index df300961fb1..0b2ac7c1b0c 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -218,66 +218,70 @@ if ($object->id) $pdir = get_exdir($object->id, 2, 0, 0, $object, 'category') . $object->id ."/photos/"; $dir = $upload_dir.'/'.$pdir; - print '
'; - print ''; + $listofphoto = $object->liste_photos($dir); - foreach ($object->liste_photos($dir) as $key => $obj) + if (is_array($listofphoto) && count($listofphoto)) { - $nbphoto++; + print '
'; + print '
'; + foreach ($listofphoto as $key => $obj) + { + $nbphoto++; - if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print ''; - if ($nbbyrow) print ''; + if ($nbbyrow) print ''; - if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print ''; + // On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites + if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i', $obj['photo']) && ($object->imgWidth > $maxWidth || $object->imgHeight > $maxHeight)) + { + print ''.img_picto($langs->trans('GenerateThumb'), 'refresh').'  '; + } + if ($user->rights->categorie->creer) + { + print ''; + print img_delete().''; + } + if ($nbbyrow) print ''; + if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print ''; + } + + // Ferme tableau + while ($nbphoto % $nbbyrow) + { + print ''; + $nbphoto++; + } + + print '
'; + if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '
'; - print ''; + print ''; - // Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine - if ($obj['photo_vignette']) - { - $filename=$obj['photo_vignette']; - } - else - { - $filename=$obj['photo']; - } + // Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine + if ($obj['photo_vignette']) + { + $filename=$obj['photo_vignette']; + } + else + { + $filename=$obj['photo']; + } - // Nom affiche - $viewfilename=$obj['photo']; + // Nom affiche + $viewfilename=$obj['photo']; - // Taille de l'image - $object->get_image_size($dir.$filename); - $imgWidth = ($object->imgWidth < $maxWidth) ? $object->imgWidth : $maxWidth; - $imgHeight = ($object->imgHeight < $maxHeight) ? $object->imgHeight : $maxHeight; + // Taille de l'image + $object->get_image_size($dir.$filename); + $imgWidth = ($object->imgWidth < $maxWidth) ? $object->imgWidth : $maxWidth; + $imgHeight = ($object->imgHeight < $maxHeight) ? $object->imgHeight : $maxHeight; - print ''; + print ''; - print ''; - print '
'.$viewfilename; - print '
'; + print ''; + print '
'.$viewfilename; + print '
'; - // On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites - if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i', $obj['photo']) && ($object->imgWidth > $maxWidth || $object->imgHeight > $maxHeight)) - { - print ''.img_picto($langs->trans('GenerateThumb'), 'refresh').'  '; - } - if ($user->rights->categorie->creer) - { - print ''; - print img_delete().''; - } - if ($nbbyrow) print '
 
'; } - // Ferme tableau - while ($nbphoto % $nbbyrow) - { - print ' '; - $nbphoto++; - } - - print ''; - if ($nbphoto < 1) { print '
'.$langs->trans("NoPhotoYet")."
"; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 1f6e9280475..a7170b799a2 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -313,7 +313,7 @@ else } else { - print "'.$langs->trans("NoSubCat").""; + print ''.$langs->trans("NoSubCat").''; } print "\n"; } @@ -342,10 +342,9 @@ if ($type == Categorie::TYPE_PRODUCT) print ''; print ''; print ''; - print ''; print ''; print '
'; + print '
'; print $langs->trans("AddProductServiceIntoCategory").'  '; print $form->select_produits('', 'elemid', '', 0, 0, -1, 2, '', 1); - print ''; print '
'; @@ -354,7 +353,7 @@ if ($type == Categorie::TYPE_PRODUCT) print "
"; print "\n"; - print '\n"; + print ''."\n"; if (count($prods) > 0) { @@ -376,8 +375,9 @@ if ($type == Categorie::TYPE_PRODUCT) if ($permission) { print ""; - print img_delete($langs->trans("DeleteFromCat")).' '; - print $langs->trans("DeleteFromCat").""; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink'); + print ""; } print ''; print "\n"; @@ -385,7 +385,7 @@ if ($type == Categorie::TYPE_PRODUCT) } else { - print ""; + print ''; } print "
'.$langs->trans("ProductsAndServices")." (".count($prods).")
'.$langs->trans("ProductsAndServices").' '.count($prods).'
'.$langs->trans("ThisCategoryHasNoProduct")."
'.$langs->trans("ThisCategoryHasNoProduct").'
\n"; } @@ -402,7 +402,7 @@ if ($type == Categorie::TYPE_SUPPLIER) { print "
"; print ''."\n"; - print '\n"; + print '\n"; if (count($socs) > 0) { @@ -423,8 +423,9 @@ if ($type == Categorie::TYPE_SUPPLIER) if ($permission) { print ""; - print img_delete($langs->trans("DeleteFromCat")).' '; - print $langs->trans("DeleteFromCat").""; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink'); + print ""; } print ''; @@ -433,7 +434,7 @@ if ($type == Categorie::TYPE_SUPPLIER) } else { - print ''; + print ''; } print "
'.$langs->trans("Suppliers")." (".count($socs).")
'.$langs->trans("Suppliers").' '.count($socs)."
'.$langs->trans("ThisCategoryHasNoSupplier").'
'.$langs->trans("ThisCategoryHasNoSupplier").'
\n"; } @@ -450,7 +451,7 @@ if($type == Categorie::TYPE_CUSTOMER) { print "
"; print ''."\n"; - print '\n"; + print ''."\n"; if (count($socs) > 0) { @@ -476,8 +477,9 @@ if($type == Categorie::TYPE_CUSTOMER) if ($permission) { print ""; - print img_delete($langs->trans("DeleteFromCat")).' '; - print $langs->trans("DeleteFromCat").""; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink'); + print ""; } print ''; print "\n"; @@ -485,7 +487,7 @@ if($type == Categorie::TYPE_CUSTOMER) } else { - print ''; + print ''; } print "
'.$langs->trans("Customers")." (".count($socs).")
'.$langs->trans("Customers").' '.count($socs).'
'.$langs->trans("ThisCategoryHasNoCustomer").'
'.$langs->trans("ThisCategoryHasNoCustomer").'
\n"; } @@ -505,7 +507,7 @@ if ($type == Categorie::TYPE_MEMBER) { print "
"; print "\n"; - print '\n"; + print ''."\n"; if (count($prods) > 0) { @@ -529,15 +531,16 @@ if ($type == Categorie::TYPE_MEMBER) if ($permission) { print ""; - print img_delete($langs->trans("DeleteFromCat")).' '; - print $langs->trans("DeleteFromCat").""; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink'); + print ""; } print "\n"; } } else { - print ''; + print ''; } print "
'.$langs->trans("Member")." (".count($prods).")
'.$langs->trans("Member").' '.count($prods).'
'.$langs->trans("ThisCategoryHasNoMember").'
'.$langs->trans("ThisCategoryHasNoMember").'
\n"; } @@ -555,7 +558,7 @@ if ($type == Categorie::TYPE_CONTACT) { print "
"; print ''."\n"; - print '\n"; + print ''."\n"; if (count($contacts) > 0) { @@ -579,8 +582,9 @@ if ($type == Categorie::TYPE_CONTACT) if ($permission) { print ""; - print img_delete($langs->trans("DeleteFromCat")).' '; - print $langs->trans("DeleteFromCat").""; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink'); + print ""; } print ''; print "\n"; @@ -588,7 +592,7 @@ if ($type == Categorie::TYPE_CONTACT) } else { - print ''; + print ''; } print "
'.$langs->trans("Contact")." (".count($contacts).")
'.$langs->trans("Contact").' '.count($contacts).'
'.$langs->trans("ThisCategoryHasNoContact").'
'.$langs->trans("ThisCategoryHasNoContact").'
\n"; } @@ -608,7 +612,7 @@ if ($type == Categorie::TYPE_ACCOUNT) { print "
"; print "\n"; - print '\n"; + print ''."\n"; if (count($accounts) > 0) { @@ -631,15 +635,16 @@ if ($type == Categorie::TYPE_ACCOUNT) if ($permission) { print ""; - print img_delete($langs->trans("DeleteFromCat")).' '; - print $langs->trans("DeleteFromCat").""; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink'); + print ""; } print "\n"; } } else { - print ''; + print ''; } print "
'.$langs->trans("Account")." (".count($accounts).")
'.$langs->trans("Account").' '.count($accounts).'
'.$langs->trans("ThisCategoryHasNoAccount").'
'.$langs->trans("ThisCategoryHasNoAccount").'
\n"; } @@ -659,7 +664,7 @@ if ($type == Categorie::TYPE_PROJECT) { print "
"; print "\n"; - print '\n"; + print ''."\n"; if (count($projects) > 0) { @@ -682,15 +687,16 @@ if ($type == Categorie::TYPE_PROJECT) if ($permission) { print ""; - print img_delete($langs->trans("DeleteFromCat")).' '; - print $langs->trans("DeleteFromCat").""; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink'); + print ""; } print "\n"; } } else { - print ''; + print ''; } print "
'.$langs->trans("Project")." (".count($projects).")
'.$langs->trans("Project").' '.count($projects).'
'.$langs->trans("ThisCategoryHasNoProject").'
'.$langs->trans("ThisCategoryHasNoProject").'
\n"; } diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index da14436f749..d160967c9a0 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -451,7 +451,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand if ($feature == 'project') $feature='projet'; if ($feature == 'task') $feature='projet_task'; - $check = array('adherent','banque','don','user','usergroup','product','produit','service','produit|service','categorie','resource'); // Test on entity only (Objects with no link to company) + $check = array('adherent','banque','don','user','usergroup','product','produit','service','produit|service','categorie','resource','expensereport','holiday'); // Test on entity only (Objects with no link to company) $checksoc = array('societe'); // Test for societe object $checkother = array('contact','agenda'); // Test on entity and link to third party. Allowed if link is empty (Ex: contacts...). $checkproject = array('projet','project'); // Test for project object diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 9bc181f66d9..1c92e558c41 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -45,7 +45,8 @@ $ref=GETPOST('ref', 'alpha'); $fuserid = (GETPOST('fuserid', 'int')?GETPOST('fuserid', 'int'):$user->id); // Protection if external user -if ($user->societe_id > 0) accessforbidden(); +if ($user->societe_id) $socid=$user->societe_id; +$result = restrictedArea($user, 'holiday', $id, 'holiday'); $now=dol_now(); diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php index be948280eaf..942b6cb98fb 100644 --- a/htdocs/holiday/document.php +++ b/htdocs/holiday/document.php @@ -144,7 +144,7 @@ if ($object->id) print ''.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')'; print ''.dol_print_date($object->date_debut, 'day'); print '     '; - print $langs->trans($listhalfday[$starthalfday]); + print ''.$langs->trans($listhalfday[$starthalfday]).''; print ''; print ''; } @@ -166,7 +166,7 @@ if ($object->id) print ''.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')'; print ''.dol_print_date($object->date_fin, 'day'); print '     '; - print $langs->trans($listhalfday[$endhalfday]); + print ''.$langs->trans($listhalfday[$endhalfday]).''; print ''; print ''; }