From a448b7e36a61b14ea1a8001586ea54f698f67220 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 29 Aug 2014 19:19:26 +0200 Subject: [PATCH 01/27] add product minimum recommended price --- htdocs/langs/en_US/products.lang | 2 + htdocs/langs/fr_FR/products.lang | 2 + htdocs/product/class/product.class.php | 32 +++++++++ htdocs/product/price.php | 90 +++++++++++++++++++++----- 4 files changed, 109 insertions(+), 17 deletions(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 684ee5ef20a..241746d8470 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -239,3 +239,5 @@ PricingRule=Pricing Rules AddCustomerPrice=Add price by customers ForceUpdateChildPriceSoc=Set same price on customer subsidiaries PriceByCustomerLog=Price by customer log +MinimumPriceLimit=Minimum price can't be lower that %s +MinimumRecommendedPrice=Minimum recommended price is : %s diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 68ff2cbefbb..877a2b55d54 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -239,3 +239,5 @@ PricingRule=Règle de prix AddCustomerPrice=Ajouter prix par clients ForceUpdateChildPriceSoc=Définir le même prix sur les filiales des clients PriceByCustomerLog=Trace des prix par clients +MinimumPriceLimit=Le prix minimum ne peut être inférieur à %s +MinimumRecommendedPrice=Le prix minimum conseillé est de : %s \ No newline at end of file diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 134f65b8ff6..6e3c8d44013 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -9,6 +9,7 @@ * Copyright (C) 2013 Marcos García * Copyright (C) 2011-2014 Alexandre Spangaro * Copyright (C) 2014 Henry Florian + * Copyright (C) 2014 Philippe Grand * * 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 @@ -3513,4 +3514,35 @@ class Product extends CommonObject } } } + + /** + * Return minimum product recommended price + * + * @return void + */ + function min_recommended_price() + { + global $conf; + if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) + { + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; + $product_fourn = new ProductFournisseur($this->db); + $product_fourn_list = $product_fourn->list_product_fournisseur_price($this->id, '', ''); + $maxpricesupplier=0; + + if (is_array($product_fourn_list) && count($product_fourn_list)>0) + { + foreach($product_fourn_list as $productfourn) + { + if ($productfourn->fourn_unitprice>$maxpricesupplier) + { + $maxpricesupplier = $productfourn->fourn_unitprice; + } + } + + $maxpricesupplier*=$conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE; + } + return $maxpricesupplier; + } + } } diff --git a/htdocs/product/price.php b/htdocs/product/price.php index a28fbd83706..b2f0ba09937 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -6,6 +6,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2014 Florian Henry * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2014 Philippe Grand * * 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 @@ -52,6 +53,8 @@ $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product $object = new Product($db); +$error=0; + /* * Actions */ @@ -59,6 +62,9 @@ $object = new Product($db); if ($action == 'update_price' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { $result = $object->fetch($id); + $error=0; + $maxpricesupplier = $object->min_recommended_price(); + // MultiPrix if (! empty($conf->global->PRODUIT_MULTIPRICES)) { @@ -93,6 +99,13 @@ if ($action == 'update_price' && ! $_POST ["cancel"] && ($user->rights->produit- $newpsq = empty($newpsq) ? 0 : $newpsq; } + if ($newprice_min<$maxpricesupplier && !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) + { + setEventMessage($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')),'errors'); + $error++; + $action='edit_price'; + } + if ($object->updatePrice($newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq) > 0) { $action = ''; setEventMessage($langs->trans("RecordSaved")); @@ -197,6 +210,9 @@ if ($action == 'delete_all_price_by_qty') { * **************************************************** */ if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { + + $error=0; + $maxpricesupplier = $object->min_recommended_price(); $update_child_soc = GETPOST('updatechildprice'); @@ -211,15 +227,24 @@ if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->ri $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); - $result = $prodcustprice->create($user, 0, $update_child_soc); + if ($prodcustprice->price_min<$maxpricesupplier && !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) + { + setEventMessage($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')),'errors'); + $error++; + $action='add_customer_price'; + } - if ($result < 0) { - setEventMessage($prodcustprice->error, 'errors'); - } else { - setEventMessage($langs->trans('Save'), 'mesgs'); + if (empty($error)) { + $result = $prodcustprice->create($user, 0, $update_child_soc); + + if ($result < 0) { + setEventMessage($prodcustprice->error, 'errors'); + } else { + setEventMessage($langs->trans('Save'), 'mesgs'); + } + + $action = ''; } - - $action = ''; } if ($action == 'delete_customer_price' && ($user->rights->produit->supprimer || $user->rights->service->supprimer)) { @@ -236,6 +261,11 @@ if ($action == 'delete_customer_price' && ($user->rights->produit->supprimer || } if ($action == 'update_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { + + $result = $object->fetch($id); + + $error=0; + $maxpricesupplier = $object->min_recommended_price(); $update_child_soc = GETPOST('updatechildprice'); @@ -248,15 +278,23 @@ if ($action == 'update_customer_price_confirm' && ! $_POST ["cancel"] && ($user- $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); - $result = $prodcustprice->update($user, 0, $update_child_soc); - - if ($result < 0) { - setEventMessage($prodcustprice->error, 'errors'); - } else { - setEventMessage($langs->trans('Save'), 'mesgs'); + if ($prodcustprice->price_min<$maxpricesupplier && !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) + { + setEventMessage($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')),'errors'); + $error++; + $action='update_customer_price'; + } + if (empty($error)) { + $result = $prodcustprice->update($user, 0, $update_child_soc); + + if ($result < 0) { + setEventMessage($prodcustprice->error, 'errors'); + } else { + setEventMessage($langs->trans('Save'), 'mesgs'); + } + + $action = ''; } - - $action = ''; } /* @@ -613,6 +651,10 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> } else { print ''; } + if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) + { + print ''.$langs->trans("MinimumRecommendedPrice", price($maxpricesupplier,0,'',1,-1,-1,'auto')).' '.img_warning().''; + } print ''; print ''; @@ -660,6 +702,10 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> } else { print ''; } + if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) + { + print ''.$langs->trans("MinimumRecommendedPrice", price($maxpricesupplier,0,'',1,-1,-1,'auto')).' '.img_warning().''; + } print ''; print ' '; @@ -806,6 +852,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { if ($action == 'add_customer_price') { // Create mode + $maxpricesupplier = $object->min_recommended_price(); print_fiche_titre($langs->trans('PriceByCustomer')); @@ -856,6 +903,10 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { } else { print ''; } + if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) + { + print ''.$langs->trans("MinimumRecommendedPrice", price($maxpricesupplier,0,'',1,-1,-1,'auto')).' '.img_warning().''; + } print ''; // Update all child soc @@ -876,6 +927,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { } elseif ($action == 'edit_customer_price') { // Edit mode + $maxpricesupplier = $object->min_recommended_price(); print_fiche_titre($langs->trans('PriceByCustomer')); @@ -893,11 +945,11 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print '' . $langs->trans('ThirdParty') . ''; $staticsoc = new Societe($db); $staticsoc->fetch($prodcustprice->fk_soc); - print "" . $staticsoc->getNomUrl(1) . ""; + print "" . $staticsoc->getNomUrl(1) . ""; print ''; // VAT - print '' . $langs->trans("VATRate") . ''; + print '' . $langs->trans("VATRate") . ''; print $form->load_tva("tva_tx", $prodcustprice->tva_tx, $mysoc, '', $object->id, $prodcustprice->recuperableonly); print ''; @@ -931,6 +983,10 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { } else { print ''; } + if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) + { + print ''.$langs->trans("MinimumRecommendedPrice", price($maxpricesupplier,0,'',1,-1,-1,'auto')).' '.img_warning().''; + } print ''; // Update all child soc From 058cf8782cd8f3224b3ac3bcf1c9226ed95171d7 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Wed, 3 Sep 2014 21:47:46 +0200 Subject: [PATCH 02/27] Payment VAT :: Add control on field required --- htdocs/compta/tva/fiche.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/compta/tva/fiche.php b/htdocs/compta/tva/fiche.php index 65c4285d7d1..a4a5a8831c4 100644 --- a/htdocs/compta/tva/fiche.php +++ b/htdocs/compta/tva/fiche.php @@ -72,6 +72,16 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $tva->label=GETPOST("label"); $tva->note=GETPOST("note"); + if (empty($tva->datev)) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateValue")),'errors'); + $error++; + } + if (empty($tva->datep)) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DatePayment")),'errors'); + $error++; + } if (empty($tva->type_payment) || $tva->type_payment < 0) { setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentMode")),'errors'); From 291d70fa9d5a1aeee6e151f1317e6137e4c0c33f Mon Sep 17 00:00:00 2001 From: aspangaro Date: Wed, 3 Sep 2014 21:48:15 +0200 Subject: [PATCH 03/27] Payment Salaries :: Add field required & control on it --- htdocs/compta/salaries/fiche.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/salaries/fiche.php b/htdocs/compta/salaries/fiche.php index ae74344ccf8..c46f83dd6fb 100644 --- a/htdocs/compta/salaries/fiche.php +++ b/htdocs/compta/salaries/fiche.php @@ -80,7 +80,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $sal->num_payment=GETPOST("num_payment"); $sal->fk_user_creat=$user->id; - if (empty($datep) || empty($datesp) || empty($dateep)) + if (empty($datep) || empty($datev) || empty($datesp) || empty($dateep)) { setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors'); $error++; @@ -219,7 +219,7 @@ if ($action == 'create') print $form->select_date((empty($datep)?-1:$datep),"datep",'','','','add',1,1); print ''; - print ''.$langs->trans("DateValue").''; + print ''.$langs->trans("DateValue").''; print $form->select_date((empty($datev)?-1:$datev),"datev",'','','','add',1,1); print ''; From 2cba7ab9e6c72d9ac78344cb52aadbfbfdaed9f9 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 4 Sep 2014 04:22:43 +0200 Subject: [PATCH 04/27] Card presentation --- htdocs/compta/bank/fiche.php | 42 +++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php index 27acf7eba59..c118186df27 100644 --- a/htdocs/compta/bank/fiche.php +++ b/htdocs/compta/bank/fiche.php @@ -240,7 +240,7 @@ if ($action == 'create') print ''; // Ref - print ''; + print ''; print ''; // Label @@ -306,11 +306,15 @@ if ($action == 'create') $doleditor=new DolEditor('account_comment',$account->comment,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70); $doleditor->Create(); print ''; + + print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'ref).'" maxlength="12">
'; + + print '
'; + + print ''; // Sold - print ''; - - print ''; + print ''; print ''; print ''; @@ -332,12 +336,12 @@ if ($action == 'create') // Accountancy code if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) { - print ''; + print ''; print ''; } else { - print ''; + print ''; print ''; } @@ -506,8 +510,7 @@ else $account->fetch(GETPOST('id','int')); print_fiche_titre($langs->trans("EditFinancialAccount")); - print "
"; - + if ($conf->use_javascript_ajax) { print "\n".'' . "\n"; + if (! empty($conf->use_javascript_ajax)) + { + $s.='
' . $langs->trans("LocalAgenda").'  
'; + if (is_array($showextcals) && count($showextcals) > 0) + { + foreach ($showextcals as $val) + { + $htmlname = dol_string_nospecial($val['name']); + $s.='' . "\n"; + $s.='
' . $val ['name'] . '  
'; + } + } + } + $s.='
'.$langs->trans("AgendaShowBirthdayEvents").'  
'; + + //print ''; +} + + +$link=''; +// Add link to show birthdays +if (empty($conf->use_javascript_ajax)) +{ + $newparam=$param; // newparam is for birthday links + $newparam=preg_replace('/showbirthday=[0-1]/i','showbirthday='.(empty($showbirthday)?1:0),$newparam); + if (! preg_match('/showbirthday=/i',$newparam)) $newparam.='&showbirthday=1'; + $link=''; + if (empty($showbirthday)) $link.=$langs->trans("AgendaShowBirthdayEvents"); + else $link.=$langs->trans("AgendaHideBirthdayEvents"); + $link.=''; +} + +//print_fiche_titre($s,$link.'     '.$nav, ''); // Get event in an array @@ -336,7 +430,7 @@ else if ($type) $sql.= " AND ca.id = ".$type; if ($status == '0') { $sql.= " AND a.percent = 0"; } if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable -if ($status == '50') { $sql.= " AND (a.percent >= 0 AND a.percent < 100)"; } // Running +if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; } if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; } if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0) @@ -349,7 +443,7 @@ if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0) $sql.= ")"; } // Sort on date -$sql.= ' ORDER BY datep'; +$sql.= ' ORDER BY fk_user_action, datep'; //fk_user_action //print $sql; dol_syslog("comm/action/index.php", LOG_DEBUG); @@ -446,6 +540,7 @@ else dol_print_error($db); } + $maxnbofchar=18; $cachethirdparties=array(); $cachecontacts=array(); @@ -459,6 +554,156 @@ if (is_readable($color_file)) if (! is_array($theme_datacolor)) $theme_datacolor=array(array(120,130,150), array(200,160,180), array(190,190,220)); +$newparam=$param; // newparam is for birthday links +$newparam=preg_replace('/showbirthday=/i','showbirthday_=',$newparam); // To avoid replacement when replace day= is done +$newparam=preg_replace('/action=show_month&?/i','',$newparam); +$newparam=preg_replace('/action=show_week&?/i','',$newparam); +$newparam=preg_replace('/day=[0-9]+&?/i','',$newparam); +$newparam=preg_replace('/month=[0-9]+&?/i','',$newparam); +$newparam=preg_replace('/year=[0-9]+&?/i','',$newparam); +$newparam=preg_replace('/viewweek=[0-9]+&?/i','',$newparam); +$newparam=preg_replace('/showbirthday_=/i','showbirthday=',$newparam); // Restore correct parameter +$newparam.='&viewweek=1'; + +echo ''; +echo ''; +echo ''; +echo '' ; +echo ''; + + +// Table : +echo '
'.$langs->trans("InitialBankBalance").'...
'.$langs->trans("InitialBankBalance").'
'.$langs->trans("InitialBankBalance").'solde)).'">
'.$langs->trans("Date").'
'.$langs->trans("AccountancyCode").'
'.$langs->trans("AccountancyCode").'
'.$langs->trans("AccountancyCode").'
'.$langs->trans("AccountancyCode").'
'; + +echo ''; +echo ''; +$i=0; +while ($i < 7) +{ + echo '\n"; + $i++; +} +echo "\n"; + +echo ''; +echo ''; +$i=0; +while ($i < 7) +{ + for ($h = $begin_h; $h < $end_h; $h++) + { + echo '"; + } + echo "\n"; + $i++; +} +echo "\n"; + + + + + + +// In loops, tmpday contains day nb in current month (can be zero or negative for days of previous month) +//var_dump($eventarray); +//print $tmpday; + +// Define $usernames +$usernames = array(); //init +/* Use this to have list of users only if users have events +foreach ($eventarray as $daykey => $notused) +{ + $annee = date('Y',$daykey); + $mois = date('m',$daykey); + $jour = date('d',$daykey); + //if ($day==$jour && $month==$mois && $year==$annee) + //{ + //Tout les events à la même date : + foreach ($eventarray[$daykey] as $index => $event) + { + $myuser = new User($db); + $user_id = $event->usertodo->id; + $myuser->fetch($user_id); + $username = $myuser->getFullName($langs); + if (! in_array($username, $usernames)) + { + $usernames[] = $username; + } + } + //} +}*/ +if ($filtert > 0) +{ + var_dump($filtert); + $tmpuser = new User($db); + $tmpuser->fetch($filtert); + $usernames[] = $tmpuser; +} +else if ($usergroup) +{ + $tmpgroup = new UserGroup($db); + $tmpgroup->fetch($usergroup); + $usernames = $tmpgroup->listUsersForGroup(); +} +else +{ + $tmpgroup = new UserGroup($db); + //$tmpgroup->fetch($usergroup); No fetch, we want all users for all groups + $usernames = $tmpgroup->listUsersForGroup(); +} + + +// Loop on each user to show calendar +$sav = $tmpday; +$showheader = true; +foreach ($usernames as $username) +{ + echo ""; + echo ''; + $tmpday = $sav; + + for ($iter_day = 0; $iter_day < 7; $iter_day++) + { + if (($tmpday <= $max_day_in_month)) + { + // Show days of the current week + $curtime = dol_mktime(0, 0, 0, $month, $tmpday, $year); + + $style='cal_current_month'; + if ($iter_day == 6) $style.=' cal_other_month_right'; + $today=0; + $todayarray=dol_getdate($now,'fast'); + if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1; + if ($today) $style='cal_today'; + + //echo ' \n"; + } + else + { + $style='cal_current_month'; + if ($iter_day == 6) $style.=' cal_other_month_right'; + //echo ' \n"; + } + $tmpday++; + } + echo "\n"; + $showheader = false; +} + +echo "
'; + echo $langs->trans("Day".(($i+(isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)) % 7)); + print "
"; + if ($i) print dol_print_date(dol_time_plus_duree($firstdaytoshow, $i, 'd'),'day'); + else print dol_print_date($firstdaytoshow,'day'); + echo "
'; + print "".$h.""; + print "
' . $username->getNomUrl(1). ''; + //show_day_events($db, $day, $month, $year, $monthshown, $style, $eventarray); + show_day_events2($username, $tmpday, $month, $year, $monthshown, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader); + //echo " '; + show_day_events2($username, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300); + //echo "
\n"; + /* TODO Export @@ -478,3 +723,234 @@ $("#actionagenda_vcal_link").attr("href","/public/agenda/agendaexport.php?format llxFooter(); $db->close(); + + + +/** + * Change color with a delta + * + * @param string $color Color + * @param int $minus Delta + * @return string New color + */ +function dol_color_minus($color, $minus) +{ + $newcolor=$color; + $newcolor[0]=((hexdec($newcolor[0])-$minus)<0)?0:dechex((hexdec($newcolor[0])-$minus)); + $newcolor[2]=((hexdec($newcolor[2])-$minus)<0)?0:dechex((hexdec($newcolor[2])-$minus)); + $newcolor[4]=((hexdec($newcolor[4])-$minus)<0)?0:dechex((hexdec($newcolor[4])-$minus)); + return $newcolor; +} + + + + + +/** + * + * @param unknown_type $h + * @param unknown_type $cases + */ +function mafonction($h, &$cases) +{ + if (isset($cases[$h])) + if ($cases[$h] != '') + { + $title = (int) $cases[$h]; + $title .= 'h'; + if ((int) $cases[$h] != $cases[$h]) + $title .= '30'; + else + $title .= '00'; + print "$title"; + } + else + { + print ""; + } + else + print ""; +} + + +/** + * Show event of a particular day + * + * @param int $day Day + * @param int $month Month + * @param int $year Year + * @param int $monthshown Current month shown in calendar view + * @param string $style Style to use for this day + * @param array &$eventarray Array of events + * @param int $maxprint Nb of actions to show each day on month view (0 means no limit) + * @param int $maxnbofchar Nb of characters to show for event line + * @param string $newparam Parameters on current URL + * @param int $showinfo Add extended information (used by day view) + * @param int $minheight Minimum height for each event. 60px by default. + * @return void + */ +function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $showheader=false) +{ + global $db; + global $user, $conf, $langs; + global $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form + global $theme_datacolor; + global $cachethirdparties, $cachecontacts, $colorindexused; + global $begin_h, $end_h; + + $cases = array(); + + $curtime = dol_mktime(0, 0, 0, $month, $day, $year); + + $i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array(); + $ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day); + + $nextindextouse=count($colorindexused); // At first run this is 0, so fist user has 0, next 1, ... + + foreach ($eventarray as $daykey => $notused) + { + $annee = date('Y',$daykey); + $mois = date('m',$daykey); + $jour = date('d',$daykey); + if ($day==$jour && $month==$mois && $year==$annee) + { + //Tout les events à la même date : + foreach ($eventarray[$daykey] as $index => $event) + { + if ($username->id != $event->usertodo->id) continue; // We discard record if event is from another user than user we want to show + + if (1 == 1) + { + $ponct=($event->date_start_in_calendar == $event->date_end_in_calendar); + + // Define $color and $cssclass of event + $color=-1; $cssclass=''; $colorindex=-1; + if ((! empty($event->author->id) && $event->author->id == $user->id) + || (! empty($event->usertodo->id) && $event->usertodo->id == $user->id) + || (! empty($event->userdone->id) && $event->userdone->id == $user->id)) + { + $nummytasks++; $cssclass='family_mytasks'; + } + else if ($event->type_code == 'ICALEVENT') + { + $numical++; + if (! empty($event->icalname)) { + if (! isset($numicals[dol_string_nospecial($event->icalname)])) { + $numicals[dol_string_nospecial($event->icalname)] = 0; + } + $numicals[dol_string_nospecial($event->icalname)]++; + } + $color=$event->icalcolor; + $cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unsortable'); + } + else if ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); } + else { $numother++; $cssclass='family_other'; } + if ($color == -1) // Color was not forced. Set color according to color index. + { + // Define color index if not yet defined + $idusertouse=($event->usertodo->id?$event->usertodo->id:0); + if (isset($colorindexused[$idusertouse])) + { + $colorindex=$colorindexused[$idusertouse]; // Color already assigned to this user + } + else + { + $colorindex=$nextindextouse; + $colorindexused[$idusertouse]=$colorindex; + if (! empty($theme_datacolor[$nextindextouse+1])) $nextindextouse++; // Prepare to use next color + } + // Define color + $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); + } + //$cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd; + + // Show rect of event + //print '
'; + //print ''; + //print ''; + for ($h = $begin_h; $h < ($end_h*2); $h++) + { + $color = ''; //init + if (empty($event->fulldayevent)) { + $a = dol_mktime((int) $h/2,0,0,$month,$day,$year); + $b = dol_mktime((int) $h/2,30,0,$month,$day,$year); + //$c = $b+($b-$a); + + if ($h % 2 == 1) { + if ($event->date_start_in_calendar <= $a && $event->date_end_in_calendar > $b) { + $color = $h/2; + } + } else { + if ($event->date_start_in_calendar <= $b + && $event->date_end_in_calendar > $a) { + $color = $h/2; + } + if ($h == 0 && $event->date_start_in_calendar <= $b && $event->date_end_in_calendar > $a) + $cases[0] = "0"; + } + } else { + $color = $h/2; + } + //if ($color != '') + //if(!isset($cases[$h])) + if (!isset($cases[$h]) || $cases[$h] == '') + $cases[$h] = $color; + //echo ""; //DEBUG + } + $i++; + } + else + { + print ''.img_picto("all","1downarrow_selected.png").' ...'; + print ' +'.(count($eventarray[$daykey])-$maxprint); + print ''; + break; + //$ok=false; // To avoid to show twice the link + } + } + + break; + } + } + + for ($h = $begin_h; $h < $end_h; $h++) + { + echo ""; + } + +} diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 007f8474721..436c0eef48e 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -48,6 +48,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $showextcals=array(), $actioncode='', $usergroupid='') { global $conf, $user, $langs, $db, $hookmanager; + global $begin_h, $end_h, $begin_d, $end_d; // Filters print ''; @@ -140,6 +141,35 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print ''; } + if ($canedit && $action == 'show_week') + { + // Filter on hours + print ''; + print ''; + print "'; + + // Filter on days + print ''; + print ''; + print "'; + + // Filter on day + print ''; + print ''; + print "'; + } + // Hooks $parameters = array('canedit'=>$canedit, 'pid'=>$pid, 'socid'=>$socid); $reshook = $hookmanager->executeHooks('searchAgendaFrom', $parameters, $object, $action); // Note that $action and $object may have been diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 3c37a79b7dd..7fff80d9def 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -132,7 +132,7 @@ function getServerTimeZoneInt($refgmtdate='now') * @param int $time Date timestamp (or string with format YYYY-MM-DD) * @param int $duration_value Value of delay to add * @param int $duration_unit Unit of added delay (d, m, y, w) - * @return int New timestamp + * @return int New timestamp */ function dol_time_plus_duree($time,$duration_value,$duration_unit) { @@ -482,7 +482,7 @@ function dol_get_last_day($year,$month=12,$gm=false) * @param int $month Month * @param int $year Year * @param int $gm False or 0 or 'server' = Return date to compare with server TZ, True or 1 to compare with GM date. - * @return array year,month, week,first_day,prev_year,prev_month,prev_day + * @return array year,month,week,first_day,prev_year,prev_month,prev_day */ function dol_get_first_day_week($day,$month,$year,$gm=false) { @@ -505,7 +505,7 @@ function dol_get_first_day_week($day,$month,$year,$gm=false) $tmpday = date($tmparray[0])-$seconds; $tmpday = date("d",$tmpday); - //Check first day of week is form this month or not + //Check first day of week is in same month than current day or not if ($tmpday>$day) { $prev_month = $month-1; @@ -522,6 +522,8 @@ function dol_get_first_day_week($day,$month,$year,$gm=false) $prev_month = $month; $prev_year = $year; } + $tmpmonth = $prev_month; + $tmpyear = $prev_year; //Get first day of next week $tmptime=dol_mktime(12,0,0,$month,$tmpday,$year,1,0); @@ -529,7 +531,7 @@ function dol_get_first_day_week($day,$month,$year,$gm=false) $tmparray=dol_getdate($tmptime,true); $prev_day = $tmparray['mday']; - //Check first day of week is form this month or not + //Check prev day of week is in same month than first day or not if ($prev_day>$tmpday) { $prev_month = $month-1; @@ -544,7 +546,7 @@ function dol_get_first_day_week($day,$month,$year,$gm=false) $week = date("W",dol_mktime(0,0,0,$month,$tmpday,$year,$gm)); - return array('year' => $year, 'month' => $month, 'week' => $week, 'first_day' => $tmpday, 'prev_year' => $prev_year, 'prev_month' => $prev_month, 'prev_day' => $prev_day); + return array('year' => $year, 'month' => $month, 'week' => $week, 'first_day' => $tmpday, 'first_month' => $tmpmonth, 'first_year' => $tmpyear, 'prev_year' => $prev_year, 'prev_month' => $prev_month, 'prev_day' => $prev_day); } /** @@ -659,7 +661,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR') if($jour_semaine == 0 || $jour_semaine == 6) $ferie=true; //Samedi (6) et dimanche (0) } - + if ($countrycode == 'ES') { $countryfound=1; diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index d18276c362e..73f169609e3 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -80,8 +80,10 @@ DefaultWorkingHours=Default working hours in day (Example: 9-18) # External Sites ical ExportCal=Export calendar ExtSites=Import external calendars -ExtSitesEnableThisTool=Show external calendars into agenda +ExtSitesEnableThisTool=Show external calendars (defined into global setup) into agenda. Does not affect external calendars defined by users. ExtSitesNbOfAgenda=Number of calendars AgendaExtNb=Calendar nb %s ExtSiteUrlAgenda=URL to access .ical file ExtSiteNoLabel=No Description +WorkingTimeRange=Working time range +WorkingDaysRange=Working days range \ No newline at end of file diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 5d90093b379..b801c2660aa 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -174,7 +174,7 @@ class UserGroup extends CommonObject } /** - * Return array of users id for group this->id (or all if this->id not defined) + * Return array of User objects for group this->id (or all if this->id not defined) * * @param string $excludefilter Filter to exclude * @param int $mode 0=Return array of user instance, 1=Return array of users id only @@ -546,7 +546,7 @@ class UserGroup extends CommonObject { // Call trigger $result=$this->call_trigger('GROUP_DELETE',$user); - if ($result < 0) { $error++; $this->db->rollback(); return -1; } + if ($result < 0) { $error++; $this->db->rollback(); return -1; } // End call triggers $this->db->commit(); @@ -579,7 +579,7 @@ class UserGroup extends CommonObject if (! empty($conf->multicompany->enabled) && $conf->entity == 1) $entity=$this->entity; $this->db->begin(); - + $sql = "INSERT INTO ".MAIN_DB_PREFIX."usergroup ("; $sql.= "datec"; $sql.= ", nom"; @@ -602,7 +602,7 @@ class UserGroup extends CommonObject { // Call trigger $result=$this->call_trigger('GROUP_CREATE',$user); - if ($result < 0) { $error++; $this->db->rollback(); return -1; } + if ($result < 0) { $error++; $this->db->rollback(); return -1; } // End call triggers } @@ -636,7 +636,7 @@ class UserGroup extends CommonObject } $this->db->begin(); - + $sql = "UPDATE ".MAIN_DB_PREFIX."usergroup SET "; $sql.= " nom = '" . $this->db->escape($this->nom) . "'"; $sql.= ", entity = " . $this->db->escape($entity); @@ -651,11 +651,11 @@ class UserGroup extends CommonObject { // Call trigger $result=$this->call_trigger('GROUP_MODIFY',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers } - if (! $error) + if (! $error) { $this->db->commit(); return 1; From de0cf14ece2c3b9e8a0a3de2c97062b999f1c6f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Sep 2014 15:10:31 +0200 Subject: [PATCH 18/27] Fix: Bad position of week --- htdocs/comm/action/index.php | 50 ++++++++++++++++-------------------- htdocs/core/lib/date.lib.php | 2 +- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 5c84e9fab69..2fff1a681dc 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -231,18 +231,20 @@ if ($action=='show_week') $prev_month = $prev['prev_month']; $prev_day = $prev['prev_day']; $first_day = $prev['first_day']; + $first_month= $prev['first_month']; + $first_year = $prev['first_year']; $week = $prev['week']; $day = (int) $day; - $next = dol_get_next_week($day, $week, $month, $year); + $next = dol_get_next_week($first_day, $week, $first_month, $first_year); $next_year = $next['year']; $next_month = $next['month']; $next_day = $next['day']; // Define firstdaytoshow and lastdaytoshow - $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$first_day,$prev_year); - $lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year); + $firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year); + $lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 6, 'd'); $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); @@ -299,7 +301,7 @@ if (empty($action) || $action=='show_month') if ($action=='show_week') { $nav ="".img_previous($langs->trans("Previous"))."\n"; - $nav.=" ".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%Y").", ".$langs->trans("Week")." ".$week; + $nav.=" ".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("Week")." ".$week; $nav.=" \n"; $nav.="".img_next($langs->trans("Next"))."\n"; $nav.="   (".$langs->trans("Today").")"; @@ -992,33 +994,25 @@ elseif ($action == 'show_week') // View by week echo " \n"; - for($iter_day = 0; $iter_day < 7; $iter_day++) + for ($iter_day = 0; $iter_day < 7; $iter_day++) { - if(($tmpday <= $max_day_in_month)) - { - // Show days of the current week - $curtime = dol_mktime(0, 0, 0, $month, $tmpday, $year); + // Show days of the current week + $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); + $tmparray = dol_getdate($curtime,'fast'); + $tmpday = $tmparray['mday']; + $tmpmonth = $tmparray['mon']; + $tmpyear = $tmparray['year']; - $style='cal_current_month'; - if ($iter_day == 6) $style.=' cal_other_month_right'; - $today=0; - $todayarray=dol_getdate($now,'fast'); - if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1; - if ($today) $style='cal_today'; + $style='cal_current_month'; + if ($iter_day == 6) $style.=' cal_other_month_right'; + $today=0; + $todayarray=dol_getdate($now,'fast'); + if ($todayarray['mday']==$tmpday && $todayarray['mon']==$tmpmonth && $todayarray['year']==$tmpyear) $today=1; + if ($today) $style='cal_today'; - echo ' \n"; - } - else - { - $style='cal_current_month'; - if ($iter_day == 6) $style.=' cal_other_month_right'; - echo ' \n"; - } - $tmpday++; + echo ' \n"; } echo " \n"; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 7fff80d9def..762ebf4e605 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -544,7 +544,7 @@ function dol_get_first_day_week($day,$month,$year,$gm=false) } } - $week = date("W",dol_mktime(0,0,0,$month,$tmpday,$year,$gm)); + $week = date("W",dol_mktime(0,0,0,$tmpmonth,$tmpday,$tmpyear,$gm)); return array('year' => $year, 'month' => $month, 'week' => $week, 'first_day' => $tmpday, 'first_month' => $tmpmonth, 'first_year' => $tmpyear, 'prev_year' => $prev_year, 'prev_month' => $prev_month, 'prev_day' => $prev_day); } From a86de9b68576bf9a1b062b7caff420debbe7e49d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Sep 2014 21:12:01 +0200 Subject: [PATCH 19/27] Work on agenda per user. --- htdocs/comm/action/index.php | 16 +- htdocs/comm/action/listactions.php | 4 +- htdocs/comm/action/peruser.php | 577 +++++++++++------------------ htdocs/core/lib/agenda.lib.php | 2 +- htdocs/theme/eldy/style.css.php | 9 +- 5 files changed, 234 insertions(+), 374 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 2fff1a681dc..29ad7182e5b 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -343,10 +343,6 @@ $showextcals=$listofextcals; if ($conf->use_javascript_ajax) { $s=''; - //print ''; + // Id print ''; + // Type print ''; + // Date print ''; - print ''; + // User + print ''; + if ($obj->socid) print ''; else print ''; + print ''; $tripandexpense_static->statut=$obj->fk_statut; From bc7d839c646bdef28af6d540f97cf2d909b3f951 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 6 Sep 2014 17:16:24 +0200 Subject: [PATCH 25/27] Fix: Missing status "refunded". Fix: translation --- .../deplacement/class/deplacement.class.php | 12 +++-- htdocs/compta/deplacement/fiche.php | 50 ++++++++++++++++--- htdocs/compta/deplacement/stats/index.php | 2 +- htdocs/langs/en_US/trips.lang | 1 + 4 files changed, 52 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 9eeacee312c..4d24aac9a83 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -64,8 +64,8 @@ class Deplacement extends CommonObject { $this->db = $db; - $this->statuts_short = array(0 => 'Draft', 1 => 'Validated', 2 => 'Closed'); - $this->statuts = array(0 => 'Draft', 1 => 'Validated', 2 => 'Closed'); + $this->statuts_short = array(0 => 'Draft', 1 => 'Validated', 2 => 'Refunded'); + $this->statuts = array(0 => 'Draft', 1 => 'Validated', 2 => 'Refunded'); return 1; } @@ -132,9 +132,9 @@ class Deplacement extends CommonObject { $this->db->rollback(); return -2; - } + } // End call triggers - + $result=$this->update($user); if ($result > 0) { @@ -321,21 +321,25 @@ class Deplacement extends CommonObject { if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]); if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]); + if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]); } if ($mode == 3) { if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); + if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); } if ($mode == 4) { if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); + if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); } if ($mode == 5) { if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); + if ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); } } diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php index 9df4bb90652..b6bb980c462 100644 --- a/htdocs/compta/deplacement/fiche.php +++ b/htdocs/compta/deplacement/fiche.php @@ -76,6 +76,24 @@ if ($action == 'validate' && $user->rights->deplacement->creer) } } +else if ($action == 'classifyrefunded' && $user->rights->deplacement->creer) +{ + $object->fetch($id); + if ($object->statut == 1) + { + $result = $object->setStatut(2); + if ($result > 0) + { + header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); + exit; + } + else + { + setEventMessage($object->error, 'errors'); + } + } +} + else if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer) { $result=$object->delete($id); @@ -491,11 +509,23 @@ else if ($id) /* * Barre d'actions - */ + */ print '
'; - if ($object->statut == 0) // if blocked... + if ($object->statut < 2) // if not refunded + { + if ($user->rights->deplacement->creer) + { + print ''.$langs->trans('Modify').''; + } + else + { + print ''.$langs->trans('Modify').''; + } + } + + if ($object->statut == 0) // if draft { if ($user->rights->deplacement->creer) { @@ -507,14 +537,18 @@ else if ($id) } } - if ($user->rights->deplacement->creer) + if ($object->statut == 1) // if validated { - print ''.$langs->trans('Modify').''; - } - else - { - print ''.$langs->trans('Modify').''; + if ($user->rights->deplacement->creer) + { + print ''.$langs->trans('ClassifyRefunded').''; + } + else + { + print ''.$langs->trans('ClassifyRefunded').''; + } } + if ($user->rights->deplacement->supprimer) { print ''.$langs->trans('Delete').''; diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 476b0b12790..6e702002505 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -219,7 +219,7 @@ $filter=''; print $form->select_company($socid,'socid',$filter,1,1); print '
'; // User -print ''; // Year diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang index 06d46c7ac65..1759ca8e174 100644 --- a/htdocs/langs/en_US/trips.lang +++ b/htdocs/langs/en_US/trips.lang @@ -19,3 +19,4 @@ TF_TRIP=Trip ListTripsAndExpenses=List of trips and expenses ExpensesArea=Trips and expenses area SearchATripAndExpense=Search a trip and expense +ClassifyRefunded=Classify 'Refunded' \ No newline at end of file From 63bfc093c3fffac4792735e55769ea311942bff8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 6 Sep 2014 17:55:33 +0200 Subject: [PATCH 26/27] Search on a specific day is possible into per user view. --- htdocs/comm/action/peruser.php | 13 ++++++++++++- htdocs/core/lib/agenda.lib.php | 9 --------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index cad01c1d11f..70194a5e21e 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -86,6 +86,14 @@ $type=GETPOST("type"); $maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':''); +$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear')); +if ($dateselect > 0) +{ + $day=GETPOST('dateselectday'); + $month=GETPOST('dateselectmonth'); + $year=GETPOST('dateselectyear'); +} + $tmp=empty($conf->global->MAIN_DEFAULT_WORKING_HOURS)?'9-18':$conf->global->MAIN_DEFAULT_WORKING_HOURS; $tmparray=explode('-',$tmp); $begin_h = GETPOST('begin_h')?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9); @@ -226,7 +234,6 @@ $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); $tmpday = $first_day; - $nav ="".img_previous($langs->trans("Previous"))."\n"; $nav.=" ".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("Week")." ".$week; $nav.=" \n"; @@ -234,6 +241,10 @@ $nav.="".$langs->trans("Today").")"; $picto='calendarweek'; +$nav.='   '; +$nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1); +$nav.=' '; +$nav.=''; // Must be after the nav definition $param.='&year='.$year.'&month='.$month.($day?'&day='.$day:''); diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 80dfbf65e38..5f4f743a45d 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -159,15 +159,6 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print ' - '; print ''; print ''; - - // Filter on day - print ''; - print ''; - print "'; } // Hooks From 012643a892b0b5b9bb0bbe370aa2bac49fd588ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 6 Sep 2014 19:10:59 +0200 Subject: [PATCH 27/27] New: Can filter on status on interventions. --- ChangeLog | 1 + htdocs/fichinter/list.php | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f226db24ee7..864f0930fe2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.7 compared to 3.6.* ***** For users: +- New: Can filter on status on interventions. - New: Add help info of field type into dictionary of payment types. - New: Add proposals into referer page of thirdparty. - New: On contact list can set filter on both active and not active (no more exclusive select). diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 6a730dbe046..cb343627959 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->load("companies"); +$langs->load("bills"); $langs->load("interventions"); $socid=GETPOST('socid','int'); @@ -54,12 +55,15 @@ $limit = $conf->liste_limit; $search_ref=GETPOST('search_ref','alpha'); $search_company=GETPOST('search_company','alpha'); $search_desc=GETPOST('search_desc','alpha'); +$search_status=GETPOST('search_status'); /* * View */ +$form = new Form($db); + llxHeader(); @@ -83,11 +87,14 @@ if ($search_company) { if ($search_desc) { $sql .= natural_search(array('f.description', 'fd.description'), $search_desc); } +if ($search_status != '' && $search_status >= 0) { + $sql .= ' AND f.fk_statut = '.$search_status; +} if (! $user->rights->societe->client->voir && empty($socid)) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = " . $socid; -$sql.= " ORDER BY ".$sortfield." ".$sortorder; +$sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1, $offset); $result=$db->query($sql); @@ -100,7 +107,7 @@ if ($result) $urlparam="&socid=$socid"; print_barre_liste($langs->trans("ListOfInterventions"), $page, $_SERVER['PHP_SELF'], $urlparam, $sortfield, $sortorder, '', $num); - print '
'."\n"; + print ''."\n"; print '
$color"; + + $h2=$h*2; + if (isset($cases[$h2])) + { + if ($cases[$h2] != '') + { + $title = (int) $cases[$h2]; + $title .= 'h'; + if ((int) $cases[$h2] != $cases[$h2]) + $title .= '30'; + else + $title .= '00'; + print "$title"; + } + } + $h2=$h*2+1; + if (isset($cases[$h2])) + { + if ($cases[$h2] != '') + { + $title = (int) $cases[$h2]; + $title .= 'h'; + if ((int) $cases[$h2] != $cases[$h2]) $title .= '30'; + else $title .= '00'; + print "$title"; + } + } + +// mafonction($h*2, $cases); +// mafonction($h*2+1,$cases); + print "
'.$langs->trans("WorkingTimeRange").'"; + print ' - '; + print ''; + print ' '.$langs->trans("H"); + print '
'.$langs->trans("WorkingDaysRange").'"; + print ' - '; + print ''; + print '
'.$langs->trans("Week").'"; + print ''; + print '
'; - show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300); - echo " '; - show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300); - echo "'; + show_day_events($db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300); + echo "
'; - - //print $langs->trans("Calendars").': '; - //print ''; $s.=' -'; -*/ - llxFooter(); $db->close(); -/** - * Change color with a delta - * - * @param string $color Color - * @param int $minus Delta - * @return string New color - */ -function dol_color_minus($color, $minus) -{ - $newcolor=$color; - $newcolor[0]=((hexdec($newcolor[0])-$minus)<0)?0:dechex((hexdec($newcolor[0])-$minus)); - $newcolor[2]=((hexdec($newcolor[2])-$minus)<0)?0:dechex((hexdec($newcolor[2])-$minus)); - $newcolor[4]=((hexdec($newcolor[4])-$minus)<0)?0:dechex((hexdec($newcolor[4])-$minus)); - return $newcolor; -} - - - - - -/** - * - * @param unknown_type $h - * @param unknown_type $cases - */ -function mafonction($h, &$cases) -{ - if (isset($cases[$h])) - if ($cases[$h] != '') - { - $title = (int) $cases[$h]; - $title .= 'h'; - if ((int) $cases[$h] != $cases[$h]) - $title .= '30'; - else - $title .= '00'; - print "$title"; - } - else - { - print ""; - } - else - print ""; -} /** @@ -791,166 +665,157 @@ function mafonction($h, &$cases) */ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $showheader=false) { - global $db; - global $user, $conf, $langs; - global $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form - global $theme_datacolor; - global $cachethirdparties, $cachecontacts, $colorindexused; - global $begin_h, $end_h; + global $db; + global $user, $conf, $langs; + global $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form + global $theme_datacolor; + global $cachethirdparties, $cachecontacts, $colorindexused; + global $begin_h, $end_h; - $cases = array(); + $cases1 = array(); // Color first half hour + $cases2 = array(); // Color second half hour - $curtime = dol_mktime(0, 0, 0, $month, $day, $year); + $curtime = dol_mktime(0, 0, 0, $month, $day, $year); - $i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array(); - $ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day); + $i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array(); + $ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day); - $nextindextouse=count($colorindexused); // At first run this is 0, so fist user has 0, next 1, ... + $nextindextouse=count($colorindexused); // At first run this is 0, so fist user has 0, next 1, ... - foreach ($eventarray as $daykey => $notused) - { - $annee = date('Y',$daykey); - $mois = date('m',$daykey); - $jour = date('d',$daykey); - if ($day==$jour && $month==$mois && $year==$annee) - { - //Tout les events à la même date : - foreach ($eventarray[$daykey] as $index => $event) - { - if ($username->id != $event->usertodo->id) continue; // We discard record if event is from another user than user we want to show - - if (1 == 1) - { - $ponct=($event->date_start_in_calendar == $event->date_end_in_calendar); - - // Define $color and $cssclass of event - $color=-1; $cssclass=''; $colorindex=-1; - if ((! empty($event->author->id) && $event->author->id == $user->id) - || (! empty($event->usertodo->id) && $event->usertodo->id == $user->id) - || (! empty($event->userdone->id) && $event->userdone->id == $user->id)) - { - $nummytasks++; $cssclass='family_mytasks'; - } - else if ($event->type_code == 'ICALEVENT') - { - $numical++; - if (! empty($event->icalname)) { - if (! isset($numicals[dol_string_nospecial($event->icalname)])) { - $numicals[dol_string_nospecial($event->icalname)] = 0; - } - $numicals[dol_string_nospecial($event->icalname)]++; - } - $color=$event->icalcolor; - $cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unsortable'); - } - else if ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); } - else { $numother++; $cssclass='family_other'; } - if ($color == -1) // Color was not forced. Set color according to color index. - { - // Define color index if not yet defined - $idusertouse=($event->usertodo->id?$event->usertodo->id:0); - if (isset($colorindexused[$idusertouse])) - { - $colorindex=$colorindexused[$idusertouse]; // Color already assigned to this user - } - else - { - $colorindex=$nextindextouse; - $colorindexused[$idusertouse]=$colorindex; - if (! empty($theme_datacolor[$nextindextouse+1])) $nextindextouse++; // Prepare to use next color - } - // Define color - $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); - } - //$cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd; - - // Show rect of event - //print '
'; - //print ''; - //print ''; - for ($h = $begin_h; $h < ($end_h*2); $h++) - { - $color = ''; //init - if (empty($event->fulldayevent)) { - $a = dol_mktime((int) $h/2,0,0,$month,$day,$year); - $b = dol_mktime((int) $h/2,30,0,$month,$day,$year); - //$c = $b+($b-$a); - - if ($h % 2 == 1) { - if ($event->date_start_in_calendar <= $a && $event->date_end_in_calendar > $b) { - $color = $h/2; - } - } else { - if ($event->date_start_in_calendar <= $b - && $event->date_end_in_calendar > $a) { - $color = $h/2; - } - if ($h == 0 && $event->date_start_in_calendar <= $b && $event->date_end_in_calendar > $a) - $cases[0] = "0"; - } - } else { - $color = $h/2; - } - //if ($color != '') - //if(!isset($cases[$h])) - if (!isset($cases[$h]) || $cases[$h] == '') - $cases[$h] = $color; - //echo ""; //DEBUG - } - $i++; - } - else - { - print ''.img_picto("all","1downarrow_selected.png").' ...'; - print ' +'.(count($eventarray[$daykey])-$maxprint); - print ''; - break; - //$ok=false; // To avoid to show twice the link - } - } - - break; - } - } - - for ($h = $begin_h; $h < $end_h; $h++) - { - echo ""; - } + if ($h == $begin_h) echo ''; + } } diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 436c0eef48e..80dfbf65e38 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -141,7 +141,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print ''; } - if ($canedit && $action == 'show_week') + if ($canedit && $action == 'show_peruser') { // Filter on hours print ''; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 1a0423d2b16..2c8fc342fe3 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2312,15 +2312,22 @@ td.hidden { table.cal_month { border-spacing: 0px; } .cal_current_month { border-top: 0; border-left: solid 1px #E0E0E0; border-right: 0; border-bottom: solid 1px #E0E0E0; } +.cal_current_month_peruserleft { border-top: 0; border-left: solid 1px #A0A0A0; border-right: 0; border-bottom: solid 1px #E0E0E0; } .cal_current_month_oneday { border-right: solid 1px #E0E0E0; } .cal_other_month { border-top: 0; border-left: solid 1px #C0C0C0; border-right: 0; border-bottom: solid 1px #C0C0C0; } +.cal_other_month_peruserleft { border-top: 0; border-left: solid 1px #A0A0A0 !important; border-right: 0; } .cal_current_month_right { border-right: solid 1px #E0E0E0; } .cal_other_month_right { border-right: solid 1px #C0C0C0; } .cal_other_month { opacity: 0.6; background: #EAEAEA; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_past_month { opacity: 0.6; background: #EEEEEE; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_current_month { background: #FFFFFF; border-left: solid 1px #E0E0E0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_current_month_peruserleft { background: #FFFFFF; border-left: solid 1px #A0A0A0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_today { background: #FFFFFF; border: solid 2px #6C7C7B; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_today_peruser { background: #FFFFFF; border-right: solid 1px #6C7C7B; border-top: solid 1px #A0A0A0; border-bottom: solid 1px #A0A0A0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_today_peruser_peruserleft { background: #FFFFFF; border-left: solid 2px #6C7C7B; border-top: solid 1px #A0A0A0; border-right: solid 1px #6C7C7B; border-bottom: solid 1px #A0A0A0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_past { } +.cal_peruser { padding: 0px; } +.peruser_busy { background: #FF8888; } table.cal_event { border: none; border-collapse: collapse; margin-bottom: 1px; -webkit-border-radius: 6px; border-radius: 6px; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25); moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25); @@ -2562,7 +2569,7 @@ A.none, A.none:active, A.none:visited, A.none:hover { /* CKEditor */ /* ============================================================================== */ -.cke_editable +.cke_editable { margin: 5px !important; } From be0f091474c4e67e3e9bae45f9fbee5d26d62e58 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Sep 2014 21:47:16 +0200 Subject: [PATCH 20/27] css for agenda view per user --- htdocs/comm/action/peruser.php | 21 +++++++++++++++++---- htdocs/theme/amarok/style.css.php | 6 ++++++ htdocs/theme/auguria/style.css.php | 10 ++++++++-- htdocs/theme/bureau2crea/style.css.php | 5 +++++ htdocs/theme/cameleo/style.css.php | 5 +++++ htdocs/theme/eldy/style.css.php | 8 ++++---- 6 files changed, 45 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 69688899e8e..f692869a6cd 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -789,7 +789,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $title .= '00'; $string1=' '; $style1='peruser_busy'; - $url=''.$title.''; + $url=''; } } if (isset($cases2[$h])) @@ -802,17 +802,30 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & else $title .= '00'; $string2=' '; $style2='peruser_busy'; - $url=''.$title.''; + $url=''; } } if ($h == $begin_h) echo '\n"; - - - - - -// In loops, tmpday contains day nb in current month (can be zero or negative for days of previous month) -//var_dump($eventarray); -//print $tmpday; - // Define $usernames $usernames = array(); //init /* Use this to have list of users only if users have events @@ -639,6 +630,18 @@ foreach ($usernames as $username) echo "
$color"; - - $h2=$h*2; - if (isset($cases[$h2])) + foreach ($eventarray as $daykey => $notused) + { + $annee = date('Y',$daykey); + $mois = date('m',$daykey); + $jour = date('d',$daykey); + if ($day==$jour && $month==$mois && $year==$annee) { - if ($cases[$h2] != '') + //Tout les events à la même date : + foreach ($eventarray[$daykey] as $index => $event) { - $title = (int) $cases[$h2]; + if ($username->id != $event->usertodo->id) continue; // We discard record if event is from another user than user we want to show + + $ponct=($event->date_start_in_calendar == $event->date_end_in_calendar); + + // Define $color and $cssclass of event + $color=-1; $cssclass=''; $colorindex=-1; + if ((! empty($event->author->id) && $event->author->id == $user->id) + || (! empty($event->usertodo->id) && $event->usertodo->id == $user->id) + || (! empty($event->userdone->id) && $event->userdone->id == $user->id)) + { + $nummytasks++; $cssclass='family_mytasks'; + } + else if ($event->type_code == 'ICALEVENT') + { + $numical++; + if (! empty($event->icalname)) { + if (! isset($numicals[dol_string_nospecial($event->icalname)])) { + $numicals[dol_string_nospecial($event->icalname)] = 0; + } + $numicals[dol_string_nospecial($event->icalname)]++; + } + $color=$event->icalcolor; + $cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unsortable'); + } + else if ($event->type_code == 'BIRTHDAY') { + $numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); + } + else { $numother++; $cssclass='family_other'; + } + if ($color == -1) // Color was not forced. Set color according to color index. + { + // Define color index if not yet defined + $idusertouse=($event->usertodo->id?$event->usertodo->id:0); + if (isset($colorindexused[$idusertouse])) + { + $colorindex=$colorindexused[$idusertouse]; // Color already assigned to this user + } + else + { + $colorindex=$nextindextouse; + $colorindexused[$idusertouse]=$colorindex; + if (! empty($theme_datacolor[$nextindextouse+1])) $nextindextouse++; // Prepare to use next color + } + // Define color + $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); + } + //$cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd; + + // Show rect of event + for ($h = $begin_h; $h < $end_h; $h++) + { + $color = ''; //init + if (empty($event->fulldayevent)) + { + $a = dol_mktime((int) $h,0,0,$month,$day,$year); + $b = dol_mktime((int) $h,30,0,$month,$day,$year); + $c = dol_mktime((int) $h+1,0,0,$month,$day,$year); + + if ($event->date_start_in_calendar < $b && $event->date_end_in_calendar > $a) + { + $cases1[$h][$event->id]++; + } + if ($event->date_start_in_calendar < $c && $event->date_end_in_calendar > $b) + { + $cases2[$h][$event->id]++; + } + } + else + { + $cases1[$h][$event->id]=1; + $cases2[$h][$event->id]=1; + break; + } + } + $i++; + } + + break; + } + } + + for ($h = $begin_h; $h < $end_h; $h++) + { + $style1='';$style2=''; + $string1=' ';$string2=' '; + if (isset($cases1[$h])) + { + if ($cases1[$h] != '') + { + $title = (int) $cases1[$h]; $title .= 'h'; - if ((int) $cases[$h2] != $cases[$h2]) + if ((int) $cases1[$h] != $cases1[$h]) $title .= '30'; else $title .= '00'; - print "$title"; + $string1=' '; + $style1='peruser_busy'; + $url=''.$title.''; } } - $h2=$h*2+1; - if (isset($cases[$h2])) + if (isset($cases2[$h])) { - if ($cases[$h2] != '') + if ($cases2[$h] != '') { - $title = (int) $cases[$h2]; + $title = (int) $cases2[$h]; $title .= 'h'; - if ((int) $cases[$h2] != $cases[$h2]) $title .= '30'; + if ((int) $cases2[$h] != $cases2[$h]) $title .= '30'; else $title .= '00'; - print "$title"; + $string2=' '; + $style2='peruser_busy'; + $url=''.$title.''; } } -// mafonction($h*2, $cases); -// mafonction($h*2+1,$cases); - print "'; + else echo ''; + print ''; + print ''; + print '
'; + print $string1; + print ''; + print $string2; + print '
'; + print '
'; else echo ''; + if (count($cases1[$h]) == 1) // 1 seul evenement + { + $ids=array_keys($cases1[$h]); + $id=$ids[0]; + $title1='zzz'; + } + if (count($cases2[$h]) == 1) // 1 seul evenement + { + $ids=array_keys($cases2[$h]); + $id=$ids[0]; + $title2='bbb'; + } print ''; - print ''; print '
'; + print '
'; + //var_dump($cases1[$h]); print $string1; - print ''; + print ''; print $string2; print '
'; diff --git a/htdocs/theme/amarok/style.css.php b/htdocs/theme/amarok/style.css.php index 1d81029a1e4..2c9ebe81c15 100644 --- a/htdocs/theme/amarok/style.css.php +++ b/htdocs/theme/amarok/style.css.php @@ -1690,13 +1690,19 @@ td.hidden {display:none;} table.cal_month { border-spacing: 0px; } .cal_current_month { border-top: 0; border-left: solid 1px #E0E0E0; border-right: 0; border-bottom: solid 1px #E0E0E0; } +.cal_current_month_peruserleft { border-top: 0; border-left: solid 3px #6C7C7B; border-right: 0; border-bottom: solid 1px #E0E0E0; } .cal_other_month { border-top: 0; border-left: solid 1px #C0C0C0; border-right: 0; border-bottom: solid 1px #C0C0C0; } +.cal_other_month_peruserleft { border-top: 0; border-left: solid 3px #6C7C7B !important; border-right: 0; } .cal_current_month_right { border-right: solid 1px #E0E0E0; } .cal_other_month_right { border-right: solid 1px #C0C0C0; } .cal_other_month { opacity: 0.6; background: #EAEAEA; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_past_month { opacity: 0.6; background: #EEEEEE; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_current_month { background: #FFFFFF; border-left: solid 1px #E0E0E0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_current_month_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } + +.cal_today_peruser { background: #FFFFFF; border-right: solid 1px #6C7C7B; border-top: solid 1px #A0A0A0; border-bottom: solid 1px #A0A0A0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_today_peruser_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; border-top: solid 1px #A0A0A0; border-right: solid 1px #6C7C7B; border-bottom: solid 1px #A0A0A0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_today { background:#ffffff; diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php index c5d36b6d699..64a045a46ad 100644 --- a/htdocs/theme/auguria/style.css.php +++ b/htdocs/theme/auguria/style.css.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006 Rodolphe Quiedeville + * Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2007-2011 Regis Houssin * Copyright (C) 2012 Juanjo Menent * @@ -1839,9 +1839,14 @@ td.hidden { table.cal_month { border-spacing: 0px; } .cal_other_month { background: #DDDDDD; border: solid 1px #ACBCBB; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_other_month_peruserleft { border-top: 0; border-left: solid 3px #6C7C7B !important; border-right: 0; } .cal_past_month { background: #EEEEEE; border: solid 1px #ACBCBB; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } -.cal_current_month { background: #FFFFFF; border: solid 1px #ACBCBB; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_current_month { background: #FFFFFF; border-left: solid 1px #ACBCBB; border-bottom: solid 1px #ACBCBB; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_current_month_peruserleft { border-top: 0; border-left: solid 3px #6C7C7B; border-right: 0; border-bottom: solid 1px #ACBCBB; } +.cal_current_month_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_today { background: #FFFFFF; border: solid 2px #6C7C7B; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_today_peruser { background: #FFFFFF; border-right: solid 1px #6C7C7B; border-top: solid 1px #A0A0A0; border-bottom: solid 1px #A0A0A0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_today_peruser_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; border-top: solid 1px #A0A0A0; border-right: solid 1px #6C7C7B; border-bottom: solid 1px #A0A0A0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } table.cal_event { border-collapse: collapse; margin-bottom: 1px; } table.cal_event td { border: 0px; padding-: 0px; padding-: 2px; padding-top: 0px; padding-bottom: 0px; } ul.cal_event { padding-right: 2px; padding-top: 1px; border: none; list-style-type: none; margin: 0 auto; padding-left: 0px; padding-start: 0px; -khtml-padding-start: 0px; -o-padding-start: 0px; -webkit-padding-start: 0px; -webkit-padding-start: 0px; } @@ -1850,6 +1855,7 @@ li.cal_event { border: none; list-style-type: none; } .cal_event a:visited { color: #111111; font-size: 11px; font-weight: normal !important; } .cal_event a:active { color: #111111; font-size: 11px; font-weight: normal !important; } .cal_event a:hover { color: #111111; font-size: 11px; font-weight: normal !important; } +.cal_peruser { padding: 0px; } /* ============================================================================== */ diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index 867f25e1d0d..cd3ef16c8c9 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -1938,13 +1938,18 @@ td.hidden { table.cal_month { border-spacing: 0px; } .cal_current_month { border-top: 0; border-left: solid 1px #E0E0E0; border-right: 0; border-bottom: solid 1px #E0E0E0; } +.cal_current_month_peruserleft { border-top: 0; border-left: solid 3px #6C7C7B; border-right: 0; border-bottom: solid 1px #E0E0E0; } .cal_other_month { border-top: 0; border-left: solid 1px #C0C0C0; border-right: 0; border-bottom: solid 1px #C0C0C0; } +.cal_other_month_peruserleft { border-top: 0; border-left: solid 3px #6C7C7B !important; border-right: 0; } .cal_current_month_right { border-right: solid 1px #E0E0E0; } .cal_other_month_right { border-right: solid 1px #C0C0C0; } .cal_other_month { background: #DDDDDD; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_past_month { background: #EEEEEE; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_current_month { background: #FFFFFF; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_current_month_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_today { background: #FFFFFF; border: solid 2px #C0C0C0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_today_peruser { background: #FFFFFF; border-right: solid 1px #6C7C7B; border-top: solid 1px #A0A0A0; border-bottom: solid 1px #A0A0A0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_today_peruser_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; border-top: solid 1px #A0A0A0; border-right: solid 1px #6C7C7B; border-bottom: solid 1px #A0A0A0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } table.cal_event { border-collapse: collapse; margin-bottom: 1px; } table.cal_event td { border: 0px; padding-: 0px; padding-: 2px; padding-top: 0px; padding-bottom: 0px; } ul.cal_event { padding-right: 2px; padding-top: 1px; border: none; list-style-type: none; margin: 0 auto; padding-left: 0px; padding-start: 0px; -khtml-padding-start: 0px; -o-padding-start: 0px; -webkit-padding-start: 0px; -webkit-padding-start: 0px; } diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php index 1c6e13944ca..67b55100f7a 100644 --- a/htdocs/theme/cameleo/style.css.php +++ b/htdocs/theme/cameleo/style.css.php @@ -1963,13 +1963,18 @@ td.hidden { table.cal_month { border-spacing: 0px; } .cal_current_month { border-top: 0; border-left: solid 1px #E0E0E0; border-right: 0; border-bottom: solid 1px #E0E0E0; } +.cal_current_month_peruserleft { border-top: 0; border-left: solid 3px #6C7C7B; border-right: 0; border-bottom: solid 1px #E0E0E0; } .cal_other_month { border-top: 0; border-left: solid 1px #C0C0C0; border-right: 0; border-bottom: solid 1px #C0C0C0; } +.cal_other_month_peruserleft { border-top: 0; border-left: solid 3px #6C7C7B !important; border-right: 0; } .cal_current_month_right { border-right: solid 1px #E0E0E0; } .cal_other_month_right { border-right: solid 1px #C0C0C0; } .cal_other_month { background: #DDDDDD; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_past_month { background: #EEEEEE; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_current_month { background: #FFFFFF; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_current_month_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_today { background: #FFFFFF; border: solid 2px #C0C0C0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_today_peruser { background: #FFFFFF; border-right: solid 1px #6C7C7B; border-top: solid 1px #A0A0A0; border-bottom: solid 1px #A0A0A0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_today_peruser_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; border-top: solid 1px #A0A0A0; border-right: solid 1px #6C7C7B; border-bottom: solid 1px #A0A0A0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } table.cal_event { border-collapse: collapse; margin-bottom: 1px; } table.cal_event td { border: 0px; padding-: 0px; padding-: 2px; padding-top: 0px; padding-bottom: 0px; } ul.cal_event { padding-right: 2px; padding-top: 1px; border: none; list-style-type: none; margin: 0 auto; padding-left: 0px; padding-start: 0px; -khtml-padding-start: 0px; -o-padding-start: 0px; -webkit-padding-start: 0px; -webkit-padding-start: 0px; } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 2c8fc342fe3..28870f7987f 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2312,19 +2312,19 @@ td.hidden { table.cal_month { border-spacing: 0px; } .cal_current_month { border-top: 0; border-left: solid 1px #E0E0E0; border-right: 0; border-bottom: solid 1px #E0E0E0; } -.cal_current_month_peruserleft { border-top: 0; border-left: solid 1px #A0A0A0; border-right: 0; border-bottom: solid 1px #E0E0E0; } +.cal_current_month_peruserleft { border-top: 0; border-left: solid 3px #6C7C7B; border-right: 0; border-bottom: solid 1px #E0E0E0; } .cal_current_month_oneday { border-right: solid 1px #E0E0E0; } .cal_other_month { border-top: 0; border-left: solid 1px #C0C0C0; border-right: 0; border-bottom: solid 1px #C0C0C0; } -.cal_other_month_peruserleft { border-top: 0; border-left: solid 1px #A0A0A0 !important; border-right: 0; } +.cal_other_month_peruserleft { border-top: 0; border-left: solid 3px #6C7C7B !important; border-right: 0; } .cal_current_month_right { border-right: solid 1px #E0E0E0; } .cal_other_month_right { border-right: solid 1px #C0C0C0; } .cal_other_month { opacity: 0.6; background: #EAEAEA; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_past_month { opacity: 0.6; background: #EEEEEE; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_current_month { background: #FFFFFF; border-left: solid 1px #E0E0E0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } -.cal_current_month_peruserleft { background: #FFFFFF; border-left: solid 1px #A0A0A0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_current_month_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_today { background: #FFFFFF; border: solid 2px #6C7C7B; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_today_peruser { background: #FFFFFF; border-right: solid 1px #6C7C7B; border-top: solid 1px #A0A0A0; border-bottom: solid 1px #A0A0A0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } -.cal_today_peruser_peruserleft { background: #FFFFFF; border-left: solid 2px #6C7C7B; border-top: solid 1px #A0A0A0; border-right: solid 1px #6C7C7B; border-bottom: solid 1px #A0A0A0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_today_peruser_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; border-top: solid 1px #A0A0A0; border-right: solid 1px #6C7C7B; border-bottom: solid 1px #A0A0A0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_past { } .cal_peruser { padding: 0px; } .peruser_busy { background: #FF8888; } From b543f76ac9aec4d06a59f4f737aae5955d93419f Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 5 Sep 2014 22:38:17 +0200 Subject: [PATCH 21/27] Changelog Conflicts: ChangeLog --- ChangeLog | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index d2f17ad4166..6ba13dbefc2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -103,12 +103,18 @@ Dolibarr better: ***** ChangeLog for 3.6.1 compared to 3.6.* ***** For users: - Fix: Can upload files on services. -- Fix: sql errors on updat fichinter -- Fix: debian script syntax error +- Fix: sql errors on updat fichinter. +- Fix: debian script syntax error. - Fix: error "menu param is not inside list" into pos module. -- Fix: Salary payments are not reflected on the reporting sheets -- Fix: Unsubscribe emailing not working -- Fix: Trigger on create category call failed because user is not passed on card +- Fix: Salary payments are not reflected on the reporting sheets. +- Fix: Unsubscribe emailing not working. +- Fix: Trigger on create category call failed because user is not passed on card. +- Fix: list event view lost type event filter. +- Fix: Save also code event. +- Fix: VAT payment - Add control on field date value. +- Fix: Salaries payment - Field date value is now required and add control on it. +- Fix: Iban was used instead of Bic into SEPA file. +- Fix: Must unaccent strings into SEPA file. ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: From cbaa7816bfcffe3dec4497a0b8a7901a42f95142 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 6 Sep 2014 00:32:54 +0200 Subject: [PATCH 22/27] New: add css style "cursorpointer". Start to work on clicable links into peruser agenda view. --- ChangeLog | 1 + htdocs/comm/action/peruser.php | 26 +++++++++++++++----------- htdocs/theme/amarok/style.css.php | 3 +++ htdocs/theme/auguria/style.css.php | 4 +++- htdocs/theme/bureau2crea/style.css.php | 3 +++ htdocs/theme/cameleo/style.css.php | 3 +++ htdocs/theme/eldy/style.css.php | 4 +++- 7 files changed, 31 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ba13dbefc2..f226db24ee7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -74,6 +74,7 @@ For translators: - New: When a translation is not available we always jump to en_US and only en_US. For developers: +- New: Add a css style "cursorpointer". - New: Select list of users can return user into hierarchy. - New: getBrowserInfo can return type of layout of browser (classic/phone/tablet) - New: Add hook "searchAgendaFrom". diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index f692869a6cd..cad01c1d11f 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -542,15 +542,6 @@ while ($i < 7) } echo "
\n"; +// Add js code to manage click on a box +print ''; + + + llxFooter(); $db->close(); @@ -777,6 +780,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & { $style1='';$style2=''; $string1=' ';$string2=' '; + $title1='';$title2=''; if (isset($cases1[$h])) { if ($cases1[$h] != '') @@ -822,10 +826,10 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $title2='bbb'; } print ''; - print ''; print '
'; + print '
'; //var_dump($cases1[$h]); print $string1; - print ''; + print ''; print $string2; print '
'; diff --git a/htdocs/theme/amarok/style.css.php b/htdocs/theme/amarok/style.css.php index 2c9ebe81c15..c6340e9d19c 100644 --- a/htdocs/theme/amarok/style.css.php +++ b/htdocs/theme/amarok/style.css.php @@ -336,6 +336,9 @@ th .button { .nounderline { text-decoration: none; } +.cursorpointer { + cursor: pointer; +} .blockvmenubookmarks .menu_contenu { background-color: transparent; diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php index 64a045a46ad..0ec5b806880 100644 --- a/htdocs/theme/auguria/style.css.php +++ b/htdocs/theme/auguria/style.css.php @@ -233,7 +233,9 @@ div.inline-block .nounderline { text-decoration: none; } - +.cursorpointer { + cursor: pointer; +} /* ============================================================================== */ /* Styles to hide objects */ diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index cd3ef16c8c9..e9c742a24c1 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -258,6 +258,9 @@ div.inline-block .nounderline { text-decoration: none; } +.cursorpointer { + cursor: pointer; +} /* ============================================================================== */ diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php index 67b55100f7a..555e674fb92 100644 --- a/htdocs/theme/cameleo/style.css.php +++ b/htdocs/theme/cameleo/style.css.php @@ -234,6 +234,9 @@ div.inline-block .nounderline { text-decoration: none; } +.cursorpointer { + cursor: pointer; +} /* ============================================================================== */ diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 28870f7987f..36cbc9afb54 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -399,7 +399,9 @@ th .button { .nounderline { text-decoration: none; } - +.cursorpointer { + cursor: pointer; +} /* ============================================================================== */ /* Styles to hide objects */ From bf0b578e5a4f73b7535ea28da35941c6f5a36d40 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 6 Sep 2014 16:24:44 +0200 Subject: [PATCH 23/27] Fix: Sort at wrong place Fix: sql syntax error (field were renamed) --- htdocs/core/class/html.form.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7dd220f25be..358c2a90304 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -595,7 +595,7 @@ class Form $sql = "SELECT c.code, c.label"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_fees as c"; - $sql.= " ORDER BY lower(c.libelle) ASC"; + //$sql.= " ORDER BY c.label ASC"; // No sort here, sort must be done after translation dol_syslog(get_class($this).'::load_cache_types_fees', LOG_DEBUG); $resql=$this->db->query($sql); @@ -613,6 +613,9 @@ class Form $this->cache_types_fees[$obj->code] = $label; $i++; } + + asort($this->cache_types_fees); + return $num; } else From 91a894f4598dfd7bd312bb5e674c7880f0a3c847 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 6 Sep 2014 17:10:22 +0200 Subject: [PATCH 24/27] Fix: Missing user name --- htdocs/compta/deplacement/list.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index 195bf9023b4..89df2428ca9 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -56,6 +56,7 @@ $search_ref=GETPOST('search_ref','alpha'); */ $tripandexpense_static=new Deplacement($db); +$userstatic = new User($db); llxHeader(); @@ -132,12 +133,23 @@ if ($resql) $var=!$var; print '
'.img_object($langs->trans("ShowTrip"),"trip").' '.$obj->rowid.''.$langs->trans($obj->type).''.dol_print_date($db->jdate($obj->dd),'day').''.img_object($langs->trans("ShowUser"),"user").' '.$obj->firstname.' '.$obj->name.''; + $userstatic->id = $obj->rowid; + $userstatic->lastname = $obj->lastname; + $userstatic->firstname = $obj->firstname; + print $userstatic->getNomUrl(1); + print ''.$soc->getNomUrl(1).' '.$obj->km.'
'.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").''; +print '
'.$langs->trans("User").''; print $form->select_dolusers($userid,'userid',1); print '
'.$langs->trans("Week").'"; - print ''; - print '
'; print ''; @@ -130,7 +137,11 @@ if ($result) print ''; print ''; } - print ''; + print ''; print "\n"; $companystatic=new Societe($db);
  '; + $liststatus=array('0'=>$langs->trans("Draft"), '1'=>$langs->trans("Validated"), '2'=>$langs->trans("Billed")); + print $form->selectarray('search_status', $liststatus, GETPOST('search_status'), 1); + print ''; + print '