diff --git a/ChangeLog b/ChangeLog index 39c65f5e083..7799e25b45e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -110,6 +110,7 @@ For developers: - New: Added hook "formConfirm" and "doActions" for supplier invoice card. - New: [ task #1511, #1426 ] Added hook "doActions" for supplier card and supplier order card. - New: renamed table llx_c_pays to llx_c_country & libelle field to label. +- New: Added hook "formConfirm" and "doActions" for fichinter card - Qual: Renamed table llx_c_civilite into llx_c_civility, field civilite into label in the same table, and field civilite into civility in other table. diff --git a/build/debian/changelog b/build/debian/changelog index 06d0d2212d5..76e8ae3a2fc 100644 --- a/build/debian/changelog +++ b/build/debian/changelog @@ -1,3 +1,10 @@ +dolibarr (3.6.1-3) unstable; urgency=low + + [ Laurent Destailleur (eldy) ] + * New upstream release. + + -- Laurent Destailleur (eldy) Tue, 23 Sep 2014 12:00:00 +0100 + dolibarr (3.6.0-3) unstable; urgency=low [ Laurent Destailleur (eldy) ] diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index da727786896..1657ff1c7e7 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -17,9 +17,9 @@ ; ----- Change this ----- AppName=DoliWamp ; DoliWamp-x.x.x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x -AppVerName=DoliWamp-3.6.0 +AppVerName=DoliWamp-3.6.1 ; DoliWamp-x.x x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x -OutputBaseFilename=DoliWamp-3.6.0 +OutputBaseFilename=DoliWamp-3.6.1 ; ----- End of change ;OutputManifestFile=build\doliwampbuild.log ; Define full path from which all relative path are defined diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index b0ee55e399b..0b881cedb35 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -460,8 +460,8 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/license.txt`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-2.33`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-20100919`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-*`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/utils`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/LICENSE.TXT`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/savant`; @@ -610,9 +610,6 @@ if ($nboftargetok) { print "Version is $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n"; - #print "Create directory $RPMDIR\n"; - #$ret=`mkdir -p "$RPMDIR"`; - print "Remove target ".$FILENAMERPM."...\n"; unlink("$NEWDESTI/".$FILENAMERPM); print "Remove target ".$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm...\n"; @@ -620,13 +617,13 @@ if ($nboftargetok) { print "Create directory $BUILDROOT/$FILENAMETGZ2\n"; $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2`; + print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMETGZ2\n"; $cmd="cp -pr '$BUILDROOT/$PROJECT' '$BUILDROOT/$FILENAMETGZ2'"; $ret=`$cmd`; - # Set owners - #print "Set owners on files/dir\n"; - #$ret=`chown -R root.root $BUILDROOT/$FILENAMETGZ2`; + # Removed files we don't need + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/htdocs/includes/ckeditor/_source`; print "Set permissions on files/dir\n"; $ret=`chmod -R 755 $BUILDROOT/$FILENAMETGZ2`; @@ -747,10 +744,18 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/rpm`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/zip`; # Removed duplicate license files + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/_source/LICENSE.md`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/_source/plugins/scayt/LICENSE.md`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/_source/plugins/wsc/LICENSE.md`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/LICENSE.md`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/plugins/scayt/LICENSE.md`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/plugins/wsc/LICENSE.md`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/jquery/plugins/flot/LICENSE.txt`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-2.34/LICENSE`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/tcpdf/fonts/freefont-20120503/COPYING`; + # Removed files we don't need + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/_source`; + # Rename upstream changelog to match debian rules $ret=`mv $BUILDROOT/$PROJECT.tmp/ChangeLog $BUILDROOT/$PROJECT.tmp/changelog`; diff --git a/build/makepack-howto.txt b/build/makepack-howto.txt index 24e5f809185..40b0e5180bc 100644 --- a/build/makepack-howto.txt +++ b/build/makepack-howto.txt @@ -36,14 +36,13 @@ complete release of Dolibarr, step by step. - Update version number with x.y.z in build/exe/doliwamp/doliwamp.iss - Update version number with x.y.z in build/rpm/*.spec - Commit all changes. -- Add a Tag (x.y.z) - Build Dolibarr and DoliWamp packages with makepack-dolibarr.pl - Check content of built packages. - Move build files into www.dolibarr.org web site (/home/dolibarr/wwwroot/files/stable). - Run makepack-dolibarr.pl again with option to publish files on - sourceforge. + sourceforge. This will also add official tag. - Edit symbolic links in directory "/home/dolibarr/wwwroot/files/stable/xxx" on server to point to new files (used by some web sites). diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index d676e59255e..439a09b8266 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -333,6 +333,9 @@ fi # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release %changelog +* Wed Sep 24 2014 Laurent Destailleur 3.6.1-0.3 +- Upstream release + * Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3 - Upstream release diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index ef94435a62a..945e8f4812c 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -569,6 +569,9 @@ fi # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release %changelog +* Wed Sep 24 2014 Laurent Destailleur 3.6.1-0.3 +- Upstream release + * Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3 - Upstream release diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index dfa148570f0..17b46c3c143 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -338,6 +338,9 @@ fi # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release %changelog +* Wed Sep 24 2014 Laurent Destailleur 3.6.1-0.3 +- Upstream release + * Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3 - Upstream release diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index b3b304312f5..f6192c87c9b 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -349,6 +349,9 @@ fi # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release %changelog +* Wed Sep 24 2014 Laurent Destailleur 3.6.1-0.3 +- Upstream release + * Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3 - Upstream release diff --git a/dev/skeletons/skeleton_page.php b/dev/skeletons/skeleton_page.php index 67d6298863a..deaecd95526 100644 --- a/dev/skeletons/skeleton_page.php +++ b/dev/skeletons/skeleton_page.php @@ -114,8 +114,8 @@ if ($action == 'add') } { // Creation KO - if (! empty($object->errors)) setEventMessage($object->errors, 'errors'); - else setEventMessage($object->error, 'errors'); + if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); + else setEventMessages($object->error, null, 'errors'); $action='create'; } } @@ -139,7 +139,7 @@ if ($action == 'update' && ! GETPOST('cancel')) if (empty($object->ref)) { $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),'errors'); + setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),null,'errors'); } if (! $error) @@ -152,8 +152,8 @@ if ($action == 'update' && ! GETPOST('cancel')) else { // Creation KO - if (! empty($object->errors)) setEventMessage($object->errors, 'errors'); - else setEventMessage($object->error, 'errors'); + if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); + else setEventMessages($object->error, null, 'errors'); $action='edit'; } } @@ -170,14 +170,14 @@ if ($action == 'confirm_delete') if ($result > 0) { // Delete OK - setEventMessage($langs->trans("RecordDeleted")); + setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); header("Location: ".dol_buildpath('/buildingmanagement/list.php',1)); exit; } else { - if (! empty($object->errors)) setEventMessage($object->errors,'errors'); - else setEventMessage($object->error,'errors'); + if (! empty($object->errors)) setEventMessages(null,$object->errors,'errors'); + else setEventMessages($object->error,null,'errors'); } } @@ -327,6 +327,8 @@ if ($id && (empty($action) || $action == 'view')) print '
'."\n"; $parameters=array(); $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) { if ($user->rights->mymodule->write) diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index 501b5ed87d1..343c8c4a628 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -44,6 +44,8 @@ $object = new Adherent($db); $result=$object->fetch($id); if ($result > 0) { + $object->fetch_thirdparty(); + $adht = new AdherentType($db); $result=$adht->fetch($object->typeid); } @@ -146,7 +148,23 @@ if ($object->id > 0) print '
'; - print load_fiche_titre($langs->trans("ActionsOnMember"),'',''); + $out=''; + + /*$objthirdparty=$object->thirdparty; + $objcon=new stdClass(); + + $permok=$user->rights->agenda->myactions->create; + if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok) + { + $out.=''; + $out.=$langs->trans("AddAnAction").' '; + $out.=img_picto($langs->trans("AddAnAction"),'filenew'); + $out.=""; + }*/ + + print load_fiche_titre($langs->trans("ActionsOnMember"),$out,''); // List of todo actions show_actions_todo($conf,$langs,$db,$object); diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php index 79ba8597672..cf89e1f526c 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -94,7 +94,7 @@ abstract class ActionsAdherentCardCommon /** * Load data control * - * @param string &$action Type of action + * @param string $action Type of action * @param int $id Id of object * @return void */ @@ -228,7 +228,7 @@ abstract class ActionsAdherentCardCommon /** * Set content of ->tpl array, to use into template * - * @param string &$action Type of action + * @param string $action Type of action * @param int $id Id * @return string HTML output */ diff --git a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php index b88e4b2134f..5c40cb22954 100644 --- a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php +++ b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php @@ -76,7 +76,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon /** * Assign custom values for canvas * - * @param string &$action Type of action + * @param string $action Type of action * @param int $id Id * @return void */ diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 3b1f61df5b5..1c9de056acc 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -117,6 +117,7 @@ $hookmanager->initHooks(array('membercard')); $parameters=array('rowid'=>$rowid, 'objcanvas'=>$objcanvas); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer)) { diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 1d05efa8e99..e5b2e5e6b1d 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Andre Cianfarani - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2011-2013 Philippe Grand @@ -117,6 +117,35 @@ else if ($action == 'specimen') } } +// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) +if ($action == 'setModuleOptions') +{ + $post_size=count($_POST); + + $db->begin(); + + for($i=0;$i < $post_size;$i++) + { + if (array_key_exists('param'.$i,$_POST)) + { + $param=GETPOST("param".$i,'alpha'); + $value=GETPOST("value".$i,'alpha'); + if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + } + if (! $error) + { + $db->commit(); + setEventMessage($langs->trans("SetupSaved")); + } + else + { + $db->rollback(); + setEventMessage($langs->trans("Error"),'errors'); + } +} + // Activate a model if ($action == 'set') { @@ -192,14 +221,6 @@ else if ($action == 'set_COMMANDE_FREE_TEXT') setEventMessage($langs->trans("Error"),'errors'); } } -else if ($action=='setModuleOptions') { - if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF_ODT_PATH",GETPOST('value1'),'chaine',0,'',$conf->entity)) - { - // La constante qui a ete lue en avant du nouveau set - // on passe donc par une variable pour avoir un affichage coherent - $conf->global->COMMANDE_ADDON_PDF_ODT_PATH = GETPOST('value1'); - } -} /* diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 4c3ee7207df..2abb2b5acad 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -35,8 +35,9 @@ if (!$user->admin) accessforbidden(); $action = GETPOST('action','alpha'); $value = GETPOST('value','alpha'); +$label = GETPOST('label','alpha'); $scandir = GETPOST('scandir','alpha'); -$type='contrat'; +$type='contract'; if (empty($conf->global->CONTRACT_ADDON)) { @@ -111,6 +112,35 @@ else if ($action == 'specimen') // For contract } } +// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) +if ($action == 'setModuleOptions') +{ + $post_size=count($_POST); + + $db->begin(); + + for($i=0;$i < $post_size;$i++) + { + if (array_key_exists('param'.$i,$_POST)) + { + $param=GETPOST("param".$i,'alpha'); + $value=GETPOST("value".$i,'alpha'); + if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + } + if (! $error) + { + $db->commit(); + setEventMessage($langs->trans("SetupSaved")); + } + else + { + $db->rollback(); + setEventMessage($langs->trans("Error"),'errors'); + } +} + // Activate a model else if ($action == 'set') { @@ -192,7 +222,7 @@ else if ($action == 'set_CONTRACT_DRAFT_WATERMARK') */ $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); - + llxHeader(); $form=new Form($db); @@ -318,7 +348,6 @@ print '
'; print_titre($langs->trans("TemplatePDFContracts")); // Defini tableau def des modeles -$type='contrat'; $def = array(); $sql = "SELECT nom"; $sql.= " FROM ".MAIN_DB_PREFIX."document_model"; diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index d89b406280b..2efdfdd56ba 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -138,6 +138,35 @@ else if ($action == 'specimen') } } +// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) +else if ($action == 'setModuleOptions') +{ + $post_size=count($_POST); + + $db->begin(); + + for($i=0;$i < $post_size;$i++) + { + if (array_key_exists('param'.$i,$_POST)) + { + $param=GETPOST("param".$i,'alpha'); + $value=GETPOST("value".$i,'alpha'); + if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + } + if (! $error) + { + $db->commit(); + setEventMessage($langs->trans("SetupSaved")); + } + else + { + $db->rollback(); + setEventMessage($langs->trans("Error"),'errors'); + } +} + // Activate a model else if ($action == 'set') { @@ -175,14 +204,6 @@ else if ($action == 'setmodel') { dolibarr_set_const($db, "EXPEDITION_ADDON_NUMBER",$value,'chaine',0,'',$conf->entity); } -else if ($action=='setModuleOptions') { - if (dolibarr_set_const($db, "EXPEDITION_ADDON_PDF_ODT_PATH",GETPOST('value1'),'chaine',0,'',$conf->entity)) - { - // La constante qui a ete lue en avant du nouveau set - // on passe donc par une variable pour avoir un affichage coherent - $conf->global->EXPEDITION_ADDON_PDF_ODT_PATH = GETPOST('value1'); - } -} /* diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 37a3b2a5a5c..dad5f484a4d 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2011-2013 Philippe Grand @@ -113,6 +113,35 @@ else if ($action == 'specimen') // For fiche inter } } +// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) +if ($action == 'setModuleOptions') +{ + $post_size=count($_POST); + + $db->begin(); + + for($i=0;$i < $post_size;$i++) + { + if (array_key_exists('param'.$i,$_POST)) + { + $param=GETPOST("param".$i,'alpha'); + $value=GETPOST("value".$i,'alpha'); + if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + } + if (! $error) + { + $db->commit(); + setEventMessage($langs->trans("SetupSaved")); + } + else + { + $db->rollback(); + setEventMessage($langs->trans("Error"),'errors'); + } +} + // Activate a model else if ($action == 'set') { @@ -261,13 +290,13 @@ foreach ($dirmodels as $reldir) require_once $dir.$file.'.php'; $module = new $file; - + if ($module->isEnabled()) { // Show modules according to features level if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; - + $var=!$var; print ''.$module->nom."\n"; print $module->info(); @@ -372,78 +401,99 @@ foreach ($dirmodels as $reldir) $handle=opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) - { - if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_') + while (($file = readdir($handle))!==false) + { + $filelist[]=$file; + } + closedir($handle); + arsort($filelist); + + foreach($filelist as $file) + { + if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) { - $var=!$var; - - $name = substr($file, 4, dol_strlen($file) -16); - $classname = substr($file, 0, dol_strlen($file) -12); - - require_once $dir.'/'.$file; - $module = new $classname($db); - - print ''; - print (empty($module->name)?$name:$module->name); - print "\n"; - require_once $dir.$file; - $module = new $classname($db); - print $module->description; - print ''; - - // Active - if (in_array($name, $def)) + if (file_exists($dir.'/'.$file)) { - print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; - print img_picto($langs->trans("Enabled"),'switch_on'); - print ''; - print ""; - } - else - { - print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; - print ""; - } + $var=!$var; - // Default - print ""; - if ($conf->global->FICHEINTER_ADDON_PDF == "$name") - { - print img_picto($langs->trans("Default"),'on'); - } - else - { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; - } - print ''; + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); - // Info - $htmltooltip = ''.$langs->trans("Name").': '.$module->name; - $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); - $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; - $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; - $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); - $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); - $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); - $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); - $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1); - print ''; - print $form->textwithpicto('',$htmltooltip,-1,0); - print ''; - - // Preview - $link=''.img_object($langs->trans("Preview"),'intervention').''; - print ''; - print $link; - print ''; + require_once $dir.'/'.$file; + $module = new $classname($db); - print ''; + $modulequalified=1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; + + if ($modulequalified) + { + print ''; + print (empty($module->name)?$name:$module->name); + print "\n"; + if (method_exists($module,'info')) print $module->info($langs); + else print $module->description; + print ''; + + // Active + if (in_array($name, $def)) + { + print "\n"; + print 'scandir.'&label='.urlencode($module->name).'">'; + print img_picto($langs->trans("Enabled"),'switch_on'); + print ''; + print ""; + } + else + { + print "\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print ""; + } + + // Default + print ""; + if ($conf->global->FICHEINTER_ADDON_PDF == "$name") + { + print img_picto($langs->trans("Default"),'on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + } + print ''; + + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); + $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); + $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); + $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); + $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1); + print ''; + print $form->textwithpicto('',$htmltooltip,-1,0); + print ''; + + // Preview + print ''; + if ($module->type == 'pdf') + { + print ''.img_object($langs->trans("Preview"),'intervention').''; + } + else + { + print img_object($langs->trans("PreviewNotAvailable"),'generic'); + } + print ''; + + print ''; + } + } } } - closedir($handle); } } } diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 415bff261de..b591aa79c08 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2011-2013 Philippe Grand * @@ -95,7 +95,7 @@ if ($action == 'specimen') $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); foreach($dirmodels as $reldir) { - $file=dol_buildpath($reldir."core/modules/livraison/pdf/pdf_".$modele.".modules.php",0); + $file=dol_buildpath($reldir."core/modules/livraison/doc/pdf_".$modele.".modules.php",0); if (file_exists($file)) { $filefound=1; @@ -128,6 +128,35 @@ if ($action == 'specimen') } } +// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) +if ($action == 'setModuleOptions') +{ + $post_size=count($_POST); + + $db->begin(); + + for($i=0;$i < $post_size;$i++) + { + if (array_key_exists('param'.$i,$_POST)) + { + $param=GETPOST("param".$i,'alpha'); + $value=GETPOST("value".$i,'alpha'); + if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + } + if (! $error) + { + $db->commit(); + setEventMessage($langs->trans("SetupSaved")); + } + else + { + $db->rollback(); + setEventMessage($langs->trans("Error"),'errors'); + } +} + if ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); @@ -356,75 +385,101 @@ clearstatcache(); $var=true; foreach ($dirmodels as $reldir) { - $dir = dol_buildpath($reldir."core/modules/livraison/pdf/"); + $dir = dol_buildpath($reldir."core/modules/livraison/doc/"); if (is_dir($dir)) { $handle = opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) - { - if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_') + while (($file = readdir($handle))!==false) + { + $filelist[]=$file; + } + closedir($handle); + arsort($filelist); + + foreach($filelist as $file) + { + if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) { - $name = substr($file, 4, dol_strlen($file) - 16); - $classname = substr($file, 0, dol_strlen($file) - 12); + if (file_exists($dir.'/'.$file)) + { + $var=!$var; - $var=!$var; + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); - print ''; - print $name; - print "\n"; - require_once $dir.$file; - $module = new $classname($db); + require_once $dir.'/'.$file; + $module = new $classname($db); - print $module->description; - print ''; + $modulequalified=1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; - // Activ - if (in_array($name, $def)) - { - print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; - print img_picto($langs->trans("Enabled"),'switch_on'); - print ''; - print ""; - } - else - { - print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; - print ""; - } + if ($modulequalified) + { + print ''; + print (empty($module->name)?$name:$module->name); + print "\n"; + if (method_exists($module,'info')) print $module->info($langs); + else print $module->description; + print ''; - // Default - print ""; - if ($conf->global->LIVRAISON_ADDON_PDF == "$name") - { - print img_picto($langs->trans("Default"),'on'); - } - else - { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; - } - print ''; + // Active + if (in_array($name, $def)) + { + print "\n"; + print 'scandir.'&label='.urlencode($module->name).'">'; + print img_picto($langs->trans("Enabled"),'switch_on'); + print ''; + print ""; + } + else + { + print "\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print ""; + } - // Info - $htmltooltip = ''.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); - $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; - $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; - $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); - print ''; - print $form->textwithpicto('',$htmltooltip,1,0); - print ''; - print ''; - print ''.img_object($langs->trans("Preview"),'sending').''; - print ''; + // Default + print ""; + if ($conf->global->LIVRAISON_ADDON_PDF == "$name") + { + print img_picto($langs->trans("Default"),'on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + } + print ''; - print ''; + // Info + $htmltooltip = ''.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); + print ''; + print $form->textwithpicto('',$htmltooltip,1,0); + print ''; + + // Preview + print ''; + if ($module->type == 'pdf') + { + print ''.img_object($langs->trans("Preview"),'sending').''; + } + else + { + print img_object($langs->trans("PreviewNotAvailable"),'generic'); + } + print ''; + + print ''; + } + } } } - closedir($handle); } } } diff --git a/htdocs/admin/system/index.php b/htdocs/admin/system/index.php index 30bd3f80d4a..64df9432e82 100644 --- a/htdocs/admin/system/index.php +++ b/htdocs/admin/system/index.php @@ -117,4 +117,3 @@ print info_admin($langs->trans("SystemInfoDesc")).'
'; llxFooter(); $db->close(); - diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index a21f7a53699..d1fe7848564 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -102,7 +102,7 @@ $hookmanager->initHooks(array('categorycard')); $parameters=array('id'=>$socid); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks -$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors); +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index aef2d5fad3d..827e2df976a 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -219,6 +219,7 @@ if ($action == 'add') if ($value['id'] > 0) { $usertodo->fetch($value['id']); + $object->userownerid = $usertodo->id; } $object->usertodo = $usertodo; $object->transparency = (GETPOST("transparency")=='on'?1:0); @@ -235,6 +236,7 @@ if ($action == 'add') if ($_POST["doneby"] > 0) { $userdone->fetch($_POST["doneby"]); + $object->userdoneid = $userdone->id; } $object->userdone = $userdone; } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 1d7cf0efd68..773fdb48b0f 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -47,8 +47,10 @@ class ActionComm extends CommonObject var $datec; // Date creation record (datec) var $datem; // Date modification record (tms) - var $author; // Object user that create action - var $usermod; // Object user that modified action + var $author; // Object user that create action //deprecated + var $usermod; // Object user that modified action // deprecated + var $authorid; // Id user that create action + var $usermodid; // Id user that modified action var $datep; // Date action start (datep) var $datef; // Date action end (datep2) @@ -63,8 +65,9 @@ class ActionComm extends CommonObject var $note; // Description var $userassigned = array(); // Array of user ids - var $usertodo; // Object user of owner - var $userdone; // Object user that did action (deprecated) + var $userownerid; // Id of user owner + var $usertodo; // Object user of owner // deprecated + var $userdone; // Object user that did action // deprecated var $socid; var $contactid; @@ -134,6 +137,9 @@ class ActionComm extends CommonObject if ($this->elementtype=='commande') $this->elementtype='order'; if ($this->elementtype=='contrat') $this->elementtype='contract'; + $userownerid=isset($this->usertodo->id)?$this->usertodo->id:$this->userownerid; // For backward compatibility + $userdoneid=isset($this->userdone->id)?$this->userdone->id:$this->userdoneid; // For backward compatibility + if (! $this->type_id && $this->type_code) { // Get id from code @@ -197,8 +203,8 @@ class ActionComm extends CommonObject $sql.= " '".$this->db->escape($this->note)."',"; $sql.= (isset($this->contactid) && $this->contactid > 0?"'".$this->contactid."'":"null").","; $sql.= (isset($user->id) && $user->id > 0 ? "'".$user->id."'":"null").","; - $sql.= (isset($this->usertodo->id) && $this->usertodo->id > 0?"'".$this->usertodo->id."'":"null").","; - $sql.= (isset($this->userdone->id) && $this->userdone->id > 0?"'".$this->userdone->id."'":"null").","; + $sql.= ($userownerid>0?"'".$userownerid."'":"null").","; + $sql.= ($userdoneid>0?"'".$userdoneid."'":"null").","; $sql.= "'".$this->db->escape($this->label)."','".$this->percentage."','".$this->priority."','".$this->fulldayevent."','".$this->db->escape($this->location)."','".$this->punctual."',"; $sql.= "'".$this->transparency."',"; $sql.= (! empty($this->fk_element)?$this->fk_element:"null").","; @@ -304,7 +310,7 @@ class ActionComm extends CommonObject $sql.= " a.fk_user_action, a.fk_user_done,"; $sql.= " a.fk_contact, a.percent as percentage,"; $sql.= " a.fk_element, a.elementtype,"; - $sql.= " a.priority, a.fulldayevent, a.location, a.transparency,"; + $sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,"; $sql.= " c.id as type_id, c.code as type_code, c.libelle,"; $sql.= " s.nom as socname,"; $sql.= " u.firstname, u.lastname as lastname"; @@ -351,8 +357,9 @@ class ActionComm extends CommonObject $this->author->lastname = $obj->lastname; $this->usermod->id = $obj->fk_user_mod; - $this->usertodo->id = $obj->fk_user_action; - $this->userdone->id = $obj->fk_user_done; + $this->userownerid = $obj->fk_user_action; + $this->usertodo->id = $obj->fk_user_action; // deprecated + //$this->userdone->id = $obj->fk_user_done; $this->priority = $obj->priority; $this->fulldayevent = $obj->fulldayevent; $this->location = $obj->location; @@ -380,19 +387,25 @@ class ActionComm extends CommonObject /** - * Initialize this->userassigned array + * Initialize this->userassigned array with list of id of user assigned to event * * @return int <0 if KO, >0 if OK */ function fetch_userassigned() { global $langs; + $sql.="SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency"; $sql.=" FROM ".MAIN_DB_PREFIX."actioncomm_resources"; $sql.=" WHERE element_type = 'user' AND fk_actioncomm = ".$this->id; $resql2=$this->db->query($sql); if ($resql2) { + $this->userassigned=array(); + + // If owner is known, we must but id first into list + if ($this->userownerid > 0) $this->userassigned[$this->userownerid]=array('id'=>$this->userownerid); // Set first so will be first into list. + while ($obj = $this->db->fetch_object($resql2)) { $this->userassigned[$obj->fk_element]=array('id'=>$obj->fk_element, 'mandatory'=>$obj->mandatory, 'answer_status'=>$obj->answer_status, 'transparency'=>$obj->transparency); @@ -948,7 +961,7 @@ class ActionComm extends CommonObject $sql.= " a.fk_user_action, a.fk_user_done,"; $sql.= " a.fk_contact, a.percent as percentage,"; $sql.= " a.fk_element, a.elementtype,"; - $sql.= " a.priority, a.fulldayevent, a.location,"; + $sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,"; $sql.= " u.firstname, u.lastname,"; $sql.= " s.nom as socname,"; $sql.= " c.id as type_id, c.code as type_code, c.libelle"; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 44d1e209694..24502897ec1 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -218,9 +218,9 @@ if (empty($action) || $action=='show_month') $tmpday = -date("w",dol_mktime(0,0,0,$month,1,$year))+2; $tmpday+=((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)-1); if ($tmpday >= 1) $tmpday -= 7; - // Define firstdaytoshow and lastdaytoshow + // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$max_day_in_prev_month+$tmpday,$prev_year); - $next_day=7-($max_day_in_month+1-$tmpday)%7; + $next_day=7 - ($max_day_in_month+1-$tmpday) % 7; if ($next_day < 6) $next_day+=7; $lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year); } @@ -242,9 +242,9 @@ if ($action=='show_week') $next_month = $next['month']; $next_day = $next['day']; - // Define firstdaytoshow and lastdaytoshow + // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) $firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year); - $lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 6, 'd'); + $lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd'); $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); @@ -261,7 +261,7 @@ if ($action == 'show_day') $next_month = $next['month']; $next_day = $next['day']; - // Define firstdaytoshow and lastdaytoshow + // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$prev_day,$prev_year); $lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year); } @@ -419,6 +419,7 @@ if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'"; if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid; +// FIXME: We must filter on assignement table if ($usergroup > 0) $sql.= " AND ugu.fk_user = a.fk_user_action"; if ($action == 'show_day') { @@ -453,6 +454,7 @@ if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable 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)."'))"; } +// FIXME: We must filter on assignement table if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0) { $sql.= " AND ("; @@ -484,10 +486,12 @@ if ($resql) $event->type_code=$obj->code; $event->libelle=$obj->label; $event->percentage=$obj->percent; - $event->author->id=$obj->fk_user_author; // user id of creator - $event->usertodo->id=$obj->fk_user_action; // user id of owner - $event->userdone->id=$obj->fk_user_done; // deprecated - // $event->userstodo=... with s after user, in future version, will be an array with all id of user assigned to event + //$event->author->id=$obj->fk_user_author; // user id of creator + $event->authorid=$obj->fk_user_author; // user id of creator + $event->userownerid=$obj->fk_user_action; // user id of owner + $event->fetch_userassigned(); // This load $event->userassigned + //$event->usertodo->id=$obj->fk_user_action; // user id of owner + //$event->userdone->id=$obj->fk_user_done; // deprecated $event->priority=$obj->priority; $event->fulldayevent=$obj->fulldayevent; $event->location=$obj->location; @@ -518,14 +522,14 @@ if ($resql) // Check values if ($event->date_end_in_calendar < $firstdaytoshow || - $event->date_start_in_calendar > $lastdaytoshow) + $event->date_start_in_calendar >= $lastdaytoshow) { // This record is out of visible range } else { if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow; - if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=$lastdaytoshow; + if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow-1); // Add an entry in actionarray for each day $daycursor=$event->date_start_in_calendar; @@ -655,7 +659,7 @@ if (count($listofextcals)) if (isset($icalevent['RRULE']) && is_array($icalevent['RRULE'])) //repeatable event { //if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow; - //if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=$lastdaytoshow; + //if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow-1); if ($icalevent['DTSTART;VALUE=DATE']) //fullday event { $datecurstart=dol_stringtotime($icalevent['DTSTART;VALUE=DATE'],1); @@ -694,10 +698,10 @@ if (count($listofextcals)) $until=empty($icalevent['RRULE']['UNTIL'])?0:dol_stringtotime($icalevent['RRULE']['UNTIL'],1); $maxrepeat=empty($icalevent['RRULE']['COUNT'])?0:$icalevent['RRULE']['COUNT']; if ($until && ($until+($datecurend-$datecurstart)) < $firstdaytoshow) continue; // We discard repeatable event that end before start date to show - if ($datecurstart > $lastdaytoshow) continue; // We discard repeatable event that start after end date to show + if ($datecurstart >= $lastdaytoshow) continue; // We discard repeatable event that start after end date to show $numofevent=0; - while (($datecurstart <= $lastdaytoshow) && (empty($maxrepeat) || ($numofevent < $maxrepeat))) + while (($datecurstart < $lastdaytoshow) && (empty($maxrepeat) || ($numofevent < $maxrepeat))) { if ($datecurend >= $firstdaytoshow) // We add event { @@ -829,7 +833,7 @@ if (count($listofextcals)) } // Add event into $eventarray if date range are ok. - if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar > $lastdaytoshow) + if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) { //print 'x'.$datestart.'-'.$dateend;exit; //print 'x'.$datestart.'-'.$dateend;exit; @@ -839,7 +843,7 @@ if (count($listofextcals)) else { if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow; - if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=$lastdaytoshow; + if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1); // Add an entry in actionarray for each day $daycursor=$event->date_start_in_calendar; @@ -1069,7 +1073,7 @@ $db->close(); * @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 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 @@ -1132,19 +1136,19 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa { if ($i < $maxprint || $maxprint == 0 || ! empty($conf->global->MAIN_JS_SWITCH_AGENDA)) { - $ponct=($event->date_start_in_calendar == $event->date_end_in_calendar); + $keysofuserassigned=array_keys($event->userassigned); + + $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'; + if (in_array($user->id, $keysofuserassigned)) + { + $nummytasks++; $cssclass='family_mytasks'; // TODO Set a color using user color // Must defined rule to choose color of who to use. - // event->usertodo->id will still contains user id of owner - // event->userstodo will be an array in future. + // event->ownerid will still contains user id of owner + // event->userassigned will be an array in future. // $color=$user->color; } else if ($event->type_code == 'ICALEVENT') @@ -1164,7 +1168,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa 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); + $idusertouse=($event->userownerid?$event->userownerid:0); if (isset($colorindexused[$idusertouse])) { $colorindex=$colorindexused[$idusertouse]; // Color already assigned to this user @@ -1344,7 +1348,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } else { - print 'escape($actioncode)."'"; if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; if ($socid > 0) $sql.= " AND s.rowid = ".$socid; +// FIXME: We must filter on assignement table if ($usergroup > 0) $sql.= " AND ugu.fk_user = a.fk_user_action"; if ($type) $sql.= " AND c.id = ".$type; if ($status == '0') { $sql.= " AND a.percent = 0"; } @@ -170,6 +171,7 @@ if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable 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)."'))"; } +// FIXME: We must filter on assignement table if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0) { $sql.= " AND ("; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index f6a616d3496..54dada1ff52 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -96,7 +96,7 @@ if ($dateselect > 0) $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); +$begin_h = GETPOST('begin_h')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9); $end_h = GETPOST('end_h')?GETPOST('end_h'):($tmparray[1] != '' ? $tmparray[1] : 18); if ($begin_h < 0 || $begin_h > 23) $begin_h = 9; if ($end_h < 1 || $end_h > 24) $end_h = 18; @@ -179,17 +179,11 @@ $next_year = $next['year']; $next_month = $next['month']; $next_day = $next['day']; -// Define firstdaytoshow and lastdaytoshow -$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)); $tmpday = $first_day; //print 'xx'.$prev_year.'-'.$prev_month.'-'.$prev_day; //print 'xx'.$next_year.'-'.$next_month.'-'.$next_day; -//print dol_print_date($firstdaytoshow,'day'); -//print dol_print_date($lastdaytoshow,'day'); $title=$langs->trans("DoneAndToDoActions"); if ($status == 'done') $title=$langs->trans("DoneActions"); @@ -225,9 +219,11 @@ $next_year = $next['year']; $next_month = $next['month']; $next_day = $next['day']; -// Define firstdaytoshow and lastdaytoshow +// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) $firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year); -$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 6, 'd'); +$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd'); +//print dol_print_date($firstdaytoshow,'dayhour'); +//print dol_print_date($lastdaytoshow,'dayhour'); $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); @@ -335,6 +331,7 @@ if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'"; if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid; +// FIXME: We must filter on assignement table if ($usergroup > 0) $sql.= " AND ugu.fk_user = a.fk_user_action"; if ($action == 'show_day') { @@ -369,6 +366,7 @@ if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable 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)."'))"; } +// FIXME: We must filter on assignement table if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0) { $sql.= " AND ("; @@ -398,13 +396,14 @@ if ($resql) $event->datep=$db->jdate($obj->datep); // datep and datef are GMT date $event->datef=$db->jdate($obj->datep2); $event->type_code=$obj->code; - $event->libelle=$obj->label; // deprecated + //$event->libelle=$obj->label; // deprecated $event->label=$obj->label; $event->percentage=$obj->percent; - $event->author->id=$obj->fk_user_author; // user id of creator - $event->usertodo->id=$obj->fk_user_action; // user id of owner - $event->userdone->id=$obj->fk_user_done; // deprecated - // $event->userstodo=... with s after user, in future version, will be an array with all id of user assigned to event + //$event->author->id=$obj->fk_user_author; // user id of creator + $event->authorid=$obj->fk_user_author; // user id of creator + $event->userownerid=$obj->fk_user_action; // user id of owner + $event->fetch_userassigned(); // This load $event->userassigned + //$event->userdone->id=$obj->fk_user_done; // deprecated $event->priority=$obj->priority; $event->fulldayevent=$obj->fulldayevent; $event->location=$obj->location; @@ -412,8 +411,8 @@ if ($resql) $event->socid=$obj->fk_soc; $event->contactid=$obj->fk_contact; - $event->societe->id=$obj->fk_soc; - $event->contact->id=$obj->fk_contact; + //$event->societe->id=$obj->fk_soc; // deprecated + //$event->contact->id=$obj->fk_contact; // deprecated // Defined date_start_in_calendar and date_end_in_calendar property // They are date start and end of action but modified to not be outside calendar view. @@ -424,7 +423,7 @@ if ($resql) else $event->date_end_in_calendar=$event->datep; } else - { + { $event->date_start_in_calendar=$event->datep; if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef; else $event->date_end_in_calendar=$event->datep; @@ -437,14 +436,14 @@ if ($resql) // Check values if ($event->date_end_in_calendar < $firstdaytoshow || - $event->date_start_in_calendar > $lastdaytoshow) + $event->date_start_in_calendar >= $lastdaytoshow) { // This record is out of visible range } else - { + { if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow; - if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=$lastdaytoshow; + if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1); // Add an entry in actionarray for each day $daycursor=$event->date_start_in_calendar; @@ -456,7 +455,7 @@ if ($resql) $loop=true; $j=0; $daykey=dol_mktime(0,0,0,$mois,$jour,$annee); do - { + { //if ($event->id==408) print 'daykey='.$daykey.' '.$event->datep.' '.$event->datef.'
'; $eventarray[$daykey][]=$event; @@ -479,7 +478,6 @@ else dol_print_error($db); } - $maxnbofchar=18; $cachethirdparties=array(); $cachecontacts=array(); @@ -598,8 +596,12 @@ else $usernames = $tmpgroup->listUsersForGroup(); } +// Load array of colors by type +// TODO +$colorsbytype=array(); // Loop on each user to show calendar +$todayarray=dol_getdate($now,'fast'); $sav = $tmpday; $showheader = true; foreach ($usernames as $username) @@ -608,6 +610,7 @@ foreach ($usernames as $username) echo '' . $username->getNomUrl(1). ''; $tmpday = $sav; + // Lopp on each day of week $i = 0; for ($iter_day = 0; $iter_day < 7; $iter_day++) { @@ -627,11 +630,10 @@ foreach ($usernames as $username) $style='cal_current_month'; if ($iter_day == 6) $style.=' cal_other_month'; $today=0; - $todayarray=dol_getdate($now,'fast'); - if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1; + if ($todayarray['mday']==$tmpday && $todayarray['mon']==$tmpmonth && $todayarray['year']==$tmpyear) $today=1; if ($today) $style='cal_today_peruser'; - show_day_events2($username, $tmpday, $month, $year, $monthshown, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader); + show_day_events2($username, $tmpday, $tmpmonth, $tmpyear, $monthshown, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype); $i++; } @@ -641,7 +643,6 @@ foreach ($usernames as $username) echo "\n"; - // Add js code to manage click on a box print '