diff --git a/.scrutinizer.yml b/.scrutinizer.yml index a176c114cb8..73b43e95f4b 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -100,8 +100,9 @@ tools: comparison_of_bit_result: true basic_semantic_checks: enabled: true + # Disabled unused code. In most cases, we want to keep it. unused_code: - enabled: true + enabled: false deprecation_checks: enabled: true useless_function_calls: diff --git a/ChangeLog b/ChangeLog index d97bfe9a9ce..409c885050f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -133,6 +133,12 @@ Fix: [ bug #1393 ] PHP Warning when creating a supplier invoice. Fix: [ bug #1399 ] [pgsql] Silent warning when setting a propal as "facturée" in propal.php Fix: When number reach 9999 with default numbering module, next number will be 10000 instead of 0000 and error. +Fix: element page on project give wrong href link. +Fix: [ bug #1397 ] Filter by supplier orders with status Draft does not filter. +Fix: [ bug #1388 ] Wrong date when invoicing several orders. +Fix: [ bug #1411 ] Unable to set an expedition note if invoices module is not enabled. +Fix: [ bug #1407 ] Rouget pdf overlapped when using tracking number and public notes. +Fix: [ bug #1405 ] Rouget PDF expedition incorrect when two expeditions under the same commande ***** ChangeLog for 3.5.2 compared to 3.5.1 ***** Fix: Can't add user for a task. @@ -220,6 +226,7 @@ Fix: [ bug #1306 ] Fatal error when adding an external calendar. New: Added es_CL language Fix: Margin tabs bad data show Fix: [ bug #1318 ] Problem with enter key when adding an existing product to a customer invoice. +Fix: [ bug #1410 ] Add customer order line asks for required Unit Price but doesn't interrupt the creation of the line ***** ChangeLog for 3.5 compared to 3.4.* ***** For users: diff --git a/build/debian/README.howto b/build/debian/README.howto index 78f93cd46cc..6b6e71c4874 100644 --- a/build/debian/README.howto +++ b/build/debian/README.howto @@ -229,7 +229,9 @@ from origin/upstream and origin/pristine. * If new upstream is available onto sourceforge, launch: > debian/get-orig-source.sh -* Edit tgz file to remove ckeditor and phpexcel and renama file into dolibarr-x.y.z+dsfgw.tgz +* Edit tgz file to remove ckeditor and phpexcel and rename file into +dolibarr-x.y.z+dsfgw.tgz +(x.y.z = version, w start from 1 and is increased for each new import) * Staying into git root directory, run > git-import-orig -vv ../dolibarr-x.y.z+dsfgw.tgz diff --git a/build/dmg/dolimamp/install.forced.php b/build/dmg/dolimamp/install.forced.php index da6238945ba..31d0b5ae685 100644 --- a/build/dmg/dolimamp/install.forced.php +++ b/build/dmg/dolimamp/install.forced.php @@ -14,4 +14,3 @@ $force_install_databaserootpass='root'; $force_install_dolibarrlogin='admin'; $force_install_nophpinfo='1'; $force_install_lockinstall='444'; -?> \ No newline at end of file diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 62c6c60fc9c..973b0f65036 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -452,6 +452,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/adapters`; # Keep this removal in case we embed libraries #$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/_source`; # _source must be kept into tarball + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/datatables/extras/TableTools/swf`; # Source of this flash is not available $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`; diff --git a/dev/examples/create_invoice.php b/dev/examples/create_invoice.php index 03bc03ac3d2..d59655ef613 100755 --- a/dev/examples/create_invoice.php +++ b/dev/examples/create_invoice.php @@ -115,4 +115,3 @@ else $db->close(); return $error; -?> diff --git a/dev/rmphpclosingtag.sh b/dev/rmphpclosingtag.sh new file mode 100755 index 00000000000..ec755bc399b --- /dev/null +++ b/dev/rmphpclosingtag.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# vim:ft=sh:ts=3:sts=3:sw=3:et: + +### +# Strips the closing php tag `?>` and any following blank lines from the +# end of any PHP file in the current working directory and sub-directories. Files +# with non-whitespace characters following the closing tag will not be affected. +# +# Author: Bryan C. Geraghty +# Date: 2009-10-28 +# Source: http://bryan.ravensight.org/2010/07/remove-php-closing-tag/ +## + +FILES=$(pcregrep -rnM --include='^.*\.php$' '^\?\>(?=([\s\n]+)?$(?!\n))' .); + +for MATCH in $FILES; +do + FILE=`echo $MATCH | awk -F ':' '{print $1}'`; + TARGET=`echo $MATCH | awk -F ':' '{print $2}'`; + LINE_COUNT=`wc -l $FILE | awk -F " " '{print $1}'`; + echo "Removing lines ${TARGET} through ${LINE_COUNT} from file $FILE..."; + sed -i "${TARGET},${LINE_COUNT}d" $FILE; +done; diff --git a/dev/skeletons/skeleton_class.class.php b/dev/skeletons/skeleton_class.class.php index 072375c89d9..c36dad4b4b5 100644 --- a/dev/skeletons/skeleton_class.class.php +++ b/dev/skeletons/skeleton_class.class.php @@ -371,4 +371,3 @@ class Skeleton_Class extends CommonObject } } -?> diff --git a/dev/skeletons/skeleton_webservice_server.php b/dev/skeletons/skeleton_webservice_server.php index dca2ae7a564..278057fd4f6 100644 --- a/dev/skeletons/skeleton_webservice_server.php +++ b/dev/skeletons/skeleton_webservice_server.php @@ -271,4 +271,3 @@ function createSkeleton($authentication,$skeleton) // Return the results. $server->service($HTTP_RAW_POST_DATA); -?> diff --git a/dev/translation/autotranslator.class.php b/dev/translation/autotranslator.class.php index 288cda7101d..63a69c4b2ef 100644 --- a/dev/translation/autotranslator.class.php +++ b/dev/translation/autotranslator.class.php @@ -338,4 +338,3 @@ class autoTranslator } } -?> diff --git a/dev/translation/strip_language_file.php b/dev/translation/strip_language_file.php index 62cb86c99eb..fc778770bb9 100755 --- a/dev/translation/strip_language_file.php +++ b/dev/translation/strip_language_file.php @@ -264,4 +264,3 @@ foreach($filesToProcess as $fileToProcess) return 0; -?> diff --git a/htdocs/accountancy/class/accountancyaccount.class.php b/htdocs/accountancy/class/accountancyaccount.class.php index 6190969abd3..229bc79ba41 100644 --- a/htdocs/accountancy/class/accountancyaccount.class.php +++ b/htdocs/accountancy/class/accountancyaccount.class.php @@ -93,4 +93,3 @@ class AccountancyAccount } } -?> diff --git a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php index dad66600d0e..b88e4b2134f 100644 --- a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php +++ b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php @@ -62,7 +62,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon */ private function getTitle($action) { - global $langs; + global $langs,$conf; $out=''; diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 91c786b2a10..0fcedb8e96d 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -138,7 +138,7 @@ if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights if ($_POST["userid"] != $object->user_id) // If link differs from currently in database { $result=$object->setUserId($_POST["userid"]); - if ($result < 0) dol_print_error($object->db,$object->error); + if ($result < 0) dol_print_error('',$object->error); $_POST['action']=''; $action=''; } @@ -172,7 +172,7 @@ if ($action == 'setsocid') if (! $error) { $result=$object->setThirdPartyId(GETPOST('socid','int')); - if ($result < 0) dol_print_error($object->db,$object->error); + if ($result < 0) dol_print_error('',$object->error); $_POST['action']=''; $action=''; } @@ -1101,4 +1101,3 @@ else llxFooter(); $db->close(); -?> \ No newline at end of file diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index ab964100c04..dbccbdb4f01 100644 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -280,4 +280,3 @@ print '
'; llxFooter(); $db->close(); -?> diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 73036747a6c..77cbff2918a 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -95,6 +95,8 @@ class Adherent extends CommonObject var $first_subscription_date; var $first_subscription_amount; var $last_subscription_date; + var $last_subscription_date_start; + var $last_subscription_date_end; var $last_subscription_amount; var $subscriptions=array(); diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 66f7508fa20..e861af709b8 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -99,8 +99,10 @@ class AdherentType extends CommonObject */ function update($user) { - global $hookmanager; - + global $hookmanager,$conf; + + $error=0; + $this->libelle=trim($this->libelle); $sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type "; @@ -116,6 +118,8 @@ class AdherentType extends CommonObject $result = $this->db->query($sql); if ($result) { + $action='update'; + // Actions on extra fields (by external module or standard code) $hookmanager->initHooks(array('membertypedao')); $parameters=array('membertype'=>$this->id); @@ -132,8 +136,8 @@ class AdherentType extends CommonObject } } else if ($reshook < 0) $error++; - - + + return 1; } else diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 7cbb0ce0370..371854410b0 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -30,8 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -if (!$user->admin) - accessforbidden(); +if (!$user->admin) accessforbidden(); $langs->load("agenda"); $langs->load("admin"); @@ -63,7 +62,7 @@ if ($actionsave) // Save agendas while ($i <= $MAXAGENDA) { - $name=trim(GETPOST('agenda_ext_name'.$i),'alpha'); + $name=trim(GETPOST('agenda_ext_name'.$i,'alpha')); $src=trim(GETPOST('agenda_ext_src'.$i,'alpha')); $color=trim(GETPOST('agenda_ext_color'.$i,'alpha')); if ($color=='-1') $color=''; @@ -76,7 +75,7 @@ if ($actionsave) break; } - //print 'color='.$color; + //print '-name='.$name.'-color='.$color; $res=dolibarr_set_const($db,'AGENDA_EXT_NAME'.$i,$name,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; $res=dolibarr_set_const($db,'AGENDA_EXT_SRC'.$i,$src,'chaine',0,'',$conf->entity); @@ -218,8 +217,7 @@ print ''; print '
'; print '
'; - -print "trans("Save")."\">"; +print "trans("Save")."\">"; print "
"; print "\n"; diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 1d8110c00d6..988b49efd07 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -64,7 +64,7 @@ else if ($action == 'update') { if (GETPOST('submit_GENBARCODE_LOCATION')) { - $location = GETPOST('genbarcodelocation','alpha'); + $location = GETPOST('GENBARCODE_LOCATION','alpha'); $res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity); } if (GETPOST('submit_PRODUIT_DEFAULT_BARCODE_TYPE')) diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 5c2c8176842..d58a1576a31 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -468,4 +468,3 @@ print ''; llxFooter(); $db->close(); -?> diff --git a/htdocs/admin/compta.php b/htdocs/admin/compta.php index 2eee562f217..5c77149c0f0 100644 --- a/htdocs/admin/compta.php +++ b/htdocs/admin/compta.php @@ -170,4 +170,3 @@ print '

'.showModulesExludedForExte llxFooter(); $db->close(); -?> diff --git a/htdocs/admin/orderdet_extrafields.php b/htdocs/admin/orderdet_extrafields.php index a78ee9ea761..794cc1b890a 100644 --- a/htdocs/admin/orderdet_extrafields.php +++ b/htdocs/admin/orderdet_extrafields.php @@ -157,4 +157,3 @@ if ($action == 'edit' && ! empty($attrname)) llxFooter(); $db->close(); -?> \ No newline at end of file diff --git a/htdocs/admin/osc-languages.php b/htdocs/admin/osc-languages.php index 83446034f0d..804c72f2850 100644 --- a/htdocs/admin/osc-languages.php +++ b/htdocs/admin/osc-languages.php @@ -88,4 +88,3 @@ print ""; $db->close(); llxFooter(); -?> diff --git a/htdocs/admin/supplierorder_extrafields.php b/htdocs/admin/supplierorder_extrafields.php index 0dc27149006..9cb2dc65880 100644 --- a/htdocs/admin/supplierorder_extrafields.php +++ b/htdocs/admin/supplierorder_extrafields.php @@ -156,4 +156,3 @@ if ($action == 'edit' && ! empty($attrname)) llxFooter(); $db->close(); -?> \ No newline at end of file diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 3dae4273319..b69e8a4cacf 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -253,4 +253,3 @@ print "\n"; llxFooter(); $db->close(); -?> \ No newline at end of file diff --git a/htdocs/admin/system/about.php b/htdocs/admin/system/about.php index 48b690a7198..e7490225107 100644 --- a/htdocs/admin/system/about.php +++ b/htdocs/admin/system/about.php @@ -113,28 +113,23 @@ print '
  • Google print ''; -print $langs->trans("OfficialWebHostingService").':'; -$url='http://wiki.dolibarr.org/index.php/Cloud_Solutions'; $title=$langs->trans('List'); +print $langs->trans("OtherResources").':'; +print '
      '; + +$url='http://saas.dolibarr.org'; $title=$langs->trans("OfficialWebHostingService"); if (preg_match('/^fr_/i',$langs->getDefaultLang())) $url='http://wiki.dolibarr.org/index.php/Solutions_de_Cloud'; if (preg_match('/^es_/i',$langs->getDefaultLang())) $url='http://wiki.dolibarr.org/index.php/Soluciones_en_la_Nube'; -print ''; llxFooter(); $db->close(); -?> - - - - - - - - - - diff --git a/htdocs/admin/system/os.php b/htdocs/admin/system/os.php index 35645345426..669e8d84be9 100644 --- a/htdocs/admin/system/os.php +++ b/htdocs/admin/system/os.php @@ -51,4 +51,3 @@ print ''; llxFooter(); -?> diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index 590502f617d..27c447e7c15 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -86,18 +86,35 @@ print '
      '; // OPCode cache print '
      '; print ''.$langs->trans("OPCodeCache").': '; -$test1=function_exists('xcache_info'); -if ($test1) +$foundcache=0; +$test=function_exists('xcache_info'); +if (! $foundcache && $test) { + $foundcache++; print img_picto('','tick.png').' '.$langs->trans("XCacheInstalled"); print ' '.$langs->trans("MoreInformation").' Xcache admin page'; } -else +$test=function_exists('eaccelerator_info'); +if (! $foundcache && $test) { - $test2=function_exists('eaccelerator_info'); - if ($test2) print img_picto('','tick.png').' '.$langs->trans("EAcceleratorInstalled"); - else print $langs->trans("NoOPCodeCacheFound"); + $foundcache++; + print img_picto('','tick.png').' '.$langs->trans("EAcceleratorInstalled"); } +$test=function_exists('apc_cache_info'); +if (! $foundcache && $test) +{ + //var_dump(apc_cache_info()); + if (ini_get('apc.enabled')) + { + $foundcache++; + print img_picto('','tick.png').' '.$langs->trans("APCInstalled"); + } + else + { + print img_picto('','warning').' '.$langs->trans("APCCacheInstalledButDisabled"); + } +} +if (! $foundcache) print $langs->trans("NoOPCodeCacheFound"); print '
      '; // HTTPCacheStaticResources diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index bbb2c60e51f..22fecdfd524 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -120,4 +120,3 @@ foreach($phparray as $key => $value) llxFooter(); $db->close(); -?> \ No newline at end of file diff --git a/htdocs/admin/system/web.php b/htdocs/admin/system/web.php index 159915ee456..6c2e36a3e8e 100644 --- a/htdocs/admin/system/web.php +++ b/htdocs/admin/system/web.php @@ -64,4 +64,3 @@ print ''; llxFooter(); $db->close(); -?> diff --git a/htdocs/admin/tools/listsessions.php b/htdocs/admin/tools/listsessions.php index 5f12b6c150f..cab2881ed16 100644 --- a/htdocs/admin/tools/listsessions.php +++ b/htdocs/admin/tools/listsessions.php @@ -214,4 +214,3 @@ print '
      '; llxFooter(); $db->close(); -?> \ No newline at end of file diff --git a/htdocs/cashdesk/affContenu.php b/htdocs/cashdesk/affContenu.php index b88c78ffb4d..ca471e0bdf4 100644 --- a/htdocs/cashdesk/affContenu.php +++ b/htdocs/cashdesk/affContenu.php @@ -54,16 +54,23 @@ print '
  • '; print '
    '; -if ( $_GET['menu'] ) +$page=GETPOST('menu','alpha'); +if (in_array( + $page, + array( + 'deconnexion', + 'index','index_verif','facturation','facturation_verif','facturation_dhtml', + 'validation','validation_ok','validation_ticket','validation_verif', + ) + )) { - include $_GET['menu'].'.php'; + include $page.'.php'; } else { - include 'facturation.php'; + dol_print_error('','menu param '.$page.' is not inside allowed list'); } print '
    '; $_SESSION['serObjFacturation'] = serialize($obj_facturation); - diff --git a/htdocs/cashdesk/class/Auth.class.php b/htdocs/cashdesk/class/Auth.class.php index ac8d58f93d1..33bbd094050 100644 --- a/htdocs/cashdesk/class/Auth.class.php +++ b/htdocs/cashdesk/class/Auth.class.php @@ -141,4 +141,3 @@ class Auth } -?> \ No newline at end of file diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index 292252c2716..b2bb87a0bb2 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -653,4 +653,3 @@ class Facturation } -?> diff --git a/htdocs/cashdesk/facturation_verif.php b/htdocs/cashdesk/facturation_verif.php index 3b65d7dd132..42e1c00f651 100644 --- a/htdocs/cashdesk/facturation_verif.php +++ b/htdocs/cashdesk/facturation_verif.php @@ -166,4 +166,3 @@ $_SESSION['serObjFacturation'] = serialize($obj_facturation); header('Location: '.$redirection); exit; -?> diff --git a/htdocs/cashdesk/index_verif.php b/htdocs/cashdesk/index_verif.php index 9f7e0332046..c96b4f2b6f1 100644 --- a/htdocs/cashdesk/index_verif.php +++ b/htdocs/cashdesk/index_verif.php @@ -142,4 +142,3 @@ else exit; } -?> \ No newline at end of file diff --git a/htdocs/cashdesk/validation.php b/htdocs/cashdesk/validation.php index d9cd286691c..289c864ca32 100644 --- a/htdocs/cashdesk/validation.php +++ b/htdocs/cashdesk/validation.php @@ -26,4 +26,3 @@ $form=new Form($db); // Affichage des templates require ('tpl/validation1.tpl.php'); -?> diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index bca56b811b2..717d7269fa2 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -56,14 +56,13 @@ class ICal { $this->file = $file; $file_text=''; - + $tmparray=file($file); if (is_array($tmparray)) { $file_text = join("", $tmparray); //load file - $file_text = preg_replace("/[\r\n]{1,} ([:;])/","\\1",$file_text); + $file_text = preg_replace("/[\r\n]{1,} /","",$file_text); } - return $file_text; // return all text } @@ -115,6 +114,7 @@ class ICal { // get Key and Value VCALENDAR:Begin -> Key = VCALENDAR, Value = begin list($key, $value) = $this->retun_key_value($text); + //var_dump($text.' -> '.$key.' - '.$value); switch ($text) // search special string { @@ -165,6 +165,8 @@ class ICal } } } + + //var_dump($this->cal); return $this->cal; } @@ -236,6 +238,7 @@ class ICal */ function retun_key_value($text) { + /* preg_match("/([^:]+)[:]([\w\W]+)/", $text, $matches); if (empty($matches)) @@ -246,8 +249,8 @@ class ICal { $matches = array_splice($matches, 1, 2); return $matches; - } - + }*/ + return explode(':',$text,2); } /** diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 0f21d190773..92b87d94ad1 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -146,9 +146,11 @@ if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 0 $source='AGENDA_EXT_SRC'.$i; $name='AGENDA_EXT_NAME'.$i; $color='AGENDA_EXT_COLOR'.$i; + $buggedfile='AGENDA_EXT_BUGGEDFILE'.$i; if (! empty($conf->global->$source) && ! empty($conf->global->$name)) { - $listofextcals[]=array('src'=>$conf->global->$source,'name'=>$conf->global->$name,'color'=>$conf->global->$color); + // Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight' + $listofextcals[]=array('src'=>$conf->global->$source,'name'=>$conf->global->$name,'color'=>$conf->global->$color,'buggedfile'=>(isset($conf->global->buggedfile)?$conf->global->buggedfile:0)); } } } @@ -527,9 +529,11 @@ if (count($listofextcals)) $url=$extcal['src']; // Example: https://www.google.com/calendar/ical/eldy10%40gmail.com/private-cde92aa7d7e0ef6110010a821a2aaeb/basic.ics $namecal = $extcal['name']; $colorcal = $extcal['color']; - //print "url=".$url." namecal=".$namecal." colorcal=".$colorcal; + $buggedfile = $extcal['buggedfile']; + //print "url=".$url." namecal=".$namecal." colorcal=".$colorcal." buggedfile=".$buggedfile; $ical=new ICal(); $ical->parse($url); + // After this $ical->cal['VEVENT'] contains array of events, $ical->cal['DAYLIGHT'] contains daylight info, $ical->cal['STANDARD'] contains non daylight info, ... //var_dump($ical->cal); exit; $icalevents=array(); @@ -643,6 +647,8 @@ if (count($listofextcals)) // Loop on each entry into cal file to know if entry is qualified and add an ActionComm into $eventarray foreach($icalevents as $icalevent) { + //var_dump($icalevent); + //print $icalevent['SUMMARY'].'->'.var_dump($icalevent).'
    ';exit; if (! empty($icalevent['RRULE'])) continue; // We found a repeatable event. It was already split into unitary events, so we discard general rule. @@ -659,12 +665,36 @@ if (count($listofextcals)) $event->fulldayevent=true; $addevent=true; } - elseif (!is_array($icalevent['DTSTART'])) // not fullday event (DTSTART is not array) + elseif (!is_array($icalevent['DTSTART'])) // not fullday event (DTSTART is not array. It is a value like '19700101T000000Z' for 00:00 in greenwitch) { $datestart=$icalevent['DTSTART']; $dateend=$icalevent['DTEND']; $addevent=true; } + elseif (isset($icalevent['DTSTART']['unixtime'])) // File contains a local timezone + a TZ (for example when using bluemind) + { + $datestart=$icalevent['DTSTART']['unixtime']; + $dateend=$icalevent['DTEND']['unixtime']; + // $buggedfile is set to uselocalandtznodaylight if conf->global->AGENDA_EXT_BUGGEDFILEx = 'uselocalandtznodaylight' + if ($buggedfile === 'uselocalandtznodaylight') // unixtime is a local date that does not take daylight into account, TZID is +1 for example for 'Europe/Paris' in summer instead of 2 + { + // TODO + } + // $buggedfile is set to uselocalandtzdaylight if conf->global->AGENDA_EXT_BUGGEDFILEx = 'uselocalandtzdaylight' (for example with bluemind) + if ($buggedfile === 'uselocalandtzdaylight') // unixtime is a local date that does take daylight into account, TZID is +2 for example for 'Europe/Paris' in summer + { + $localtzs = new DateTimeZone(preg_replace('/"/','',$icalevent['DTSTART']['TZID'])); + $localtze = new DateTimeZone(preg_replace('/"/','',$icalevent['DTEND']['TZID'])); + $localdts = new DateTime(dol_print_date($datestart,'dayrfc','gmt'), $localtzs); + $localdte = new DateTime(dol_print_date($dateend,'dayrfc','gmt'), $localtze); + $tmps=-1*$localtzs->getOffset($localdts); + $tmpe=-1*$localtze->getOffset($localdte); + $datestart+=$tmps; + $dateend+=$tmpe; + //var_dump($datestart); + } + $addevent=true; + } if ($addevent) { diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php index 7f9d7ede440..279044ccf25 100644 --- a/htdocs/comm/contact.php +++ b/htdocs/comm/contact.php @@ -179,4 +179,3 @@ else llxFooter(); $db->close(); -?> \ No newline at end of file diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 4a6b04f54fb..efed0298f52 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1157,7 +1157,7 @@ if ($action == 'create') { // Date print '' . $langs->trans('Date') . ''; - $form->select_date('', '', '', '', '', "addprop"); + $form->select_date('', '', '', '', '', "addprop", 1, 1); print ''; // Validaty duration @@ -1191,10 +1191,9 @@ if ($action == 'create') { $syear = date("Y", $tmpdte); $smonth = date("m", $tmpdte); $sday = date("d", $tmpdte); - $form->select_date($syear . "-" . $smonth . "-" . $sday, 'liv_', '', '', '', "addprop"); + $form->select_date($syear."-".$smonth."-".$sday, 'liv_', '', '', '', "addprop"); } else { - $datepropal = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : 0; - $form->select_date($datepropal, 'liv_', '', '', '', "addprop"); + $form->select_date(-1, 'liv_', '', '', '', "addprop", 1, 1); } print ''; @@ -1247,8 +1246,9 @@ if ($action == 'create') { print ''; } - print ''; - if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) { + if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print '
    '; + if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) + { // For backward compatibility print ''; print ''; @@ -1311,13 +1311,11 @@ if ($action == 'create') { print ''; print ''; } - print "
    %
    "; } print ''; } - print ''; - print '
    '; + if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print '
    '; $langs->load("bills"); print '
    '; diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index ccd318c93fb..d224c20bc97 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -142,4 +142,3 @@ else llxFooter(); $db->close(); -?> diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 73d1cb720d4..ba0a49f2772 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -285,7 +285,7 @@ if ($result) print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'p.datep','',$param, 'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('DateEndPropalShort'),$_SERVER["PHP_SELF"],'dfv','',$param, 'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre(''); print "\n"; @@ -301,6 +301,7 @@ if ($result) print ''; print ''; print ''; + // Date print ''; //print $langs->trans('Month').': '; print ''; @@ -309,11 +310,12 @@ if ($result) $formother->select_year($syear,'year',1, 20, 5); print ''; print ' '; + // Amount print ''; print ''; print ''; - - print ''; + // Author + print ''; print ''; print ''; print ''; diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php index abd6564779f..58a384df6d0 100644 --- a/htdocs/comm/prospect/list.php +++ b/htdocs/comm/prospect/list.php @@ -466,4 +466,3 @@ else llxFooter(); $db->close(); -?> diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 086dc5a8073..e2b0f5506fb 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1387,7 +1387,7 @@ class Commande extends CommonOrder $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); $this->fetch_optionals($this->id,$extralabels); - $this->db->free(); + $this->db->free($result); /* * Lines diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index 055d4a42787..e4b30a6e60d 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -224,4 +224,3 @@ if ($id > 0 || ! empty($ref)) $db->close(); llxFooter(); -?> \ No newline at end of file diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 2b326858c48..7c1f0d30d25 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -476,7 +476,7 @@ else if ($action == 'setremiseabsolue' && $user->rights->commande->creer) { // Add a new line else if ($action == 'addline' && $user->rights->commande->creer) { $langs->load('errors'); - $error = false; + $error = 0; // Set if we used free entry or predefined product $predef=''; @@ -1319,13 +1319,13 @@ if ($action == 'create' && $user->rights->commande->creer) { $ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : ''); $soc = $objectsrc->client; - $cond_reglement_id = (! empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (! empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 1)); - $mode_reglement_id = (! empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (! empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0)); - $availability_id = (! empty($objectsrc->availability_id) ? $objectsrc->availability_id : (! empty($soc->availability_id) ? $soc->availability_id : 0)); - $demand_reason_id = (! empty($objectsrc->demand_reason_id) ? $objectsrc->demand_reason_id : (! empty($soc->demand_reason_id) ? $soc->demand_reason_id : 0)); - $remise_percent = (! empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (! empty($soc->remise_percent) ? $soc->remise_percent : 0)); - $remise_absolue = (! empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (! empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); - $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : 0; + $cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1)); + $mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0)); + $availability_id = (!empty($objectsrc->availability_id)?$objectsrc->availability_id:(!empty($soc->availability_id)?$soc->availability_id:0)); + $demand_reason_id = (!empty($objectsrc->demand_reason_id)?$objectsrc->demand_reason_id:(!empty($soc->demand_reason_id)?$soc->demand_reason_id:0)); + $remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0)); + $remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0)); + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; $datedelivery = (! empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : ''); @@ -1335,17 +1335,19 @@ if ($action == 'create' && $user->rights->commande->creer) { // Object source contacts list $srccontactslist = $objectsrc->liste_contact(- 1, 'external', 1); } - } else { - $cond_reglement_id = $soc->cond_reglement_id; - $mode_reglement_id = $soc->mode_reglement_id; - $availability_id = $soc->availability_id; - $demand_reason_id = $soc->demand_reason_id; - $remise_percent = $soc->remise_percent; - $remise_absolue = 0; - $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : 0; - $projectid = 0; } - $absolute_discount = $soc->getAvailableDiscounts(); + else + { + $cond_reglement_id = $soc->cond_reglement_id; + $mode_reglement_id = $soc->mode_reglement_id; + $availability_id = $soc->availability_id; + $demand_reason_id = $soc->demand_reason_id; + $remise_percent = $soc->remise_percent; + $remise_absolue = 0; + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; + $projectid = 0; + } + $absolute_discount=$soc->getAvailableDiscounts(); $nbrow = 10; @@ -1414,12 +1416,11 @@ if ($action == 'create' && $user->rights->commande->creer) { print ''; // Date de livraison - print "" . $langs->trans("DeliveryDate") . ''; - if (empty($datedelivery)) { - if (! empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) - $datedelivery = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); - else - $datedelivery = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : 0; + print "".$langs->trans("DeliveryDate").''; + if (empty($datedelivery)) + { + if (! empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) $datedelivery = time() + ((7*$conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); + else $datedelivery=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; } $form->select_date($datedelivery, 'liv_', '', '', '', "crea_commande", 1, 1); print ""; diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index bfdf2dbb5ca..0036aa430f1 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -373,7 +373,7 @@ if ($action == 'create' && empty($mesgs)) $remise_percent = $soc->remise_percent; } $remise_absolue = 0; - $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; $absolute_discount=$soc->getAvailableDiscounts(); print '
    '; @@ -413,7 +413,7 @@ if ($action == 'create' && empty($mesgs)) // Date invoice print ''.$langs->trans('Date').''; - $html->select_date(0,'','','','',"add",1,1); + $html->select_date('','','','','',"add",1,1); print ''; // Payment term print ''.$langs->trans('PaymentConditionsShort').''; diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 5c2d6812302..27690ae7093 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -855,4 +855,3 @@ else llxFooter(); $db->close(); -?> diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index ededeab44a1..c77aea4178e 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -798,7 +798,8 @@ else if ($action == 'add' && $user->rights->facture->creer) $object->fetch_thirdparty(); // If creation from another object of another module (Example: origin=propal, originid=1) - if ($_POST['origin'] && $_POST['originid']) { + if ($_POST['origin'] && $_POST['originid']) + { // Parse element/subelement (ex: project_task) $element = $subelement = $_POST['origin']; if (preg_match('/^([^_]+)_([^_]+)/i', $_POST['origin'], $regs)) { @@ -835,15 +836,20 @@ else if ($action == 'add' && $user->rights->facture->creer) $id = $object->create($user); - if ($id > 0) { + if ($id > 0) + { // If deposit invoice - if ($_POST['type'] == 3) { + if ($_POST['type'] == 3) + { $typeamount = GETPOST('typedeposit', 'alpha'); $valuedeposit = GETPOST('valuedeposit', 'int'); - if ($typeamount == 'amount') { + if ($typeamount == 'amount') + { $amountdeposit = $valuedeposit; - } else { + } + else + { $amountdeposit = 0; dol_include_once('/' . $element . '/class/' . $subelement . '.class.php'); @@ -853,7 +859,8 @@ else if ($action == 'add' && $user->rights->facture->creer) dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add deposit lines"); $result = $srcobject->fetch($object->origin_id); - if ($result > 0) { + if ($result > 0) + { $totalamount = 0; $lines = $srcobject->lines; $numlines=count($lines); @@ -898,7 +905,9 @@ else if ($action == 'add' && $user->rights->facture->creer) 0, $langs->trans('Deposit') ); - } else { + } + else + { dol_include_once('/' . $element . '/class/' . $subelement . '.class.php'); @@ -907,10 +916,10 @@ else if ($action == 'add' && $user->rights->facture->creer) dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines"); $result = $srcobject->fetch($object->origin_id); - if ($result > 0) { + if ($result > 0) + { $lines = $srcobject->lines; - if (empty($lines) && method_exists($srcobject, 'fetch_lines')) - $lines = $srcobject->fetch_lines(); + if (empty($lines) && method_exists($srcobject, 'fetch_lines')) $lines = $srcobject->fetch_lines(); $fk_parent_line=0; $num=count($lines); @@ -919,7 +928,8 @@ else if ($action == 'add' && $user->rights->facture->creer) $label=(! empty($lines[$i]->label)?$lines[$i]->label:''); $desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle); - if ($lines [$i]->subprice < 0) { + if ($lines [$i]->subprice < 0) + { // Negative line, we create a discount line $discount = new DiscountAbsolute($db); $discount->fk_soc = $object->socid; @@ -1861,10 +1871,12 @@ if ($action == 'create') $ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : ''); $soc = $objectsrc->thirdparty; - $cond_reglement_id = (! empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (! empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 1)); - $mode_reglement_id = (! empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (! empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0)); - $remise_percent = (! empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (! empty($soc->remise_percent) ? $soc->remise_percent : 0)); - $remise_absolue = (! empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (! empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); + + $cond_reglement_id = (! empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(! empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1)); + $mode_reglement_id = (! empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(! empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0)); + $remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0)); + $remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0)); + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; // Replicate extrafields $objectsrc->fetch_optionals($originid); @@ -1874,11 +1886,11 @@ if ($action == 'create') } else { - $cond_reglement_id = $soc->cond_reglement_id; - $mode_reglement_id = $soc->mode_reglement_id; - $remise_percent = $soc->remise_percent; - $remise_absolue = 0; - $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? -1 : ''; // Do not set 0 here (0 for a date is 1970) + $cond_reglement_id = $soc->cond_reglement_id; + $mode_reglement_id = $soc->mode_reglement_id; + $remise_percent = $soc->remise_percent; + $remise_absolue = 0; + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; // Do not set 0 here (0 for a date is 1970) } $absolute_discount = $soc->getAvailableDiscounts(); diff --git a/htdocs/compta/facture/admin/facturedet_cust_extrafields.php b/htdocs/compta/facture/admin/facturedet_cust_extrafields.php index 5365cf2bee9..ccd208c7c6f 100644 --- a/htdocs/compta/facture/admin/facturedet_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facturedet_cust_extrafields.php @@ -156,4 +156,3 @@ if ($action == 'edit' && ! empty($attrname)) llxFooter(); $db->close(); -?> \ No newline at end of file diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 6bafdd827cd..81bf47715e6 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2056,7 +2056,7 @@ class Facture extends CommonInvoice $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc); - $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, '', $localtaxes_type); + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -2133,7 +2133,7 @@ class Facture extends CommonInvoice if (! empty($fk_parent_line)) $this->line_order(true,'DESC'); // Mise a jour informations denormalisees au niveau de la facture meme - $result=$this->update_price(1,'auto'); // This method is designed to add line from user input so total calculation must be done using 'auto' mode. + $result=$this->update_price(1,'auto',0,$mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode. if ($result > 0) { $this->db->commit(); diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 31a741d9dcf..60c47564743 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -166,4 +166,3 @@ else $db->close(); llxFooter(); -?> diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index 097a89c3918..cc71b402060 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -310,4 +310,3 @@ print ''; $db->close(); llxFooter(); -?> diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 5cee6ad4d82..c7ee207f853 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -179,4 +179,3 @@ else $db->close(); llxFooter(); -?> diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index eba0f8633a8..4187de7136c 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1094,4 +1094,3 @@ class Contact extends CommonObject } } -?> diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 86462d05fae..92ba03e9861 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -249,4 +249,3 @@ if ($action != 'edit') llxFooter(); $db->close(); -?> diff --git a/htdocs/contrat/info.php b/htdocs/contrat/info.php index 8764c53eea5..234f986a00c 100644 --- a/htdocs/contrat/info.php +++ b/htdocs/contrat/info.php @@ -58,4 +58,3 @@ print ''; $db->close(); llxFooter(); -?> diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 8759af8a719..d1a64f6b256 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -253,4 +253,3 @@ if ($section) // Close db if mode is not noajax if ((! isset($mode) || $mode != 'noajax') && is_object($db)) $db->close(); -?> diff --git a/htdocs/core/ajax/bankconciliate.php b/htdocs/core/ajax/bankconciliate.php index dc0e5f092dc..855709f48e2 100644 --- a/htdocs/core/ajax/bankconciliate.php +++ b/htdocs/core/ajax/bankconciliate.php @@ -71,4 +71,3 @@ if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $ exit; } -?> diff --git a/htdocs/core/ajax/loadinplace.php b/htdocs/core/ajax/loadinplace.php index 025e7e9cb48..69a0bbc72c7 100644 --- a/htdocs/core/ajax/loadinplace.php +++ b/htdocs/core/ajax/loadinplace.php @@ -115,4 +115,3 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($ } } -?> diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index a1094a8274c..ff63927b526 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -156,4 +156,3 @@ class box_actions extends ModeleBoxes } -?> diff --git a/htdocs/core/class/antivir.class.php b/htdocs/core/class/antivir.class.php index 1ea2dddd557..68241cb4d62 100644 --- a/htdocs/core/class/antivir.class.php +++ b/htdocs/core/class/antivir.class.php @@ -165,4 +165,3 @@ class AntiVir } -?> \ No newline at end of file diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index 31419e64e9d..f51056b2551 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -198,4 +198,3 @@ class Canvas } } -?> diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 6eae61063ba..e2b79448ea8 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -627,10 +627,10 @@ abstract class CommonObject /** * Load data for barcode into properties ->barcode_type* - * Properties ->barcode_type is used to find others. - * If not defined, ->element must be defined to know default barcode type. + * Properties ->barcode_type that is id of barcode type is used to find other properties, but + * if it is not defined, ->element must be defined to know default barcode type. * - * @return int <0 if KO, >=0 if OK + * @return int <0 if KO, 0 if can't guess type of barcode (ISBN, EAN13...), >0 if OK (all barcode properties loaded) */ function fetch_barcode() { @@ -639,11 +639,11 @@ abstract class CommonObject dol_syslog(get_class($this).'::fetch_barcode this->element='.$this->element.' this->barcode_type='.$this->barcode_type); $idtype=$this->barcode_type; - if (! $idtype) + if (empty($idtype) && $idtype != '0') // If type of barcode no set, we try to guess. If set to '0' it means we forced to have type remain not defined { if ($this->element == 'product') $idtype = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; else if ($this->element == 'societe') $idtype = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY; - else dol_print_error('','Call fetch_barcode with barcode_type not defined and cant be guessed'); + else dol_syslog('Call fetch_barcode with barcode_type not defined and cant be guessed', LOG_WARNING); } if ($idtype > 0) @@ -1518,7 +1518,7 @@ abstract class CommonObject * @param int $exclspec >0 = Exclude special product (product_type=9) * @param string $roundingadjust 'none'=Do nothing, 'auto'=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND if defined, or '0'), '0'=Force use total of rounding, '1'=Force use rounding of total * @param int $nodatabaseupdate 1=Do not update database. Update only properties of object. - * @param Societe $seller If roundingadjust is 0, it means we recalculate total for lines before calculating total for object. For this, we need seller object. + * @param Societe $seller If roundingadjust is '0' or '1', it means we recalculate total for lines before calculating total for object. For this, we need seller object. * @return int <0 if KO, >0 if OK */ function update_price($exclspec=0,$roundingadjust='none',$nodatabaseupdate=0,$seller='') @@ -3237,6 +3237,7 @@ abstract class CommonObject $marginInfo = $this->getMarginInfos($force_price); print ''; + print ''; print ''; print ''; @@ -3250,38 +3251,49 @@ abstract class CommonObject if (! empty($conf->global->DISPLAY_MARK_RATES)) print ''; print ''; - //if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) { - print ''; - print ''; - print ''; - print ''; - print ''; - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''; - if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''; - if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''; - print ''; - //} - print ''; - print ''; - print ''; - print ''; - print ''; - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''; - if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''; - print ''; + + if (! empty($conf->product->enabled)) + { + //if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) { + print ''; + print ''; + print ''; + print ''; + print ''; + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) + print ''; + if (! empty($conf->global->DISPLAY_MARK_RATES)) + print ''; + print ''; + } + + if (! empty($conf->service->enabled)) + { + print ''; + print ''; + print ''; + print ''; + print ''; + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) + print ''; + if (! empty($conf->global->DISPLAY_MARK_RATES)) + print ''; + print ''; + } + + if (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) + { + print ''; + print ''; + print ''; + print ''; + print ''; + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) + print ''; + if (! empty($conf->global->DISPLAY_MARK_RATES)) + print ''; + print ''; + } print '
    '.$langs->trans('Margins').''.$langs->trans('SellingPrice').''.$langs->trans('MarkRate').'
    '.$langs->trans('MarginOnProducts').''.price($marginInfo['pv_products'], null, null, null, null, $rounding).''.price($marginInfo['pa_products'], null, null, null, null, $rounding).''.price($marginInfo['margin_on_products'], null, null, null, null, $rounding).''.(($marginInfo['margin_rate_products'] == '')?'':price($marginInfo['margin_rate_products'], null, null, null, null, $rounding).'%').''.(($marginInfo['mark_rate_products'] == '')?'':price($marginInfo['mark_rate_products'], null, null, null, null, $rounding).'%').'
    '.$langs->trans('MarginOnServices').''.price($marginInfo['pv_services'], null, null, null, null, $rounding).''.price($marginInfo['pa_services'], null, null, null, null, $rounding).''.price($marginInfo['margin_on_services'], null, null, null, null, $rounding).''.(($marginInfo['margin_rate_services'] == '')?'':price($marginInfo['margin_rate_services'], null, null, null, null, $rounding).'%').''.(($marginInfo['mark_rate_services'] == '')?'':price($marginInfo['mark_rate_services'], null, null, null, null, $rounding).'%').'
    '.$langs->trans('TotalMargin').''.price($marginInfo['pv_total'], null, null, null, null, $rounding).''.price($marginInfo['pa_total'], null, null, null, null, $rounding).''.price($marginInfo['total_margin'], null, null, null, null, $rounding).''.(($marginInfo['total_margin_rate'] == '')?'':price($marginInfo['total_margin_rate'], null, null, null, null, $rounding).'%').''.(($marginInfo['total_mark_rate'] == '')?'':price($marginInfo['total_mark_rate'], null, null, null, null, $rounding).'%').'
    '.$langs->trans('MarginOnProducts').''.price($marginInfo['pv_products'], null, null, null, null, $rounding).''.price($marginInfo['pa_products'], null, null, null, null, $rounding).''.price($marginInfo['margin_on_products'], null, null, null, null, $rounding).''.(($marginInfo['margin_rate_products'] == '')?'':price($marginInfo['margin_rate_products'], null, null, null, null, $rounding).'%').''.(($marginInfo['mark_rate_products'] == '')?'':price($marginInfo['mark_rate_products'], null, null, null, null, $rounding).'%').'
    '.$langs->trans('MarginOnServices').''.price($marginInfo['pv_services'], null, null, null, null, $rounding).''.price($marginInfo['pa_services'], null, null, null, null, $rounding).''.price($marginInfo['margin_on_services'], null, null, null, null, $rounding).''.(($marginInfo['margin_rate_services'] == '')?'':price($marginInfo['margin_rate_services'], null, null, null, null, $rounding).'%').''.(($marginInfo['mark_rate_services'] == '')?'':price($marginInfo['mark_rate_services'], null, null, null, null, $rounding).'%').'
    '.$langs->trans('TotalMargin').''.price($marginInfo['pv_total'], null, null, null, null, $rounding).''.price($marginInfo['pa_total'], null, null, null, null, $rounding).''.price($marginInfo['total_margin'], null, null, null, null, $rounding).''.(($marginInfo['total_margin_rate'] == '')?'':price($marginInfo['total_margin_rate'], null, null, null, null, $rounding).'%').''.(($marginInfo['total_mark_rate'] == '')?'':price($marginInfo['total_mark_rate'], null, null, null, null, $rounding).'%').'
    '; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d3111d38a05..ccc5b915aac 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -191,8 +191,9 @@ class Form $ret.=''; if ($typeofdata != 'day' && $typeofdata != 'datepicker' && $typeofdata != 'datehourpicker') { - $ret.=''; - $ret.='

    '."\n"; + $ret.=''; + $ret.=''; + $ret.='
    '."\n"; $ret.=''; $ret.=''; } @@ -4087,8 +4088,8 @@ class Form // Complete object if not complete if (empty($object->barcode_type_code) || empty($object->barcode_type_coder)) { - $result = $object->fetch_barcode(); - //Check if fetch_barcode() failed + $result = $object->fetch_barcode(); + //Check if fetch_barcode() failed if ($result < 1) return ''; } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 73aa3742206..16cab849514 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1184,4 +1184,3 @@ class FormFile } -?> diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 6567204232a..b6065909ade 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -363,7 +363,8 @@ class FormOther $sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login"; $sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql_usr.= " WHERE u.entity IN (0,".$conf->entity.")"; - if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.fk_societe = ".($user->societe_id?$user->societe_id:0); + if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.rowid = ".$user->id; + if (! empty($user->societe_id)) $sql_usr.=" AND u.fk_societe = ".$user->societe_id; // Add existing sales representatives of thirdparty of external user if (empty($user->rights->user->user->lire) && $user->societe_id) { @@ -1164,4 +1165,3 @@ class FormOther } -?> diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 9e0d78118b0..2c371d4afcd 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -194,6 +194,7 @@ class FormProjets if (!empty($this->societe->id)) { $sql.= " AND fk_soc=".$this->societe->id; } + $sql.= ' AND entity='.$conf->entity; $sql.= " ORDER BY ref DESC"; dol_syslog(get_class($this).'::select_element sql='.$sql,LOG_DEBUG); diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index 06d26c94edf..80ca1b155b7 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -775,4 +775,3 @@ function xml2php($xml) } -?> diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index be898d8a114..ab9d6e5850e 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -825,8 +825,16 @@ class DoliDBMysql extends DoliDB $resql=$this->query($sql); if (! $resql) { - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); - return -1; + if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS') + { + dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); + return -1; + } + else + { + // If user already exists, we continue to set permissions + dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING); + } } $sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'"; dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 09199f84318..40061a4fa1a 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -829,8 +829,16 @@ class DoliDBMysqli extends DoliDB $resql=$this->query($sql); if (! $resql) { - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); - return -1; + if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS') + { + dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); + return -1; + } + else + { + // If user already exists, we continue to set permissions + dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING); + } } $sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'"; dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index e7e7df739b7..155977cc8d1 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -46,7 +46,7 @@ class DoliDBPgsql extends DoliDB static $versionmin=array(8,4,0); // Version min database //! Resultset of last query private $_results; - + public $unescapeslashquot; public $standard_conforming_strings; @@ -172,6 +172,8 @@ class DoliDBPgsql extends DoliDB else if (preg_match('/DROP TABLE/i',$line)) $type='dml'; } + $line=preg_replace('/ as signed\)/i',' as integer)',$line); + if ($type == 'dml') { $line=preg_replace('/\s/',' ',$line); // Replace tabulation with space @@ -196,8 +198,7 @@ class DoliDBPgsql extends DoliDB // nuke unsigned $line=preg_replace('/(int\w+|smallint)\s+unsigned/i','\\1',$line); - $line=preg_replace('/as signed/i','as integer',$line); - + // blob -> text $line=preg_replace('/\w*blob/i','text',$line); @@ -463,7 +464,7 @@ class DoliDBPgsql extends DoliDB function query($query,$usesavepoint=0,$type='auto') { global $conf; - + $query = trim($query); // Convert MySQL syntax to PostgresSQL syntax @@ -484,7 +485,7 @@ class DoliDBPgsql extends DoliDB else $loop=false; } } - + if ($usesavepoint && $this->transaction_opened) { @pg_query($this->db, 'SAVEPOINT mysavepoint'); diff --git a/htdocs/core/filemanagerdol/connectors/php/basexml.php b/htdocs/core/filemanagerdol/connectors/php/basexml.php index 84d2e04666a..439353b4e26 100644 --- a/htdocs/core/filemanagerdol/connectors/php/basexml.php +++ b/htdocs/core/filemanagerdol/connectors/php/basexml.php @@ -108,4 +108,3 @@ function SendErrorNode($number, $text) else echo '' ; } -?> diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index d2d380ad45c..bb55e57f86b 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -39,7 +39,7 @@ * @param string $filterd Filter of done by user * @param int $pid Product id * @param int $socid Third party id - * @param array $showextcals Array with list of external calendars, or -1 to show no legend + * @param array $showextcals Array with list of external calendars (used to show links to select calendar), or -1 to show no legend * @param string $actioncode Preselected value of actioncode for filter on type * @return void */ @@ -136,7 +136,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print '});' . "\n"; print '' . "\n"; print ''; - if (! empty($conf->global->MAIN_JS_SWITCH_AGENDA)) + if (! empty($conf->use_javascript_ajax)) { if (count($showextcals) > 0) { @@ -147,7 +147,10 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '';*/ - global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax; $forceall=1; $senderissupplier=1; $dateSelector=0; $inputalsopricewithtax=1; - if ($object->statut == 0 && $user->rights->propal->creer) + if ($object->statut == 0 && $user->rights->fournisseur->facture->creer) { if ($action != 'editline') { @@ -2086,108 +2082,6 @@ else $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook } } - - // Add free products/services form - /* - $var=true; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - // Ajout de produits/services predefinis - if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) - { - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $var=! $var; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - }*/ } print '
    '; print '' . "\n"; print ' ' . $val ['name']; @@ -434,9 +437,9 @@ function actions_prepare_head($object) $head[$h][1] = $langs->trans('Info'); $head[$h][2] = 'info'; $h++; - + complete_head_from_modules($conf,$langs,$object,$head,$h,'action'); - + complete_head_from_modules($conf,$langs,$object,$head,$h,'action','remove'); return $head; diff --git a/htdocs/core/lib/barcode.lib.php b/htdocs/core/lib/barcode.lib.php index 83d161a20a0..bc0422a5fb4 100644 --- a/htdocs/core/lib/barcode.lib.php +++ b/htdocs/core/lib/barcode.lib.php @@ -416,4 +416,3 @@ function barcode_outimage($text, $bars, $scale = 1, $mode = "png", $total_y = 0, } } -?> diff --git a/htdocs/core/lib/contract.lib.php b/htdocs/core/lib/contract.lib.php index 37ab1f7881f..1086d4dcd14 100644 --- a/htdocs/core/lib/contract.lib.php +++ b/htdocs/core/lib/contract.lib.php @@ -119,4 +119,3 @@ function contract_admin_prepare_head() return $head; } -?> diff --git a/htdocs/core/lib/fichinter.lib.php b/htdocs/core/lib/fichinter.lib.php index b25bfe808f2..01d79cdcabe 100644 --- a/htdocs/core/lib/fichinter.lib.php +++ b/htdocs/core/lib/fichinter.lib.php @@ -134,4 +134,3 @@ function fichinter_admin_prepare_head() } -?> diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index a6981be8355..171eda67a90 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -198,4 +198,3 @@ function supplierorder_admin_prepare_head($object) } -?> \ No newline at end of file diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 91544d83485..a22c38834cf 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3694,6 +3694,7 @@ function dol_textishtml($msg,$option=0) elseif (preg_match('/<(br|div|font|img|li|span|strong|table)>/i',$msg)) return true; elseif (preg_match('/<(br|div|font|img|li|span|strong|table)\s+[^<>\/]*>/i',$msg)) return true; elseif (preg_match('/<(br|div|font|img|li|span|strong|table)\s+[^<>\/]*\/>/i',$msg)) return true; + elseif (preg_match('//i',$msg)) return true; elseif (preg_match('/&[A-Z0-9]{1,6};/i',$msg)) return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp) elseif (preg_match('/&#[0-9]{2,3};/i',$msg)) return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp) return false; @@ -4588,5 +4589,3 @@ function natural_search($fields, $value) } return " AND " . ($end > 1? '(' : '') . $res; } - -?> diff --git a/htdocs/core/lib/invoice2.lib.php b/htdocs/core/lib/invoice2.lib.php index 5eed1e8e2df..9309d083187 100644 --- a/htdocs/core/lib/invoice2.lib.php +++ b/htdocs/core/lib/invoice2.lib.php @@ -286,4 +286,3 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte else return $result; } -?> diff --git a/htdocs/core/lib/mailmanspip.lib.php b/htdocs/core/lib/mailmanspip.lib.php index eb57f4b6163..ce7f2927630 100644 --- a/htdocs/core/lib/mailmanspip.lib.php +++ b/htdocs/core/lib/mailmanspip.lib.php @@ -44,4 +44,3 @@ function mailmanspip_admin_prepare_head() ); } -?> \ No newline at end of file diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index 655efe5b61b..67b6794f3a3 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -205,4 +205,3 @@ function member_stats_prepare_head($object) return $head; } -?> diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 6f8a86389bc..09b39f22812 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1036,10 +1036,10 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl if (empty($hideref)) { - if ($issupplierline) $ref_prodserv = $prodser->ref.' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')'; // Show local ref and supplier ref + if ($issupplierline) $ref_prodserv = $prodser->ref.($ref_supplier ? ' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')' : ''); // Show local ref and supplier ref else $ref_prodserv = $prodser->ref; // Show local ref only - $ref_prodserv .= " - "; + if (! empty($libelleproduitservice)) $ref_prodserv .= " - "; } $libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice; diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 6c1a51471fa..31e900f8e7e 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -311,7 +311,9 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature } } - //print "Delete access is ko"; + // If a or and at least one ok + if (preg_match('/\|/', $features) && $nbko < count($featuresarray)) $deleteok=1; + if (! $deleteok) accessforbidden(); //print "Delete access is ok"; } diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 99f34b24d3b..e5835ff6a68 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -286,7 +286,7 @@ function dol_loginfunction($langs,$conf,$mysoc) // Set jquery theme $dol_loginmesg = (! empty($_SESSION["dol_loginmesg"])?$_SESSION["dol_loginmesg"]:''); - $favicon=DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/favicon.ico'; + $favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1); if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL; $jquerytheme = 'smoothness'; if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME; diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index 35165597cff..a52aeb37345 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -588,4 +588,3 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, return $list; } -?> \ No newline at end of file diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index 54093976a68..1bbf2e55e27 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -165,4 +165,3 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree') if (empty($pere['rowid'])) print ''; } -?> \ No newline at end of file diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 35b3f78c5e7..e3a6f79210d 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -773,16 +773,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // Suppliers if (! empty($conf->societe->enabled) && ! empty($conf->fournisseur->enabled)) { - if (! empty($conf->facture->enabled)) - { - $langs->load("bills"); - $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills'); - $newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer); - $newmenu->add("/fourn/facture/impayees.php", $langs->trans("Unpaid"),1,$user->rights->fournisseur->facture->lire); - $newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire); + $langs->load("bills"); + $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills'); + $newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer); + $newmenu->add("/fourn/facture/impayees.php", $langs->trans("Unpaid"),1,$user->rights->fournisseur->facture->lire); + $newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire); - $newmenu->add("/compta/facture/stats/index.php?leftmenu=suppliers_bills&mode=supplier", $langs->trans("Statistics"),1,$user->rights->fournisseur->facture->lire); - } + $newmenu->add("/compta/facture/stats/index.php?leftmenu=suppliers_bills&mode=supplier", $langs->trans("Statistics"),1,$user->rights->fournisseur->facture->lire); } // Orders diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 37273397ee6..e03bdc6d2e9 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -161,20 +161,23 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode /** * Check validity of code according to its rules * - * @param DoliDB $db Database handler - * @param string &$code Code to check/correct - * @param Product $product Object product - * @param int $type 0 = customer/prospect , 1 = supplier - * @return int 0 if OK - * -1 ErrorBadCustomerCodeSyntax - * -2 ErrorCustomerCodeRequired - * -3 ErrorCustomerCodeAlreadyUsed - * -4 ErrorPrefixRequired + * @param DoliDB $db Database handler + * @param string &$code Code to check/correct + * @param Product $product Object product + * @param int $thirdparty_type 0 = customer/prospect , 1 = supplier + * @param string $type type of barcode (EAN, ISBN, ...) + * @return int 0 if OK + * -1 ErrorBadCustomerCodeSyntax + * -2 ErrorCustomerCodeRequired + * -3 ErrorCustomerCodeAlreadyUsed + * -4 ErrorPrefixRequired */ - function verif($db, &$code, $product, $type) + function verif($db, &$code, $product, $thirdparty_type, $type) { global $conf; + //var_dump($code.' '.$product->ref.' '.$thirdparty_type);exit; + require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; $result=0; @@ -190,7 +193,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode } else { - if ($this->verif_syntax($code) >= 0) + if ($this->verif_syntax($code, $type) >= 0) { $is_dispo = $this->verif_dispo($db, $code, $product); if ($is_dispo <> 0) @@ -215,7 +218,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode } } - dol_syslog(get_class($this)."::verif type=".$type." result=".$result); + dol_syslog(get_class($this)."::verif type=".$thirdparty_type." result=".$result); return $result; } @@ -254,12 +257,13 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode } /** - * Renvoi si un code respecte la syntaxe + * Return if a barcode value match syntax * - * @param string $code Code a verifier + * @param string $codefortest Code to check syntax + * @param string $typefortest Type of barcode (ISBN, EAN, ...) * @return int 0 if OK, <0 if KO */ - function verif_syntax($code) + function verif_syntax($codefortest, $typefortest) { global $conf; @@ -273,7 +277,13 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode return ''; } - $result=check_value($mask,$code); + $newcodefortest=$codefortest; + if (in_array($typefortest,array('EAN13','ISBN'))) // We remove the CRC char not included into mask + { + $newcodefortest=substr($newcodefortest,0,12); + } + + $result=check_value($mask,$newcodefortest); return $result; } diff --git a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php index 7b2b099b67c..96214f08d66 100644 --- a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php @@ -403,4 +403,3 @@ class BordereauChequeBlochet extends ModeleChequeReceipts } -?> diff --git a/htdocs/core/modules/commande/modules_commande.php b/htdocs/core/modules/commande/modules_commande.php index 5ddcc38e8d9..1146b1cc181 100644 --- a/htdocs/core/modules/commande/modules_commande.php +++ b/htdocs/core/modules/commande/modules_commande.php @@ -256,4 +256,3 @@ function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0 return -1; } } -?> diff --git a/htdocs/core/modules/contract/mod_contract_serpis.php b/htdocs/core/modules/contract/mod_contract_serpis.php index a595fb5f59c..a07f3261133 100644 --- a/htdocs/core/modules/contract/mod_contract_serpis.php +++ b/htdocs/core/modules/contract/mod_contract_serpis.php @@ -144,4 +144,3 @@ class mod_contract_serpis extends ModelNumRefContracts } } -?> diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index d75e8d203e5..30c753bf1dc 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2014 Marcos García * * 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 @@ -179,9 +180,10 @@ class pdf_rouget extends ModelePdfExpedition $tab_height = 130; $tab_height_newpage = 150; - if (! empty($object->note_public) || ! empty($object->tracking_number)) + if (! empty($object->note_public) || (! empty($object->tracking_number) && ! empty($object->shipping_method_id))) { $tab_top = 88; + $tab_top_alt = $tab_top; // Tracking number if (! empty($object->tracking_number)) @@ -196,7 +198,9 @@ class pdf_rouget extends ModelePdfExpedition $label=$outputlangs->trans("LinkToTrackYourPackage")."
    "; $label.=$outputlangs->trans("SendingMethod".strtoupper($code))." :"; $pdf->SetFont('','B', $default_font_size - 2); - $pdf->writeHTMLCell(60, 4, $this->posxdesc-1, $tab_top-1, $label." ".$object->tracking_url, 0, 1, false, true, 'L'); + $pdf->writeHTMLCell(60, 7, $this->posxdesc-1, $tab_top-1, $label." ".$object->tracking_url, 0, 1, false, true, 'L'); + + $tab_top_alt += 7; } } } @@ -205,7 +209,7 @@ class pdf_rouget extends ModelePdfExpedition if (! empty($object->note_public)) { $pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top_alt, dol_htmlentitiesbr($object->note_public), 0, 1); } $nexY = $pdf->GetY(); diff --git a/htdocs/core/modules/expedition/mod_expedition_safor.php b/htdocs/core/modules/expedition/mod_expedition_safor.php index 5fb3db1ddfe..ba779658051 100644 --- a/htdocs/core/modules/expedition/mod_expedition_safor.php +++ b/htdocs/core/modules/expedition/mod_expedition_safor.php @@ -143,4 +143,3 @@ class mod_expedition_safor extends ModelNumRefExpedition } } -?> diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php index 220df75dc72..9a8b5feaed7 100644 --- a/htdocs/core/modules/facture/mod_facture_terre.php +++ b/htdocs/core/modules/facture/mod_facture_terre.php @@ -224,4 +224,3 @@ class mod_facture_terre extends ModeleNumRefFactures } -?> diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 5e7c2141a0f..f2055e8d643 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -600,4 +600,3 @@ class pdf_soleil extends ModelePDFFicheinter } -?> diff --git a/htdocs/core/modules/fichinter/mod_pacific.php b/htdocs/core/modules/fichinter/mod_pacific.php index 3d0b15d0d09..65e5aa979b9 100644 --- a/htdocs/core/modules/fichinter/mod_pacific.php +++ b/htdocs/core/modules/fichinter/mod_pacific.php @@ -145,4 +145,3 @@ class mod_pacific extends ModeleNumRefFicheinter } -?> diff --git a/htdocs/core/modules/modImport.class.php b/htdocs/core/modules/modImport.class.php index cc05e0eba5e..3a371ecf2e7 100644 --- a/htdocs/core/modules/modImport.class.php +++ b/htdocs/core/modules/modImport.class.php @@ -117,4 +117,3 @@ class modImport extends DolibarrModules } } -?> diff --git a/htdocs/core/modules/modNotification.class.php b/htdocs/core/modules/modNotification.class.php index 6a5fb72c953..78e939f4048 100644 --- a/htdocs/core/modules/modNotification.class.php +++ b/htdocs/core/modules/modNotification.class.php @@ -107,4 +107,3 @@ class modNotification extends DolibarrModules } } -?> diff --git a/htdocs/core/modules/modPaypal.class.php b/htdocs/core/modules/modPaypal.class.php index 1e3645745da..8c1e0fe4797 100644 --- a/htdocs/core/modules/modPaypal.class.php +++ b/htdocs/core/modules/modPaypal.class.php @@ -199,4 +199,3 @@ class modPaypal extends DolibarrModules } -?> \ No newline at end of file diff --git a/htdocs/core/modules/modPrelevement.class.php b/htdocs/core/modules/modPrelevement.class.php index 21feb8c4a37..7bb5e748037 100644 --- a/htdocs/core/modules/modPrelevement.class.php +++ b/htdocs/core/modules/modPrelevement.class.php @@ -158,4 +158,3 @@ class modPrelevement extends DolibarrModules } } -?> diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 49b08003a23..05c934a8ea6 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -245,6 +245,7 @@ class modProduct extends DolibarrModules $this->import_tables_array[$r]=array('p'=>MAIN_DB_PREFIX.'product','extra'=>MAIN_DB_PREFIX.'product_extrafields'); $this->import_tables_creator_array[$r]=array('p'=>'fk_user_author'); // Fields to store import user id $this->import_fields_array[$r]=array('p.ref'=>"Ref*",'p.label'=>"Label*",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.duration'=>"Duration",'p.customcode'=>'CustomCode','p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",'p.tva_tx'=>'VAT','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation*'); + if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode')); // Add extra fields $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity = ".$conf->entity; $resql=$this->db->query($sql); diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index a998f41298e..2b9bb8d44f8 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin @@ -17,7 +17,6 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * */ /** @@ -209,7 +208,8 @@ class modService extends DolibarrModules $this->import_tables_array[$r]=array('p'=>MAIN_DB_PREFIX.'product','extra'=>MAIN_DB_PREFIX.'product_extrafields'); $this->import_tables_creator_array[$r]=array('p'=>'fk_user_author'); // Fields to store import user id $this->import_fields_array[$r]=array('p.ref'=>"Ref*",'p.label'=>"Label*",'p.description'=>"Description",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.duration'=>"Duration",'p.customcode'=>'CustomCode','p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",'p.tva_tx'=>'VAT','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation*'); - // Add extra fields + if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode')); + // Add extra fields $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product'"; $resql=$this->db->query($sql); if ($resql) // This can fail when class is used on old database (during migration for example) diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index ea0b6144c91..3ab5fdb9e09 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -301,4 +301,3 @@ class mod_codeproduct_elephant extends ModeleProductCode } -?> diff --git a/htdocs/core/modules/project/modules_project.php b/htdocs/core/modules/project/modules_project.php index 6aae57c34d5..2595485eac1 100644 --- a/htdocs/core/modules/project/modules_project.php +++ b/htdocs/core/modules/project/modules_project.php @@ -247,4 +247,3 @@ function project_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, } } -?> \ No newline at end of file diff --git a/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php index 9525639dd9c..75b06755b80 100644 --- a/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php @@ -1037,4 +1037,3 @@ class doc_generic_project_odt extends ModelePDFProjects } } -?> diff --git a/htdocs/core/modules/project/task/modules_task.php b/htdocs/core/modules/project/task/modules_task.php index f9d10f90534..8aacc535b7e 100644 --- a/htdocs/core/modules/project/task/modules_task.php +++ b/htdocs/core/modules/project/task/modules_task.php @@ -248,4 +248,3 @@ function task_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $h } } -?> diff --git a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php index 50982a8b1c7..f7e6b75adc2 100644 --- a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php +++ b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php @@ -258,4 +258,3 @@ function supplier_order_pdf_create($db, $object, $modele, $outputlangs, $hidedet } } -?> diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index 6cfd835925d..facca267160 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -252,4 +252,3 @@ if ($id > 0 || ! empty($ref)) llxFooter(); $db->close(); -?> \ No newline at end of file diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index f208c82b5d2..1fd33b29c53 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -1688,4 +1688,3 @@ else if ($id || $ref) llxFooter(); $db->close(); -?> diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 549a9caed32..e10a39128a2 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -444,7 +444,7 @@ class FactureFournisseur extends CommonInvoice */ function fetch_lines() { - $sql = 'SELECT f.rowid, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx, f.tva'; + $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx, f.tva'; $sql.= ', f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 '; $sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits'; $sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc'; @@ -452,7 +452,7 @@ class FactureFournisseur extends CommonInvoice $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid'; $sql.= ' WHERE fk_facture_fourn='.$this->id; - dol_syslog("FactureFournisseur::fetch_lines sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch_lines sql=".$sql, LOG_DEBUG); $resql_rows = $this->db->query($sql); if ($resql_rows) { @@ -467,11 +467,11 @@ class FactureFournisseur extends CommonInvoice $this->lines[$i] = new stdClass(); $this->lines[$i]->rowid = $obj->rowid; $this->lines[$i]->description = $obj->description; - $this->lines[$i]->ref = $obj->product_ref; // TODO deprecated $this->lines[$i]->product_ref = $obj->product_ref; // Internal reference - //$this->lines[$i]->ref_fourn = $obj->ref_fourn; // Reference fournisseur du produit - $this->lines[$i]->libelle = $obj->label; // Label du produit - $this->lines[$i]->product_desc = $obj->product_desc; // Description du produit + $this->lines[$i]->ref = $obj->product_ref; // deprecated. + $this->lines[$i]->ref_supplier = $obj->ref_supplier; // Reference product supplier TODO Rename field ref to ref_supplier into table llx_facture_fourn_det and llx_commande_fournisseurdet and update fields it into updateline + $this->lines[$i]->libelle = $obj->label; // This field may contains label of product (when invoice create from order) + $this->lines[$i]->product_desc = $obj->product_desc; // Description du produit $this->lines[$i]->pu_ht = $obj->pu_ht; $this->lines[$i]->pu_ttc = $obj->pu_ttc; $this->lines[$i]->tva_tx = $obj->tva_tx; @@ -498,7 +498,7 @@ class FactureFournisseur extends CommonInvoice else { $this->error=$this->db->error(); - dol_syslog('FactureFournisseur::fetch_lines: Error '.$this->error,LOG_ERR); + dol_syslog(get_class($this).'::fetch_lines: Error '.$this->error,LOG_ERR); return -3; } } @@ -1059,6 +1059,8 @@ class FactureFournisseur extends CommonInvoice * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,idprod) * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue). * + * FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order. + * * @param string $desc Description de la ligne * @param double $pu Prix unitaire (HT ou TTC selon price_base_type, > 0 even for credit note) * @param double $txtva Taux de tva force, sinon -1 @@ -1152,7 +1154,7 @@ class FactureFournisseur extends CommonInvoice * Update a line detail into database * * @param int $id Id of line invoice - * @param string $label Description of line + * @param string $desc Description of line * @param double $pu Prix unitaire (HT ou TTC selon price_base_type) * @param double $vatrate VAT Rate * @param double $txlocaltax1 LocalTax1 Rate @@ -1166,9 +1168,9 @@ class FactureFournisseur extends CommonInvoice * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - function updateline($id, $label, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0, $notrigger=false) + function updateline($id, $desc, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0, $notrigger=false) { - dol_syslog(get_class($this)."::updateline $id,$label,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent", LOG_DEBUG); + dol_syslog(get_class($this)."::updateline $id,$desc,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent", LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; $pu = price2num($pu); @@ -1194,7 +1196,7 @@ class FactureFournisseur extends CommonInvoice $localtaxes_type=getLocalTaxesFromRate($vatrate,0,$this->thirdparty); - $tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty,$localtaxes_type); + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -1217,7 +1219,7 @@ class FactureFournisseur extends CommonInvoice } $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET"; - $sql.= " description ='".$this->db->escape($label)."'"; + $sql.= " description ='".$this->db->escape($desc)."'"; $sql.= ", pu_ht = ".price2num($pu_ht); $sql.= ", pu_ttc = ".price2num($pu_ttc); $sql.= ", qty = ".price2num($qty); diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 4aeb265a41c..b642926f802 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -40,8 +40,13 @@ class ProductFournisseur extends Product var $product_fourn_price_id; // id of ligne product-supplier var $id; // product id - var $fourn_ref; // ref supplier - var $fourn_qty; // quantity for price + var $fourn_ref; // deprecated + var $ref_supplier; // ref supplier (can be set by get_buyprice) + var $vatrate_supplier; // default vat rate for this supplier/qty/product (can be set by get_buyprice) + + var $fourn_qty; // quantity for price (can be set by get_buyprice) + var $fourn_pu; // unit price for quantity (can be set by get_buyprice) + var $fourn_price; // price for quantity var $fourn_remise_percent; // discount for quantity (percent) var $fourn_remise; // discount for quantity (amount) diff --git a/htdocs/fourn/commande/liste.php b/htdocs/fourn/commande/liste.php index f6f634ec7ea..9e0c12ecf5f 100644 --- a/htdocs/fourn/commande/liste.php +++ b/htdocs/fourn/commande/liste.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2014 Marcos García * * 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 @@ -115,7 +116,8 @@ if ($sall) } if ($socid) $sql.= " AND s.rowid = ".$socid; -if (GETPOST('statut')!='') +//Required triple check because statut=0 means draft filter +if (GETPOST('statut', 'int') !== '') { $sql .= " AND fk_statut IN (".GETPOST('statut').")"; } diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 75025a8a539..e70d78d1ea6 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -363,6 +363,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; + // FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example. $result = $object->addline( $desc, $lines[$i]->subprice, @@ -466,9 +467,10 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) } } -// Modification d'une ligne +// Edit line elseif ($action == 'update_line' && $user->rights->fournisseur->facture->creer) { + // TODO Missing transaction if (GETPOST('etat') == '1' && ! GETPOST('cancel')) // si on valide la modification { $object->fetch($id); @@ -516,6 +518,8 @@ elseif ($action == 'update_line' && $user->rights->fournisseur->facture->creer) elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) { + $db->begin(); + $ret=$object->fetch($id); if ($ret < 0) { @@ -601,6 +605,7 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) $type = $productsupplier->type; + // TODO Save the product supplier ref into database into field ref_supplier (must rename field ref into ref_supplier first) $result=$object->addline($desc, $productsupplier->fourn_pu, $tvatx, $localtax1tx, $localtax2tx, $qty, $idprod, $remise_percent, '', '', 0, $npr); } if ($idprod == -2 || $idprod == 0) @@ -655,6 +660,8 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) //print "xx".$tva_tx; exit; if (! $error && $result > 0) { + $db->commit(); + // Define output language $outputlangs = $langs; $newlang=GETPOST('lang_id','alpha'); @@ -704,9 +711,13 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) unset($_POST['date_endmonth']); unset($_POST['date_endyear']); } - else if (empty($mesg)) - { - $mesg='
    '.$object->error.'
    '; + else + { + $db->rollback(); + if (empty($mesg)) + { + $mesg='
    '.$object->error.'
    '; + } } $action = ''; @@ -1141,10 +1152,10 @@ if ($action == 'create') $mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_supplier_id)?$soc->mode_reglement_supplier_id:0)); $remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0)); $remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0)); - $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; $datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']); - $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datetmp); + $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp); $datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']); $datedue=($datetmp==''?-1:$datetmp); } @@ -1154,7 +1165,7 @@ if ($action == 'create') $cond_reglement_id = $societe->cond_reglement_supplier_id; $mode_reglement_id = $societe->mode_reglement_supplier_id; $datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']); - $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datetmp); + $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp); $datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']); $datedue=($datetmp==''?-1:$datetmp); } @@ -2056,24 +2067,9 @@ else // Form to add new line if ($object->statut == 0 && $action != 'edit_line') { - /*print '
    '; - print ''; // ancre - print $langs->trans('AddNewLine').' - '.$langs->trans("FreeZone").''.$langs->trans('VAT').''.$langs->trans('PriceUHT').''.$langs->trans('PriceUTTC').''.$langs->trans('Qty').''.$langs->trans('ReductionShort').'    
    '; - - $forceall=1; // For suppliers, we always show all types - print $form->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1,0,$forceall); - if ($forceall || (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) - || (empty($conf->product->enabled) && empty($conf->service->enabled))) print '
    '; - - if (is_object($hookmanager)) - { - $parameters=array(); - $reshook=$hookmanager->executeHooks('formCreateSupplierProductOptions',$parameters,$object,$action); - } - - $nbrows=ROWS_2; - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; - $doleditor=new DolEditor('dp_desc',GETPOST("dp_desc"),'',100,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70); - $doleditor->Create(); - - print '
    '; - print $form->load_tva('tauxtva',(GETPOST('tauxtva')?GETPOST('tauxtva'):-1),$societe,$mysoc); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '%  
    '; - print $langs->trans("AddNewLine").' - '; - if (! empty($conf->service->enabled)) - { - print $langs->trans('RecordedProductsAndServices'); - } - else - { - print $langs->trans('RecordedProducts'); - } - print ''.$langs->trans('Qty').''.$langs->trans('ReductionShort').'  
    '; - - $ajaxoptions=array( - 'update' => array('qty_predef'=>'qty','remise_percent_predef' => 'discount'), // html id tag will be edited with which ajax json response key - 'disabled' => 'addPredefinedProductButton', // html id to disable once select is done - 'error' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'error' - ); - $form->select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions); - - if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) print '
    '; - - if (is_object($hookmanager)) - { - $parameters=array('htmlname'=>'idprodfournprice'); - $reshook=$hookmanager->executeHooks('formCreateProductSupplierOptions',$parameters,$object,$action); - } - - $nbrows=ROWS_2; - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; - $doleditor = new DolEditor('np_desc', GETPOST('np_desc'), '', 100, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, $nbrows, 70); - $doleditor->Create(); - - print '
    %  
    '; diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php index 40799e2bcb9..4b2c61c02a5 100644 --- a/htdocs/fourn/facture/impayees.php +++ b/htdocs/fourn/facture/impayees.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; -if (! $user->rights->facture->lire) accessforbidden(); +if (! $user->rights->fournisseur->facture->lire) accessforbidden(); $langs->load("companies"); $langs->load("bills"); diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 8502e13834d..f02e48a9be5 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -243,7 +243,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $object->fetch($facid); $datefacture=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); - $dateinvoice=($datefacture==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datefacture); + $dateinvoice=($datefacture==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datefacture); $sql = 'SELECT s.nom, s.rowid as socid,'; $sql.= ' f.rowid, f.ref, f.ref_supplier, f.amount, f.total_ttc as total'; diff --git a/htdocs/holiday/admin/holiday.php b/htdocs/holiday/admin/holiday.php index 174adbdf725..2b265711fa1 100644 --- a/htdocs/holiday/admin/holiday.php +++ b/htdocs/holiday/admin/holiday.php @@ -60,18 +60,18 @@ $cp = new Holiday($db); if ($action == "add") { $message = ''; - $error = false; + $error = 0; // Option du groupe de validation /*if (!$cp->updateConfCP('userGroup',$_POST['userGroup'])) { - $error = true; + $error++; }*/ // Option du délai pour faire une demande de congés payés if (!$cp->updateConfCP('delayForRequest',$_POST['delayForRequest'])) { - $error = true; + $error++; } // Option du nombre de jours à ajouter chaque mois @@ -79,67 +79,69 @@ if ($action == "add") if(!$cp->updateConfCP('nbHolidayEveryMonth',$nbHolidayEveryMonth)) { - $error = true; + $error++; } // Option du nombre de jours pour un mariage $OptMariageCP = price2num($_POST['OptMariage'],5); if(!$cp->updateConfCP('OptMariage',$OptMariageCP)) { - $error = true; + $error++; } // Option du nombre de jours pour un décés d'un proche $OptDecesProcheCP = price2num($_POST['OptDecesProche'],5); if(!$cp->updateConfCP('OptDecesProche',$OptDecesProcheCP)) { - $error = true; + $error++; } // Option du nombre de jours pour un mariage d'un enfant $OptMariageProcheCP = price2num($_POST['OptMariageProche'],5); if(!$cp->updateConfCP('OptMariageProche',$OptMariageProcheCP)) { - $error = true; + $error++; } // Option du nombre de jours pour un décés d'un parent $OptDecesParentsCP = price2num($_POST['OptDecesParents'],5); if(!$cp->updateConfCP('OptDecesParents',$OptDecesParentsCP)) { - $error = true; + $error++; } // Option pour avertir le valideur si délai de demande incorrect if(isset($_POST['AlertValidatorDelay'])) { if(!$cp->updateConfCP('AlertValidatorDelay','1')) { - $error = true; + $error++; } } else { if(!$cp->updateConfCP('AlertValidatorDelay','0')) { - $error = true; + $error++; } } // Option pour avertir le valideur si solde des congés de l'utilisateur inccorect if(isset($_POST['AlertValidatorSolde'])) { if(!$cp->updateConfCP('AlertValidatorSolde','1')) { - $error = true; + $error++; } } else { if(!$cp->updateConfCP('AlertValidatorSolde','0')) { - $error = true; + $error++; } } // Option du nombre de jours à déduire pour 1 jour de congés $nbHolidayDeducted = price2num($_POST['nbHolidayDeducted'],2); - if(!$cp->updateConfCP('nbHolidayDeducted',$nbHolidayDeducted)) { - $error = true; + if(!$cp->updateConfCP('nbHolidayDeducted',$nbHolidayDeducted)) + { + $error++; } - if ($error) { + if ($error) + { $message = '
    '.$langs->trans('ErrorUpdateConfCP').'
    '; } else { $message = '
    '.$langs->trans('UpdateConfCPOK').'
    '; @@ -151,8 +153,8 @@ if ($action == "add") $result = $db->query($sql); $num = $db->num_rows($sql); - - if($num < 1) { + if($num < 1) + { $cp->createCPusers(); $message.= '
    '.$langs->trans('AddCPforUsers').'
    '; } @@ -202,7 +204,7 @@ elseif ($action == 'create_event') } elseif($action == 'event' && isset($_POST['update_event'])) { - $error = false; + $error = 0; $eventId = array_keys($_POST['update_event']); $eventId = $eventId[0]; @@ -213,19 +215,21 @@ elseif($action == 'event' && isset($_POST['update_event'])) $eventValue = $optValue; $eventValue = $eventValue[$eventId]; - if(!empty($eventName)) { + if (!empty($eventName)) + { $eventName = trim($eventName); } else { - $error = true; + $error++; } - if(!empty($eventValue)) { + if (!empty($eventValue)) + { $eventValue = price2num($eventValue,2); } else { - $error = true; + $error++; } - if(!$error) + if (!$error) { // Mise à jour des congés de l'utilisateur $update = $cp->updateEventCP($eventId,$eventName,$eventValue); diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 1cf37e77d6f..f167422f503 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -82,7 +82,7 @@ if ($action == 'update' && isset($_POST['update_cp'])) $sql.= " value = '".dol_print_date($now,'%Y%m%d%H%M%S')."'"; $sql.= " WHERE name = 'lastUpdate' and value IS NULL"; // Add value IS NULL to be sure to update only at init. dol_syslog('define_holiday update lastUpdate entry sql='.$sql); - $result = $db->query($sql); + $result = $db->query($sql); $mesg='
    '.$langs->trans('UpdateConfCPOK').'
    '; @@ -91,21 +91,24 @@ if ($action == 'update' && isset($_POST['update_cp'])) } elseif($action == 'add_event') { - $error = false; + $error = 0; if(!empty($_POST['list_event']) && $_POST['list_event'] > 0) { $event = $_POST['list_event']; - } else { $error = true; + } else { $error++; } if(!empty($_POST['userCP']) && $_POST['userCP'] > 0) { $userCP = $_POST['userCP']; - } else { $error = true; + } else { $erro++; } - if($error) { + if ($error) + { $message = '
    '.$langs->trans('ErrorAddEventToUserCP').'
    '; - } else { + } + else + { $nb_holiday = $holiday->getCPforUser($userCP); $add_holiday = $holiday->getValueEventCp($event); $new_holiday = $nb_holiday + $add_holiday; diff --git a/htdocs/includes/jquery/plugins/tablednd/jquery.tablednd.0.6.js b/htdocs/includes/jquery/plugins/tablednd/jquery.tablednd.0.6.js new file mode 100644 index 00000000000..34f3c88232b --- /dev/null +++ b/htdocs/includes/jquery/plugins/tablednd/jquery.tablednd.0.6.js @@ -0,0 +1,400 @@ +/** + * TableDnD plug-in for JQuery, allows you to drag and drop table rows + * You can set up various options to control how the system will work + * Copyright (c) Denis Howlett + * Licensed like jQuery, see http://docs.jquery.com/License. + * + * Configuration options: + * + * onDragStyle + * This is the style that is assigned to the row during drag. There are limitations to the styles that can be + * associated with a row (such as you can't assign a border--well you can, but it won't be + * displayed). (So instead consider using onDragClass.) The CSS style to apply is specified as + * a map (as used in the jQuery css(...) function). + * onDropStyle + * This is the style that is assigned to the row when it is dropped. As for onDragStyle, there are limitations + * to what you can do. Also this replaces the original style, so again consider using onDragClass which + * is simply added and then removed on drop. + * onDragClass + * This class is added for the duration of the drag and then removed when the row is dropped. It is more + * flexible than using onDragStyle since it can be inherited by the row cells and other content. The default + * is class is tDnD_whileDrag. So to use the default, simply customise this CSS class in your + * stylesheet. + * onDrop + * Pass a function that will be called when the row is dropped. The function takes 2 parameters: the table + * and the row that was dropped. You can work out the new order of the rows by using + * table.rows. + * onDragStart + * Pass a function that will be called when the user starts dragging. The function takes 2 parameters: the + * table and the row which the user has started to drag. + * onAllowDrop + * Pass a function that will be called as a row is over another row. If the function returns true, allow + * dropping on that row, otherwise not. The function takes 2 parameters: the dragged row and the row under + * the cursor. It returns a boolean: true allows the drop, false doesn't allow it. + * scrollAmount + * This is the number of pixels to scroll if the user moves the mouse cursor to the top or bottom of the + * window. The page should automatically scroll up or down as appropriate (tested in IE6, IE7, Safari, FF2, + * FF3 beta + * dragHandle + * This is the name of a class that you assign to one or more cells in each row that is draggable. If you + * specify this class, then you are responsible for setting cursor: move in the CSS and only these cells + * will have the drag behaviour. If you do not specify a dragHandle, then you get the old behaviour where + * the whole row is draggable. + * + * Other ways to control behaviour: + * + * Add class="nodrop" to any rows for which you don't want to allow dropping, and class="nodrag" to any rows + * that you don't want to be draggable. + * + * Inside the onDrop method you can also call $.tableDnD.serialize() this returns a string of the form + * []=&[]= so that you can send this back to the server. The table must have + * an ID as must all the rows. + * + * Other methods: + * + * $("...").tableDnDUpdate() + * Will update all the matching tables, that is it will reapply the mousedown method to the rows (or handle cells). + * This is useful if you have updated the table rows using Ajax and you want to make the table draggable again. + * The table maintains the original configuration (so you don't have to specify it again). + * + * $("...").tableDnDSerialize() + * Will serialize and return the serialized string as above, but for each of the matching tables--so it can be + * called from anywhere and isn't dependent on the currentTable being set up correctly before calling + * + * Known problems: + * - Auto-scoll has some problems with IE7 (it scrolls even when it shouldn't), work-around: set scrollAmount to 0 + * + * Version 0.2: 2008-02-20 First public version + * Version 0.3: 2008-02-07 Added onDragStart option + * Made the scroll amount configurable (default is 5 as before) + * Version 0.4: 2008-03-15 Changed the noDrag/noDrop attributes to nodrag/nodrop classes + * Added onAllowDrop to control dropping + * Fixed a bug which meant that you couldn't set the scroll amount in both directions + * Added serialize method + * Version 0.5: 2008-05-16 Changed so that if you specify a dragHandle class it doesn't make the whole row + * draggable + * Improved the serialize method to use a default (and settable) regular expression. + * Added tableDnDupate() and tableDnDSerialize() to be called when you are outside the table + * Version 0.6: 2011-12-02 Added support for touch devices + */ +// Determine if this is a touch device +var hasTouch = 'ontouchstart' in document.documentElement, + startEvent = hasTouch ? 'touchstart' : 'mousedown', + moveEvent = hasTouch ? 'touchmove' : 'mousemove', + endEvent = hasTouch ? 'touchend' : 'mouseup'; + +jQuery.tableDnD = { + /** Keep hold of the current table being dragged */ + currentTable : null, + /** Keep hold of the current drag object if any */ + dragObject: null, + /** The current mouse offset */ + mouseOffset: null, + /** Remember the old value of Y so that we don't do too much processing */ + oldY: 0, + + + /** Actually build the structure */ + build: function(options) { + // Set up the defaults if any + + this.each(function() { + // This is bound to each matching table, set up the defaults and override with user options + this.tableDnDConfig = jQuery.extend({ + onDragStyle: null, + onDropStyle: null, + // Add in the default class for whileDragging + onDragClass: "tDnD_whileDrag", + onDrop: null, + onDragStart: null, + scrollAmount: 5, + + serializeRegexp: /[^\-]*$/, // The regular expression to use to trim row IDs + serializeParamName: null, // If you want to specify another parameter name instead of the table ID + dragHandle: null // If you give the name of a class here, then only Cells with this class will be draggable + }, options || {}); + // Now make the rows draggable + jQuery.tableDnD.makeDraggable(this); + }); + + // Don't break the chain + return this; + }, + + /** This function makes all the rows on the table draggable apart from those marked as "NoDrag" */ + makeDraggable: function(table) { + + var config = table.tableDnDConfig; + if (config.dragHandle) { + // We only need to add the event to the specified cells + var cells = jQuery("td."+table.tableDnDConfig.dragHandle, table); + cells.each(function() { + // The cell is bound to "this" + jQuery(this).bind(startEvent, function(ev) { + jQuery.tableDnD.initialiseDrag(this.parentNode, table, this, ev, config); + return false; + }); + }) + } else { + // For backwards compatibility, we add the event to the whole row + var rows = jQuery("tr", table); // get all the rows as a wrapped set + rows.each(function() { + // Iterate through each row, the row is bound to "this" + var row = jQuery(this); + if (! row.hasClass("nodrag")) { + row.bind(startEvent, function(ev) { + if (ev.target.tagName == "TD") { + jQuery.tableDnD.initialiseDrag(this, table, this, ev, config); + return false; + } + }).css("cursor", "move"); // Store the tableDnD object + } + }); + } + }, + + initialiseDrag: function(dragObject, table, target, evnt, config) { + jQuery.tableDnD.dragObject = dragObject; + jQuery.tableDnD.currentTable = table; + jQuery.tableDnD.mouseOffset = jQuery.tableDnD.getMouseOffset(target, evnt); + jQuery.tableDnD.originalOrder = jQuery.tableDnD.serialize(); + // Now we need to capture the mouse up and mouse move event + // We can use bind so that we don't interfere with other event handlers + jQuery(document) + .bind(moveEvent, jQuery.tableDnD.mousemove) + .bind(endEvent, jQuery.tableDnD.mouseup); + if (config.onDragStart) { + // Call the onDragStart method if there is one + config.onDragStart(table, target); + } + }, + + updateTables: function() { + this.each(function() { + // this is now bound to each matching table + if (this.tableDnDConfig) { + jQuery.tableDnD.makeDraggable(this); + } + }) + }, + + /** Get the mouse coordinates from the event (allowing for browser differences) */ + mouseCoords: function(ev){ + if(ev.pageX || ev.pageY){ + return {x:ev.pageX, y:ev.pageY}; + } + return { + x:ev.clientX + document.body.scrollLeft - document.body.clientLeft, + y:ev.clientY + document.body.scrollTop - document.body.clientTop + }; + }, + + /** Given a target element and a mouse event, get the mouse offset from that element. + To do this we need the element's position and the mouse position */ + getMouseOffset: function(target, ev) { + ev = ev || window.event; + + var docPos = this.getPosition(target); + var mousePos = this.mouseCoords(ev); + return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y}; + }, + + /** Get the position of an element by going up the DOM tree and adding up all the offsets */ + getPosition: function(e){ + var left = 0; + var top = 0; + /** Safari fix -- thanks to Luis Chato for this! */ + if (e.offsetHeight == 0) { + /** Safari 2 doesn't correctly grab the offsetTop of a table row + this is detailed here: + http://jacob.peargrove.com/blog/2006/technical/table-row-offsettop-bug-in-safari/ + the solution is likewise noted there, grab the offset of a table cell in the row - the firstChild. + note that firefox will return a text node as a first child, so designing a more thorough + solution may need to take that into account, for now this seems to work in firefox, safari, ie */ + e = e.firstChild; // a table cell + } + + while (e.offsetParent){ + left += e.offsetLeft; + top += e.offsetTop; + e = e.offsetParent; + } + + left += e.offsetLeft; + top += e.offsetTop; + + return {x:left, y:top}; + }, + + mousemove: function(ev) { + if (jQuery.tableDnD.dragObject == null) { + return; + } + if (ev.type == 'touchmove') { + // prevent touch device screen scrolling + event.preventDefault(); + } + + var dragObj = jQuery(jQuery.tableDnD.dragObject); + var config = jQuery.tableDnD.currentTable.tableDnDConfig; + var mousePos = jQuery.tableDnD.mouseCoords(ev); + var y = mousePos.y - jQuery.tableDnD.mouseOffset.y; + //auto scroll the window + var yOffset = window.pageYOffset; + if (document.all) { + // Windows version + //yOffset=document.body.scrollTop; + if (typeof document.compatMode != 'undefined' && + document.compatMode != 'BackCompat') { + yOffset = document.documentElement.scrollTop; + } + else if (typeof document.body != 'undefined') { + yOffset=document.body.scrollTop; + } + + } + + if (mousePos.y-yOffset < config.scrollAmount) { + window.scrollBy(0, -config.scrollAmount); + } else { + var windowHeight = window.innerHeight ? window.innerHeight + : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight; + if (windowHeight-(mousePos.y-yOffset) < config.scrollAmount) { + window.scrollBy(0, config.scrollAmount); + } + } + + + if (y != jQuery.tableDnD.oldY) { + // work out if we're going up or down... + var movingDown = y > jQuery.tableDnD.oldY; + // update the old value + jQuery.tableDnD.oldY = y; + // update the style to show we're dragging + if (config.onDragClass) { + dragObj.addClass(config.onDragClass); + } else { + dragObj.css(config.onDragStyle); + } + // If we're over a row then move the dragged row to there so that the user sees the + // effect dynamically + var currentRow = jQuery.tableDnD.findDropTargetRow(dragObj, y); + if (currentRow) { + // TODO worry about what happens when there are multiple TBODIES + if (movingDown && jQuery.tableDnD.dragObject != currentRow) { + jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow.nextSibling); + } else if (! movingDown && jQuery.tableDnD.dragObject != currentRow) { + jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow); + } + } + } + + return false; + }, + + /** We're only worried about the y position really, because we can only move rows up and down */ + findDropTargetRow: function(draggedRow, y) { + var rows = jQuery.tableDnD.currentTable.rows; + for (var i=0; i rowY - rowHeight) && (y < (rowY + rowHeight))) { + // that's the row we're over + // If it's the same as the current row, ignore it + if (row == draggedRow) {return null;} + var config = jQuery.tableDnD.currentTable.tableDnDConfig; + if (config.onAllowDrop) { + if (config.onAllowDrop(draggedRow, row)) { + return row; + } else { + return null; + } + } else { + // If a row has nodrop class, then don't allow dropping (inspired by John Tarr and Famic) + var nodrop = jQuery(row).hasClass("nodrop"); + if (! nodrop) { + return row; + } else { + return null; + } + } + return row; + } + } + return null; + }, + + mouseup: function(e) { + if (jQuery.tableDnD.currentTable && jQuery.tableDnD.dragObject) { + // Unbind the event handlers + jQuery(document) + .unbind(moveEvent, jQuery.tableDnD.mousemove) + .unbind(endEvent, jQuery.tableDnD.mouseup); + var droppedRow = jQuery.tableDnD.dragObject; + var config = jQuery.tableDnD.currentTable.tableDnDConfig; + // If we have a dragObject, then we need to release it, + // The row will already have been moved to the right place so we just reset stuff + if (config.onDragClass) { + jQuery(droppedRow).removeClass(config.onDragClass); + } else { + jQuery(droppedRow).css(config.onDropStyle); + } + jQuery.tableDnD.dragObject = null; + var newOrder = jQuery.tableDnD.serialize(); + if (config.onDrop && (jQuery.tableDnD.originalOrder != newOrder)) { + // Call the onDrop method if there is one + config.onDrop(jQuery.tableDnD.currentTable, droppedRow); + } + jQuery.tableDnD.currentTable = null; // let go of the table too + } + }, + + serialize: function() { + if (jQuery.tableDnD.currentTable) { + return jQuery.tableDnD.serializeTable(jQuery.tableDnD.currentTable); + } else { + return "Error: No Table id set, you need to set an id on your table and every row"; + } + }, + + serializeTable: function(table) { + var result = ""; + var tableId = table.id; + var rows = table.rows; + for (var i=0; i 0) result += "&"; + var rowId = rows[i].id; + if (rowId && rowId && table.tableDnDConfig && table.tableDnDConfig.serializeRegexp) { + rowId = rowId.match(table.tableDnDConfig.serializeRegexp)[0]; + } + + result += tableId + '[]=' + rowId; + } + return result; + }, + + serializeTables: function() { + var result = ""; + this.each(function() { + // this is now bound to each matching table + result += jQuery.tableDnD.serializeTable(this); + }); + return result; + } + +}; + + +jQuery.fn.extend( + { + tableDnD : jQuery.tableDnD.build, + tableDnDUpdate : jQuery.tableDnD.updateTables, + tableDnDSerialize: jQuery.tableDnD.serializeTables + } +); \ No newline at end of file diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 57dccdc1b0a..486811f7157 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -443,7 +443,8 @@ else $choice .= ''; $choice .= $langs->trans("UpgradeDesc"); - if ($recommended_choice) { + if ($recommended_choice) + { $choice .= '
    '; //print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE); $choice .= '
    '.$langs->trans("InstallChoiceSuggested").'
    '; @@ -475,6 +476,13 @@ else } } + // If there is no choice at all, we show all of them. + if (empty($available_choices)) + { + $available_choices=$notavailable_choices; + $notavailable_choices=array(); + } + // Array of install choices print ''; foreach ($available_choices as $choice) { diff --git a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql index bf48ab3207f..87579367a8a 100755 --- a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql +++ b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql @@ -11,8 +11,10 @@ -- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; -- To restrict request to Mysql version x.y use -- VMYSQLx.y -- To restrict request to Pgsql version x.y use -- VPGSQLx.y --- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; --- To make pk to be auto increment (postgres) VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE +-- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE +-- To remove a not null status (mysql): VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN colname integer NULL; +-- To remove a not null status (postgres): VPGSQL8.2 ALTER TABLE llx_table ALTER colname DROP NOT NULL; -- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); @@ -323,6 +325,8 @@ ALTER TABLE llx_facture_fourn ADD fk_mode_reglement integer NULL AFTER fk_cond_r ALTER TABLE llx_facture_fourn MODIFY COLUMN fk_mode_reglement integer NULL; ALTER TABLE llx_facture_fourn MODIFY COLUMN fk_cond_reglement integer NULL; +-- VPGSQL8.2 ALTER TABLE llx_facture_fourn ALTER fk_mode_reglement DROP NOT NULL; +-- VPGSQL8.2 ALTER TABLE llx_facture_fourn ALTER fk_cond_reglement DROP NOT NULL; INSERT INTO llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (9,'COMPANY_SENTBYMAIL','Mails sent from third party card','Executed when you send email from third party card','societe',1); diff --git a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql index 176568def37..bc2a62ea929 100644 --- a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql +++ b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql @@ -1197,3 +1197,8 @@ create table llx_c_type_resource )ENGINE=innodb; ALTER TABLE llx_c_type_resource ADD UNIQUE INDEX uk_c_type_resource_id (label, code); + +-- Fix: Missing instruction not correctly done into 3.5 +-- VPGSQL8.2 ALTER TABLE llx_facture_fourn ALTER fk_mode_reglement DROP NOT NULL; +-- VPGSQL8.2 ALTER TABLE llx_facture_fourn ALTER fk_cond_reglement DROP NOT NULL; + diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index de0a8fe28a1..9b15d36ffe9 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -444,4 +444,3 @@ if ($db->connected) $db->close(); // Return code if ran from command line if ($ret) exit($ret); -?> diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index d22e27c1cbf..6dce9fec19d 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -233,7 +233,9 @@ OfficialWebSiteFr=French official web site OfficialWiki=Dolibarr documentation on Wiki OfficialDemo=Dolibarr online demo OfficialMarketPlace=Official market place for external modules/addons -OfficialWebHostingService=Official web hosting services (Cloud hosting) +OfficialWebHostingService=Referenced web hosting services (Cloud hosting) +ReferencedPreferredPartners=Preferred Partners +OtherResources=Autres ressources ForDocumentationSeeWiki=For user or developer documentation (Doc, FAQs...),
    take a look at the Dolibarr Wiki:
    %s ForAnswersSeeForum=For any other questions/help, you can use the Dolibarr forum:
    %s HelpCenterDesc1=This area can help you to get a Help support service on Dolibarr. diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php index 49049a20783..c3b7e7da1c7 100644 --- a/htdocs/livraison/fiche.php +++ b/htdocs/livraison/fiche.php @@ -807,4 +807,3 @@ else llxFooter(); $db->close(); -?> diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index da7642e8df4..5d9babd0e89 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -247,4 +247,3 @@ if (! defined('MAIN_LABEL_MENTION_NPR') ) define('MAIN_LABEL_MENTION_NPR','NPR') // We force FPDF if (! empty($dolibarr_pdf_force_fpdf)) $conf->global->MAIN_USE_FPDF=$dolibarr_pdf_force_fpdf; -?> diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index c98993526f5..37c04e50a29 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -519,4 +519,3 @@ class Opensurveysondage extends CommonObject $this->sujet = trim($this->sujet); } } -?> diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index 4b0ca196639..d7cdaae62ac 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -193,4 +193,3 @@ print ''."\n"; llxFooter(); $db->close(); -?> \ No newline at end of file diff --git a/htdocs/opensurvey/public/studs.php b/htdocs/opensurvey/public/studs.php index bd0ff34073e..01bb969df20 100644 --- a/htdocs/opensurvey/public/studs.php +++ b/htdocs/opensurvey/public/studs.php @@ -741,4 +741,3 @@ print ''."\n"; llxFooterSurvey(); $db->close(); -?> \ No newline at end of file diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php index a7f788250eb..6e10e10778a 100644 --- a/htdocs/opensurvey/wizard/choix_date.php +++ b/htdocs/opensurvey/wizard/choix_date.php @@ -555,4 +555,3 @@ print ''."\n"; llxFooter(); $db->close(); -?> \ No newline at end of file diff --git a/htdocs/opensurvey/wizard/create_survey.php b/htdocs/opensurvey/wizard/create_survey.php index a1e08f25632..b63536247f5 100644 --- a/htdocs/opensurvey/wizard/create_survey.php +++ b/htdocs/opensurvey/wizard/create_survey.php @@ -199,4 +199,3 @@ print ''."\n"; llxFooter(); $db->close(); -?> diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index 89664230492..69b0664eb9d 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -386,4 +386,3 @@ if (! empty($conf->use_javascript_ajax)) llxFooter(); $db->close(); -?> diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ae1c0f2f43c..a2d2ee36d9c 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -267,7 +267,10 @@ class Product extends CommonObject $this->accountancy_code_buy = trim($this->accountancy_code_buy); $this->accountancy_code_sell= trim($this->accountancy_code_sell); - // Check parameters + // Barcode value + $this->barcode=trim($this->barcode); + + // Check parameters if (empty($this->libelle)) { $this->error='ErrorMandatoryParametersNotProvided'; @@ -277,7 +280,7 @@ class Product extends CommonObject { // Load object modCodeProduct $module=(! empty($conf->global->PRODUCT_CODEPRODUCT_ADDON)?$conf->global->PRODUCT_CODEPRODUCT_ADDON:'mod_codeproduct_leopard'); - if ($module != 'mod_codeproduct_leopard') // Do not load module file + if ($module != 'mod_codeproduct_leopard') // Do not load module file for leopard { if (substr($module, 0, 16) == 'mod_codeproduct_' && substr($module, -3) == 'php') { @@ -306,11 +309,11 @@ class Product extends CommonObject // For automatic creation during create action (not used by Dolibarr GUI, can be used by scripts) if ($this->barcode == -1) $this->barcode = $this->get_barcode($this,$this->barcode_type_code); - + // Check more parameters // If error, this->errors[] is filled $result = $this->verify(); - + if ($result >= 0) { $sql = "SELECT count(*) as nb"; @@ -453,7 +456,8 @@ class Product extends CommonObject /** - * Check properties of product are ok (like name, barcode, ...) + * Check properties of product are ok (like name, barcode, ...). + * All properties must be already loaded on object (this->barcode, this->barcode_type_code, ...). * * @return int 0 if OK, <0 if KO */ @@ -470,7 +474,7 @@ class Product extends CommonObject $result = -2; } - $rescode = $this->check_barcode($this->barcode); + $rescode = $this->check_barcode($this->barcode,$this->barcode_type_code); if ($rescode <> 0) { if ($rescode == -1) @@ -492,15 +496,16 @@ class Product extends CommonObject } /** - * Check customer code + * Check barcode * * @param string $valuetotest Value to test + * @param string $typefortest Type of barcode (ISBN, EAN, ...) * @return int 0 if OK * -1 ErrorBadBarCodeSyntax * -2 ErrorBarCodeRequired * -3 ErrorBarCodeAlreadyUsed */ - function check_barcode($valuetotest) + function check_barcode($valuetotest,$typefortest) { global $conf; if (! empty($conf->barcode->enabled) && ! empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) @@ -515,9 +520,9 @@ class Product extends CommonObject } $mod = new $module(); - - dol_syslog(get_class($this)."::check_barcode barcode=".$valuetotest." module=".$module); - $result = $mod->verif($this->db, $valuetotest, $this, 0); + + dol_syslog(get_class($this)."::check_barcode value=".$valuetotest." type=".$typefortest." module=".$module); + $result = $mod->verif($this->db, $valuetotest, $this, 0, $typefortest); return $result; } else @@ -566,7 +571,7 @@ class Product extends CommonObject if (empty($this->country_id)) $this->country_id = 0; - //Gencod + // Barcode value $this->barcode=trim($this->barcode); $this->accountancy_code_buy = trim($this->accountancy_code_buy); @@ -581,7 +586,7 @@ class Product extends CommonObject { $result = $this->verify(); // We don't check when update called during a create because verify was already done } - + if ($result >= 0) { // For automatic creation @@ -595,7 +600,7 @@ class Product extends CommonObject $sql.= ", recuperableonly = " . $this->tva_npr; $sql.= ", localtax1_tx = " . $this->localtax1_tx; $sql.= ", localtax2_tx = " . $this->localtax2_tx; - + $sql.= ", barcode = ". (empty($this->barcode)?"null":"'".$this->db->escape($this->barcode)."'"); $sql.= ", fk_barcode_type = ". (empty($this->barcode_type)?"null":$this->db->escape($this->barcode_type)); @@ -622,7 +627,7 @@ class Product extends CommonObject $sql.= ", accountancy_code_sell= '" . $this->accountancy_code_sell."'"; $sql.= ", desiredstock = " . ((isset($this->desiredstock) && $this->desiredstock != '') ? $this->desiredstock : "null"); $sql.= " WHERE rowid = " . $id; - + dol_syslog(get_class($this)."update sql=".$sql); $resql=$this->db->query($sql); if ($resql) @@ -1038,14 +1043,14 @@ class Product extends CommonObject /** - * Lit le prix pratique par un fournisseur - * On renseigne le couple prodfournprice/qty ou le triplet qty/product_id/fourn_ref + * Read price used by a provider + * We enter as input couple prodfournprice/qty or triplet qty/product_id/fourn_ref * * @param int $prodfournprice Id du tarif = rowid table product_fournisseur_price * @param double $qty Quantity asked * @param int $product_id Filter on a particular product id * @param string $fourn_ref Filter on a supplier ref - * @return int <-1 if KO, -1 if qty not enough, 0 si ok mais rien trouve, id_product si ok et trouve + * @return int <-1 if KO, -1 if qty not enough, 0 si ok mais rien trouve, id_product si ok et trouve. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...) */ function get_buyprice($prodfournprice,$qty,$product_id=0,$fourn_ref=0) { @@ -1076,7 +1081,7 @@ class Product extends CommonObject { // We do same select again but searching with qty, ref and id product $sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.fk_soc,"; - $sql.= " pfp.fk_product, pfp.ref_fourn, pfp.tva_tx"; + $sql.= " pfp.fk_product, pfp.ref_fourn as ref_supplier, pfp.tva_tx"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= " WHERE pfp.ref_fourn = '".$fourn_ref."'"; $sql.= " AND pfp.fk_product = ".$product_id; @@ -1091,9 +1096,11 @@ class Product extends CommonObject $obj = $this->db->fetch_object($resql); if ($obj && $obj->quantity > 0) // If found { - $this->buyprice = $obj->price; // \deprecated + $this->buyprice = $obj->price; // deprecated + $this->fourn_qty = $obj->quantity; // min quantity for price $this->fourn_pu = $obj->price / $obj->quantity; // Prix unitaire du produit pour le fournisseur $fourn_id - $this->ref_fourn = $obj->ref_fourn; // Ref supplier + $this->ref_fourn = $obj->ref_supplier; // deprecated + $this->ref_supplier = $obj->ref_supplier; // Ref supplier $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier $result=$obj->fk_product; return $result; diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 0f88d80d34b..3e5417ae9e8 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -153,4 +153,3 @@ else llxFooter(); $db->close(); -?> diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 21fa78abd7f..deeae6784e6 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -36,6 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; @@ -122,7 +123,7 @@ if (empty($reshook)) // Barcode value if ($action == 'setbarcode' && $createbarcode) { - $result=$object->check_barcode(GETPOST('barcode')); + $result=$object->check_barcode(GETPOST('barcode'),GETPOT('barcode_type_code')); if ($result >= 0) { @@ -206,7 +207,20 @@ if (empty($reshook)) $object->barcode_type = GETPOST('fk_barcode_type'); $object->barcode = GETPOST('barcode'); - + // Set barcode_type_xxx from barcode_type id + $stdobject=new GenericObject($db); + $stdobject->element='product'; + $stdobject->barcode_type=GETPOST('fk_barcode_type'); + $result=$stdobject->fetch_barcode(); + if ($result < 0) + { + $error++; + setEventMessage('Failed to get bar code type information '.$stdobject->error, 'errors'); + } + $object->barcode_type_code = $stdobject->barcode_type_code; + $object->barcode_type_coder = $stdobject->barcode_type_coder; + $object->barcode_type_label = $stdobject->barcode_type_label; + $object->description = dol_htmlcleanlastbr(GETPOST('desc')); $object->url = GETPOST('url'); $object->note = dol_htmlcleanlastbr(GETPOST('note')); @@ -307,7 +321,20 @@ if (empty($reshook)) $object->barcode_type = GETPOST('fk_barcode_type'); $object->barcode = GETPOST('barcode'); - + // Set barcode_type_xxx from barcode_type id + $stdobject=new GenericObject($db); + $stdobject->element='product'; + $stdobject->barcode_type=GETPOST('fk_barcode_type'); + $result=$stdobject->fetch_barcode(); + if ($result < 0) + { + $error++; + setEventMessage('Failed to get bar code type information '.$stdobject->error, 'errors'); + } + $object->barcode_type_code = $stdobject->barcode_type_code; + $object->barcode_type_coder = $stdobject->barcode_type_coder; + $object->barcode_type_label = $stdobject->barcode_type_label; + $object->accountancy_code_sell = GETPOST('accountancy_code_sell'); $object->accountancy_code_buy = GETPOST('accountancy_code_buy'); @@ -798,8 +825,8 @@ else if ($showbarcode) { - print ''; } - + print ''; // Type @@ -1272,7 +1300,7 @@ else print $form->editfieldval("Type",'fk_product_type',$object->type,$object,$user->rights->produit->creer||$user->rights->service->creer,$typeformat); print ''; } - + if ($showbarcode) { // Barcode type @@ -1309,6 +1337,7 @@ else print ''; print ''; print ''; + print ''; print ''; print ' '; } diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 015e7a8a1e3..40e99a2d2ee 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -368,6 +368,15 @@ else print ' '; print ''; } + else + { + print ''; + print ''; + } print ''; } - // Date + // Modification Date print '\n"; // Duration if (! empty($conf->service->enabled) && $type != 0) { print ''; } @@ -454,7 +467,8 @@ else } // Better buy price - if ($user->rights->produit->creer) { + if ($user->rights->produit->creer) + { print ''; + print ''; + print ''; } } diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index fcf03068935..2a06c30a496 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -199,4 +199,3 @@ else llxFooter(); $db->close(); -?> diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index 05be133ac00..a55673c62b0 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -186,4 +186,3 @@ else llxFooter(); $db->close(); -?> diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 00716b9df01..1498b12a033 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -569,4 +569,3 @@ llxFooter(); $db->close(); -?> diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php index e2899e4e465..17e23fef009 100644 --- a/htdocs/product/stock/valo.php +++ b/htdocs/product/stock/valo.php @@ -162,4 +162,3 @@ else llxFooter(); $db->close(); -?> diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index 1a2f6603d1d..218e165a195 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -335,4 +335,3 @@ print ''; llxFooter(); $db->close(); -?> diff --git a/htdocs/projet/admin/project_extrafields.php b/htdocs/projet/admin/project_extrafields.php index 9ed4381103a..5707c6be640 100644 --- a/htdocs/projet/admin/project_extrafields.php +++ b/htdocs/projet/admin/project_extrafields.php @@ -150,4 +150,3 @@ if ($action == 'edit' && ! empty($attrname)) llxFooter(); $db->close(); -?> diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index c652c591ff7..d40682d7ce6 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -157,4 +157,3 @@ else llxFooter(); $db->close(); -?> diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index b35f89dd1a7..04164a38579 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -317,7 +317,7 @@ foreach ($listofreferent as $key => $value) } if ($key == 'invoice' && ! empty($conf->facture->enabled) && $user->rights->facture->creer) { - print ''.$langs->trans("AddCustomerInvoice").''; + print ''.$langs->trans("AddCustomerInvoice").''; } } if ($project->societe->fournisseur) diff --git a/htdocs/projet/jsgantt_language.js.php b/htdocs/projet/jsgantt_language.js.php index d7135e9ca0d..16b89fbebb3 100644 --- a/htdocs/projet/jsgantt_language.js.php +++ b/htdocs/projet/jsgantt_language.js.php @@ -73,4 +73,3 @@ i18n["Period"] = "transnoentities("Period") ?>"; close(); -?> diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php index 94e05ece06a..d019a629bdd 100644 --- a/htdocs/projet/tasks/index.php +++ b/htdocs/projet/tasks/index.php @@ -126,7 +126,7 @@ print ''; print ''; print "\n"; -if (count($tasksarray) > (empty($conf->global->PROJECT_MAX_NB_TASKS)?1000:$conf->global->PROJECT_MAX_NB_TASKS)) +if (count($tasksarray) > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)) { print ''; print '
    '.$langs->trans('BarcodeType').''; - if (isset($_POST['fk_barcode_type'])) + print '
    '.$langs->trans('BarcodeType').''; + if (isset($_POST['fk_barcode_type'])) { $fk_barcode_type=GETPOST('fk_barcode_type'); } @@ -1066,6 +1093,7 @@ else } else { + $fk_barcode_type=$object->barcode_type; if (empty($fk_barcode_type) && ! empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; } require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; @@ -1250,7 +1278,7 @@ else if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) $nblignes+=2; if ($object->isservice()) $nblignes++; else $nblignes+=4; - + // Photo if ($showphoto || $showbarcode) { @@ -1260,7 +1288,7 @@ else if ($showbarcode) print $form->showbarcode($object); print '
    '; + print ' '; + print ''; + print ' '; + print ''; print $form->selectarray('tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'),'1'=>$langs->trans('ProductStatusOnSellShort')),$tosell,1); @@ -429,18 +438,22 @@ else print ''.$objp->barcode.''.dol_print_date($db->jdate($objp->datem),'day')."'; - if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); - elseif (preg_match('/([0-9]+)m/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth"); - elseif (preg_match('/([0-9]+)w/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek"); - elseif (preg_match('/([0-9]+)d/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay"); - else print $objp->duration; + if (preg_match('/([0-9]+)[a-z]/i',$objp->duration)) + { + if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); + elseif (preg_match('/([0-9]+)m/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth"); + elseif (preg_match('/([0-9]+)w/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek"); + elseif (preg_match('/([0-9]+)d/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay"); + //elseif (preg_match('/([0-9]+)h/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationHour"); + else print $objp->duration; + } print ''; if ($objp->minsellprice != '') { @@ -489,7 +503,12 @@ else } else { - print ' '; + print ' '; + print ''; + print ' '; + print '
    '; diff --git a/htdocs/public/emailing/mailing-unsubscribe.php b/htdocs/public/emailing/mailing-unsubscribe.php index ec95078808c..0b11ec3642b 100644 --- a/htdocs/public/emailing/mailing-unsubscribe.php +++ b/htdocs/public/emailing/mailing-unsubscribe.php @@ -124,4 +124,3 @@ if (! empty($tag) && ($unsuscrib=='1')) } $db->close(); -?> diff --git a/htdocs/public/paybox/index.php b/htdocs/public/paybox/index.php index 08cbbd48176..0b7ad1c82e4 100644 --- a/htdocs/public/paybox/index.php +++ b/htdocs/public/paybox/index.php @@ -26,4 +26,3 @@ require '../../master.inc.php'; header("Location: ".DOL_URL_ROOT.'/public/error-404.php'); -?> diff --git a/htdocs/resource/add.php b/htdocs/resource/add.php index 5b127204185..fde152b6185 100755 --- a/htdocs/resource/add.php +++ b/htdocs/resource/add.php @@ -172,4 +172,3 @@ if ( !$action ) // End of page llxFooter(); $db->close(); -?> diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index 1ecf827fe39..38562557e3a 100755 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -249,4 +249,3 @@ else { // End of page llxFooter(); $db->close(); -?> diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php index cdeb11950eb..f618581aecd 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -201,4 +201,3 @@ class FormResource } -?> diff --git a/htdocs/resource/class/resource.class.php b/htdocs/resource/class/resource.class.php index 6b3f0d6d6ee..6edeef201fb 100644 --- a/htdocs/resource/class/resource.class.php +++ b/htdocs/resource/class/resource.class.php @@ -894,4 +894,3 @@ class Resource extends CommonObject return $result; } } -?> diff --git a/htdocs/societe/ajaxcountries.php b/htdocs/societe/ajaxcountries.php index 6b23b3290ce..78018a22035 100644 --- a/htdocs/societe/ajaxcountries.php +++ b/htdocs/societe/ajaxcountries.php @@ -76,4 +76,3 @@ if (! empty($country)) } } -?> \ No newline at end of file diff --git a/htdocs/societe/canvas/individual/actions_card_individual.class.php b/htdocs/societe/canvas/individual/actions_card_individual.class.php index d64adde4cb6..b8cb94a820b 100644 --- a/htdocs/societe/canvas/individual/actions_card_individual.class.php +++ b/htdocs/societe/canvas/individual/actions_card_individual.class.php @@ -141,4 +141,3 @@ class ActionsCardIndividual extends ActionsCardCommon } -?> \ No newline at end of file diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index 0fb2da5a053..20c9068d4f6 100644 --- a/htdocs/societe/checkvat/checkVatPopup.php +++ b/htdocs/societe/checkvat/checkVatPopup.php @@ -169,4 +169,3 @@ if ($messagetoshow) llxFooter(); -?> diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index 7c11b074e3b..27209c05abd 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -86,4 +86,3 @@ class Client extends Societe } } -?> diff --git a/htdocs/societe/notify/fiche.php b/htdocs/societe/notify/fiche.php index 04210617d3d..198739398a2 100644 --- a/htdocs/societe/notify/fiche.php +++ b/htdocs/societe/notify/fiche.php @@ -406,4 +406,3 @@ $db->close(); llxFooter(); -?> diff --git a/htdocs/support/inc.php b/htdocs/support/inc.php index 921a64963bf..58b9de1d38c 100644 --- a/htdocs/support/inc.php +++ b/htdocs/support/inc.php @@ -239,4 +239,3 @@ function pFooter($nonext=0,$setuplang='') print ''."\n"; } -?> diff --git a/htdocs/theme/amarok/style.css.php b/htdocs/theme/amarok/style.css.php index 38df086e267..f47813271a8 100644 --- a/htdocs/theme/amarok/style.css.php +++ b/htdocs/theme/amarok/style.css.php @@ -2112,6 +2112,14 @@ div.jnotify-background { .sorting_desc { background: url('') no-repeat center right; } .sorting_asc_disabled { background: url('') no-repeat center right; } .sorting_desc_disabled { background: url('') no-repeat center right; } +.paginate_disabled_previous:hover, .paginate_enabled_previous:hover, .paginate_disabled_next:hover, .paginate_enabled_next:hover +{ + font-weight: normal; +} +.paginate_enabled_previous:hover, .paginate_enabled_next:hover +{ + text-decoration: underline !important; +} /* ============================================================================== */ diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php index a3b5150bb57..47e982404d2 100644 --- a/htdocs/theme/auguria/style.css.php +++ b/htdocs/theme/auguria/style.css.php @@ -2287,6 +2287,14 @@ div.ecmjqft { .sorting_desc { background: url('') no-repeat center right; } .sorting_asc_disabled { background: url('') no-repeat center right; } .sorting_desc_disabled { background: url('') no-repeat center right; } +.paginate_disabled_previous:hover, .paginate_enabled_previous:hover, .paginate_disabled_next:hover, .paginate_enabled_next:hover +{ + font-weight: normal; +} +.paginate_enabled_previous:hover, .paginate_enabled_next:hover +{ + text-decoration: underline !important; +} /* ============================================================================== */ diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index 00bb6e62a14..ab50dae7ae9 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -2475,6 +2475,14 @@ div.ecmjqft { .sorting_desc { background: url('') no-repeat center right; } .sorting_asc_disabled { background: url('') no-repeat center right; } .sorting_desc_disabled { background: url('') no-repeat center right; } +.paginate_disabled_previous:hover, .paginate_enabled_previous:hover, .paginate_disabled_next:hover, .paginate_enabled_next:hover +{ + font-weight: normal; +} +.paginate_enabled_previous:hover, .paginate_enabled_next:hover +{ + text-decoration: underline !important; +} /* ============================================================================== */ diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php index ff6e3696d33..285fcad6880 100644 --- a/htdocs/theme/cameleo/style.css.php +++ b/htdocs/theme/cameleo/style.css.php @@ -2370,6 +2370,14 @@ div.ecmjqft { .sorting_desc { background: url('') no-repeat center right; } .sorting_asc_disabled { background: url('') no-repeat center right; } .sorting_desc_disabled { background: url('') no-repeat center right; } +.paginate_disabled_previous:hover, .paginate_enabled_previous:hover, .paginate_disabled_next:hover, .paginate_enabled_next:hover +{ + font-weight: normal; +} +.paginate_enabled_previous:hover, .paginate_enabled_next:hover +{ + text-decoration: underline !important; +} /* ============================================================================== */ diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 2f2622cd9c1..63b789a4597 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2270,6 +2270,8 @@ li.cal_event { border: none; list-style-type: none; } /* Ajax - Liste deroulante de l'autocompletion */ /* ============================================================================== */ +.ui-widget-content { border: solid 1px rgba(0,0,0,.3); background: #fff; } + .ui-autocomplete-loading { background: white url() right center no-repeat; } .ui-autocomplete { position:absolute; @@ -2483,7 +2485,7 @@ A.none, A.none:active, A.none:visited, A.none:hover { { line-height: 1em !important; } -.ui-autocomplete-input { margin: 0; } +.ui-autocomplete-input { margin: 0; padding: 2px; } /* ============================================================================== */ @@ -2693,7 +2695,14 @@ div.dolEventError h1, div.dolEventError h2 { .sorting_desc { background: url('') no-repeat center right; } .sorting_asc_disabled { background: url('') no-repeat center right; } .sorting_desc_disabled { background: url('') no-repeat center right; } - +.paginate_disabled_previous:hover, .paginate_enabled_previous:hover, .paginate_disabled_next:hover, .paginate_enabled_next:hover +{ + font-weight: normal; +} +.paginate_enabled_previous:hover, .paginate_enabled_next:hover +{ + text-decoration: underline !important; +} /* For jquery plugin combobox */ /* Disable this. It breaks wrapping of boxes diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index b95374d800b..3dc3c14cc12 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -217,4 +217,3 @@ if ($id > 0) llxFooter(); $db->close(); -?> diff --git a/htdocs/webservices/server_category.php b/htdocs/webservices/server_category.php index 5e55dae8b18..1b85c677175 100644 --- a/htdocs/webservices/server_category.php +++ b/htdocs/webservices/server_category.php @@ -302,4 +302,3 @@ function getCategory($authentication,$id) // Return the results. $server->service($HTTP_RAW_POST_DATA); -?> diff --git a/scripts/company/export-contacts-xls-example.php b/scripts/company/export-contacts-xls-example.php index 55c1b04b400..bf55c4a2eaf 100755 --- a/scripts/company/export-contacts-xls-example.php +++ b/scripts/company/export-contacts-xls-example.php @@ -122,4 +122,3 @@ $objWriter->save($fname); print 'File '.$fname.' was generated.'."\n"; exit(0); -?> diff --git a/scripts/user/sync_users_ldap2dolibarr.php b/scripts/user/sync_users_ldap2dolibarr.php index 60cb1118c37..a1237b999cb 100755 --- a/scripts/user/sync_users_ldap2dolibarr.php +++ b/scripts/user/sync_users_ldap2dolibarr.php @@ -311,4 +311,3 @@ function dolValidElement($element) return (trim($element) != ''); } -?> diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index 339d8e50ede..d8dda85f2fc 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -196,4 +196,3 @@ class AllTests } } -?> diff --git a/test/phpunit/BuildDocTest.php b/test/phpunit/BuildDocTest.php index 89da06c559e..50f9598e79e 100644 --- a/test/phpunit/BuildDocTest.php +++ b/test/phpunit/BuildDocTest.php @@ -424,4 +424,3 @@ class BuildDocTest extends PHPUnit_Framework_TestCase return 0; } } -?> diff --git a/test/phpunit/CategorieTest.php b/test/phpunit/CategorieTest.php index ae3e92268df..bae2e989f24 100755 --- a/test/phpunit/CategorieTest.php +++ b/test/phpunit/CategorieTest.php @@ -336,4 +336,3 @@ class CategorieTest extends PHPUnit_Framework_TestCase } } -?> diff --git a/test/phpunit/ChargeSocialesTest.php b/test/phpunit/ChargeSocialesTest.php index 23df7ff09fd..69b1f93f776 100755 --- a/test/phpunit/ChargeSocialesTest.php +++ b/test/phpunit/ChargeSocialesTest.php @@ -239,4 +239,3 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase } } -?> \ No newline at end of file diff --git a/test/phpunit/ContactTest.php b/test/phpunit/ContactTest.php index 27610daa16b..3c09df861f0 100755 --- a/test/phpunit/ContactTest.php +++ b/test/phpunit/ContactTest.php @@ -404,4 +404,3 @@ class ContactTest extends PHPUnit_Framework_TestCase return $localobjectadd->id; } } -?> diff --git a/test/phpunit/CoreTest.php b/test/phpunit/CoreTest.php index 2142f69e646..8d56b4a0b42 100755 --- a/test/phpunit/CoreTest.php +++ b/test/phpunit/CoreTest.php @@ -297,4 +297,3 @@ class CoreTest extends PHPUnit_Framework_TestCase $this->assertEquals($result,$expectedresult); } } -?> diff --git a/test/phpunit/DateLibTest.php b/test/phpunit/DateLibTest.php index 4d59ca7eb57..f5d9e7d0cc4 100644 --- a/test/phpunit/DateLibTest.php +++ b/test/phpunit/DateLibTest.php @@ -342,4 +342,3 @@ class DateLibTest extends PHPUnit_Framework_TestCase } } -?> diff --git a/test/phpunit/DiscountTest.php b/test/phpunit/DiscountTest.php index 80343da8083..d9f92c84bd1 100755 --- a/test/phpunit/DiscountTest.php +++ b/test/phpunit/DiscountTest.php @@ -187,4 +187,3 @@ class DiscountTest extends PHPUnit_Framework_TestCase return $result; } } -?> \ No newline at end of file diff --git a/test/phpunit/FactureFournisseurTest.php b/test/phpunit/FactureFournisseurTest.php index 2cacb073b60..a5855b37a37 100644 --- a/test/phpunit/FactureFournisseurTest.php +++ b/test/phpunit/FactureFournisseurTest.php @@ -265,4 +265,3 @@ class FactureFournisseurTest extends PHPUnit_Framework_TestCase } } -?> \ No newline at end of file diff --git a/test/phpunit/FactureTestRounding.php b/test/phpunit/FactureTestRounding.php index 6adeb71471d..d4bb8b9dff7 100644 --- a/test/phpunit/FactureTestRounding.php +++ b/test/phpunit/FactureTestRounding.php @@ -333,4 +333,3 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase } } -?> diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index 21444d2a60a..0e011c96d2c 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -387,4 +387,3 @@ class FilesLibTest extends PHPUnit_Framework_TestCase $this->assertEquals(0,count($result)); } } -?> diff --git a/test/phpunit/Functions2LibTest.php b/test/phpunit/Functions2LibTest.php index e302e1858e7..8e4bfe7550f 100755 --- a/test/phpunit/Functions2LibTest.php +++ b/test/phpunit/Functions2LibTest.php @@ -155,4 +155,3 @@ class Functions2LibTest extends PHPUnit_Framework_TestCase } } -?> \ No newline at end of file diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 11035d148d5..2178ad6fb5a 100755 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -186,6 +186,9 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $input='xxx
    '; $after=dol_textishtml($input); $this->assertTrue($after); + $input='

    abc

    '; + $after=dol_textishtml($input); + $this->assertTrue($after); // False $input='xxx < br>'; @@ -594,16 +597,16 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase public function testVerifCond() { $verifcond=verifCond('1==1'); - $this->assertTrue($verifcond); + $this->assertTrue($verifcond,'Test a true comparison'); $verifcond=verifCond('1==2'); - $this->assertFalse($verifcond); + $this->assertFalse($verifcond,'Test a false comparison'); $verifcond=verifCond('$conf->facture->enabled'); - $this->assertTrue($verifcond); + $this->assertTrue($verifcond,'Test that conf property of a module report true when enabled'); $verifcond=verifCond('$conf->moduledummy->enabled'); - $this->assertFalse($verifcond); + $this->assertFalse($verifcond,'Test that conf property of a module report false when disabled'); $verifcond=verifCond(''); $this->assertTrue($verifcond); diff --git a/test/phpunit/HolidayTest.php b/test/phpunit/HolidayTest.php index d9b0b54b5f7..e91305c21e2 100644 --- a/test/phpunit/HolidayTest.php +++ b/test/phpunit/HolidayTest.php @@ -290,4 +290,3 @@ class HolidayTest extends PHPUnit_Framework_TestCase } } -?> diff --git a/test/phpunit/ImportTest.php b/test/phpunit/ImportTest.php index af3b53a837e..4d9590e7a1d 100755 --- a/test/phpunit/ImportTest.php +++ b/test/phpunit/ImportTest.php @@ -134,4 +134,3 @@ class ImportTest extends PHPUnit_Framework_TestCase } } -?> diff --git a/test/phpunit/JsonLibTest.php b/test/phpunit/JsonLibTest.php index e5610981399..caceb6d0dc3 100755 --- a/test/phpunit/JsonLibTest.php +++ b/test/phpunit/JsonLibTest.php @@ -170,4 +170,3 @@ class JsonLibTest extends PHPUnit_Framework_TestCase } } -?> diff --git a/test/phpunit/LangTest.php b/test/phpunit/LangTest.php index 916f870d874..75bdc958c14 100755 --- a/test/phpunit/LangTest.php +++ b/test/phpunit/LangTest.php @@ -174,4 +174,3 @@ class LangTest extends PHPUnit_Framework_TestCase return; } } -?> diff --git a/test/phpunit/MarginsLibTest.php b/test/phpunit/MarginsLibTest.php index 79d8f021d47..7ae615e4934 100644 --- a/test/phpunit/MarginsLibTest.php +++ b/test/phpunit/MarginsLibTest.php @@ -148,4 +148,3 @@ class MarginsLibTest extends PHPUnit_Framework_TestCase } } -?> diff --git a/test/phpunit/NumberingModulesTest.php b/test/phpunit/NumberingModulesTest.php index 4b834bded69..a3788b309d1 100644 --- a/test/phpunit/NumberingModulesTest.php +++ b/test/phpunit/NumberingModulesTest.php @@ -545,4 +545,3 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase } } -?> diff --git a/test/phpunit/PdfDocTest.php b/test/phpunit/PdfDocTest.php index ee1a8bdf599..02d20a816a8 100755 --- a/test/phpunit/PdfDocTest.php +++ b/test/phpunit/PdfDocTest.php @@ -168,4 +168,3 @@ class PdfDocTest extends PHPUnit_Framework_TestCase $this->assertEquals($result,10.4); } } -?> diff --git a/test/phpunit/ProjectTest.php b/test/phpunit/ProjectTest.php index 9ed50eb2475..8b97f9fe8ea 100644 --- a/test/phpunit/ProjectTest.php +++ b/test/phpunit/ProjectTest.php @@ -233,4 +233,3 @@ class ProjectTest extends PHPUnit_Framework_TestCase } } -?> \ No newline at end of file diff --git a/test/phpunit/ScriptsTest.php b/test/phpunit/ScriptsTest.php index 73310291cf3..76d59c6705b 100755 --- a/test/phpunit/ScriptsTest.php +++ b/test/phpunit/ScriptsTest.php @@ -254,4 +254,3 @@ class ScriptsTest extends PHPUnit_Framework_TestCase return $result; } } -?> diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index e3717a7023f..0d92aee8b76 100755 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -265,4 +265,3 @@ class SecurityTest extends PHPUnit_Framework_TestCase } } -?> \ No newline at end of file diff --git a/test/phpunit/UserGroupTest.php b/test/phpunit/UserGroupTest.php index 5ab1976506f..0e43b361e20 100644 --- a/test/phpunit/UserGroupTest.php +++ b/test/phpunit/UserGroupTest.php @@ -284,4 +284,3 @@ class UserGroupTest extends PHPUnit_Framework_TestCase } } -?> \ No newline at end of file diff --git a/test/phpunit/WebservicesOrdersTest.php b/test/phpunit/WebservicesOrdersTest.php index f2a47e2718a..d76fc784722 100755 --- a/test/phpunit/WebservicesOrdersTest.php +++ b/test/phpunit/WebservicesOrdersTest.php @@ -180,4 +180,3 @@ class WebservicesOrdersTest extends PHPUnit_Framework_TestCase } } -?> diff --git a/test/phpunit/WebservicesOtherTest.php b/test/phpunit/WebservicesOtherTest.php index b3462bb8ec9..1ea80beb4bf 100755 --- a/test/phpunit/WebservicesOtherTest.php +++ b/test/phpunit/WebservicesOtherTest.php @@ -213,4 +213,3 @@ class WebservicesOtherTest extends PHPUnit_Framework_TestCase } } -?> diff --git a/test/phpunit/WebservicesProductsTest.php b/test/phpunit/WebservicesProductsTest.php index 3ebeab4dfc0..a4ff7293091 100755 --- a/test/phpunit/WebservicesProductsTest.php +++ b/test/phpunit/WebservicesProductsTest.php @@ -321,4 +321,3 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase } } -?> \ No newline at end of file diff --git a/test/phpunit/WebservicesUserTest.php b/test/phpunit/WebservicesUserTest.php index e5e5de6d1bd..e06b98d0921 100755 --- a/test/phpunit/WebservicesUserTest.php +++ b/test/phpunit/WebservicesUserTest.php @@ -212,4 +212,3 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase } } -?> diff --git a/test/phpunit/XCalLibTest.php b/test/phpunit/XCalLibTest.php index ab16d4e3cb6..6ec63912878 100644 --- a/test/phpunit/XCalLibTest.php +++ b/test/phpunit/XCalLibTest.php @@ -138,4 +138,3 @@ class XCalLibTest extends PHPUnit_Framework_TestCase } } -?>