diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index c1882ce4bf9ce..4df9b56979d7f 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -41,29 +41,15 @@ function printBookmarksList($aDb, $aLangs) $langs->load("bookmarks"); $url= $_SERVER["PHP_SELF"].(! empty($_SERVER["QUERY_STRING"])?'?'.$_SERVER["QUERY_STRING"]:''); - // TODO Add post param to $url $ret = ''; // Menu bookmark - /* - $ret.= ''; - */ $ret.= ''."\n"; - $ret.= '
'; - $ret.= ''; $ret.= ''; $ret.= ''; // Url to go on create new bookmark page @@ -77,19 +63,18 @@ function printBookmarksList($aDb, $aLangs) { $sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark"; $sql.= " WHERE (fk_user = ".$user->id." OR fk_user is NULL OR fk_user = 0)"; - $sql.= " AND entity = ".$conf->entity; + $sql.= " AND entity IN (".getEntity('bookmarks',1).")"; $sql.= " ORDER BY position"; if ($resql = $db->query($sql) ) { $i=0; while ($i < $conf->global->BOOKMARKS_SHOW_IN_MENU && $obj = $db->fetch_object($resql)) { - //$ret.=''; + $ret.=''; $i++; } } diff --git a/htdocs/core/ajax/check_notifications.php b/htdocs/core/ajax/check_notifications.php index 332626fbabd6f..6984bbff5b4fa 100644 --- a/htdocs/core/ajax/check_notifications.php +++ b/htdocs/core/ajax/check_notifications.php @@ -33,7 +33,7 @@ global $user, $db, $langs, $conf; -$time = (int) GETPOST('time'); // Use the time parameter that is always increased by time_update, even if call is late +$time = (int) GETPOST('time','int'); // Use the time parameter that is always increased by time_update, even if call is late //$time=dol_now(); diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 4c492d1693e97..2d5b8d2f6db21 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -54,7 +54,7 @@ function dol_basename($pathfile) * @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file',...) * @see dol_dir_list_indatabase */ -function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=false) +function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0) { global $db, $hookmanager; global $object; @@ -483,6 +483,8 @@ function dolReplaceInFile($srcfile, $arrayreplacement, $destfile='', $newmask=0) dol_delete_file($tmpdestfile); + // Create $newpathoftmpdestfile from $newpathofsrcfile + diff --git a/htdocs/install/default.css b/htdocs/install/default.css index b3905e63a4965..e23a36ddd21dc 100644 --- a/htdocs/install/default.css +++ b/htdocs/install/default.css @@ -289,11 +289,11 @@ div.comment { } h3 { - margin-top: 10px; + margin-top: 20px; font-size:16px; font-weight: normal; - color: #4965B3; - text-shadow: 1px 1px 1px #c0c0c0; + color: rgb(100,60,20); + /* text-shadow: 1px 1px 1px #c0c0c0; */ } tr.bg1 { @@ -345,15 +345,15 @@ ul { .button { background: #fcfcfc; - border: 1px solid #d0d0d0; + border: 1px solid #e0e0e0; padding: 0.3em 0.7em; margin: 0 0.5em; - -moz-border-radius:0 5px 0 5px; - -webkit-border-radius:0 5px 0 5px; - border-radius:0 5px 0 5px; - -moz-box-shadow: 2px 2px 3px #CCC; - -webkit-box-shadow: 2px 2px 3px #CCC; - box-shadow: 2px 2px 3px #CCC; + -moz-border-radius: 5px 5px 5px 5px; + -webkit-border-radius: 5px 5px 5px 5px; + border-radius: 5px 5px 5px 5px; + -moz-box-shadow: 2px 2px 3px #ddd; + -webkit-box-shadow: 2px 2px 3px #ddd; + box-shadow: 2px 2px 3px #ddd; } a.button:hover { text-decoration:none; @@ -368,3 +368,12 @@ a.button:hover { .center { text-align: center; } + +.valignmiddle { + vertical-align: middle; +} + +.valigntextbottom { + vertical-align: text-bottom; +} + diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index cdd639ad50b8c..c0a3aaf65fdba 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -86,7 +86,7 @@ if (! empty($force_install_message)) { - print '
'.$langs->trans($force_install_message).'
'; + print '

'.$langs->trans($force_install_message).'
'; /*print ''; +$sql = "SELECT"; +$sql.= " t.rowid,"; +$sql.= " t.field1,"; +$sql.= " t.field2"; +// Add fields from extrafields +foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql.= " FROM ".MAIN_DB_PREFIX."mytable as t"; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."mytable_extrafields as ef on (t.rowid = ef.fk_object)"; +$sql.= " WHERE 1 = 1"; +//$sql.= " WHERE u.entity IN (".getEntity('mytable',1).")"; +if ($search_field1) $sql.= natural_search("field1",$search_field1); +if ($search_field2) $sql.= natural_search("field2",$search_field2); +if ($sall) $sql.= natural_search(array_keys($fieldstosearchall), $sall); +// Add where from extra fields +foreach ($search_array_options as $key => $val) +{ + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $typ=$extrafields->attribute_type[$tmpkey]; + $mode=0; + if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric + if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) + { + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + } +} +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql.=$db->order($sortfield,$sortorder); + +// Count total nb of records +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + +$sql.= $db->plimit($limit+1, $offset); + +dol_syslog($script_file, LOG_DEBUG); +$resql=$db->query($sql); +if (! $resql) +{ + dol_print_error($db); + exit; +} + +$num = $db->num_rows($resql); + +// Direct jump if only one record found +if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) +{ + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".DOL_URL_ROOT.'/skeleton/card.php?id='.$id); + exit; +} + +llxHeader('', $title, $help_url); + +$arrayofselected=is_array($toselect)?$toselect:array(); + +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +if ($search_field1 != '') $param.= '&search_field1='.urlencode($search_field1); +if ($search_field2 != '') $param.= '&search_field2='.urlencode($search_field2); +if ($optioncss != '') $param.='&optioncss='.$optioncss; +// Add $param from extra fields +foreach ($search_array_options as $key => $val) +{ + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); +} + +$arrayofmassactions = array( + 'presend'=>$langs->trans("SendByMail"), + 'builddoc'=>$langs->trans("PDFMerge"), +); +if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); +if ($massaction == 'presend') $arrayofmassactions=array(); +$massactionbutton=$form->selectMassAction('', $arrayofmassactions); + +print ''; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); + +if ($sall) +{ + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); +} + +$moreforfilter = ''; +$moreforfilter.='
'; +$moreforfilter.= $langs->trans('MyFilter') . ': '; +$moreforfilter.= '
'; + +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook +if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; +else $moreforfilter = $hookmanager->resPrint; + +if (! empty($moreforfilter)) +{ + print '
'; + print $moreforfilter; + print '
'; +} + +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields -// TODO +print '
'; +print ''."\n"; +// Fields title +print ''; +// LIST_OF_TD_TITLE_FIELDS +//if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($arrayfields['t.field1']['label'],$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder); +//if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($arrayfields['t.field2']['label'],$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder); +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + $sortonfield = "ef.".$key; + if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; + print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + } + } +} +// Hook fields +$parameters=array('arrayfields'=>$arrayfields); +$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'],$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'],$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +//if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"t.status","",$param,'align="center"',$sortfield,$sortorder); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); +print ''."\n"; + +// Fields title search +print ''; +// LIST_OF_TD_TITLE_SEARCH +//if (! empty($arrayfields['t.field1']['checked'])) print ''; +//if (! empty($arrayfields['t.field2']['checked'])) print ''; +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + $typeofextrafield=$extrafields->attribute_type[$key]; + print ''; + } + } +} +// Fields from hook +$parameters=array('arrayfields'=>$arrayfields); +$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +if (! empty($arrayfields['t.datec']['checked'])) +{ + // Date creation + print ''; +} +if (! empty($arrayfields['t.tms']['checked'])) +{ + // Date modification + print ''; +} +/*if (! empty($arrayfields['u.statut']['checked'])) +{ + // Status + print ''; +}*/ +// Action column +print ''; +print ''."\n"; + + +// Detect if we need a fetch on each output line +$needToFetchEachLine=0; +foreach ($extrafields->attribute_computed as $key => $val) +{ + if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object +} +$i=0; +$totalarray=array(); +while ($i < min($num, $limit)) +{ + $obj = $db->fetch_object($resql); + if ($obj) + { + // Show here line of result + print ''; + // LIST_OF_TD_FIELDS_LIST + /* + if (! empty($arrayfields['t.field1']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['t.field2']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + }*/ + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + print 'getAlignFlag($key); + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); + print ''; + if (! $i) $totalarray['nbfield']++; + } + } + } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (! empty($arrayfields['t.datec']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Date modification + if (! empty($arrayfields['t.tms']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Status + /* + if (! empty($arrayfields['u.statut']['checked'])) + { + $userstatic->statut=$obj->statut; + print ''; + }*/ + + // Action column + print ''; + if (! $i) $totalarray['nbfield']++; + + print ''; + } + $i++; +} + +// Show total line +if (isset($totalarray['totalhtfield'])) +{ + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if ($i == 1) + { + if ($num < $limit) print ''; + else print ''; + } + elseif ($totalarray['totalhtfield'] == $i) print ''; + elseif ($totalarray['totalvatfield'] == $i) print ''; + elseif ($totalarray['totalttcfield'] == $i) print ''; + else print ''; + } + print ''; +} + +$db->free($resql); + +$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print '
'; + if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attribute_computed[$key])) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $searchclass=''; + if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; + if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; + print ''; + } + print ''; + print ''; + print ''; + print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut); + print ''; +$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); +print $searchpicto; +print '
'.$obj->field1.''.$obj->field2.''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour'); + print ''.$userstatic->getLibStatut(3).''; + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + { + $selected=0; + if (in_array($obj->rowid, $arrayofselected)) $selected=1; + print ''; + } + print '
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totalht']).''.price($totalarray['totalvat']).''.price($totalarray['totalttc']).'
'."\n"; +print '
'."\n"; + +print ''."\n"; + + +if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) +{ + // Show list of available documents + $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; + $urlsource.=str_replace('&','&',$param); + + $filedir=$diroutputmassaction; + $genallowed=$user->rights->facture->lire; + $delallowed=$user->rights->facture->lire; + + print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); +} +else +{ + print '
'.$langs->trans("ShowTempMassFilesArea").''; +} -// Example 2: Adding links to objects -// The class must extend CommonObject for this method to be available -$somethingshown = $form->showLinkedObjectBlock($myobject); // End of page llxFooter(); +$db->close(); diff --git a/htdocs/modulebuilder/template/scripts/myobject.php b/htdocs/modulebuilder/template/scripts/myobject.php new file mode 100644 index 0000000000000..af381b0bfae00 --- /dev/null +++ b/htdocs/modulebuilder/template/scripts/myobject.php @@ -0,0 +1,165 @@ +#!/usr/bin/env php + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/modulebuilder/template/scripts/myobject.php + * \ingroup mymodule + * \brief This file is an example for a command line script to work on MyObject + */ + +$sapi_type = php_sapi_name(); +$script_file = basename(__FILE__); +$path=dirname(__FILE__).'/'; + +// Test if batch mode +if (substr($sapi_type, 0, 3) == 'cgi') { + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; + exit(-1); +} + +// Global variables +$version='1.0'; +$error=0; + + +// -------------------- START OF YOUR CODE HERE -------------------- +@set_time_limit(0); // No timeout for this script +define('EVEN_IF_ONLY_LOGIN_ALLOWED',1); // Set this define to 0 if you want to lock your script when dolibarr setup is "locked to admin user only". + +// Include and load Dolibarr environment variables +require_once($path."../../htdocs/master.inc.php"); +// After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file). +// $user is created but empty. + +//$langs->setDefaultLang('en_US'); // To change default language of $langs +$langs->load("main"); // To load language file for default language + +// Load user and its permissions +$result=$user->fetch('','admin'); // Load user for login 'admin'. Comment line to run as anonymous user. +if (! $result > 0) { dol_print_error('',$user->error); exit; } +$user->getrights(); + + +print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; +if (! isset($argv[1])) { // Check parameters + print "Usage: ".$script_file." param1 param2 ...\n"; + exit(-1); +} +print '--- start'."\n"; +print 'Argument 1='.$argv[1]."\n"; +print 'Argument 2='.$argv[2]."\n"; + + +// Start of transaction +$db->begin(); + + +// Examples for manipulating class MyObject +dol_include_once("/mymodule/class/myobject.class.php"); +$myobject=new MyObject($db); + +// Example for inserting creating object in database +/* +dol_syslog($script_file." CREATE", LOG_DEBUG); +$myobject->prop1='value_prop1'; +$myobject->prop2='value_prop2'; +$id=$myobject->create($user); +if ($id < 0) { $error++; dol_print_error($db,$myobject->error); } +else print "Object created with id=".$id."\n"; +*/ + +// Example for reading object from database +/* +dol_syslog($script_file." FETCH", LOG_DEBUG); +$result=$myobject->fetch($id); +if ($result < 0) { $error; dol_print_error($db,$myobject->error); } +else print "Object with id=".$id." loaded\n"; +*/ + +// Example for updating object in database ($myobject must have been loaded by a fetch before) +/* +dol_syslog($script_file." UPDATE", LOG_DEBUG); +$myobject->prop1='newvalue_prop1'; +$myobject->prop2='newvalue_prop2'; +$result=$myobject->update($user); +if ($result < 0) { $error++; dol_print_error($db,$myobject->error); } +else print "Object with id ".$myobject->id." updated\n"; +*/ + +// Example for deleting object in database ($myobject must have been loaded by a fetch before) +/* +dol_syslog($script_file." DELETE", LOG_DEBUG); +$result=$myobject->delete($user); +if ($result < 0) { $error++; dol_print_error($db,$myobject->error); } +else print "Object with id ".$myobject->id." deleted\n"; +*/ + + +// An example of a direct SQL read without using the fetch method +/* +$sql = "SELECT field1, field2"; +$sql.= " FROM ".MAIN_DB_PREFIX."myobject"; +$sql.= " WHERE field3 = 'xxx'"; +$sql.= " ORDER BY field1 ASC"; + +dol_syslog($script_file, LOG_DEBUG); +$resql=$db->query($sql); +if ($resql) +{ + $num = $db->num_rows($resql); + $i = 0; + if ($num) + { + while ($i < $num) + { + $obj = $db->fetch_object($resql); + if ($obj) + { + // You can use here results + print $obj->field1; + print $obj->field2; + } + $i++; + } + } +} +else +{ + $error++; + dol_print_error($db); +} +*/ + + +// -------------------- END OF YOUR CODE -------------------- + +if (! $error) +{ + $db->commit(); + print '--- end ok'."\n"; +} +else +{ + print '--- end error code='.$error."\n"; + $db->rollback(); +} + +$db->close(); // Close $db database opened handler + +exit($error); diff --git a/htdocs/modulebuilder/template/scripts/myscript.php b/htdocs/modulebuilder/template/scripts/myscript.php deleted file mode 100644 index 468729c59f31b..0000000000000 --- a/htdocs/modulebuilder/template/scripts/myscript.php +++ /dev/null @@ -1,203 +0,0 @@ -#!/usr/bin/env php - - * Copyright (C) - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file scripts/myscript.php - * \ingroup mymodule - * \brief Example command line script. - * - * Put detailed description here. - */ - -$sapi_type = php_sapi_name(); -$script_file = basename(__FILE__); -$path = dirname(__FILE__) . '/'; - -// Test if batch mode -if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Error: You are using PHP for CGI. To execute "; - echo $script_file; - echo " from command line, you must use PHP for CLI mode.\n"; - exit; -} - -// Global variables -$version = '1.0.0'; -$error = 0; - - -/* - * -------------------- YOUR CODE STARTS HERE -------------------- - */ -/* Set this define to 0 if you want to allow execution of your script - * even if dolibarr setup is "locked to admin user only". */ -define('EVEN_IF_ONLY_LOGIN_ALLOWED', 0); - -/* Include Dolibarr environment - * Customize to your needs - */ -require_once $path . '../../../master.inc.php'; -/* After this $db, $conf, $langs, $mysoc, $user and other Dolibarr utility variables should be defined. - * Warning: this still requires a valid htdocs/conf.php file - */ - -global $conf, $db, $langs, $mysoc, $user; - -// No timeout for this script -@set_time_limit(0); - -// Set the default language -//$langs->setDefaultLang('en_US'); - -// Load translations for the default language -$langs->load("main"); - -/* User and permissions loading - * Loads user for login 'admin'. - * Comment out to run as anonymous user. */ -$result = $user->fetch('', 'admin'); -if (! $result > 0) { - dol_print_error('', $user->error); - exit; -} -$user->getrights(); - -// Display banner and help -echo "***** " . $script_file . " (" . $version . ") pid=" . getmypid() . " *****\n"; -dol_syslog($script_file . " launched with arg " . join(',', $argv)); -if (! isset($argv[1])) { - // Check parameters - echo "Usage: " . $script_file . " param1 param2 ...\n"; - exit; -} -echo '--- start' . "\n"; -echo 'Argument 1=' . $argv[1] . "\n"; -echo 'Argument 2=' . $argv[2] . "\n"; - -// Start database transaction -$db->begin(); - -// Examples for manipulating a class -require_once '../class/myclass.class.php'; -$myobject = new MyClass($db); - -// Example for inserting creating object in database -/* - dol_syslog($script_file . " CREATE", LOG_DEBUG); - $myobject->prop1 = 'value_prop1'; - $myobject->prop2 = 'value_prop2'; - $id = $myobject->create($user); - if ($id < 0) { - $error++; - dol_print_error($db, $myobject->error); - } else { - echo "Object created with id=" . $id . "\n"; - } - */ - -// Example for reading object from database -/* - dol_syslog($script_file . " FETCH", LOG_DEBUG); - $result = $myobject->fetch($id); - if ($result < 0) { - $error; - dol_print_error($db, $myobject->error); - } else { - echo "Object with id=" . $id . " loaded\n"; - } - */ - -// Example for updating object in database -// ($myobject must have been loaded by a fetch before) -/* - dol_syslog($script_file . " UPDATE", LOG_DEBUG); - $myobject->prop1 = 'newvalue_prop1'; - $myobject->prop2 = 'newvalue_prop2'; - $result = $myobject->update($user); - if ($result < 0) { - $error++; - dol_print_error($db, $myobject->error); - } else { - echo "Object with id " . $myobject->id . " updated\n"; - } - */ - -// Example for deleting object in database -// ($myobject must have been loaded by a fetch before) -/* - dol_syslog($script_file . " DELETE", LOG_DEBUG); - $result = $myobject->delete($user); - if ($result < 0) { - $error++; - dol_print_error($db, $myobject->error); - } else { - echo "Object with id " . $myobject->id . " deleted\n"; - } - */ - -// An example of a direct SQL read without using the fetch method -/* - $sql = "SELECT field1, field2"; - $sql.= " FROM " . MAIN_DB_PREFIX . "c_pays"; - $sql.= " WHERE field3 = 'xxx'"; - $sql.= " ORDER BY field1 ASC"; - - dol_syslog($script_file . " sql=" . $sql, LOG_DEBUG); - $resql=$db->query($sql); - if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - if ($num) { - while ($i < $num) { - $obj = $db->fetch_object($resql); - if ($obj) { - // You can use here results - echo $obj->field1; - echo $obj->field2; - } - $i++; - } - } - } else { - $error++; - dol_print_error($db); - } - */ - - -/* - * --------------------- YOUR CODE ENDS HERE ---------------------- - */ - -// Error management -if (! $error) { - $db->commit(); - echo '--- end ok' . "\n"; - $exit_status = 0; // UNIX no errors exit status -} else { - echo '--- end error code=' . $error . "\n"; - $db->rollback(); - $exit_status = 1; // UNIX general error exit status -} - -// Close database handler -$db->close(); - -// Return exit status code -return $exit_status; diff --git a/htdocs/modulebuilder/template/sql/data.sql b/htdocs/modulebuilder/template/sql/data.sql index 90e9e0ced2b02..82266dc08b3d8 100644 --- a/htdocs/modulebuilder/template/sql/data.sql +++ b/htdocs/modulebuilder/template/sql/data.sql @@ -14,6 +14,6 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -INSERT INTO llx_mytable VALUES ( +INSERT INTO llx_myobject VALUES ( 1, 1, 'mydata' ); diff --git a/htdocs/modulebuilder/template/sql/llx_mytable.key.sql b/htdocs/modulebuilder/template/sql/llx_myobject.key.sql similarity index 90% rename from htdocs/modulebuilder/template/sql/llx_mytable.key.sql rename to htdocs/modulebuilder/template/sql/llx_myobject.key.sql index 56975f55a0152..6fd4bb4cda66f 100644 --- a/htdocs/modulebuilder/template/sql/llx_mytable.key.sql +++ b/htdocs/modulebuilder/template/sql/llx_myobject.key.sql @@ -14,4 +14,4 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -ALTER TABLE llx_mytable ADD UNIQUE INDEX uk_fk_othertable (fk_othertable); +ALTER TABLE llx_myobject ADD UNIQUE INDEX uk_fk_othertable (fk_othertable); diff --git a/htdocs/modulebuilder/template/sql/llx_mytable.sql b/htdocs/modulebuilder/template/sql/llx_myobject.sql similarity index 97% rename from htdocs/modulebuilder/template/sql/llx_mytable.sql rename to htdocs/modulebuilder/template/sql/llx_myobject.sql index 2ef08b7fca156..edcd7a7c26dca 100644 --- a/htdocs/modulebuilder/template/sql/llx_mytable.sql +++ b/htdocs/modulebuilder/template/sql/llx_myobject.sql @@ -14,7 +14,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -CREATE TABLE llx_mytable( +CREATE TABLE llx_myobject( rowid INTEGER AUTO_INCREMENT PRIMARY KEY, entity INTEGER DEFAULT 1 NOT NULL, fk_othertable INTEGER NOT NULL, diff --git a/htdocs/modulebuilder/template/test/functional/MyModuleFunctionalTest.php b/htdocs/modulebuilder/template/test/phpunit/MyModuleFunctionalTest.php similarity index 100% rename from htdocs/modulebuilder/template/test/functional/MyModuleFunctionalTest.php rename to htdocs/modulebuilder/template/test/phpunit/MyModuleFunctionalTest.php diff --git a/htdocs/modulebuilder/template/test/unit/MyClassTest.php b/htdocs/modulebuilder/template/test/phpunit/MyObjectTest.php similarity index 91% rename from htdocs/modulebuilder/template/test/unit/MyClassTest.php rename to htdocs/modulebuilder/template/test/phpunit/MyObjectTest.php index 94898e9209bc5..37a65323fdafd 100644 --- a/htdocs/modulebuilder/template/test/unit/MyClassTest.php +++ b/htdocs/modulebuilder/template/test/phpunit/MyObjectTest.php @@ -17,20 +17,18 @@ */ /** - * \file test/unit/MyClassTest.php + * \file test/unit/MyObjectTest.php * \ingroup mymodule - * \brief Example PHPUnit test. - * - * Put detailed description here. + * \brief PHPUnit test for MyObject class. */ namespace test\unit; /** - * Class MyClassTest + * Class MyObjectTest * @package Testmymodule */ -class MyClassTest extends \PHPUnit_Framework_TestCase +class MyObjectTest extends \PHPUnit_Framework_TestCase { /** * Global test setup diff --git a/htdocs/theme/common/ical.gif b/htdocs/theme/common/ical.gif deleted file mode 100644 index 01cc8cde5643d..0000000000000 Binary files a/htdocs/theme/common/ical.gif and /dev/null differ diff --git a/htdocs/theme/common/information.png b/htdocs/theme/common/information.png deleted file mode 100644 index 231d39426c5bf..0000000000000 Binary files a/htdocs/theme/common/information.png and /dev/null differ diff --git a/htdocs/theme/common/rss.gif b/htdocs/theme/common/rss.gif deleted file mode 100644 index 16c96dd33756b..0000000000000 Binary files a/htdocs/theme/common/rss.gif and /dev/null differ diff --git a/htdocs/theme/common/vcal.gif b/htdocs/theme/common/vcal.gif deleted file mode 100644 index 6ff53f5b7bc36..0000000000000 Binary files a/htdocs/theme/common/vcal.gif and /dev/null differ diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index a8eddcd825f0d..3e995d83c83b0 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1782,7 +1782,7 @@ a.vsmenu:link, a.vsmenu:visited { color: #; white-space: nowrap; } font.vsmenudisabledmargin { margin: 1px 1px 1px 6px; } -a.help:link, a.help:visited, a.help:hover, a.help:active, span.help { font-size:px; font-family: ; text-align: ; font-weight: normal; color: #666666; text-decoration: none; } +a.help:link, a.help:visited, a.help:hover, a.help:active, span.help { font-size:px; font-family: ; text-align: ; font-weight: normal; color: #aaa; text-decoration: none; } .vmenu div.blockvmenufirst, .vmenu div.blockvmenulogo, .vmenu div.blockvmenusearchphone, .vmenu div.blockvmenubookmarks { @@ -1815,6 +1815,7 @@ } div.blockvmenubookmarks { + padding-top: 10px !important; padding-bottom: 16px !important; } div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks, div.blockvmenuend diff --git a/htdocs/theme/login_background.png b/htdocs/theme/login_background.png deleted file mode 100644 index facc2c6f4423e..0000000000000 Binary files a/htdocs/theme/login_background.png and /dev/null differ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 943540fa02f57..4fd3d736f04ca 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1805,7 +1805,7 @@ a.vsmenu:link, a.vsmenu:visited { color: #; white-space: nowrap; } font.vsmenudisabledmargin { margin: 1px 1px 1px 8px; } -a.help:link, a.help:visited, a.help:hover, a.help:active, span.help { font-size:px; font-family: ; text-align: ; font-weight: normal; color: #666666; text-decoration: none; } +a.help:link, a.help:visited, a.help:hover, a.help:active, span.help { font-size:px; font-family: ; text-align: ; font-weight: normal; color: #999; text-decoration: none; } div.blockvmenulogo {