From 563947f0b0a2ee76fcc659bd7d627cab3f0a4b12 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Jan 2012 20:56:40 +0100 Subject: [PATCH 01/21] Work on debian package --- ChangeLog | 1 + build/debian/README.debian | 103 -------- build/debian/{README => README.howto} | 0 build/debian/control | 2 +- build/debian/copyright | 60 +---- {doc/images => build/debian}/dolibarr.xpm | 0 build/debian/install | 14 +- build/debian/rules | 30 ++- build/debian/wash | 3 + build/launchpad/README | 33 ++- build/makepack-dolibarr.pl | 291 ++++++++++------------ build/rpm/dolibarr-forrpm.patch | 6 +- htdocs/filefunc.inc.php | 2 +- htdocs/install/inc.php | 37 +-- htdocs/support/inc.php | 42 ++-- 15 files changed, 249 insertions(+), 375 deletions(-) delete mode 100755 build/debian/README.debian rename build/debian/{README => README.howto} (100%) rename {doc/images => build/debian}/dolibarr.xpm (100%) mode change 100644 => 100755 build/debian/rules diff --git a/ChangeLog b/ChangeLog index 1fcea7ca587..f5140e17a10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -43,6 +43,7 @@ For users: - New: Chart are faster to build - New: Value of data into charts are visible on mouse hover. - New: Import wizard can import contacts. +- New: Install process is now two times faster. - Fix: Can use POS module with several concurrent users. For developers: diff --git a/build/debian/README.debian b/build/debian/README.debian deleted file mode 100755 index a4dacc288af..00000000000 --- a/build/debian/README.debian +++ /dev/null @@ -1,103 +0,0 @@ -README (english) --------------------------------- -Starter documentation --------------------------------- - -1) Install Dolibarr -2) Upgrade Dolibarr from an older version -3) What's new in this version -4) What Dolibarr can do -5) What Dolibarr can't do yet, todo list - - -I - DOLIBARR INSTALL --------------------- - -Dolibarr files and its dependencies are automatically installed when you install -the dolibarr Debian package. - -Once package is installed, go on menu entry called Dolibarr or use your web browser -to call page http://localhost/dolibarr - - - -II - DOLIBARR UPGRADE ---------------------- - -Dolibarr files and its dependencies are automatically upgraded when you install -the dolibarr Debian package. - -Once new package is installed, go on menu entry called Dolibarr or use your web browser -to call page http://localhost/dolibarr -If a database upgrade is required, you will be prompted to. - - - -III - WHAT'S NEW ----------------- - -See ChangeLog file. - - - -IV - WHAT DOLIBARR CAN DO -------------------------- - -Main modules/features: -- Products and services catalog -- Customers, Prospects or Suppliers directory -- Address book -- Stock management -- Bank accounts management -- Orders management with PDF export -- Commercial proposals management with PDF export -- Contracts management -- Invoices management with PDF export -- Payments management -- Standing orders management -- Shipping management -- ECM (Electronic Content Management) -- EMailings -- Agenda with ical,vcal export for third tools integration -- Management of foundation members -- Donation management - -Other modules: -- Bookmarks management -- Can reports Dolibarr events inside Webcalendar or Phenix -- Data export tools -- LDAP connectivity -- Third parties or products categories -- ClickToDial phone numbers -- RSS - -Miscellanous: -- Mutli-user, with several permissions levels for each feature. -- Serveral menu managers (can be used by internal users, as a back-office, - with a particular menu, or by external users, as a front-office, with - another menu and permissions). -- Very user friendly and easy to use. -- Optional WYSIWYG forms, optional Ajax forms. -- Several skins. -- Code is highly customizable (a lot of use of modules and submodules). -- Works with Mysql 3.1 or higher, experimental support for PostgreSql. -- Works with PHP 4.3 or higher. -- An easy to understand and maintain code (PHP with no heavy frameworks). -- A trigger architecture to allow you to make Dolibarr business events run - PHP code to update your own information system. -- "NPR VAT Rate" (French particularity for managing VAT in DOM-TOM - called "Non Perçue Récupérable"). - - - -V - WHAT DOLIBARR CAN'T DO YET (TODO LIST) ------------------------------------------- -This is features that Dolibarr does not support completely yet: -- Accountancy. -- Dolibarr can manage only one currency. -- Dolibarr does not support the double Canadian Tax. -- Dolibarr does not make coffee (not yet). -- Stock management with option increase/decrease on invoice works on - warehouse number one only (no way to choose warehouse). -- Stock management with option increase/decrease on orders works on - warehouse number one only (no way to choose warehouse). diff --git a/build/debian/README b/build/debian/README.howto similarity index 100% rename from build/debian/README rename to build/debian/README.howto diff --git a/build/debian/control b/build/debian/control index 551cb4841db..e10b43f392d 100755 --- a/build/debian/control +++ b/build/debian/control @@ -4,7 +4,7 @@ Standards-Version: 3.9.2 Section: web Priority: optional Homepage: http://www.dolibarr.org -Build-Depends: debhelper (>= 7), po-debconf +Build-Depends: debhelper (>= 7), po-debconf, dpatch Package: dolibarr Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5, diff --git a/build/debian/copyright b/build/debian/copyright index ac9bb33a07f..e63fa08b5db 100644 --- a/build/debian/copyright +++ b/build/debian/copyright @@ -36,39 +36,8 @@ License: GPL-2+ PURPOSE. See the GNU General Public License for more details. . - You should have received a copy of the GNU General Public - License along with this package; if not, write to the Free - Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301 USA - . - On Debian systems, the full text of the GNU General Public - License version 2 can be found in the file - `/usr/share/common-licenses/GPL-2'. - -Files: htdocs/includes/artichow/* -Copyright: Artichow team -License: Public Domain - This work is not subject to copyright in any jurisdiction - -Files: htdocs/includes/ckeditor/* -Copyright: CKeditor team -License: GPL-2+ - This program is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later - version. - . - This program is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied - warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the GNU General Public License for more - details. - . - You should have received a copy of the GNU General Public - License along with this package; if not, write to the Free - Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301 USA + You should have received a copy of the GNU General Public License + along with this program. If not, see . . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file @@ -89,10 +58,8 @@ License: GPL-2+ PURPOSE. See the GNU General Public License for more details. . - You should have received a copy of the GNU General Public - License along with this package; if not, write to the Free - Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301 USA + You should have received a copy of the GNU General Public License + along with this program. If not, see . . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file @@ -113,10 +80,8 @@ License: MIT or GPL-2+ PURPOSE. See the GNU General Public License for more details. . - You should have received a copy of the GNU General Public - License along with this package; if not, write to the Free - Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301 USA + You should have received a copy of the GNU General Public License + along with this program. If not, see . . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file @@ -160,10 +125,8 @@ License: GPL-2+ PURPOSE. See the GNU General Public License for more details. . - You should have received a copy of the GNU General Public - License along with this package; if not, write to the Free - Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301 USA + You should have received a copy of the GNU General Public License + along with this program. If not, see . . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file @@ -191,10 +154,8 @@ License: GPL-2+ PURPOSE. See the GNU General Public License for more details. . - You should have received a copy of the GNU General Public - License along with this package; if not, write to the Free - Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301 USA + You should have received a copy of the GNU General Public License + along with this program. If not, see . . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file @@ -204,4 +165,3 @@ Files: htdocs/includes/tcpdf/* Copyright: TCPDF team License: LGPL 3.0 See http://www.gnu.org/licenses/old-licenses/lgpl-3.0-standalone.html - \ No newline at end of file diff --git a/doc/images/dolibarr.xpm b/build/debian/dolibarr.xpm similarity index 100% rename from doc/images/dolibarr.xpm rename to build/debian/dolibarr.xpm diff --git a/build/debian/install b/build/debian/install index d3566d3a59e..6562bda4a37 100755 --- a/build/debian/install +++ b/build/debian/install @@ -1,6 +1,8 @@ -etc/dolibarr/apache.conf -etc/dolibarr/lighttpd.conf -usr/share/applications/dolibarr.desktop -usr/share/dolibarr -usr/share/doc/dolibarr -usr/share/pixmaps +debian/dolibarr.desktop usr/share/applications +debian/dolibarr.xpm usr/share/pixmaps +build/debian/apache.conf etc/dolibarr +build/debian/lighttpd.conf etc/dolibarr +build usr/share/dolibarr +dev usr/share/dolibarr +htdocs usr/share/dolibarr +scripts usr/share/dolibarr \ No newline at end of file diff --git a/build/debian/rules b/build/debian/rules old mode 100644 new mode 100755 index 9a3f9a98c7a..280ba8fde47 --- a/build/debian/rules +++ b/build/debian/rules @@ -6,5 +6,31 @@ export DH_OPTIONS=-v #export DH_COMPAT=7 # This is the debhelper compatability version to use, now defined into compat file -%: - dh $@ \ No newline at end of file + +# use dpatch +include /usr/share/dpatch/dpatch.make + + +configure: + dh $@ + +build: patch + dh $@ + +build-arch: patch + dh $@ + +build-indep: patch + dh $@ + +binary: + dh $@ + +binary-indep: + dh $@ + +clean: + dh $@ + +binary-arch: + \ No newline at end of file diff --git a/build/debian/wash b/build/debian/wash index e69de29bb2d..7d3ec07d7a5 100644 --- a/build/debian/wash +++ b/build/debian/wash @@ -0,0 +1,3 @@ +# watch control file for uscan +#version=3 +#http://http://sourceforge.net/projects/dolibarr/files/Dolibarr%20installer%20for%20Debian-Ubuntu%20%28DoliDeb%29/ debian uupdate diff --git a/build/launchpad/README b/build/launchpad/README index 92bb699a8b0..b4428216dd5 100644 --- a/build/launchpad/README +++ b/build/launchpad/README @@ -17,22 +17,35 @@ To submit a package on LaunchPad: - Create Project - Link project to official SCM server - Upload SSH public key onto account -- Run from command line: bzr launchpad-login yourlogin - -- Create a debian directory and upload it onto bzr branch ~yourlogin/dolibarr/debian - -- Create an empty directory dolibarr and go into it. +- Run from command line: + bzr launchpad-login yourlogin + bzr whoami "Your Name " +- Create a Bazzar directory + mkdir bzr +- Create debian directory and upload it onto bzr branch ~yourlogin/dolibarr/debian + cd bzr + mkdir debian + cd debian + bzr init + cp -pr dolibarr_root/debian bzr/debian + bzr add debian + bzr commit + bzr push lp:~eldy/dolibarr/debian + or download it from launchpad bazaar: + cd bzr + bzr branch lp:~eldy/dolibarr/debian - Create a file dolibarr.recipe with content - # bzr-builder format 0.3 deb-version {debupstream}+{revno}+{revno:packaging} - lp:dolibarr - merge packaging lp:~eldy/dolibarr/debian + cd bzr + vi dolibarr.recipe + # bzr-builder format 0.3 deb-version {debupstream}+{revno}+{revno:packaging} + lp:dolibarr + merge packaging lp:~eldy/dolibarr/debian - Run command + cd bzr bzr dailydeb dolibarr.recipe working-dir This will create a directory "working-dir" with dolibarr sources and will add sources from ~eldy/dolibarr/debian - - Create a file /.pbuilderrc with content $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build - - Create chroot ubuntu env sudo pbuilder create - Test package sources diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 2012f603ae3..64bfbc60b9c 100644 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -301,6 +301,8 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/dev/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/uml`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/xdebug`; + $ret=`rm -f $BUILDROOT/$PROJECT/dev/dolibarr_changes.txt`; + $ret=`rm -f $BUILDROOT/$PROJECT/dev/README`; $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot2.png`; $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot3.png`; $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot4.png`; @@ -318,8 +320,6 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom*`; $ret=`rm -fr $BUILDROOT/$PROJECT/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`; - #$ret=`rm -fr $BUILDROOT/$PROJECT/CVS* $BUILDROOT/$PROJECT/*/CVS* $BUILDROOT/$PROJECT/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/*/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/*/*/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/*/*/*/*/*/*/CVS*`; - #$ret=`rm -fr $BUILDROOT/$PROJECT/.svn $BUILDROOT/$PROJECT/*/.svn $BUILDROOT/$PROJECT/*/*/.svn $BUILDROOT/$PROJECT/*/*/*/.svn $BUILDROOT/$PROJECT/*/*/*/*/.svn`; $ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`; $ret=`rm -f $BUILDROOT/$PROJECT/.gitignore $BUILDROOT/$PROJECT/*/.gitignore $BUILDROOT/$PROJECT/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.gitignore`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/fckeditor`; @@ -347,7 +347,8 @@ if ($nboftargetok) { print "\nBuild package for target $target\n"; - if ($target eq 'SNAPSHOT') { + if ($target eq 'SNAPSHOT') + { $NEWDESTI=$DESTI; print "Remove target $FILENAMESNAPSHOT.tgz...\n"; @@ -371,7 +372,8 @@ if ($nboftargetok) { next; } - if ($target eq 'TGZ') { + if ($target eq 'TGZ') + { $NEWDESTI=$DESTI; if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; } @@ -396,7 +398,8 @@ if ($nboftargetok) { next; } - if ($target eq 'ZIP') { + if ($target eq 'ZIP') + { $NEWDESTI=$DESTI; if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; } @@ -459,9 +462,6 @@ if ($nboftargetok) { print "Create directory $BUILDROOT/$FILENAMETGZ2\n"; $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2`; - #$ret=`mkdir -p "$BUILDROOT/$FILENAMETGZ2"`; - #print "Create directory $BUILDROOT/$FILENAMETGZ2/usr/share\n"; - #$ret=`mkdir -p "$BUILDROOT/$FILENAMETGZ2/usr/share"`; print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMETGZ2\n"; $cmd="cp -pr '$BUILDROOT/$PROJECT' '$BUILDROOT/$FILENAMETGZ2'"; $ret=`$cmd`; @@ -553,157 +553,101 @@ if ($nboftargetok) { print "Remove target ${FILENAMEDEB}.changes...\n"; unlink("$NEWDESTI/${FILENAMEDEB}.changes"); - #rmdir "$BUILDROOT/$PROJECT.tmp"; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp`; $ret=`rm -fr $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build`; - print "Create directory $BUILDROOT/$PROJECT.tmp/usr/share\n"; - $ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/usr/share"`; - print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT\n"; - $cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT\""; - $ret=`$cmd`; - - print "Fix filefunc.inc.php, install/inc.php, support/inc.php\n"; - $cmd="cat \"$BUILDROOT/$PROJECT/htdocs/filefunc.inc.php\" | - sed -e 's/conffile = \"\\\.\\\.\\\/conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | - sed -e 's/conffile = \"conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | - sed -e 's/conffiletoshow = \"htdocs\\\/conf\\\/conf.php\"/conffiletoshow = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' > \"$BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/filefunc.inc.php\""; - $ret=`$cmd`; - $cmd="cat \"$BUILDROOT/$PROJECT/htdocs/install/inc.php\" | - sed -e 's/conffile = \"\\\.\\\.\\\/conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | - sed -e 's/conffile = \"conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | - sed -e 's/conffiletoshow = \"htdocs\\\/conf\\\/conf.php\"/conffiletoshow = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' > \"$BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/install/inc.php\""; - $ret=`$cmd`; - $cmd="cat \"$BUILDROOT/$PROJECT/htdocs/support/inc.php\" | - sed -e 's/conffile = \"\\\.\\\.\\\/conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | - sed -e 's/conffile = \"conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | - sed -e 's/conffiletoshow = \"htdocs\\\/conf\\\/conf.php\"/conffiletoshow = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' > \"$BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/support/inc.php\""; + print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$PROJECT.tmp\n"; + $cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$PROJECT.tmp\""; $ret=`$cmd`; +# print "Fix filefunc.inc.php, install/inc.php, support/inc.php\n"; +# $cmd="cat \"$BUILDROOT/$PROJECT/htdocs/filefunc.inc.php\" | +# sed -e 's/conffile = \"\\\.\\\.\\\/conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | +# sed -e 's/conffile = \"conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | +# sed -e 's/conffiletoshow = \"htdocs\\\/conf\\\/conf.php\"/conffiletoshow = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' > \"$BUILDROOT/$PROJECT.tmp/htdocs/filefunc.inc.php\""; +# $ret=`$cmd`; +# $cmd="cat \"$BUILDROOT/$PROJECT/htdocs/install/inc.php\" | +# sed -e 's/conffile = \"\\\.\\\.\\\/conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | +# sed -e 's/conffile = \"conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | +# sed -e 's/conffiletoshow = \"htdocs\\\/conf\\\/conf.php\"/conffiletoshow = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' > \"$BUILDROOT/$PROJECT.tmp/htdocs/install/inc.php\""; +# $ret=`$cmd`; +# $cmd="cat \"$BUILDROOT/$PROJECT/htdocs/support/inc.php\" | +# sed -e 's/conffile = \"\\\.\\\.\\\/conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | +# sed -e 's/conffile = \"conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | +# sed -e 's/conffiletoshow = \"htdocs\\\/conf\\\/conf.php\"/conffiletoshow = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' > \"$BUILDROOT/$PROJECT.tmp/htdocs/support/inc.php\""; +# $ret=`$cmd`; + print "Remove other files\n"; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/ChangeLog`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/COPYING`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/COPYRIGHT`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/INSTALL`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/README`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/README-FR`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/README`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/README-FR`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/aps`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/dmg`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/pad/README`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/tgz/README`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/README`; - #$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/po`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/source`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/changelog`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/compat`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/config`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/control*`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/copyright`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/dolibarr.desktop`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/dolibarr.lintian-overrides`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/format`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/install`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/menu`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/postrm`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/postinst`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/rules`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/README.debian`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/templates`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/templates.futur`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/wash`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/doap`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/exe`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/launchpad`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/live`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/patch`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/perl`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/rpm`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/zip`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/README-FR`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README-FR`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/aps`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/dmg`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/pad/README`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/tgz/README`; + #$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/debian`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/debian/po`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/debian/source`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/changelog`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/compat`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/config`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/control*`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/copyright`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.desktop`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.lintian-overrides`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/format`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/install`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/menu`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/postrm`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/postinst`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/rules`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/README.howto`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/templates`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/templates.futur`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/wash`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/doap`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/exe`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/launchpad`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/live`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/patch`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/perl`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/rpm`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/zip`; # We remove embedded libraries or fonts - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/includes/ckeditor`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/includes/fonts`, - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/includes/geoip`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/includes/nusoap`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/includes/odtphp/zip/pclzip`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/fonts`, + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/geoip`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/nusoap`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/odtphp/zip/pclzip`; - # Apache and lighttpd conf files - print "Copy apache.conf file into $BUILDROOT/$PROJECT.tmp/etc/$PROJECT/apache.conf\n"; - $ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/etc/$PROJECT"`; - $ret=`cp "$SOURCE/build/debian/apache.conf" "$BUILDROOT/$PROJECT.tmp/etc/$PROJECT/apache.conf"`; - print "Copy lighttpd.conf file into $BUILDROOT/$PROJECT.tmp/etc/$PROJECT/lighttpd.conf\n"; - $ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/etc/$PROJECT"`; - $ret=`cp "$SOURCE/build/debian/lighttpd.conf" "$BUILDROOT/$PROJECT.tmp/etc/$PROJECT/lighttpd.conf"`; - - # dolibarr.desktop - print "Create directory $BUILDROOT/$PROJECT.tmp/usr/share/applications\n"; - $ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/usr/share/applications"`; - print "Copy desktop file into $BUILDROOT/$PROJECT.tmp/usr/share/applications/dolibarr.desktop\n"; - $ret=`cp "$SOURCE/build/debian/dolibarr.desktop" "$BUILDROOT/$PROJECT.tmp/usr/share/applications/dolibarr.desktop"`; - - # pixmap - print "Create directory $BUILDROOT/$PROJECT.tmp/usr/share/pixmaps\n"; - $ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/usr/share/pixmaps"`; - print "Copy pixmap file into $BUILDROOT/$PROJECT.tmp/usr/share/pixmaps/dolibarr.xpm\n"; - $ret=`cp "$SOURCE/doc/images/dolibarr.xpm" "$BUILDROOT/$PROJECT.tmp/usr/share/pixmaps/dolibarr.xpm"`; - - print "Create directory $BUILDROOT/$PROJECT.tmp/usr/share/doc/$PROJECT\n"; - $ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/usr/share/doc/$PROJECT"`; + # Prepare binary package (init DEBIAN dir) + #print "Create directory $BUILDROOT/$PROJECT.tmp/DEBIAN\n"; + #$ret=`mkdir "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; + #print "Copy $SOURCE/build/debian/xxx to $BUILDROOT/$PROJECT.tmp/DEBIAN\n"; + #$ret=`cp -f "$SOURCE/build/debian/config" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; + #$ret=`cp -f "$SOURCE/build/debian/postinst" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; + #$ret=`cp -f "$SOURCE/build/debian/postrm" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; + #$ret=`cp -f "$SOURCE/build/debian/templates" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; + #$ret=`cp -fr "$SOURCE/build/debian/po" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; # changelog (to build binary package directly without sources. Useless if we build from sources) - $ret=`gzip -9 -c "$SOURCE/build/debian/changelog" > $BUILDROOT/$PROJECT.tmp/usr/share/doc/$PROJECT/changelog.gz`; + #$ret=`gzip -9 -c "$SOURCE/build/debian/changelog" > $BUILDROOT/$PROJECT.tmp/usr/share/doc/$PROJECT/changelog.gz`; - # Set owners - print "Set owners on files/dir\n"; - $ret=`chown -R root.root $BUILDROOT/$PROJECT.tmp`; - - # Set permissions - print "Set permissions on files/dir\n"; - $ret=`chmod -R 755 $BUILDROOT/$PROJECT.tmp`; - $cmd="find $BUILDROOT/$PROJECT.tmp -type f -exec chmod 644 {} \\; "; - $ret=`$cmd`; - $cmd="find $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build -name '*.php' -type f -exec chmod 755 {} \\; "; - $ret=`$cmd`; - $cmd="find $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build -name '*.pl' -type f -exec chmod 755 {} \\; "; - $ret=`$cmd`; - $cmd="find $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/dev -name '*.php' -type f -exec chmod 755 {} \\; "; - $ret=`$cmd`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/dev/translation/autotranslator.class.php`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/dev/skeletons/modMyModule.class.php`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/dev/skeletons/skeleton_class.class.php`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/dev/skeletons/skeleton_page.php`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/dev/skeletons/skeleton_webservice_server.php`; - $cmd="find $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/scripts -name '*.php' -type f -exec chmod 755 {} \\; "; - $ret=`$cmd`; + #print "Edit version in file $BUILDROOT/$PROJECT.tmp/DEBIAN/control\n"; + #open (SPECFROM,"<$SOURCE/build/debian/control.debianbin") || die "Error"; + #open (SPECTO,">$BUILDROOT/$PROJECT.tmp/DEBIAN/control") || die "Error"; + #while () { + # $_ =~ s/__VERSION__/$MAJOR.$MINOR.$newbuild/; + # print SPECTO $_; + #} + #close SPECFROM; + #close SPECTO; + #print "Version set to $MAJOR.$MINOR.$newbuild\n"; - - # Prepare binary package (init DEBIAN dir) - print "Create directory $BUILDROOT/$PROJECT.tmp/DEBIAN\n"; - $ret=`mkdir "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - print "Copy $SOURCE/build/debian/xxx to $BUILDROOT/$PROJECT.tmp/DEBIAN\n"; - $ret=`cp -f "$SOURCE/build/debian/config" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - $ret=`cp -f "$SOURCE/build/debian/postinst" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - $ret=`cp -f "$SOURCE/build/debian/postrm" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - $ret=`cp -f "$SOURCE/build/debian/templates" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - $ret=`cp -fr "$SOURCE/build/debian/po" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - - print "Edit version in file $BUILDROOT/$PROJECT.tmp/DEBIAN/control\n"; - open (SPECFROM,"<$SOURCE/build/debian/control.debianbin") || die "Error"; - open (SPECTO,">$BUILDROOT/$PROJECT.tmp/DEBIAN/control") || die "Error"; - while () { - $_ =~ s/__VERSION__/$MAJOR.$MINOR.$newbuild/; - print SPECTO $_; - } - close SPECFROM; - close SPECTO; - print "Version set to $MAJOR.$MINOR.$newbuild\n"; - - $cmd="find $BUILDROOT/$PROJECT.tmp/DEBIAN -type f -exec chmod 755 {} \\; "; - $ret=`$cmd`; - $ret=`chmod 644 $BUILDROOT/$PROJECT.tmp/DEBIAN/control`; - $ret=`chmod 644 $BUILDROOT/$PROJECT.tmp/DEBIAN/templates`; + #$cmd="find $BUILDROOT/$PROJECT.tmp/DEBIAN -type f -exec chmod 755 {} \\; "; + #$ret=`$cmd`; + #$ret=`chmod 644 $BUILDROOT/$PROJECT.tmp/DEBIAN/control`; + #$ret=`chmod 644 $BUILDROOT/$PROJECT.tmp/DEBIAN/templates`; # Creation of binary package (to build without sources) # Enable this to build a binary package without building sources first @@ -713,33 +657,60 @@ if ($nboftargetok) { #print "Launch DEB build ($cmd)\n"; #$ret=`$cmd`; #print $ret."\n"; + #$ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; + #$ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/doc"`; #exit; - - $ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - $ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/doc"`; - + # Prepare source package (init debian dir) print "Create directory $BUILDROOT/$PROJECT.tmp/debian\n"; $ret=`mkdir "$BUILDROOT/$PROJECT.tmp/debian"`; print "Copy $SOURCE/build/debian/xxx to $BUILDROOT/$PROJECT.tmp/debian\n"; # Add files for dpkg-source - $ret=`cp -f "$SOURCE/ChangeLog" "$BUILDROOT/$PROJECT.tmp/usr/share/doc/dolibarr/UserChangeLog"`; - $ret=`cp -f "$SOURCE/build/debian/README.debian" "$BUILDROOT/$PROJECT.tmp/usr/share/doc/dolibarr/README"`; $ret=`cp -f "$SOURCE/build/debian/changelog" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/control" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/dolibarr.lintian-overrides" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/install" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/rules" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/copyright" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/compat" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -fr "$SOURCE/build/debian/source" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/control" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/copyright" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.xpm" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.desktop" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.lintian-overrides" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/install" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -fr "$SOURCE/build/debian/patches" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -fr "$SOURCE/build/debian/po" "$BUILDROOT/$PROJECT.tmp/debian"`; - # Add files also required to build binary package with dpkg-buildpackages + $ret=`cp -f "$SOURCE/build/debian/README.source" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/rules" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -fr "$SOURCE/build/debian/source" "$BUILDROOT/$PROJECT.tmp/debian"`; + # Add files also required to build binary package $ret=`cp -f "$SOURCE/build/debian/config" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/postinst" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/postrm" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/templates" "$BUILDROOT/$PROJECT.tmp/debian"`; + + # Set owners and permissions + print "Set owners on files/dir\n"; + $ret=`chown -R root.root $BUILDROOT/$PROJECT.tmp`; + print "Set permissions on files/dir\n"; + $ret=`chmod -R 755 $BUILDROOT/$PROJECT.tmp`; + $cmd="find $BUILDROOT/$PROJECT.tmp -type f -exec chmod 644 {} \\; "; + $ret=`$cmd`; + $cmd="find $BUILDROOT/$PROJECT.tmp/build -name '*.php' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + $cmd="find $BUILDROOT/$PROJECT.tmp/build -name '*.dpatch' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + $cmd="find $BUILDROOT/$PROJECT.tmp/build -name '*.pl' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + $cmd="find $BUILDROOT/$PROJECT.tmp/dev -name '*.php' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + $ret=`chmod 755 $BUILDROOT/$PROJECT.tmp/debian/rules`; + $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/translation/autotranslator.class.php`; + $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/modMyModule.class.php`; + $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_class.class.php`; + $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_page.php`; + $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_webservice_server.php`; + $cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.php' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + + print "Rename directory $BUILDROOT/$PROJECT.tmp into $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n"; $cmd="mv $BUILDROOT/$PROJECT.tmp $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build"; $ret=`$cmd`; diff --git a/build/rpm/dolibarr-forrpm.patch b/build/rpm/dolibarr-forrpm.patch index f1627beb897..06dd71a8987 100755 --- a/build/rpm/dolibarr-forrpm.patch +++ b/build/rpm/dolibarr-forrpm.patch @@ -1,7 +1,7 @@ diff -up htdocs/filefunc.inc.php.patch htdocs/filefunc.inc.php --- htdocs/filefunc.inc.php.patch 2011-09-03 02:32:48.666952000 +0200 +++ htdocs/filefunc.inc.php 2011-09-03 02:33:00.510952001 +0200 -@@ -64,8 +64,8 @@ $conffiletoshowshort = "conf.php"; +@@ -64,8 +64,8 @@ $conffile = "conf/conf.php"; $conffiletoshow = "htdocs/conf/conf.php"; // For debian/redhat like systems @@ -15,7 +15,7 @@ diff -up htdocs/filefunc.inc.php.patch htdocs/filefunc.inc.php diff -up htdocs/install/inc.php.patch htdocs/install/inc.php --- htdocs/install/inc.php.patch 2011-09-03 02:33:26.450952000 +0200 +++ htdocs/install/inc.php 2011-09-03 02:33:36.286952001 +0200 -@@ -75,8 +75,8 @@ $conffiletoshowshort = "conf.php"; +@@ -84,8 +84,8 @@ $conffile = "../conf/conf.php"; $conffiletoshow = "htdocs/conf/conf.php"; // For debian/redhat like systems @@ -29,7 +29,7 @@ diff -up htdocs/install/inc.php.patch htdocs/install/inc.php diff -up htdocs/support/inc.php.patch htdocs/support/inc.php --- htdocs/support/inc.php.patch 2011-09-03 02:34:39.606952000 +0200 +++ htdocs/support/inc.php 2011-09-03 02:33:59.814952000 +0200 -@@ -69,8 +69,8 @@ $conffiletoshowshort = "conf.php"; +@@ -79,8 +79,8 @@ $conffile = "../conf/conf.php"; $conffiletoshow = "htdocs/conf/conf.php"; // For debian/redhat like systems diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index ee1a2d94f88..54046659566 100755 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -32,7 +32,7 @@ if (! defined('DOL_VERSION')) define('DOL_VERSION','3.2.0-alpha'); // Also defined in htdocs/install/inc.php (Ex: x.y.z-alpha, x.y.z) if (! defined('EURO')) define('EURO',chr(128)); -// Definition des constantes syslog +// Define syslog constants if (! defined('LOG_DEBUG')) { if (function_exists("define_syslog_variables")) diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index dddff4a1298..fafb001bd18 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -18,9 +18,10 @@ * along with this program. If not, see . */ -/** \file htdocs/install/inc.php - * \ingroup core - * \brief File that define environment for install pages +/** + * \file htdocs/install/inc.php + * \ingroup core + * \brief File that define environment for support pages */ define('DOL_VERSION','3.2.0-alpha'); // Also defined in htdocs/master.inc.php (Ex: x.y.z-alpha, x.y.z) @@ -53,25 +54,25 @@ if (isset($_SERVER["DOCUMENT_URI"]) && $_SERVER["DOCUMENT_URI"]) } -// Definition des constantes syslog -if (function_exists("define_syslog_variables")) +// Define syslog constants +if (! defined('LOG_DEBUG')) { - if (version_compare(PHP_VERSION, '5.3.0', '<')) + if (function_exists("define_syslog_variables")) { define_syslog_variables(); // Deprecated since php 5.3.0, syslog variables no longer need to be initialized } -} -else -{ - // Pour PHP sans syslog (comme sous Windows) - define('LOG_EMERG',0); - define('LOG_ALERT',1); - define('LOG_CRIT',2); - define('LOG_ERR',3); - define('LOG_WARNING',4); - define('LOG_NOTICE',5); - define('LOG_INFO',6); - define('LOG_DEBUG',7); + else + { + // Pour PHP sans syslog (comme sous Windows) + define('LOG_EMERG',0); + define('LOG_ALERT',1); + define('LOG_CRIT',2); + define('LOG_ERR',3); + define('LOG_WARNING',4); + define('LOG_NOTICE',5); + define('LOG_INFO',6); + define('LOG_DEBUG',7); + } } $includeconferror=''; diff --git a/htdocs/support/inc.php b/htdocs/support/inc.php index d07f3e1f852..a8a6a0c1ffb 100644 --- a/htdocs/support/inc.php +++ b/htdocs/support/inc.php @@ -19,8 +19,9 @@ */ /** - * \file htdocs/support/inc.php - * \brief File that define environment for support pages + * \file htdocs/support/inc.php + * \ingroup core + * \brief File that define environment for support pages */ define('DOL_VERSION','3.2.0-alpha'); // Also defined in htdocs/master.inc.php @@ -49,27 +50,26 @@ if (isset($_SERVER["DOCUMENT_URI"]) && $_SERVER["DOCUMENT_URI"]) } -// Definition des constantes syslog -if (function_exists("define_syslog_variables")) +// Define syslog constants +if (! defined('LOG_DEBUG')) { - if (version_compare(PHP_VERSION, '5.3.0', '<')) - { - define_syslog_variables(); // Deprecated since php 5.3.0, syslog variables no longer need to be initialized - } + if (function_exists("define_syslog_variables")) + { + define_syslog_variables(); // Deprecated since php 5.3.0, syslog variables no longer need to be initialized + } + else + { + // Pour PHP sans syslog (comme sous Windows) + define('LOG_EMERG',0); + define('LOG_ALERT',1); + define('LOG_CRIT',2); + define('LOG_ERR',3); + define('LOG_WARNING',4); + define('LOG_NOTICE',5); + define('LOG_INFO',6); + define('LOG_DEBUG',7); + } } -else -{ - // Pour PHP sans syslog (comme sous Windows) - define('LOG_EMERG',0); - define('LOG_ALERT',1); - define('LOG_CRIT',2); - define('LOG_ERR',3); - define('LOG_WARNING',4); - define('LOG_NOTICE',5); - define('LOG_INFO',6); - define('LOG_DEBUG',7); -} - $includeconferror=''; From 63c3cb2d486cd9b38d9774ec0708cedfeeacb813 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Jan 2012 20:57:40 +0100 Subject: [PATCH 02/21] Work on debian package --- ChangeLog | 1 + build/debian/README.debian | 103 -------- build/debian/{README => README.howto} | 0 build/debian/README.source | 12 + build/debian/control | 2 +- build/debian/copyright | 60 +---- {doc/images => build/debian}/dolibarr.xpm | 0 build/debian/install | 14 +- build/debian/patches/00list | 1 + build/debian/patches/install.dpatch | 50 ++++ build/debian/rules | 30 ++- build/debian/wash | 3 + build/launchpad/README | 33 ++- build/makepack-dolibarr.pl | 291 ++++++++++------------ build/rpm/dolibarr-forrpm.patch | 6 +- htdocs/filefunc.inc.php | 2 +- htdocs/install/inc.php | 37 +-- htdocs/support/inc.php | 42 ++-- 18 files changed, 312 insertions(+), 375 deletions(-) delete mode 100755 build/debian/README.debian rename build/debian/{README => README.howto} (100%) create mode 100644 build/debian/README.source rename {doc/images => build/debian}/dolibarr.xpm (100%) create mode 100644 build/debian/patches/00list create mode 100755 build/debian/patches/install.dpatch mode change 100644 => 100755 build/debian/rules diff --git a/ChangeLog b/ChangeLog index 1fcea7ca587..f5140e17a10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -43,6 +43,7 @@ For users: - New: Chart are faster to build - New: Value of data into charts are visible on mouse hover. - New: Import wizard can import contacts. +- New: Install process is now two times faster. - Fix: Can use POS module with several concurrent users. For developers: diff --git a/build/debian/README.debian b/build/debian/README.debian deleted file mode 100755 index a4dacc288af..00000000000 --- a/build/debian/README.debian +++ /dev/null @@ -1,103 +0,0 @@ -README (english) --------------------------------- -Starter documentation --------------------------------- - -1) Install Dolibarr -2) Upgrade Dolibarr from an older version -3) What's new in this version -4) What Dolibarr can do -5) What Dolibarr can't do yet, todo list - - -I - DOLIBARR INSTALL --------------------- - -Dolibarr files and its dependencies are automatically installed when you install -the dolibarr Debian package. - -Once package is installed, go on menu entry called Dolibarr or use your web browser -to call page http://localhost/dolibarr - - - -II - DOLIBARR UPGRADE ---------------------- - -Dolibarr files and its dependencies are automatically upgraded when you install -the dolibarr Debian package. - -Once new package is installed, go on menu entry called Dolibarr or use your web browser -to call page http://localhost/dolibarr -If a database upgrade is required, you will be prompted to. - - - -III - WHAT'S NEW ----------------- - -See ChangeLog file. - - - -IV - WHAT DOLIBARR CAN DO -------------------------- - -Main modules/features: -- Products and services catalog -- Customers, Prospects or Suppliers directory -- Address book -- Stock management -- Bank accounts management -- Orders management with PDF export -- Commercial proposals management with PDF export -- Contracts management -- Invoices management with PDF export -- Payments management -- Standing orders management -- Shipping management -- ECM (Electronic Content Management) -- EMailings -- Agenda with ical,vcal export for third tools integration -- Management of foundation members -- Donation management - -Other modules: -- Bookmarks management -- Can reports Dolibarr events inside Webcalendar or Phenix -- Data export tools -- LDAP connectivity -- Third parties or products categories -- ClickToDial phone numbers -- RSS - -Miscellanous: -- Mutli-user, with several permissions levels for each feature. -- Serveral menu managers (can be used by internal users, as a back-office, - with a particular menu, or by external users, as a front-office, with - another menu and permissions). -- Very user friendly and easy to use. -- Optional WYSIWYG forms, optional Ajax forms. -- Several skins. -- Code is highly customizable (a lot of use of modules and submodules). -- Works with Mysql 3.1 or higher, experimental support for PostgreSql. -- Works with PHP 4.3 or higher. -- An easy to understand and maintain code (PHP with no heavy frameworks). -- A trigger architecture to allow you to make Dolibarr business events run - PHP code to update your own information system. -- "NPR VAT Rate" (French particularity for managing VAT in DOM-TOM - called "Non Perçue Récupérable"). - - - -V - WHAT DOLIBARR CAN'T DO YET (TODO LIST) ------------------------------------------- -This is features that Dolibarr does not support completely yet: -- Accountancy. -- Dolibarr can manage only one currency. -- Dolibarr does not support the double Canadian Tax. -- Dolibarr does not make coffee (not yet). -- Stock management with option increase/decrease on invoice works on - warehouse number one only (no way to choose warehouse). -- Stock management with option increase/decrease on orders works on - warehouse number one only (no way to choose warehouse). diff --git a/build/debian/README b/build/debian/README.howto similarity index 100% rename from build/debian/README rename to build/debian/README.howto diff --git a/build/debian/README.source b/build/debian/README.source new file mode 100644 index 00000000000..19777b2da19 --- /dev/null +++ b/build/debian/README.source @@ -0,0 +1,12 @@ +================================================================== +Dolibarr - Web based software to manage a small company or foundation +================================================================== + + +Note for package maintainers +---------------------------- +This file explains how to modify official sources (from http://www.dolibarr.org) +to have ready to use source files to build a debian package. + +All changes are included into patch file +build/debian/install.patch diff --git a/build/debian/control b/build/debian/control index 551cb4841db..e10b43f392d 100755 --- a/build/debian/control +++ b/build/debian/control @@ -4,7 +4,7 @@ Standards-Version: 3.9.2 Section: web Priority: optional Homepage: http://www.dolibarr.org -Build-Depends: debhelper (>= 7), po-debconf +Build-Depends: debhelper (>= 7), po-debconf, dpatch Package: dolibarr Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5, diff --git a/build/debian/copyright b/build/debian/copyright index ac9bb33a07f..e63fa08b5db 100644 --- a/build/debian/copyright +++ b/build/debian/copyright @@ -36,39 +36,8 @@ License: GPL-2+ PURPOSE. See the GNU General Public License for more details. . - You should have received a copy of the GNU General Public - License along with this package; if not, write to the Free - Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301 USA - . - On Debian systems, the full text of the GNU General Public - License version 2 can be found in the file - `/usr/share/common-licenses/GPL-2'. - -Files: htdocs/includes/artichow/* -Copyright: Artichow team -License: Public Domain - This work is not subject to copyright in any jurisdiction - -Files: htdocs/includes/ckeditor/* -Copyright: CKeditor team -License: GPL-2+ - This program is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later - version. - . - This program is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied - warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the GNU General Public License for more - details. - . - You should have received a copy of the GNU General Public - License along with this package; if not, write to the Free - Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301 USA + You should have received a copy of the GNU General Public License + along with this program. If not, see . . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file @@ -89,10 +58,8 @@ License: GPL-2+ PURPOSE. See the GNU General Public License for more details. . - You should have received a copy of the GNU General Public - License along with this package; if not, write to the Free - Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301 USA + You should have received a copy of the GNU General Public License + along with this program. If not, see . . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file @@ -113,10 +80,8 @@ License: MIT or GPL-2+ PURPOSE. See the GNU General Public License for more details. . - You should have received a copy of the GNU General Public - License along with this package; if not, write to the Free - Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301 USA + You should have received a copy of the GNU General Public License + along with this program. If not, see . . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file @@ -160,10 +125,8 @@ License: GPL-2+ PURPOSE. See the GNU General Public License for more details. . - You should have received a copy of the GNU General Public - License along with this package; if not, write to the Free - Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301 USA + You should have received a copy of the GNU General Public License + along with this program. If not, see . . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file @@ -191,10 +154,8 @@ License: GPL-2+ PURPOSE. See the GNU General Public License for more details. . - You should have received a copy of the GNU General Public - License along with this package; if not, write to the Free - Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301 USA + You should have received a copy of the GNU General Public License + along with this program. If not, see . . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file @@ -204,4 +165,3 @@ Files: htdocs/includes/tcpdf/* Copyright: TCPDF team License: LGPL 3.0 See http://www.gnu.org/licenses/old-licenses/lgpl-3.0-standalone.html - \ No newline at end of file diff --git a/doc/images/dolibarr.xpm b/build/debian/dolibarr.xpm similarity index 100% rename from doc/images/dolibarr.xpm rename to build/debian/dolibarr.xpm diff --git a/build/debian/install b/build/debian/install index d3566d3a59e..6562bda4a37 100755 --- a/build/debian/install +++ b/build/debian/install @@ -1,6 +1,8 @@ -etc/dolibarr/apache.conf -etc/dolibarr/lighttpd.conf -usr/share/applications/dolibarr.desktop -usr/share/dolibarr -usr/share/doc/dolibarr -usr/share/pixmaps +debian/dolibarr.desktop usr/share/applications +debian/dolibarr.xpm usr/share/pixmaps +build/debian/apache.conf etc/dolibarr +build/debian/lighttpd.conf etc/dolibarr +build usr/share/dolibarr +dev usr/share/dolibarr +htdocs usr/share/dolibarr +scripts usr/share/dolibarr \ No newline at end of file diff --git a/build/debian/patches/00list b/build/debian/patches/00list new file mode 100644 index 00000000000..e9740160f5b --- /dev/null +++ b/build/debian/patches/00list @@ -0,0 +1 @@ +install.dpatch \ No newline at end of file diff --git a/build/debian/patches/install.dpatch b/build/debian/patches/install.dpatch new file mode 100755 index 00000000000..0b8cb5a54b5 --- /dev/null +++ b/build/debian/patches/install.dpatch @@ -0,0 +1,50 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## install.patch by +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Updates htdocs/filefunc.inc.php +## DP: Updates htdocs/install/inc.php +## DP: Updates htdocs/support/inc.php + +@DPATCH@ + + +--- old/htdocs/filefunc.inc.php 2011-09-03 02:32:48.666952000 +0200 ++++ new/htdocs/filefunc.inc.php 2011-09-03 02:33:00.510952001 +0200 +@@ -64,8 +64,8 @@ + $conffile = "conf/conf.php"; + $conffiletoshow = "htdocs/conf/conf.php"; + // For debian/redhat like systems +-//$conffile = "/etc/dolibarr/conf.php"; +-//$conffiletoshow = "/etc/dolibarr/conf.php"; ++$conffile = "/etc/dolibarr/conf.php"; ++$conffiletoshow = "/etc/dolibarr/conf.php"; + + + // Include configuration +--- old/htdocs/install/inc.php 2011-09-03 02:33:26.450952000 +0200 ++++ new/htdocs/install/inc.php 2011-09-03 02:33:36.286952001 +0200 +@@ -84,8 +84,8 @@ + $conffile = "../conf/conf.php"; + $conffiletoshow = "htdocs/conf/conf.php"; + // For debian/redhat like systems +-//$conffile = "/etc/dolibarr/conf.php"; +-//$conffiletoshow = "/etc/dolibarr/conf.php"; ++$conffile = "/etc/dolibarr/conf.php"; ++$conffiletoshow = "/etc/dolibarr/conf.php"; + + + if (! defined('DONOTLOADCONF') && file_exists($conffile)) +--- old/htdocs/support/inc.php 2011-09-03 02:34:39.606952000 +0200 ++++ new/htdocs/support/inc.php 2011-09-03 02:33:59.814952000 +0200 +@@ -79,8 +79,8 @@ + $conffile = "../conf/conf.php"; + $conffiletoshow = "htdocs/conf/conf.php"; + // For debian/redhat like systems +-//$conffile = "/etc/dolibarr/conf.php"; +-//$conffiletoshow = "/etc/dolibarr/conf.php"; ++$conffile = "/etc/dolibarr/conf.php"; ++$conffiletoshow = "/etc/dolibarr/conf.php"; + + $charset="UTF-8"; // If not output format found in any conf file + if (! defined('DONOTLOADCONF') && file_exists($conffile)) diff --git a/build/debian/rules b/build/debian/rules old mode 100644 new mode 100755 index 9a3f9a98c7a..280ba8fde47 --- a/build/debian/rules +++ b/build/debian/rules @@ -6,5 +6,31 @@ export DH_OPTIONS=-v #export DH_COMPAT=7 # This is the debhelper compatability version to use, now defined into compat file -%: - dh $@ \ No newline at end of file + +# use dpatch +include /usr/share/dpatch/dpatch.make + + +configure: + dh $@ + +build: patch + dh $@ + +build-arch: patch + dh $@ + +build-indep: patch + dh $@ + +binary: + dh $@ + +binary-indep: + dh $@ + +clean: + dh $@ + +binary-arch: + \ No newline at end of file diff --git a/build/debian/wash b/build/debian/wash index e69de29bb2d..7d3ec07d7a5 100644 --- a/build/debian/wash +++ b/build/debian/wash @@ -0,0 +1,3 @@ +# watch control file for uscan +#version=3 +#http://http://sourceforge.net/projects/dolibarr/files/Dolibarr%20installer%20for%20Debian-Ubuntu%20%28DoliDeb%29/ debian uupdate diff --git a/build/launchpad/README b/build/launchpad/README index 92bb699a8b0..b4428216dd5 100644 --- a/build/launchpad/README +++ b/build/launchpad/README @@ -17,22 +17,35 @@ To submit a package on LaunchPad: - Create Project - Link project to official SCM server - Upload SSH public key onto account -- Run from command line: bzr launchpad-login yourlogin - -- Create a debian directory and upload it onto bzr branch ~yourlogin/dolibarr/debian - -- Create an empty directory dolibarr and go into it. +- Run from command line: + bzr launchpad-login yourlogin + bzr whoami "Your Name " +- Create a Bazzar directory + mkdir bzr +- Create debian directory and upload it onto bzr branch ~yourlogin/dolibarr/debian + cd bzr + mkdir debian + cd debian + bzr init + cp -pr dolibarr_root/debian bzr/debian + bzr add debian + bzr commit + bzr push lp:~eldy/dolibarr/debian + or download it from launchpad bazaar: + cd bzr + bzr branch lp:~eldy/dolibarr/debian - Create a file dolibarr.recipe with content - # bzr-builder format 0.3 deb-version {debupstream}+{revno}+{revno:packaging} - lp:dolibarr - merge packaging lp:~eldy/dolibarr/debian + cd bzr + vi dolibarr.recipe + # bzr-builder format 0.3 deb-version {debupstream}+{revno}+{revno:packaging} + lp:dolibarr + merge packaging lp:~eldy/dolibarr/debian - Run command + cd bzr bzr dailydeb dolibarr.recipe working-dir This will create a directory "working-dir" with dolibarr sources and will add sources from ~eldy/dolibarr/debian - - Create a file /.pbuilderrc with content $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build - - Create chroot ubuntu env sudo pbuilder create - Test package sources diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 2012f603ae3..64bfbc60b9c 100644 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -301,6 +301,8 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/dev/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/uml`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/xdebug`; + $ret=`rm -f $BUILDROOT/$PROJECT/dev/dolibarr_changes.txt`; + $ret=`rm -f $BUILDROOT/$PROJECT/dev/README`; $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot2.png`; $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot3.png`; $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot4.png`; @@ -318,8 +320,6 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom*`; $ret=`rm -fr $BUILDROOT/$PROJECT/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`; - #$ret=`rm -fr $BUILDROOT/$PROJECT/CVS* $BUILDROOT/$PROJECT/*/CVS* $BUILDROOT/$PROJECT/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/*/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/*/*/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/*/*/*/*/*/*/CVS*`; - #$ret=`rm -fr $BUILDROOT/$PROJECT/.svn $BUILDROOT/$PROJECT/*/.svn $BUILDROOT/$PROJECT/*/*/.svn $BUILDROOT/$PROJECT/*/*/*/.svn $BUILDROOT/$PROJECT/*/*/*/*/.svn`; $ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`; $ret=`rm -f $BUILDROOT/$PROJECT/.gitignore $BUILDROOT/$PROJECT/*/.gitignore $BUILDROOT/$PROJECT/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.gitignore`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/fckeditor`; @@ -347,7 +347,8 @@ if ($nboftargetok) { print "\nBuild package for target $target\n"; - if ($target eq 'SNAPSHOT') { + if ($target eq 'SNAPSHOT') + { $NEWDESTI=$DESTI; print "Remove target $FILENAMESNAPSHOT.tgz...\n"; @@ -371,7 +372,8 @@ if ($nboftargetok) { next; } - if ($target eq 'TGZ') { + if ($target eq 'TGZ') + { $NEWDESTI=$DESTI; if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; } @@ -396,7 +398,8 @@ if ($nboftargetok) { next; } - if ($target eq 'ZIP') { + if ($target eq 'ZIP') + { $NEWDESTI=$DESTI; if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; } @@ -459,9 +462,6 @@ if ($nboftargetok) { print "Create directory $BUILDROOT/$FILENAMETGZ2\n"; $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2`; - #$ret=`mkdir -p "$BUILDROOT/$FILENAMETGZ2"`; - #print "Create directory $BUILDROOT/$FILENAMETGZ2/usr/share\n"; - #$ret=`mkdir -p "$BUILDROOT/$FILENAMETGZ2/usr/share"`; print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMETGZ2\n"; $cmd="cp -pr '$BUILDROOT/$PROJECT' '$BUILDROOT/$FILENAMETGZ2'"; $ret=`$cmd`; @@ -553,157 +553,101 @@ if ($nboftargetok) { print "Remove target ${FILENAMEDEB}.changes...\n"; unlink("$NEWDESTI/${FILENAMEDEB}.changes"); - #rmdir "$BUILDROOT/$PROJECT.tmp"; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp`; $ret=`rm -fr $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build`; - print "Create directory $BUILDROOT/$PROJECT.tmp/usr/share\n"; - $ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/usr/share"`; - print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT\n"; - $cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT\""; - $ret=`$cmd`; - - print "Fix filefunc.inc.php, install/inc.php, support/inc.php\n"; - $cmd="cat \"$BUILDROOT/$PROJECT/htdocs/filefunc.inc.php\" | - sed -e 's/conffile = \"\\\.\\\.\\\/conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | - sed -e 's/conffile = \"conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | - sed -e 's/conffiletoshow = \"htdocs\\\/conf\\\/conf.php\"/conffiletoshow = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' > \"$BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/filefunc.inc.php\""; - $ret=`$cmd`; - $cmd="cat \"$BUILDROOT/$PROJECT/htdocs/install/inc.php\" | - sed -e 's/conffile = \"\\\.\\\.\\\/conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | - sed -e 's/conffile = \"conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | - sed -e 's/conffiletoshow = \"htdocs\\\/conf\\\/conf.php\"/conffiletoshow = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' > \"$BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/install/inc.php\""; - $ret=`$cmd`; - $cmd="cat \"$BUILDROOT/$PROJECT/htdocs/support/inc.php\" | - sed -e 's/conffile = \"\\\.\\\.\\\/conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | - sed -e 's/conffile = \"conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | - sed -e 's/conffiletoshow = \"htdocs\\\/conf\\\/conf.php\"/conffiletoshow = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' > \"$BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/support/inc.php\""; + print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$PROJECT.tmp\n"; + $cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$PROJECT.tmp\""; $ret=`$cmd`; +# print "Fix filefunc.inc.php, install/inc.php, support/inc.php\n"; +# $cmd="cat \"$BUILDROOT/$PROJECT/htdocs/filefunc.inc.php\" | +# sed -e 's/conffile = \"\\\.\\\.\\\/conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | +# sed -e 's/conffile = \"conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | +# sed -e 's/conffiletoshow = \"htdocs\\\/conf\\\/conf.php\"/conffiletoshow = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' > \"$BUILDROOT/$PROJECT.tmp/htdocs/filefunc.inc.php\""; +# $ret=`$cmd`; +# $cmd="cat \"$BUILDROOT/$PROJECT/htdocs/install/inc.php\" | +# sed -e 's/conffile = \"\\\.\\\.\\\/conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | +# sed -e 's/conffile = \"conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | +# sed -e 's/conffiletoshow = \"htdocs\\\/conf\\\/conf.php\"/conffiletoshow = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' > \"$BUILDROOT/$PROJECT.tmp/htdocs/install/inc.php\""; +# $ret=`$cmd`; +# $cmd="cat \"$BUILDROOT/$PROJECT/htdocs/support/inc.php\" | +# sed -e 's/conffile = \"\\\.\\\.\\\/conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | +# sed -e 's/conffile = \"conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | +# sed -e 's/conffiletoshow = \"htdocs\\\/conf\\\/conf.php\"/conffiletoshow = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' > \"$BUILDROOT/$PROJECT.tmp/htdocs/support/inc.php\""; +# $ret=`$cmd`; + print "Remove other files\n"; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/ChangeLog`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/COPYING`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/COPYRIGHT`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/INSTALL`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/README`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/README-FR`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/README`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/README-FR`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/aps`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/dmg`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/pad/README`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/tgz/README`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/README`; - #$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/po`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/source`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/changelog`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/compat`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/config`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/control*`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/copyright`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/dolibarr.desktop`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/dolibarr.lintian-overrides`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/format`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/install`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/menu`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/postrm`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/postinst`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/rules`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/README.debian`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/templates`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/templates.futur`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/wash`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/doap`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/exe`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/launchpad`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/live`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/patch`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/perl`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/rpm`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/zip`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/README-FR`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README-FR`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/aps`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/dmg`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/pad/README`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/tgz/README`; + #$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/debian`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/debian/po`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/debian/source`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/changelog`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/compat`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/config`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/control*`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/copyright`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.desktop`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.lintian-overrides`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/format`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/install`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/menu`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/postrm`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/postinst`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/rules`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/README.howto`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/templates`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/templates.futur`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/wash`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/doap`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/exe`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/launchpad`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/live`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/patch`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/perl`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/rpm`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/zip`; # We remove embedded libraries or fonts - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/includes/ckeditor`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/includes/fonts`, - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/includes/geoip`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/includes/nusoap`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/includes/odtphp/zip/pclzip`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/fonts`, + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/geoip`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/nusoap`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/odtphp/zip/pclzip`; - # Apache and lighttpd conf files - print "Copy apache.conf file into $BUILDROOT/$PROJECT.tmp/etc/$PROJECT/apache.conf\n"; - $ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/etc/$PROJECT"`; - $ret=`cp "$SOURCE/build/debian/apache.conf" "$BUILDROOT/$PROJECT.tmp/etc/$PROJECT/apache.conf"`; - print "Copy lighttpd.conf file into $BUILDROOT/$PROJECT.tmp/etc/$PROJECT/lighttpd.conf\n"; - $ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/etc/$PROJECT"`; - $ret=`cp "$SOURCE/build/debian/lighttpd.conf" "$BUILDROOT/$PROJECT.tmp/etc/$PROJECT/lighttpd.conf"`; - - # dolibarr.desktop - print "Create directory $BUILDROOT/$PROJECT.tmp/usr/share/applications\n"; - $ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/usr/share/applications"`; - print "Copy desktop file into $BUILDROOT/$PROJECT.tmp/usr/share/applications/dolibarr.desktop\n"; - $ret=`cp "$SOURCE/build/debian/dolibarr.desktop" "$BUILDROOT/$PROJECT.tmp/usr/share/applications/dolibarr.desktop"`; - - # pixmap - print "Create directory $BUILDROOT/$PROJECT.tmp/usr/share/pixmaps\n"; - $ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/usr/share/pixmaps"`; - print "Copy pixmap file into $BUILDROOT/$PROJECT.tmp/usr/share/pixmaps/dolibarr.xpm\n"; - $ret=`cp "$SOURCE/doc/images/dolibarr.xpm" "$BUILDROOT/$PROJECT.tmp/usr/share/pixmaps/dolibarr.xpm"`; - - print "Create directory $BUILDROOT/$PROJECT.tmp/usr/share/doc/$PROJECT\n"; - $ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/usr/share/doc/$PROJECT"`; + # Prepare binary package (init DEBIAN dir) + #print "Create directory $BUILDROOT/$PROJECT.tmp/DEBIAN\n"; + #$ret=`mkdir "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; + #print "Copy $SOURCE/build/debian/xxx to $BUILDROOT/$PROJECT.tmp/DEBIAN\n"; + #$ret=`cp -f "$SOURCE/build/debian/config" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; + #$ret=`cp -f "$SOURCE/build/debian/postinst" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; + #$ret=`cp -f "$SOURCE/build/debian/postrm" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; + #$ret=`cp -f "$SOURCE/build/debian/templates" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; + #$ret=`cp -fr "$SOURCE/build/debian/po" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; # changelog (to build binary package directly without sources. Useless if we build from sources) - $ret=`gzip -9 -c "$SOURCE/build/debian/changelog" > $BUILDROOT/$PROJECT.tmp/usr/share/doc/$PROJECT/changelog.gz`; + #$ret=`gzip -9 -c "$SOURCE/build/debian/changelog" > $BUILDROOT/$PROJECT.tmp/usr/share/doc/$PROJECT/changelog.gz`; - # Set owners - print "Set owners on files/dir\n"; - $ret=`chown -R root.root $BUILDROOT/$PROJECT.tmp`; - - # Set permissions - print "Set permissions on files/dir\n"; - $ret=`chmod -R 755 $BUILDROOT/$PROJECT.tmp`; - $cmd="find $BUILDROOT/$PROJECT.tmp -type f -exec chmod 644 {} \\; "; - $ret=`$cmd`; - $cmd="find $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build -name '*.php' -type f -exec chmod 755 {} \\; "; - $ret=`$cmd`; - $cmd="find $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build -name '*.pl' -type f -exec chmod 755 {} \\; "; - $ret=`$cmd`; - $cmd="find $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/dev -name '*.php' -type f -exec chmod 755 {} \\; "; - $ret=`$cmd`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/dev/translation/autotranslator.class.php`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/dev/skeletons/modMyModule.class.php`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/dev/skeletons/skeleton_class.class.php`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/dev/skeletons/skeleton_page.php`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/dev/skeletons/skeleton_webservice_server.php`; - $cmd="find $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/scripts -name '*.php' -type f -exec chmod 755 {} \\; "; - $ret=`$cmd`; + #print "Edit version in file $BUILDROOT/$PROJECT.tmp/DEBIAN/control\n"; + #open (SPECFROM,"<$SOURCE/build/debian/control.debianbin") || die "Error"; + #open (SPECTO,">$BUILDROOT/$PROJECT.tmp/DEBIAN/control") || die "Error"; + #while () { + # $_ =~ s/__VERSION__/$MAJOR.$MINOR.$newbuild/; + # print SPECTO $_; + #} + #close SPECFROM; + #close SPECTO; + #print "Version set to $MAJOR.$MINOR.$newbuild\n"; - - # Prepare binary package (init DEBIAN dir) - print "Create directory $BUILDROOT/$PROJECT.tmp/DEBIAN\n"; - $ret=`mkdir "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - print "Copy $SOURCE/build/debian/xxx to $BUILDROOT/$PROJECT.tmp/DEBIAN\n"; - $ret=`cp -f "$SOURCE/build/debian/config" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - $ret=`cp -f "$SOURCE/build/debian/postinst" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - $ret=`cp -f "$SOURCE/build/debian/postrm" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - $ret=`cp -f "$SOURCE/build/debian/templates" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - $ret=`cp -fr "$SOURCE/build/debian/po" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - - print "Edit version in file $BUILDROOT/$PROJECT.tmp/DEBIAN/control\n"; - open (SPECFROM,"<$SOURCE/build/debian/control.debianbin") || die "Error"; - open (SPECTO,">$BUILDROOT/$PROJECT.tmp/DEBIAN/control") || die "Error"; - while () { - $_ =~ s/__VERSION__/$MAJOR.$MINOR.$newbuild/; - print SPECTO $_; - } - close SPECFROM; - close SPECTO; - print "Version set to $MAJOR.$MINOR.$newbuild\n"; - - $cmd="find $BUILDROOT/$PROJECT.tmp/DEBIAN -type f -exec chmod 755 {} \\; "; - $ret=`$cmd`; - $ret=`chmod 644 $BUILDROOT/$PROJECT.tmp/DEBIAN/control`; - $ret=`chmod 644 $BUILDROOT/$PROJECT.tmp/DEBIAN/templates`; + #$cmd="find $BUILDROOT/$PROJECT.tmp/DEBIAN -type f -exec chmod 755 {} \\; "; + #$ret=`$cmd`; + #$ret=`chmod 644 $BUILDROOT/$PROJECT.tmp/DEBIAN/control`; + #$ret=`chmod 644 $BUILDROOT/$PROJECT.tmp/DEBIAN/templates`; # Creation of binary package (to build without sources) # Enable this to build a binary package without building sources first @@ -713,33 +657,60 @@ if ($nboftargetok) { #print "Launch DEB build ($cmd)\n"; #$ret=`$cmd`; #print $ret."\n"; + #$ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; + #$ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/doc"`; #exit; - - $ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - $ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/doc"`; - + # Prepare source package (init debian dir) print "Create directory $BUILDROOT/$PROJECT.tmp/debian\n"; $ret=`mkdir "$BUILDROOT/$PROJECT.tmp/debian"`; print "Copy $SOURCE/build/debian/xxx to $BUILDROOT/$PROJECT.tmp/debian\n"; # Add files for dpkg-source - $ret=`cp -f "$SOURCE/ChangeLog" "$BUILDROOT/$PROJECT.tmp/usr/share/doc/dolibarr/UserChangeLog"`; - $ret=`cp -f "$SOURCE/build/debian/README.debian" "$BUILDROOT/$PROJECT.tmp/usr/share/doc/dolibarr/README"`; $ret=`cp -f "$SOURCE/build/debian/changelog" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/control" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/dolibarr.lintian-overrides" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/install" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/rules" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/copyright" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/compat" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -fr "$SOURCE/build/debian/source" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/control" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/copyright" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.xpm" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.desktop" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.lintian-overrides" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/install" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -fr "$SOURCE/build/debian/patches" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -fr "$SOURCE/build/debian/po" "$BUILDROOT/$PROJECT.tmp/debian"`; - # Add files also required to build binary package with dpkg-buildpackages + $ret=`cp -f "$SOURCE/build/debian/README.source" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/rules" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -fr "$SOURCE/build/debian/source" "$BUILDROOT/$PROJECT.tmp/debian"`; + # Add files also required to build binary package $ret=`cp -f "$SOURCE/build/debian/config" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/postinst" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/postrm" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/templates" "$BUILDROOT/$PROJECT.tmp/debian"`; + + # Set owners and permissions + print "Set owners on files/dir\n"; + $ret=`chown -R root.root $BUILDROOT/$PROJECT.tmp`; + print "Set permissions on files/dir\n"; + $ret=`chmod -R 755 $BUILDROOT/$PROJECT.tmp`; + $cmd="find $BUILDROOT/$PROJECT.tmp -type f -exec chmod 644 {} \\; "; + $ret=`$cmd`; + $cmd="find $BUILDROOT/$PROJECT.tmp/build -name '*.php' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + $cmd="find $BUILDROOT/$PROJECT.tmp/build -name '*.dpatch' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + $cmd="find $BUILDROOT/$PROJECT.tmp/build -name '*.pl' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + $cmd="find $BUILDROOT/$PROJECT.tmp/dev -name '*.php' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + $ret=`chmod 755 $BUILDROOT/$PROJECT.tmp/debian/rules`; + $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/translation/autotranslator.class.php`; + $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/modMyModule.class.php`; + $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_class.class.php`; + $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_page.php`; + $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_webservice_server.php`; + $cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.php' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + + print "Rename directory $BUILDROOT/$PROJECT.tmp into $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n"; $cmd="mv $BUILDROOT/$PROJECT.tmp $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build"; $ret=`$cmd`; diff --git a/build/rpm/dolibarr-forrpm.patch b/build/rpm/dolibarr-forrpm.patch index f1627beb897..06dd71a8987 100755 --- a/build/rpm/dolibarr-forrpm.patch +++ b/build/rpm/dolibarr-forrpm.patch @@ -1,7 +1,7 @@ diff -up htdocs/filefunc.inc.php.patch htdocs/filefunc.inc.php --- htdocs/filefunc.inc.php.patch 2011-09-03 02:32:48.666952000 +0200 +++ htdocs/filefunc.inc.php 2011-09-03 02:33:00.510952001 +0200 -@@ -64,8 +64,8 @@ $conffiletoshowshort = "conf.php"; +@@ -64,8 +64,8 @@ $conffile = "conf/conf.php"; $conffiletoshow = "htdocs/conf/conf.php"; // For debian/redhat like systems @@ -15,7 +15,7 @@ diff -up htdocs/filefunc.inc.php.patch htdocs/filefunc.inc.php diff -up htdocs/install/inc.php.patch htdocs/install/inc.php --- htdocs/install/inc.php.patch 2011-09-03 02:33:26.450952000 +0200 +++ htdocs/install/inc.php 2011-09-03 02:33:36.286952001 +0200 -@@ -75,8 +75,8 @@ $conffiletoshowshort = "conf.php"; +@@ -84,8 +84,8 @@ $conffile = "../conf/conf.php"; $conffiletoshow = "htdocs/conf/conf.php"; // For debian/redhat like systems @@ -29,7 +29,7 @@ diff -up htdocs/install/inc.php.patch htdocs/install/inc.php diff -up htdocs/support/inc.php.patch htdocs/support/inc.php --- htdocs/support/inc.php.patch 2011-09-03 02:34:39.606952000 +0200 +++ htdocs/support/inc.php 2011-09-03 02:33:59.814952000 +0200 -@@ -69,8 +69,8 @@ $conffiletoshowshort = "conf.php"; +@@ -79,8 +79,8 @@ $conffile = "../conf/conf.php"; $conffiletoshow = "htdocs/conf/conf.php"; // For debian/redhat like systems diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index ee1a2d94f88..54046659566 100755 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -32,7 +32,7 @@ if (! defined('DOL_VERSION')) define('DOL_VERSION','3.2.0-alpha'); // Also defined in htdocs/install/inc.php (Ex: x.y.z-alpha, x.y.z) if (! defined('EURO')) define('EURO',chr(128)); -// Definition des constantes syslog +// Define syslog constants if (! defined('LOG_DEBUG')) { if (function_exists("define_syslog_variables")) diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index dddff4a1298..fafb001bd18 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -18,9 +18,10 @@ * along with this program. If not, see . */ -/** \file htdocs/install/inc.php - * \ingroup core - * \brief File that define environment for install pages +/** + * \file htdocs/install/inc.php + * \ingroup core + * \brief File that define environment for support pages */ define('DOL_VERSION','3.2.0-alpha'); // Also defined in htdocs/master.inc.php (Ex: x.y.z-alpha, x.y.z) @@ -53,25 +54,25 @@ if (isset($_SERVER["DOCUMENT_URI"]) && $_SERVER["DOCUMENT_URI"]) } -// Definition des constantes syslog -if (function_exists("define_syslog_variables")) +// Define syslog constants +if (! defined('LOG_DEBUG')) { - if (version_compare(PHP_VERSION, '5.3.0', '<')) + if (function_exists("define_syslog_variables")) { define_syslog_variables(); // Deprecated since php 5.3.0, syslog variables no longer need to be initialized } -} -else -{ - // Pour PHP sans syslog (comme sous Windows) - define('LOG_EMERG',0); - define('LOG_ALERT',1); - define('LOG_CRIT',2); - define('LOG_ERR',3); - define('LOG_WARNING',4); - define('LOG_NOTICE',5); - define('LOG_INFO',6); - define('LOG_DEBUG',7); + else + { + // Pour PHP sans syslog (comme sous Windows) + define('LOG_EMERG',0); + define('LOG_ALERT',1); + define('LOG_CRIT',2); + define('LOG_ERR',3); + define('LOG_WARNING',4); + define('LOG_NOTICE',5); + define('LOG_INFO',6); + define('LOG_DEBUG',7); + } } $includeconferror=''; diff --git a/htdocs/support/inc.php b/htdocs/support/inc.php index d07f3e1f852..a8a6a0c1ffb 100644 --- a/htdocs/support/inc.php +++ b/htdocs/support/inc.php @@ -19,8 +19,9 @@ */ /** - * \file htdocs/support/inc.php - * \brief File that define environment for support pages + * \file htdocs/support/inc.php + * \ingroup core + * \brief File that define environment for support pages */ define('DOL_VERSION','3.2.0-alpha'); // Also defined in htdocs/master.inc.php @@ -49,27 +50,26 @@ if (isset($_SERVER["DOCUMENT_URI"]) && $_SERVER["DOCUMENT_URI"]) } -// Definition des constantes syslog -if (function_exists("define_syslog_variables")) +// Define syslog constants +if (! defined('LOG_DEBUG')) { - if (version_compare(PHP_VERSION, '5.3.0', '<')) - { - define_syslog_variables(); // Deprecated since php 5.3.0, syslog variables no longer need to be initialized - } + if (function_exists("define_syslog_variables")) + { + define_syslog_variables(); // Deprecated since php 5.3.0, syslog variables no longer need to be initialized + } + else + { + // Pour PHP sans syslog (comme sous Windows) + define('LOG_EMERG',0); + define('LOG_ALERT',1); + define('LOG_CRIT',2); + define('LOG_ERR',3); + define('LOG_WARNING',4); + define('LOG_NOTICE',5); + define('LOG_INFO',6); + define('LOG_DEBUG',7); + } } -else -{ - // Pour PHP sans syslog (comme sous Windows) - define('LOG_EMERG',0); - define('LOG_ALERT',1); - define('LOG_CRIT',2); - define('LOG_ERR',3); - define('LOG_WARNING',4); - define('LOG_NOTICE',5); - define('LOG_INFO',6); - define('LOG_DEBUG',7); -} - $includeconferror=''; From 06f41166e19b1afb56058c6150e59f7611d49128 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Jan 2012 21:28:45 +0100 Subject: [PATCH 03/21] Fix: Uniformize style --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 0aa977fadb2..daba7b363fe 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -374,7 +374,7 @@ class FormFile $out.= ''; $out.= '
'.$titletoshow.'
'; - $out.= ''; + $out.= '
'; $out.= ''; From d7f7ec2372ec6c600b3dc87e4052694148f543fc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Jan 2012 21:46:55 +0100 Subject: [PATCH 04/21] Fix: Position of address --- .../doc/pdf_expedition_merou.modules.php | 14 +++++++------- htdocs/expedition/fiche.php | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php index 713f7004df0..c3e2dd85838 100644 --- a/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php @@ -442,8 +442,9 @@ Class pdf_expedition_merou extends ModelePdfExpedition $blSocX2=$blSocW+$blSocX; // Sender name - $pdf->SetTextColor(0,0,60); - $pdf->SetXY($blSocX,$blSocY); + $pdf->SetTextColor(0,0,0); + $pdf->SetFont('','B', $default_font_size - 3); + $pdf->SetXY($blSocX,$blSocY+1); $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); $pdf->SetTextColor(0,0,0); @@ -451,7 +452,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition $carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); $pdf->SetFont('','', $default_font_size - 3); - $pdf->SetXY($blSocX,$blSocY+3); + $pdf->SetXY($blSocX,$blSocY+4); $pdf->MultiCell(80, 2, $carac_emetteur, 0, 'L'); @@ -504,12 +505,11 @@ Class pdf_expedition_merou extends ModelePdfExpedition /**********************************/ //Emplacement Informations Expediteur (My Company) /**********************************/ + $Yoff = $blSocY; $blExpX=$Xoff-20; $blW=52; - $Yoff = $Yoff+5; $Ydef = $Yoff; - $blSocY = 1; - $pdf->Rect($blExpX, $Yoff, $blW, 20); + $pdf->Rect($blExpX, $Yoff, $blW, 26); $object->fetch_thirdparty(); @@ -542,7 +542,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition $blW=50; $Yoff = $Ydef +1; - $pdf->Rect($blDestX, $Yoff-1, $blW, 20); + $pdf->Rect($blDestX, $Yoff-1, $blW, 26); //Titre $pdf->SetFont('','B', $default_font_size - 3); diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index fa93422cec4..2593fac3984 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -850,7 +850,7 @@ else $head=shipping_prepare_head($object); dol_fiche_head($head, 'shipping', $langs->trans("Sending"), 0, 'sending'); - if ($mesg) print $mesg; + dol_htmloutput_mesg($mesg); /* * Confirmation de la suppression @@ -970,7 +970,7 @@ else // Date creation print ''; - print '\n"; + print '\n"; print ''; // Delivery date planed @@ -1159,7 +1159,7 @@ else $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - + $label = ( ! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $lines[$i]->product_label; } else From cb37a8475a8ba2527de573aaf8e54d4cf4655026 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Jan 2012 23:07:44 +0100 Subject: [PATCH 05/21] Fix: Can edit price --- htdocs/product/price.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 7c11bcb3f2c..63739a4f44f 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani @@ -272,7 +272,8 @@ print "
'.$langs->trans("DateCreation").''.dol_print_date($object->date_creation,"daytext")."'.dol_print_date($object->date_creation,"day")."
\n"; print "\n"; -if ($mesg) print $mesg; + +dol_htmloutput_mesg($mesg); /* ************************************************************************** */ @@ -281,7 +282,7 @@ if ($mesg) print $mesg; /* */ /* ************************************************************************** */ -if ($action == 'delete') +if (! $action || $action == 'delete') { print "\n".'
'."\n"; @@ -531,5 +532,4 @@ else llxFooter(); $db->close(); - ?> From f3a966a313424f7a3b922fe2159d355efa708860 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Jan 2012 23:24:47 +0100 Subject: [PATCH 06/21] Fix: Missing name --- htdocs/bookmarks/liste.php | 2 +- htdocs/comm/multiprix.php | 2 +- htdocs/comm/propal/contact.php | 6 +++--- htdocs/commande/contact.php | 6 +++--- htdocs/compta/facture/contact.php | 6 +++--- htdocs/compta/index.php | 4 ++-- htdocs/contact/class/contact.class.php | 15 +++++++++------ htdocs/contrat/contact.php | 6 +++--- htdocs/core/class/html.formactions.class.php | 8 ++++---- htdocs/ecm/index.php | 2 +- htdocs/fichinter/contact.php | 6 +++--- htdocs/fourn/commande/contact.php | 8 ++++---- htdocs/fourn/commande/index.php | 4 ++-- htdocs/fourn/facture/contact.php | 6 +++--- htdocs/product/stock/mouvement.php | 2 +- htdocs/projet/contact.php | 8 ++++---- htdocs/projet/tasks/contact.php | 6 +++--- .../societe/canvas/actions_card_common.class.php | 4 ++-- htdocs/societe/soc.php | 4 ++-- htdocs/user/class/user.class.php | 11 +++++++---- 20 files changed, 61 insertions(+), 55 deletions(-) diff --git a/htdocs/bookmarks/liste.php b/htdocs/bookmarks/liste.php index cb05a23c77e..a9664d8dc86 100644 --- a/htdocs/bookmarks/liste.php +++ b/htdocs/bookmarks/liste.php @@ -154,7 +154,7 @@ if ($resql) if ($obj->fk_user) { $userstatic->id=$obj->fk_user; - $userstatic->nom=$obj->login; + $userstatic->lastname=$obj->login; print $userstatic->getNomUrl(1); } else diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php index 3d9ed3de3b6..790c4a8a1ee 100644 --- a/htdocs/comm/multiprix.php +++ b/htdocs/comm/multiprix.php @@ -152,7 +152,7 @@ if ($_socid > 0) print ''.dol_print_date($db->jdate($obj->dc),"dayhour").''; print ''.$obj->price_level.' '; $userstatic->id=$obj->uid; - $userstatic->nom=$obj->login; + $userstatic->lastname=$obj->login; print ''.$userstatic->getNomUrl(1).''; print ''; $i++; diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index b6fe67d4122..74d3de71b39 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -322,14 +322,14 @@ if ($id > 0 || ! empty($ref)) if ($tab[$i]['source']=='internal') { $userstatic->id=$tab[$i]['id']; - $userstatic->nom=$tab[$i]['nom']; - $userstatic->prenom=$tab[$i]['firstname']; + $userstatic->lastname=$tab[$i]['lastname']; + $userstatic->firstname=$tab[$i]['firstname']; print $userstatic->getNomUrl(1); } if ($tab[$i]['source']=='external') { $contactstatic->id=$tab[$i]['id']; - $contactstatic->name=$tab[$i]['nom']; + $contactstatic->lastname=$tab[$i]['lastname']; $contactstatic->firstname=$tab[$i]['firstname']; print $contactstatic->getNomUrl(1); } diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index 94dee98896b..966e2c660fc 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -313,14 +313,14 @@ if ($id > 0 || ! empty($ref)) if ($tab[$i]['source']=='internal') { $userstatic->id=$tab[$i]['id']; - $userstatic->nom=$tab[$i]['nom']; - $userstatic->prenom=$tab[$i]['firstname']; + $userstatic->lastname=$tab[$i]['lastname']; + $userstatic->firstname=$tab[$i]['firstname']; print $userstatic->getNomUrl(1); } if ($tab[$i]['source']=='external') { $contactstatic->id=$tab[$i]['id']; - $contactstatic->name=$tab[$i]['nom']; + $contactstatic->lastname=$tab[$i]['lastname']; $contactstatic->firstname=$tab[$i]['firstname']; print $contactstatic->getNomUrl(1); } diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 1787baa2208..410cfcff75e 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -308,14 +308,14 @@ if ($id > 0 || ! empty($ref)) if ($tab[$i]['source']=='internal') { $userstatic->id=$tab[$i]['id']; - $userstatic->nom=$tab[$i]['nom']; - $userstatic->prenom=$tab[$i]['firstname']; + $userstatic->lastname=$tab[$i]['lastname']; + $userstatic->firstname=$tab[$i]['firstname']; print $userstatic->getNomUrl(1); } if ($tab[$i]['source']=='external') { $contactstatic->id=$tab[$i]['id']; - $contactstatic->name=$tab[$i]['nom']; + $contactstatic->lastname=$tab[$i]['lastname']; $contactstatic->firstname=$tab[$i]['firstname']; print $contactstatic->getNomUrl(1); } diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 4166a4ab130..948dd09b638 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -604,8 +604,8 @@ if ($conf->deplacement->enabled && $user->rights->deplacement->lire) $deplacementstatic->ref=$objp->rowid; $deplacementstatic->id=$objp->rowid; $userstatic->id=$objp->uid; - $userstatic->nom=$objp->name; - $userstatic->prenom=$objp->firstname; + $userstatic->lastname=$objp->name; + $userstatic->firstname=$objp->firstname; print ''; print ''.$deplacementstatic->getNomUrl(1).''; print ''.$userstatic->getNomUrl(1).''; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index d3c8781aa7d..afc935fb65f 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -913,6 +913,9 @@ class Contact extends CommonObject { global $conf; + if (empty($this->lastname)) $this->lastname=($this->name?$this->name:$this->nom); + if (empty($this->firstname)) $this->firstname=($this->firstname?$this->firstname:$this->prenom); + $ret=''; if ($option && $this->civilite_id) { @@ -925,15 +928,15 @@ class Contact extends CommonObject if ($nameorder) { - if ($this->firstname) $ret.=$this->firstname; - if ($this->firstname && $this->name) $ret.=' '; - if ($this->name) $ret.=$this->name; + $ret.=$this->firstname; + if ($this->firstname && $this->lastname) $ret.=' '; + $ret.=$this->lastname; } else { - if ($this->name) $ret.=$this->name; - if ($this->firstname && $this->name) $ret.=' '; - if ($this->firstname) $ret.=$this->firstname; + $ret.=$this->lastname; + if ($this->firstname && $this->lastname) $ret.=' '; + $ret.=$this->firstname; } return trim($ret); } diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index cee7fd45353..df9f6cc6126 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -308,14 +308,14 @@ if ($id > 0) if ($tab[$i]['source']=='internal') { $userstatic->id=$tab[$i]['id']; - $userstatic->nom=$tab[$i]['nom']; - $userstatic->prenom=$tab[$i]['firstname']; + $userstatic->lastname=$tab[$i]['lastname']; + $userstatic->firstname=$tab[$i]['firstname']; print $userstatic->getNomUrl(1); } if ($tab[$i]['source']=='external') { $contactstatic->id=$tab[$i]['id']; - $contactstatic->name=$tab[$i]['nom']; + $contactstatic->lastname=$tab[$i]['lastname']; $contactstatic->firstname=$tab[$i]['firstname']; print $contactstatic->getNomUrl(1); } diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 2fcf2442956..207f29b74e4 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -101,7 +101,7 @@ class FormActions /** * Show list of actions for element - * + * * @param Object $object Object * @param string $typeelement 'invoice','propal','order','invoice_supplier','order_supplier','fichinter' * @param int $socid socid of user @@ -146,8 +146,8 @@ class FormActions print ''.dol_trunc($action->label,32).''; $userstatic = new User($this->db); $userstatic->id = $action->author->id; - $userstatic->prenom = $action->author->firstname; - $userstatic->nom = $action->author->lastname; + $userstatic->firstname = $action->author->firstname; + $userstatic->lastname = $action->author->lastname; print ''.$userstatic->getNomUrl(1).''; print ''; } @@ -160,7 +160,7 @@ class FormActions /** * Output list of type of event - * + * * @param string $selected Type pre-selectionne * @param string $htmlname Nom champ formulaire * @return void diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 7547616ca46..4ab066e0dc8 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -739,7 +739,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti // Info print ''; $userstatic->id=$val['fk_user_c']; - $userstatic->nom=$val['login_c']; + $userstatic->lastname=$val['login_c']; $htmltooltip=''.$langs->trans("ECMSection").': '.$val['label'].'
'; $htmltooltip=''.$langs->trans("Type").': '.$langs->trans("ECMSectionManual").'
'; $htmltooltip.=''.$langs->trans("ECMCreationUser").': '.$userstatic->getNomUrl(1).'
'; diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php index 34a3a03068e..467e8683527 100644 --- a/htdocs/fichinter/contact.php +++ b/htdocs/fichinter/contact.php @@ -298,14 +298,14 @@ if ($id > 0) if ($tab[$i]['source']=='internal') { $userstatic->id=$tab[$i]['id']; - $userstatic->nom=$tab[$i]['nom']; - $userstatic->prenom=$tab[$i]['firstname']; + $userstatic->lastname=$tab[$i]['lastname']; + $userstatic->firstname=$tab[$i]['firstname']; print $userstatic->getNomUrl(1); } if ($tab[$i]['source']=='external') { $contactstatic->id=$tab[$i]['id']; - $contactstatic->name=$tab[$i]['nom']; + $contactstatic->lastname=$tab[$i]['lastname']; $contactstatic->firstname=$tab[$i]['firstname']; print $contactstatic->getNomUrl(1); } diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index 5a80d98ec7d..10fd92f18c4 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -130,7 +130,7 @@ dol_htmloutput_mesg($mesg); if ($id > 0 || ! empty($ref)) { $langs->trans("OrderCard"); - + if ($object->fetch($id, $ref) > 0) { $soc = new Societe($db); @@ -303,14 +303,14 @@ if ($id > 0 || ! empty($ref)) if ($tab[$i]['source']=='internal') { $userstatic->id=$tab[$i]['id']; - $userstatic->nom=$tab[$i]['nom']; - $userstatic->prenom=$tab[$i]['firstname']; + $userstatic->lastname=$tab[$i]['lastname']; + $userstatic->firstname=$tab[$i]['firstname']; print $userstatic->getNomUrl(1); } if ($tab[$i]['source']=='external') { $contactstatic->id=$tab[$i]['id']; - $contactstatic->name=$tab[$i]['nom']; + $contactstatic->lastname=$tab[$i]['lastname']; $contactstatic->firstname=$tab[$i]['firstname']; print $contactstatic->getNomUrl(1); } diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index 29377968798..095f627a8d3 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -223,8 +223,8 @@ if ($resql) print ""; print ''; $userstatic->id=$obj->rowid; - $userstatic->nom=$obj->name; - $userstatic->prenom=$obj->firstname; + $userstatic->lastname=$obj->name; + $userstatic->firstname=$obj->firstname; print $userstatic->getNomUrl(1); print ''; print "\n"; diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index 2b5ccbf7cc3..c10bf7bca87 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -299,14 +299,14 @@ if ($id > 0) if ($tab[$i]['source']=='internal') { $userstatic->id=$tab[$i]['id']; - $userstatic->nom=$tab[$i]['nom']; - $userstatic->prenom=$tab[$i]['firstname']; + $userstatic->lastname=$tab[$i]['lastname']; + $userstatic->firstname=$tab[$i]['firstname']; print $userstatic->getNomUrl(1); } if ($tab[$i]['source']=='external') { $contactstatic->id=$tab[$i]['id']; - $contactstatic->name=$tab[$i]['nom']; + $contactstatic->lastname=$tab[$i]['lastname']; $contactstatic->firstname=$tab[$i]['firstname']; print $contactstatic->getNomUrl(1); } diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 1de22cd3e2c..5f72c6f8413 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -321,7 +321,7 @@ if ($resql) // Author print ''; $userstatic->id=$objp->fk_user_author; - $userstatic->nom=$objp->login; + $userstatic->lastname=$objp->login; print $userstatic->getNomUrl(1); print "\n"; // Value diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 24e4a7ab3b5..9409a9dc997 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -245,7 +245,7 @@ if ($id > 0 || ! empty($ref)) print ''; $var=!$var; - print ""; + print ""; print ''; print img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); @@ -327,14 +327,14 @@ if ($id > 0 || ! empty($ref)) if ($tab[$i]['source']=='internal') { $userstatic->id=$tab[$i]['id']; - $userstatic->nom=$tab[$i]['nom']; - $userstatic->prenom=$tab[$i]['firstname']; + $userstatic->lastname=$tab[$i]['nom']; + $userstatic->firstname=$tab[$i]['firstname']; print $userstatic->getNomUrl(1); } if ($tab[$i]['source']=='external') { $contactstatic->id=$tab[$i]['id']; - $contactstatic->name=$tab[$i]['nom']; + $contactstatic->lastname=$tab[$i]['nom']; $contactstatic->firstname=$tab[$i]['firstname']; print $contactstatic->getNomUrl(1); } diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index e800599a70e..26934f1c767 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -328,14 +328,14 @@ if ($id > 0 || ! empty($ref)) if ($tab[$i]['source']=='internal') { $userstatic->id=$tab[$i]['id']; - $userstatic->nom=$tab[$i]['nom']; - $userstatic->prenom=$tab[$i]['firstname']; + $userstatic->lastname=$tab[$i]['lastname']; + $userstatic->firstname=$tab[$i]['firstname']; print $userstatic->getNomUrl(1); } if ($tab[$i]['source']=='external') { $contactstatic->id=$tab[$i]['id']; - $contactstatic->name=$tab[$i]['nom']; + $contactstatic->lastname=$tab[$i]['lastname']; $contactstatic->firstname=$tab[$i]['firstname']; print $contactstatic->getNomUrl(1); } diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index be165ef3b24..ff0696f237b 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -603,8 +603,8 @@ abstract class ActionsCardCommon foreach($listsalesrepresentatives as $val) { $userstatic->id=$val['id']; - $userstatic->nom=$val['name']; - $userstatic->prenom=$val['firstname']; + $userstatic->lastname=$val['name']; + $userstatic->firstname=$val['firstname']; $this->tpl['sales_representatives'].= $userstatic->getNomUrl(1); $i++; if ($i < $nbofsalesrepresentative) $this->tpl['sales_representatives'].= ', '; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 14fecace66e..6060fc0f06a 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1802,8 +1802,8 @@ else foreach($listsalesrepresentatives as $val) { $userstatic->id=$val['id']; - $userstatic->nom=$val['name']; - $userstatic->prenom=$val['firstname']; + $userstatic->lastname=$val['name']; + $userstatic->firstname=$val['firstname']; print $userstatic->getNomUrl(1); $i++; if ($i < $nbofsalesrepresentative) print ', '; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 4cd8677cc74..d4de350a886 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1717,6 +1717,9 @@ class User extends CommonObject { global $conf; + if (empty($this->lastname)) $this->lastname=($this->name?$this->name:$this->nom); + if (empty($this->firstname)) $this->firstname=($this->firstname?$this->firstname:$this->prenom); + $ret=''; if ($option && $this->civilite_id) { @@ -1729,15 +1732,15 @@ class User extends CommonObject if ($nameorder) { - if ($this->firstname) $ret.=$this->firstname; + $ret.=$this->firstname; if ($this->firstname && $this->lastname) $ret.=' '; - if ($this->lastname) $ret.=$this->lastname; + $ret.=$this->lastname; } else { - if ($this->lastname) $ret.=$this->lastname; + $ret.=$this->lastname; if ($this->firstname && $this->lastname) $ret.=' '; - if ($this->firstname) $ret.=$this->firstname; + $ret.=$this->firstname; } return trim($ret); From 6055a758b0928e815ce4a9305600c5af593ab230 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Jan 2012 00:05:36 +0100 Subject: [PATCH 07/21] Work on debian package --- build/debian/rules | 76 ++++++++++++++++++++++++++++++++++++++ build/launchpad/README | 12 +++--- build/makepack-dolibarr.pl | 65 +------------------------------- 3 files changed, 84 insertions(+), 69 deletions(-) diff --git a/build/debian/rules b/build/debian/rules index 280ba8fde47..04247898209 100755 --- a/build/debian/rules +++ b/build/debian/rules @@ -30,6 +30,82 @@ binary-indep: dh $@ clean: + # Delete files + rm -f .buildpath + rm -fr .cache + rm -fr .git + rm -f .gitmodules + rm -f .gitignore + rm -fr .project + rm -fr .settings + rm -f build.xml + rm -f pom.xml + rm -f README.md + + rm -f htdocs/install/mssql/README + rm -f htdocs/install/mysql/README + rm -f htdocs/install/pgsql/README + + rm -fr dev/codesniffer + rm -fr dev/codetemplates + rm -fr dev/dbmodel + rm -fr dev/initdata + rm -fr dev/iso-normes + rm -fr dev/ldap + rm -fr dev/licence + rm -fr dev/mail + rm -fr dev/phpcheckstyle + rm -fr dev/phpunit + rm -fr dev/security + rm -fr dev/spec + rm -fr dev/test + rm -fr dev/uml + rm -fr dev/xdebug + rm -f dev/dolibarr_changes.txt + rm -f dev/README + rm -f doc/images/dolibarr_screenshot2.png + rm -f doc/images/dolibarr_screenshot3.png + rm -f doc/images/dolibarr_screenshot4.png + rm -f doc/images/dolibarr_screenshot5.png + rm -f doc/images/dolibarr_screenshot6.png + rm -f doc/images/dolibarr_screenshot7.png + rm -f doc/images/dolibarr_screenshot8.png + rm -f doc/images/dolibarr_screenshot9.png + rm -f doc/images/dolibarr_screenshot10.png + rm -f doc/images/dolibarr_screenshot11.png + rm -f doc/images/dolibarr_screenshot12.png + + rm -fr test + + # Licence files are included into copyright file. + rm -f htdocs/includes/jquery/plugins/flot/LICENSE.txt + rm -fr htdocs/includes/phpexcel/license.txt + rm -f htdocs/includes/tcpdf/LICENSE.TXT + + rm -fr htdocs/includes/jquery/plugins/lightbox + rm -fr htdocs/includes/jquery/plugins/jstree + rm -fr htdocs/includes/phpexcel/PHPExcel/Shared/PDF + rm -fr htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip + rm -fr htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-2.33 + rm -fr htdocs/includes/tcpdf/fonts/freefont-20100919 + rm -fr htdocs/includes/tcpdf/fonts/utils + + rm -fr build/aps + rm -fr build/dmg + rm -fr build/doap + rm -fr build/exe + rm -fr build/launchpad + rm -fr build/live + rm -fr build/patch + rm -fr build/perl + rm -fr build/rpm + rm -fr build/zip + rm -fr htdocs/includes/ckeditor + rm -fr htdocs/includes/fonts + rm -fr htdocs/includes/geoip + rm -fr htdocs/includes/nusoap + rm -fr htdocs/includes/odtphp/zip/pclzip + dh $@ binary-arch: diff --git a/build/launchpad/README b/build/launchpad/README index b4428216dd5..b1ebb65b4bc 100644 --- a/build/launchpad/README +++ b/build/launchpad/README @@ -12,7 +12,7 @@ a package onto LaunchPad # To install all packagers tools: # apt-get install bzr-builder bzr pbuilder -To submit a package on LaunchPad: +# Init local working env - Create account on launchpad.org - Create Project - Link project to official SCM server @@ -20,7 +20,11 @@ To submit a package on LaunchPad: - Run from command line: bzr launchpad-login yourlogin bzr whoami "Your Name " -- Create a Bazzar directory +- Create a file /.pbuilderrc with content + COMPONENTS="main universe multiverse restricted" + +# Init package tools for launchpad +- Create a Bazaar directory mkdir bzr - Create debian directory and upload it onto bzr branch ~yourlogin/dolibarr/debian cd bzr @@ -29,7 +33,7 @@ To submit a package on LaunchPad: bzr init cp -pr dolibarr_root/debian bzr/debian bzr add debian - bzr commit + bzr commit -m "Init" bzr push lp:~eldy/dolibarr/debian or download it from launchpad bazaar: cd bzr @@ -44,8 +48,6 @@ To submit a package on LaunchPad: cd bzr bzr dailydeb dolibarr.recipe working-dir This will create a directory "working-dir" with dolibarr sources and will add sources from ~eldy/dolibarr/debian -- Create a file /.pbuilderrc with content - $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build - Create chroot ubuntu env sudo pbuilder create - Test package sources diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 64bfbc60b9c..21a0f53096c 100644 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -280,7 +280,6 @@ if ($nboftargetok) { $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php.old`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php.postgres`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf*sav*`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/install.lock`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/mssql/README`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/mysql/README`; @@ -322,7 +321,6 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`; $ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`; $ret=`rm -f $BUILDROOT/$PROJECT/.gitignore $BUILDROOT/$PROJECT/*/.gitignore $BUILDROOT/$PROJECT/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.gitignore`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/fckeditor`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/geoip/sample*.*`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/flot/LICENSE.txt`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/lightbox`; @@ -335,8 +333,6 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-20100919`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/utils`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/LICENSE.TXT`; - # Removed because not stable yet - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/theme/bureau2crea`; } # Build package for each target @@ -560,23 +556,6 @@ if ($nboftargetok) { $cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$PROJECT.tmp\""; $ret=`$cmd`; -# print "Fix filefunc.inc.php, install/inc.php, support/inc.php\n"; -# $cmd="cat \"$BUILDROOT/$PROJECT/htdocs/filefunc.inc.php\" | -# sed -e 's/conffile = \"\\\.\\\.\\\/conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | -# sed -e 's/conffile = \"conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | -# sed -e 's/conffiletoshow = \"htdocs\\\/conf\\\/conf.php\"/conffiletoshow = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' > \"$BUILDROOT/$PROJECT.tmp/htdocs/filefunc.inc.php\""; -# $ret=`$cmd`; -# $cmd="cat \"$BUILDROOT/$PROJECT/htdocs/install/inc.php\" | -# sed -e 's/conffile = \"\\\.\\\.\\\/conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | -# sed -e 's/conffile = \"conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | -# sed -e 's/conffiletoshow = \"htdocs\\\/conf\\\/conf.php\"/conffiletoshow = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' > \"$BUILDROOT/$PROJECT.tmp/htdocs/install/inc.php\""; -# $ret=`$cmd`; -# $cmd="cat \"$BUILDROOT/$PROJECT/htdocs/support/inc.php\" | -# sed -e 's/conffile = \"\\\.\\\.\\\/conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | -# sed -e 's/conffile = \"conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | -# sed -e 's/conffiletoshow = \"htdocs\\\/conf\\\/conf.php\"/conffiletoshow = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' > \"$BUILDROOT/$PROJECT.tmp/htdocs/support/inc.php\""; -# $ret=`$cmd`; - print "Remove other files\n"; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/README-FR`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README`; @@ -613,54 +592,13 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/perl`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/rpm`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/zip`; - # We remove embedded libraries or fonts + # We remove embedded libraries or fonts (this is also inside rules file, target clean) $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/fonts`, $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/geoip`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/nusoap`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/odtphp/zip/pclzip`; - # Prepare binary package (init DEBIAN dir) - #print "Create directory $BUILDROOT/$PROJECT.tmp/DEBIAN\n"; - #$ret=`mkdir "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - #print "Copy $SOURCE/build/debian/xxx to $BUILDROOT/$PROJECT.tmp/DEBIAN\n"; - #$ret=`cp -f "$SOURCE/build/debian/config" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - #$ret=`cp -f "$SOURCE/build/debian/postinst" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - #$ret=`cp -f "$SOURCE/build/debian/postrm" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - #$ret=`cp -f "$SOURCE/build/debian/templates" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - #$ret=`cp -fr "$SOURCE/build/debian/po" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - - # changelog (to build binary package directly without sources. Useless if we build from sources) - #$ret=`gzip -9 -c "$SOURCE/build/debian/changelog" > $BUILDROOT/$PROJECT.tmp/usr/share/doc/$PROJECT/changelog.gz`; - - #print "Edit version in file $BUILDROOT/$PROJECT.tmp/DEBIAN/control\n"; - #open (SPECFROM,"<$SOURCE/build/debian/control.debianbin") || die "Error"; - #open (SPECTO,">$BUILDROOT/$PROJECT.tmp/DEBIAN/control") || die "Error"; - #while () { - # $_ =~ s/__VERSION__/$MAJOR.$MINOR.$newbuild/; - # print SPECTO $_; - #} - #close SPECFROM; - #close SPECTO; - #print "Version set to $MAJOR.$MINOR.$newbuild\n"; - - #$cmd="find $BUILDROOT/$PROJECT.tmp/DEBIAN -type f -exec chmod 755 {} \\; "; - #$ret=`$cmd`; - #$ret=`chmod 644 $BUILDROOT/$PROJECT.tmp/DEBIAN/control`; - #$ret=`chmod 644 $BUILDROOT/$PROJECT.tmp/DEBIAN/templates`; - - # Creation of binary package (to build without sources) - # Enable this to build a binary package without building sources first - #print "Go into directory $BUILDROOT\n"; - #chdir("$BUILDROOT"); - #$cmd="dpkg -b $BUILDROOT/$PROJECT.tmp $BUILDROOT/${FILENAMEDEB}_all.deb"; - #print "Launch DEB build ($cmd)\n"; - #$ret=`$cmd`; - #print $ret."\n"; - #$ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - #$ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/doc"`; - #exit; - # Prepare source package (init debian dir) print "Create directory $BUILDROOT/$PROJECT.tmp/debian\n"; $ret=`mkdir "$BUILDROOT/$PROJECT.tmp/debian"`; @@ -685,7 +623,6 @@ if ($nboftargetok) { $ret=`cp -f "$SOURCE/build/debian/postrm" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/templates" "$BUILDROOT/$PROJECT.tmp/debian"`; - # Set owners and permissions print "Set owners on files/dir\n"; $ret=`chown -R root.root $BUILDROOT/$PROJECT.tmp`; From e5d564b40f65303c2b281b384ec124bcadfd85e4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Jan 2012 00:42:47 +0100 Subject: [PATCH 08/21] Work on debian package --- build/debian/changelog | 2 +- build/debian/install | 4 +- build/debian/rules | 76 ++++++++++++++++++++++++++++++++++++++ build/launchpad/README | 16 ++++---- build/makepack-dolibarr.pl | 65 +------------------------------- 5 files changed, 90 insertions(+), 73 deletions(-) diff --git a/build/debian/changelog b/build/debian/changelog index 152492e7ad7..3b1aeb0907f 100644 --- a/build/debian/changelog +++ b/build/debian/changelog @@ -6,4 +6,4 @@ dolibarr (3.2.0+nmu1) unstable; urgency=low -- Dolibarr team Mon, 10 Aug 2011 12:00:00 +0100 -# For a changelog file dedicated to users, see /usr/share/doc/dolibarr/UserChangeLog.gz file. \ No newline at end of file +# For a changelog file dedicated to end users, see /usr/share/doc/dolibarr/ChangeLog.gz \ No newline at end of file diff --git a/build/debian/install b/build/debian/install index 6562bda4a37..911d25cae8a 100755 --- a/build/debian/install +++ b/build/debian/install @@ -1,8 +1,10 @@ debian/dolibarr.desktop usr/share/applications debian/dolibarr.xpm usr/share/pixmaps +ChangeLog usr/share/doc/dolibarr +README usr/share/doc/dolibarr build/debian/apache.conf etc/dolibarr build/debian/lighttpd.conf etc/dolibarr build usr/share/dolibarr dev usr/share/dolibarr htdocs usr/share/dolibarr -scripts usr/share/dolibarr \ No newline at end of file +scripts usr/share/dolibarr diff --git a/build/debian/rules b/build/debian/rules index 280ba8fde47..04247898209 100755 --- a/build/debian/rules +++ b/build/debian/rules @@ -30,6 +30,82 @@ binary-indep: dh $@ clean: + # Delete files + rm -f .buildpath + rm -fr .cache + rm -fr .git + rm -f .gitmodules + rm -f .gitignore + rm -fr .project + rm -fr .settings + rm -f build.xml + rm -f pom.xml + rm -f README.md + + rm -f htdocs/install/mssql/README + rm -f htdocs/install/mysql/README + rm -f htdocs/install/pgsql/README + + rm -fr dev/codesniffer + rm -fr dev/codetemplates + rm -fr dev/dbmodel + rm -fr dev/initdata + rm -fr dev/iso-normes + rm -fr dev/ldap + rm -fr dev/licence + rm -fr dev/mail + rm -fr dev/phpcheckstyle + rm -fr dev/phpunit + rm -fr dev/security + rm -fr dev/spec + rm -fr dev/test + rm -fr dev/uml + rm -fr dev/xdebug + rm -f dev/dolibarr_changes.txt + rm -f dev/README + rm -f doc/images/dolibarr_screenshot2.png + rm -f doc/images/dolibarr_screenshot3.png + rm -f doc/images/dolibarr_screenshot4.png + rm -f doc/images/dolibarr_screenshot5.png + rm -f doc/images/dolibarr_screenshot6.png + rm -f doc/images/dolibarr_screenshot7.png + rm -f doc/images/dolibarr_screenshot8.png + rm -f doc/images/dolibarr_screenshot9.png + rm -f doc/images/dolibarr_screenshot10.png + rm -f doc/images/dolibarr_screenshot11.png + rm -f doc/images/dolibarr_screenshot12.png + + rm -fr test + + # Licence files are included into copyright file. + rm -f htdocs/includes/jquery/plugins/flot/LICENSE.txt + rm -fr htdocs/includes/phpexcel/license.txt + rm -f htdocs/includes/tcpdf/LICENSE.TXT + + rm -fr htdocs/includes/jquery/plugins/lightbox + rm -fr htdocs/includes/jquery/plugins/jstree + rm -fr htdocs/includes/phpexcel/PHPExcel/Shared/PDF + rm -fr htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip + rm -fr htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-2.33 + rm -fr htdocs/includes/tcpdf/fonts/freefont-20100919 + rm -fr htdocs/includes/tcpdf/fonts/utils + + rm -fr build/aps + rm -fr build/dmg + rm -fr build/doap + rm -fr build/exe + rm -fr build/launchpad + rm -fr build/live + rm -fr build/patch + rm -fr build/perl + rm -fr build/rpm + rm -fr build/zip + rm -fr htdocs/includes/ckeditor + rm -fr htdocs/includes/fonts + rm -fr htdocs/includes/geoip + rm -fr htdocs/includes/nusoap + rm -fr htdocs/includes/odtphp/zip/pclzip + dh $@ binary-arch: diff --git a/build/launchpad/README b/build/launchpad/README index b4428216dd5..1fdb6cddb32 100644 --- a/build/launchpad/README +++ b/build/launchpad/README @@ -12,7 +12,7 @@ a package onto LaunchPad # To install all packagers tools: # apt-get install bzr-builder bzr pbuilder -To submit a package on LaunchPad: +# Init local working env - Create account on launchpad.org - Create Project - Link project to official SCM server @@ -20,7 +20,13 @@ To submit a package on LaunchPad: - Run from command line: bzr launchpad-login yourlogin bzr whoami "Your Name " -- Create a Bazzar directory +- Create a file /.pbuilderrc with content + COMPONENTS="main universe multiverse restricted" +- Create chroot ubuntu env + sudo pbuilder create + +# Init package tools for launchpad +- Create a Bazaar directory mkdir bzr - Create debian directory and upload it onto bzr branch ~yourlogin/dolibarr/debian cd bzr @@ -29,7 +35,7 @@ To submit a package on LaunchPad: bzr init cp -pr dolibarr_root/debian bzr/debian bzr add debian - bzr commit + bzr commit -m "Init" bzr push lp:~eldy/dolibarr/debian or download it from launchpad bazaar: cd bzr @@ -44,10 +50,6 @@ To submit a package on LaunchPad: cd bzr bzr dailydeb dolibarr.recipe working-dir This will create a directory "working-dir" with dolibarr sources and will add sources from ~eldy/dolibarr/debian -- Create a file /.pbuilderrc with content - $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build -- Create chroot ubuntu env - sudo pbuilder create - Test package sources sudo pbuilder build /_.dsc diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 64bfbc60b9c..21a0f53096c 100644 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -280,7 +280,6 @@ if ($nboftargetok) { $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php.old`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php.postgres`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf*sav*`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/install.lock`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/mssql/README`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/mysql/README`; @@ -322,7 +321,6 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`; $ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`; $ret=`rm -f $BUILDROOT/$PROJECT/.gitignore $BUILDROOT/$PROJECT/*/.gitignore $BUILDROOT/$PROJECT/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.gitignore`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/fckeditor`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/geoip/sample*.*`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/flot/LICENSE.txt`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/lightbox`; @@ -335,8 +333,6 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-20100919`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/utils`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/LICENSE.TXT`; - # Removed because not stable yet - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/theme/bureau2crea`; } # Build package for each target @@ -560,23 +556,6 @@ if ($nboftargetok) { $cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$PROJECT.tmp\""; $ret=`$cmd`; -# print "Fix filefunc.inc.php, install/inc.php, support/inc.php\n"; -# $cmd="cat \"$BUILDROOT/$PROJECT/htdocs/filefunc.inc.php\" | -# sed -e 's/conffile = \"\\\.\\\.\\\/conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | -# sed -e 's/conffile = \"conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | -# sed -e 's/conffiletoshow = \"htdocs\\\/conf\\\/conf.php\"/conffiletoshow = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' > \"$BUILDROOT/$PROJECT.tmp/htdocs/filefunc.inc.php\""; -# $ret=`$cmd`; -# $cmd="cat \"$BUILDROOT/$PROJECT/htdocs/install/inc.php\" | -# sed -e 's/conffile = \"\\\.\\\.\\\/conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | -# sed -e 's/conffile = \"conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | -# sed -e 's/conffiletoshow = \"htdocs\\\/conf\\\/conf.php\"/conffiletoshow = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' > \"$BUILDROOT/$PROJECT.tmp/htdocs/install/inc.php\""; -# $ret=`$cmd`; -# $cmd="cat \"$BUILDROOT/$PROJECT/htdocs/support/inc.php\" | -# sed -e 's/conffile = \"\\\.\\\.\\\/conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | -# sed -e 's/conffile = \"conf\\\/conf.php\"/conffile = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' | -# sed -e 's/conffiletoshow = \"htdocs\\\/conf\\\/conf.php\"/conffiletoshow = \"\\\/etc\\\/dolibarr\\\/conf.php\"/g' > \"$BUILDROOT/$PROJECT.tmp/htdocs/support/inc.php\""; -# $ret=`$cmd`; - print "Remove other files\n"; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/README-FR`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README`; @@ -613,54 +592,13 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/perl`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/rpm`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/zip`; - # We remove embedded libraries or fonts + # We remove embedded libraries or fonts (this is also inside rules file, target clean) $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/fonts`, $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/geoip`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/nusoap`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/odtphp/zip/pclzip`; - # Prepare binary package (init DEBIAN dir) - #print "Create directory $BUILDROOT/$PROJECT.tmp/DEBIAN\n"; - #$ret=`mkdir "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - #print "Copy $SOURCE/build/debian/xxx to $BUILDROOT/$PROJECT.tmp/DEBIAN\n"; - #$ret=`cp -f "$SOURCE/build/debian/config" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - #$ret=`cp -f "$SOURCE/build/debian/postinst" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - #$ret=`cp -f "$SOURCE/build/debian/postrm" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - #$ret=`cp -f "$SOURCE/build/debian/templates" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - #$ret=`cp -fr "$SOURCE/build/debian/po" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - - # changelog (to build binary package directly without sources. Useless if we build from sources) - #$ret=`gzip -9 -c "$SOURCE/build/debian/changelog" > $BUILDROOT/$PROJECT.tmp/usr/share/doc/$PROJECT/changelog.gz`; - - #print "Edit version in file $BUILDROOT/$PROJECT.tmp/DEBIAN/control\n"; - #open (SPECFROM,"<$SOURCE/build/debian/control.debianbin") || die "Error"; - #open (SPECTO,">$BUILDROOT/$PROJECT.tmp/DEBIAN/control") || die "Error"; - #while () { - # $_ =~ s/__VERSION__/$MAJOR.$MINOR.$newbuild/; - # print SPECTO $_; - #} - #close SPECFROM; - #close SPECTO; - #print "Version set to $MAJOR.$MINOR.$newbuild\n"; - - #$cmd="find $BUILDROOT/$PROJECT.tmp/DEBIAN -type f -exec chmod 755 {} \\; "; - #$ret=`$cmd`; - #$ret=`chmod 644 $BUILDROOT/$PROJECT.tmp/DEBIAN/control`; - #$ret=`chmod 644 $BUILDROOT/$PROJECT.tmp/DEBIAN/templates`; - - # Creation of binary package (to build without sources) - # Enable this to build a binary package without building sources first - #print "Go into directory $BUILDROOT\n"; - #chdir("$BUILDROOT"); - #$cmd="dpkg -b $BUILDROOT/$PROJECT.tmp $BUILDROOT/${FILENAMEDEB}_all.deb"; - #print "Launch DEB build ($cmd)\n"; - #$ret=`$cmd`; - #print $ret."\n"; - #$ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - #$ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/doc"`; - #exit; - # Prepare source package (init debian dir) print "Create directory $BUILDROOT/$PROJECT.tmp/debian\n"; $ret=`mkdir "$BUILDROOT/$PROJECT.tmp/debian"`; @@ -685,7 +623,6 @@ if ($nboftargetok) { $ret=`cp -f "$SOURCE/build/debian/postrm" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/templates" "$BUILDROOT/$PROJECT.tmp/debian"`; - # Set owners and permissions print "Set owners on files/dir\n"; $ret=`chown -R root.root $BUILDROOT/$PROJECT.tmp`; From 2a90f177176bbca80bff273633a4001cfe6ef1e0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Jan 2012 01:31:00 +0100 Subject: [PATCH 09/21] Update doc --- README.md | 8 +++++--- build/launchpad/README | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 649067e4b67..d61e62fb701 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,8 @@ Url depends on choice made on first step: http://localhost/dolibarr/htdocs/install/ or - + http://localhost/dolibarr/install/ +or http://yourdolibarrvirtualhost/install/ - Follow instructions provided by installer... @@ -44,8 +45,9 @@ This URL should looks like: http://localhost/dolibarr/htdocs/install/ or - - http://yourdolibarrhost/install/index.php + http://localhost/dolibarr/install/ +or + http://yourdolibarrhost/install/ Then choose the "update" option according to your case. Note: Migrate process can be ran safely several times. diff --git a/build/launchpad/README b/build/launchpad/README index 50c7ff4bc5e..68794bf0b1a 100644 --- a/build/launchpad/README +++ b/build/launchpad/README @@ -10,7 +10,7 @@ a package onto LaunchPad # This is standard command to work on RPM packaging: # # To install all packagers tools: -# apt-get install bzr-builder bzr pbuilder +# sudo apt-get install bzr-builder bzr dpatch pbuilder debootstrap devscripts # Init local working env - Create account on launchpad.org @@ -23,7 +23,7 @@ a package onto LaunchPad - Create a file /.pbuilderrc with content COMPONENTS="main universe multiverse restricted" - Create chroot ubuntu env - sudo pbuilder create + sudo pbuilder create [--distribution sid|squeeze] # Init package tools for launchpad - Create a Bazaar directory From 52b522e087fe7e38a1791434ad71e4bc6d5092c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Jan 2012 10:22:50 +0100 Subject: [PATCH 10/21] Qual: Uniformize code --- htdocs/adherents/card_subscriptions.php | 4 +- htdocs/adherents/cartes/carte.php | 6 +- htdocs/adherents/class/adherent.class.php | 42 ++--- htdocs/adherents/cotisations.php | 6 +- htdocs/adherents/document.php | 4 +- htdocs/adherents/fiche.php | 30 ++-- htdocs/adherents/index.php | 10 +- htdocs/adherents/ldap.php | 4 +- htdocs/adherents/liste.php | 6 +- htdocs/adherents/note.php | 4 +- htdocs/adherents/type.php | 10 +- htdocs/asterisk/cidlookup.php | 8 +- htdocs/bookmarks/fiche.php | 1 - htdocs/bookmarks/liste.php | 2 +- .../client/class/boutiqueclient.class.php | 6 +- htdocs/boutique/client/fiche.php | 7 +- htdocs/boutique/notification/fiche.php | 152 ------------------ htdocs/societe/class/societe.class.php | 6 +- htdocs/user/class/usergroup.class.php | 7 +- .../company/export-contacts-xls-example.php | 14 +- scripts/emailings/mailing-send.php | 8 +- ...ail_unpaid_invoices_to_representatives.php | 4 +- .../members/sync_members_ldap2dolibarr.php | 18 ++- scripts/user/sync_groups_dolibarr2ldap.php | 2 +- 24 files changed, 106 insertions(+), 255 deletions(-) delete mode 100644 htdocs/boutique/notification/fiche.php diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 7354912147e..7f4f00f8234 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -156,7 +156,7 @@ if ($action == 'setsocid') $thirdparty=new Societe($db); $thirdparty->fetch(GETPOST("socid")); $error++; - $mesg='
'.$langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty",$othermember->getFullName($langs),$othermember->login,$thirdparty->nom).'
'; + $mesg='
'.$langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty",$othermember->getFullName($langs),$othermember->login,$thirdparty->name).'
'; } } @@ -949,7 +949,7 @@ if ($rowid) print ''.$langs->trans('CheckTransmitter'); print ' ('.$langs->trans("ChequeMaker").')'; print ''; - print ''; + print ''; print ''.$langs->trans('Bank'); print ' ('.$langs->trans("ChequeBank").')'; diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index 8b0a051e0b0..e0b8fca05e7 100755 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -57,7 +57,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg $arrayofmembers=array(); // requete en prenant que les adherents a jour de cotisation - $sql = "SELECT d.rowid, d.prenom, d.nom, d.login, d.societe, d.datefin,"; + $sql = "SELECT d.rowid, d.prenom as firstname, d.nom as lastname, d.login, d.societe, d.datefin,"; $sql.= " d.adresse, d.cp, d.ville, d.naiss, d.email, d.photo,"; $sql.= " t.libelle as type,"; $sql.= " p.libelle as pays"; @@ -81,8 +81,8 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg // List of values to scan for a replacement $substitutionarray = array ( - '%PRENOM%'=>$objp->prenom, - '%NOM%'=>$objp->nom, + '%PRENOM%'=>$objp->firstname, + '%NOM%'=>$objp->lastname, '%LOGIN%'=>$objp->login, '%SERVEUR%'=>"http://".$_SERVER["SERVER_NAME"]."/", '%SOCIETE%'=>$objp->societe, diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 924c08dee25..e3ef158e436 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -509,8 +509,10 @@ class Adherent extends CommonObject if ($result >= 0) { $luser->civilite_id=$this->civilite_id; - $luser->prenom=$this->prenom; - $luser->nom=$this->nom; + $luser->firstname=$this->firstname; + $luser->lastname=$this->lastname; + $luser->prenom=$this->firstname; // deprecated + $luser->nom=$this->lastname; // deprecated $luser->login=$this->user_login; $luser->pass=$this->pass; $luser->societe_id=$this->societe; @@ -1000,19 +1002,19 @@ class Adherent extends CommonObject $this->ref = $obj->rowid; $this->id = $obj->rowid; $this->civilite_id = $obj->civilite; - $this->prenom = $obj->firstname; + $this->prenom = $obj->firstname; // deprecated $this->firstname = $obj->firstname; - $this->nom = $obj->lastname; + $this->nom = $obj->lastname; // deprecated $this->lastname = $obj->lastname; $this->login = $obj->login; $this->pass = $obj->pass; $this->societe = $obj->societe; $this->fk_soc = $obj->fk_soc; - $this->adresse = $obj->address; // TODO deprecated + $this->adresse = $obj->address; // deprecated $this->address = $obj->address; - $this->cp = $obj->zip; // TODO deprecated + $this->cp = $obj->zip; // deprecated $this->zip = $obj->zip; - $this->ville = $obj->town; // TODO deprecated + $this->ville = $obj->town; // deprecated $this->town = $obj->town; $this->state_id = $obj->fk_departement; @@ -1427,7 +1429,7 @@ class Adherent extends CommonObject { $mdpass=dol_hash($this->pass); $htpass=crypt($this->pass,makesalt()); - $query = "INSERT INTO spip_auteurs (nom, email, login, pass, htpass, alea_futur, statut) VALUES(\"".$this->prenom." ".$this->nom."\",\"".$this->email."\",\"".$this->login."\",\"$mdpass\",\"$htpass\",FLOOR(32000*RAND()),\"1comite\")"; + $query = "INSERT INTO spip_auteurs (nom, email, login, pass, htpass, alea_futur, statut) VALUES(\"".$this->firstname." ".$this->lastname."\",\"".$this->email."\",\"".$this->login."\",\"$mdpass\",\"$htpass\",FLOOR(32000*RAND()),\"1comite\")"; $mydb=getDoliDBInstance('mysql',ADHERENT_SPIP_SERVEUR,ADHERENT_SPIP_USER,ADHERENT_SPIP_PASS,ADHERENT_SPIP_DB,ADHERENT_SPIP_PORT); @@ -1683,12 +1685,16 @@ class Adherent extends CommonObject * @param Translate $langs Language object for translation of civility * @param int $option 0=No option, 1=Add civility * @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname + * @param int $maxlen Maximum length * @return string String with full name */ - function getFullName($langs,$option=0,$nameorder=-1) + function getFullName($langs,$option=0,$nameorder=-1,$maxlen=0) { global $conf; + if (empty($this->lastname)) $this->lastname=($this->name?$this->name:$this->nom); + if (empty($this->firstname)) $this->firstname=($this->firstname?$this->firstname:$this->prenom); + $ret=''; if ($option && $this->civilite_id) { @@ -1701,17 +1707,17 @@ class Adherent extends CommonObject if ($nameorder) { - if ($this->prenom) $ret.=$this->prenom; - if ($this->prenom && $this->nom) $ret.=' '; - if ($this->nom) $ret.=$this->nom; + $ret.=$this->firstname; + if ($this->firstname && $this->lastname) $ret.=' '; + $ret.=$this->lastname; } else { - if ($this->nom) $ret.=$this->nom; - if ($this->prenom && $this->nom) $ret.=' '; - if ($this->prenom) $ret.=$this->prenom; + $ret.=$this->lastname; + if ($this->firstname && $this->lastname) $ret.=' '; + $ret.=$this->firstname; } - return trim($ret); + return dol_trunc($ret,$maxlen); } @@ -1983,8 +1989,8 @@ class Adherent extends CommonObject $this->id=0; $this->specimen=1; $this->civilite_id = 0; - $this->nom = 'DOLIBARR'; - $this->prenom = 'SPECIMEN'; + $this->lastname = 'DOLIBARR'; + $this->firstname = 'SPECIMEN'; $this->login='dolibspec'; $this->pass='dolibspec'; $this->societe = 'Societe ABC'; diff --git a/htdocs/adherents/cotisations.php b/htdocs/adherents/cotisations.php index d7ddc80c463..ee05be2e5ba 100644 --- a/htdocs/adherents/cotisations.php +++ b/htdocs/adherents/cotisations.php @@ -64,7 +64,7 @@ llxHeader('',$langs->trans("ListOfSubscriptions"),'EN:Module_Foundations|FR:Modu if ($msg) print $msg.'
'; // Liste des cotisations -$sql = "SELECT d.rowid, d.login, d.prenom, d.nom, d.societe,"; +$sql = "SELECT d.rowid, d.login, d.prenom as firstname, d.nom as lastname, d.societe,"; $sql.= " c.rowid as crowid, c.cotisation,"; $sql.= " c.dateadh,"; $sql.= " c.datef,"; @@ -123,7 +123,9 @@ if ($result) $cotisation->ref=$objp->crowid; $cotisation->id=$objp->crowid; - $adherent->ref=trim($objp->prenom.' '.$objp->nom); + $adherent->lastname=$objp->lastname; + $adherent->firstname=$objp->firstname; + $adherent->ref=$adherent->getFullName($langs); $adherent->id=$objp->rowid; $adherent->login=$objp->login; diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index b71ba3dd48b..2e83fa53e25 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -172,11 +172,11 @@ if ($id > 0) print ''; // Nom - print ''.$langs->trans("Lastname").''.$member->nom.' '; + print ''.$langs->trans("Lastname").''.$member->lastname.' '; print ''; // Prenom - print ''.$langs->trans("Firstname").''.$member->prenom.' '; + print ''.$langs->trans("Firstname").''.$member->firstname.' '; print ''; // Status diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index eeb716938ca..950967b4eb4 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -137,7 +137,7 @@ if ($_POST['action'] == 'setsocid') $thirdparty=new Societe($db); $thirdparty->fetch($_POST["socid"]); $error++; - $errmsg='
'.$langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty",$othermember->getFullName($langs),$othermember->login,$thirdparty->nom).'
'; + $errmsg='
'.$langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty",$othermember->getFullName($langs),$othermember->login,$thirdparty->name).'
'; } } @@ -223,8 +223,10 @@ if ($_REQUEST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->adhe // Change values $object->civilite_id = trim($_POST["civilite_id"]); - $object->prenom = trim($_POST["prenom"]); - $object->nom = trim($_POST["nom"]); + $object->prenom = trim($_POST["prenom"]); // deprecated + $object->nom = trim($_POST["nom"]); // deprecated + $object->firstname = trim($_POST["prenom"]); + $object->lastname = trim($_POST["nom"]); $object->login = trim($_POST["login"]); $object->pass = trim($_POST["pass"]); @@ -380,8 +382,10 @@ if ($_POST["action"] == 'add' && $user->rights->adherent->creer) $socid=$_POST["socid"]; $object->civilite_id = $civilite_id; - $object->prenom = $prenom; - $object->nom = $nom; + $object->prenom = $prenom; // deprecated + $object->nom = $nom; // deprecated + $object->firstname = $prenom; + $object->lastname = $nom; $object->societe = $societe; $object->adresse = $address; // deprecated $object->address = $address; @@ -692,11 +696,11 @@ if ($action == 'create') print ''; // Lastname - print ''.$langs->trans("Lastname").'nom).'" size="40">'; + print ''.$langs->trans("Lastname").'lastname).'" size="40">'; print ''; // Firstname - print ''.$langs->trans("Firstname").'prenom).'">'; + print ''.$langs->trans("Firstname").'firstname).'">'; print ''; // Password @@ -923,11 +927,11 @@ if ($action == 'edit') print ''; // Name - print ''.$langs->trans("Lastname").'nom).'">'; + print ''.$langs->trans("Lastname").'lastname).'">'; print ''; // Firstname - print ''.$langs->trans("Firstname").'prenom).'">'; + print ''.$langs->trans("Firstname").'firstname).'">'; print ''; // Password @@ -1074,9 +1078,9 @@ if ($rowid && $action != 'edit') { // Full firstname and name separated with a dot : firstname.name include_once(DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'); - $login=dol_buildlogin($object->nom,$object->prenom); + $login=dol_buildlogin($object->lastname,$object->firstname); } - if (empty($login)) $login=strtolower(substr($object->prenom, 0, 4)) . strtolower(substr($object->nom, 0, 4)); + if (empty($login)) $login=strtolower(substr($object->firstname, 0, 4)) . strtolower(substr($object->lastname, 0, 4)); // Create a form array $formquestion=array( @@ -1246,11 +1250,11 @@ if ($rowid && $action != 'edit') print ''; // Name - print ''.$langs->trans("Lastname").''.$object->nom.' '; + print ''.$langs->trans("Lastname").''.$object->lastname.' '; print ''; // Firstname - print ''.$langs->trans("Firstname").''.$object->prenom.' '; + print ''.$langs->trans("Firstname").''.$object->firstname.' '; // Password if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 1f04032179a..dc3d8f3c689 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -203,7 +203,7 @@ $var=true; */ $max=5; -$sql = "SELECT a.rowid, a.statut, a.nom, a.prenom,"; +$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname,"; $sql.= " a.tms as datem, datefin as date_end_subscription,"; $sql.= " ta.rowid as typeid, ta.libelle, ta.cotisation"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta"; @@ -229,8 +229,8 @@ if ($resql) $obj = $db->fetch_object($resql); print ""; $staticmember->id=$obj->rowid; - $staticmember->nom=$obj->nom; - $staticmember->prenom=$obj->prenom; + $staticmember->lastname=$obj->lastname; + $staticmember->firstname=$obj->firstname; $staticmember->ref=$staticmember->getFullName($langs); $statictype->id=$obj->typeid; $statictype->libelle=$obj->libelle; @@ -283,8 +283,8 @@ if ($resql) $subscriptionstatic->id=$obj->cid; $subscriptionstatic->ref=$obj->cid; $staticmember->id=$obj->rowid; - $staticmember->nom=$obj->nom; - $staticmember->prenom=$obj->prenom; + $staticmember->lastname=$obj->lastname; + $staticmember->firstname=$obj->firstname; $staticmember->ref=$staticmember->getFullName($langs); print ''.$subscriptionstatic->getNomUrl(1).''; print ''.$staticmember->getNomUrl(1,24,'subscription').''; diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index 39a00c6444e..5e3456c2cfd 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -109,11 +109,11 @@ print $form->showrefnav($adh,'id'); print ''; // Nom -print ''.$langs->trans("Lastname").''.$adh->nom.' '; +print ''.$langs->trans("Lastname").''.$adh->lastname.' '; print ''; // Prenom -print ''.$langs->trans("Firstname").''.$adh->prenom.' '; +print ''.$langs->trans("Firstname").''.$adh->firstname.' '; print ''; // Login diff --git a/htdocs/adherents/liste.php b/htdocs/adherents/liste.php index 625ab0355b3..a88056930b7 100644 --- a/htdocs/adherents/liste.php +++ b/htdocs/adherents/liste.php @@ -79,7 +79,7 @@ llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adhé $now=dol_now(); -$sql = "SELECT d.rowid, d.login, d.prenom, d.nom, d.societe, "; +$sql = "SELECT d.rowid, d.login, d.prenom as firstname, d.nom as name, d.societe, "; $sql.= " d.datefin,"; $sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,"; $sql.= " t.libelle as type, t.cotisation"; @@ -258,8 +258,8 @@ if ($resql) // Nom $var=!$var; print ""; - $memberstatic->nom=$objp->nom; - $memberstatic->prenom=$objp->prenom; + $memberstatic->lastname=$objp->lastname; + $memberstatic->firstname=$objp->firstname; if ($objp->societe != '') { print "rowid\">".img_object($langs->trans("ShowMember"),"user").' '.dol_trunc($memberstatic->getFullName($langs))." / ".dol_trunc($objp->societe,12)."\n"; diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index a5a285da341..7c36b2414aa 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -120,11 +120,11 @@ if ($id) print ''; // Lastname - print ''.$langs->trans("Lastname").''.$adh->nom.' '; + print ''.$langs->trans("Lastname").''.$adh->lastname.' '; print ''; // Firstname - print ''.$langs->trans("Firstname").''.$adh->prenom.' '; + print ''.$langs->trans("Firstname").''.$adh->firstname.' '; // Status print ''.$langs->trans("Status").''.$adh->getLibStatut(4).''; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 470793fe1e5..ea15f11b1ed 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -338,7 +338,7 @@ if ($rowid > 0) $membertypestatic=new AdherentType($db); - $sql = "SELECT d.rowid, d.login, d.prenom, d.nom, d.societe, "; + $sql = "SELECT d.rowid, d.login, d.prenom as firstname, d.nom as lastname, d.societe, "; $sql.= " d.datefin,"; $sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,"; $sql.= " t.libelle as type, t.cotisation"; @@ -486,17 +486,19 @@ if ($rowid > 0) $datefin=$db->jdate($objp->datefin); $adh=new Adherent($db); + $adh->lastname=$objp->lastname; + $adh->firstname=$objp->firstname; // Nom $var=!$var; print ''; if ($objp->societe != '') { - print ''.img_object($langs->trans("ShowMember"),"user").' '.$objp->prenom.' '.dol_trunc($objp->nom,12).' / '.dol_trunc($objp->societe,12).''."\n"; + print ''.img_object($langs->trans("ShowMember"),"user").' '.$adh->getFullName($langs,0,-1,20).' / '.dol_trunc($objp->societe,12).''."\n"; } else { - print ''.img_object($langs->trans("ShowMember"),"user").' '.$objp->prenom.' '.dol_trunc($objp->nom).''."\n"; + print ''.img_object($langs->trans("ShowMember"),"user").' '.$adh->getFullName($langs,0,-1,32).''."\n"; } // Login @@ -627,7 +629,7 @@ if ($rowid > 0) print ""; print ''; - + print '
   '; print '
'; diff --git a/htdocs/asterisk/cidlookup.php b/htdocs/asterisk/cidlookup.php index bbd5883f283..4c30cb89eef 100644 --- a/htdocs/asterisk/cidlookup.php +++ b/htdocs/asterisk/cidlookup.php @@ -40,7 +40,7 @@ if (empty($phone)) exit; } -$sql = "SELECT nom FROM ".MAIN_DB_PREFIX."societe as s"; +$sql = "SELECT nom as name FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON sp.fk_soc = s.rowid"; $sql.= " WHERE s.entity=".$conf->entity; $sql.= " AND (s.tel='".$db->escape($phone)."'"; @@ -53,10 +53,10 @@ dol_syslog('cidlookup search information with phone '.$phone, LOG_DEBUG); $resql = $db->query($sql); if ($resql) { - $row = $db->fetch_object($resql); - if ($row) + $obj = $db->fetch_object($resql); + if ($obj) { - $found = $row->nom; + $found = $obj->name; } $db->free($resql); } diff --git a/htdocs/bookmarks/fiche.php b/htdocs/bookmarks/fiche.php index 1e9a3cd23bc..67bd962e747 100644 --- a/htdocs/bookmarks/fiche.php +++ b/htdocs/bookmarks/fiche.php @@ -230,7 +230,6 @@ if ($_GET["id"] > 0 && ! preg_match('/^add/i',$_GET["action"])) { $fuser=new User($db); $fuser->fetch($bookmark->fk_user); - //$fuser->nom=$fuser->login; $fuser->prenom=''; print $fuser->getNomUrl(1); } else diff --git a/htdocs/bookmarks/liste.php b/htdocs/bookmarks/liste.php index a9664d8dc86..10bbd015cf6 100644 --- a/htdocs/bookmarks/liste.php +++ b/htdocs/bookmarks/liste.php @@ -127,7 +127,7 @@ if ($resql) require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); $societe=new Societe($db); $societe->fetch($obj->rowid); - $obj->title=$societe->nom; + $obj->title=$societe->name; } $title=img_object($langs->trans("ShowCompany"),"company").' '.$obj->title; } diff --git a/htdocs/boutique/client/class/boutiqueclient.class.php b/htdocs/boutique/client/class/boutiqueclient.class.php index 837afb5497c..a84b81ed6a7 100644 --- a/htdocs/boutique/client/class/boutiqueclient.class.php +++ b/htdocs/boutique/client/class/boutiqueclient.class.php @@ -37,11 +37,11 @@ class BoutiqueClient /** * Constructor * - * @param DoliDB $DB Database handler + * @param DoliDB $db Database handler */ - function BoutiqueClient($DB) + function BoutiqueClient($db) { - $this->db = $DB; + $this->db = $db; } /** diff --git a/htdocs/boutique/client/fiche.php b/htdocs/boutique/client/fiche.php index 85e2c8f99b4..bd6428684e4 100644 --- a/htdocs/boutique/client/fiche.php +++ b/htdocs/boutique/client/fiche.php @@ -33,12 +33,7 @@ include_once(DOL_DOCUMENT_ROOT.'/boutique/client/class/boutiqueclient.class.php' * Actions */ -if ($action == 'update' && !$cancel) -{ - $client = new BoutiqueClient($dbosc); - $client->nom = $nom; - $client->update($id, $user); -} +// None diff --git a/htdocs/boutique/notification/fiche.php b/htdocs/boutique/notification/fiche.php deleted file mode 100644 index a1071d71ddb..00000000000 --- a/htdocs/boutique/notification/fiche.php +++ /dev/null @@ -1,152 +0,0 @@ - - * Copyright (C) 2004-2006 Laurent Destailleur - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/boutique/notification/fiche.php - * \ingroup boutique - * \brief Page fiche notification OS Commerce - */ - -require("../../main.inc.php"); -require_once(DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php'); - - -/* - * View - */ - -llxHeader(); - -if ($action == 'add') { - $editeur = new Editeur($dbosc); - - $editeur->nom = $nom; - - $id = $editeur->create($user); -} - -if ($action == 'addga') { - $editeur = new Editeur($dbosc); - - $editeur->linkga($id, $ga); -} - - -if ($action == 'update' && !$cancel) { - $editeur = new Editeur($dbosc); - - $editeur->nom = $nom; - - $editeur->update($id, $user); -} - -/* - * - * - */ -if ($action == 'create') -{ - - print "
\n"; - print ''; - print ''; - - print '
Nouvel Editeur

'; - - print ''; - print ""; - print ''; - print ''; - print '
Nom
 
'; - print '
'; - - -} -else -{ - if ($id) - { - - $editeur = new Editeur($dbosc); - $result = $editeur->fetch($id); - - if ( $result ) - { - if ($action == 'edit') - { - print '
Edition de la fiche Editeur : '.$editeur->titre.'

'; - - print "
\n"; - print ''; - print ''; - - print ''; - print ""; - print ''; - - - print ''; - - print ''; - - print '
Nom
 

'; - - } - - print '
Fiche Editeur : '.$editeur->titre.'

'; - - print ''; - print ""; - print ''; - print "
Nom'.$editeur->nom.'
"; - - - - } - else - { - print "Fetch failed"; - } - - - } - else - { - print "Error"; - } -} - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - - -print '
'; -if ($action != 'create') -{ - print ''.$langs->trans("Modify").''; -} -print '
'; - - -$dbosc->close(); - -llxFooter(); -?> diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 95916e06388..c3512c1b7d1 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -678,7 +678,7 @@ class Societe extends CommonObject $this->ref = $obj->rowid; $this->name = $obj->name; - $this->nom = $obj->name; // TODO obsolete + $this->nom = $obj->name; // deprecated $this->ref_ext = $obj->ref_ext; $this->ref_int = $obj->ref_int; @@ -1333,6 +1333,8 @@ class Societe extends CommonObject { global $conf,$langs; + $name=$this->name?$this->name:$this->nom; + $result=''; $lien=$lienfin=''; @@ -1365,8 +1367,6 @@ class Societe extends CommonObject $lien.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'">'; $lienfin=''; - $name=$this->name?$this->name:$this->nom; - if ($withpicto) $result.=($lien.img_object($langs->trans("ShowCompany").': '.$name,'company').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; $result.=$lien.($maxlen?dol_trunc($name,$maxlen):$name).$lienfin; diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index a1b95bec331..9162dc04e39 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -75,7 +75,7 @@ class UserGroup extends CommonObject $this->id = $id; - $sql = "SELECT g.rowid, g.entity, g.nom, g.note, g.datec, g.tms as datem"; + $sql = "SELECT g.rowid, g.entity, g.nom as name, g.note, g.datec, g.tms as datem"; $sql.= " FROM ".MAIN_DB_PREFIX."usergroup as g"; $sql.= " WHERE g.rowid = ".$this->id; @@ -90,7 +90,8 @@ class UserGroup extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->rowid; $this->entity = $obj->entity; - $this->nom = $obj->nom; + $this->nom = $obj->name; // depecated + $this->name = $obj->name; $this->note = $obj->note; $this->datec = $obj->datec; $this->datem = $obj->datem; @@ -106,7 +107,7 @@ class UserGroup extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::Fetch ".$this->error, LOG_ERR); + dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } diff --git a/scripts/company/export-contacts-xls-example.php b/scripts/company/export-contacts-xls-example.php index 613f4b52495..bdef2e43d40 100644 --- a/scripts/company/export-contacts-xls-example.php +++ b/scripts/company/export-contacts-xls-example.php @@ -70,7 +70,7 @@ $objPHPExcel->getActiveSheet()->setTitle('Contacts'); //$page->set_column(0,4,18); // A -$sql = "SELECT distinct c.name, c.firstname, c.email, s.nom"; +$sql = "SELECT distinct c.name as lastname, c.firstname, c.email, s.nom as name"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = c.fk_soc"; @@ -84,27 +84,19 @@ if ($resql) $i = 0; $j = 1; - //$page->write_string(0, 0, $langs->trans("ThirdParty")); $objPHPExcel->getActiveSheet()->SetCellValue('A1', $langs->trans("Firstname")); - //$page->write_string(0, 1, $langs->trans("Firstname")); $objPHPExcel->getActiveSheet()->SetCellValue('B1', $langs->trans("Lastname")); - //$page->write_string(0, 2, $langs->trans("Lastname")); $objPHPExcel->getActiveSheet()->SetCellValue('C1', $langs->trans("Email")); - //$page->write_string(0, 3, $langs->trans("Email")); $objPHPExcel->getActiveSheet()->SetCellValue('D1', $langs->trans("ThirdPart")); while ($i < $num) { $obj = $db->fetch_object($resql); - //$page->write_string($j, 0, $obj->nom); $objPHPExcel->getActiveSheet()->SetCellValue('A'.($i+2), $obj->firstname); - //$page->write_string($j, 1, $obj->firstname); - $objPHPExcel->getActiveSheet()->SetCellValue('B'.($i+2), $obj->name); - //$page->write_string($j, 2, $obj->name); + $objPHPExcel->getActiveSheet()->SetCellValue('B'.($i+2), $obj->lastname); $objPHPExcel->getActiveSheet()->SetCellValue('C'.($i+2), $obj->email); - //$page->write_string($j, 3, $obj->email); - $objPHPExcel->getActiveSheet()->SetCellValue('D'.($i+2), $obj->nom); + $objPHPExcel->getActiveSheet()->SetCellValue('D'.($i+2), $obj->name); $j++; $i++; diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 9a456a73767..aaf966eb3dc 100644 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -93,7 +93,7 @@ $nbok=0; $nbko=0; // On choisit les mails non deja envoyes pour ce mailing (statut=0) // ou envoyes en erreur (statut=-1) -$sql = "SELECT mc.rowid, mc.nom, mc.prenom, mc.email, mc.other, mc.source_url, mc.source_id, mc.source_type"; +$sql = "SELECT mc.rowid, mc.nom as lastname, mc.prenom as firstname, mc.email, mc.other, mc.source_url, mc.source_id, mc.source_type"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".$id; @@ -123,7 +123,7 @@ if ($resql) $obj = $db->fetch_object($resql); // sendto en RFC2822 - $sendto = str_replace(',',' ',$obj->prenom." ".$obj->nom) ." <".$obj->email.">"; + $sendto = str_replace(',',' ',$obj->firstname." ".$obj->lastname) ." <".$obj->email.">"; // Make subtsitutions on topic and body $other=explode(';',$obj->other); @@ -135,8 +135,8 @@ if ($resql) $substitutionarray=array( '__ID__' => $obj->source_id, '__EMAIL__' => $obj->email, - '__LASTNAME__' => $obj->nom, - '__FIRSTNAME__' => $obj->prenom, + '__LASTNAME__' => $obj->lastname, + '__FIRSTNAME__' => $obj->firstname, '__OTHER1__' => $other1, '__OTHER2__' => $other2, '__OTHER3__' => $other3, diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index ea7ad071599..5007e69b5a6 100644 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -47,7 +47,7 @@ require_once (DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php"); $error = 0; -$sql = "SELECT f.facnumber, f.total_ttc, s.nom, u.name, u.firstname, u.email"; +$sql = "SELECT f.facnumber, f.total_ttc, s.nom as name, u.name, u.firstname, u.email"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= " , ".MAIN_DB_PREFIX."societe as s"; $sql .= " , ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -85,7 +85,7 @@ if ($resql) $total = 0; } - $message .= "Facture ".$obj->facnumber." : ".price($obj->total_ttc)." : ".$obj->nom."\n"; + $message .= "Facture ".$obj->facnumber." : ".price($obj->total_ttc)." : ".$obj->name."\n"; $total += $obj->total_ttc; dol_syslog("email_unpaid_invoices_to_representatives.php: ".$obj->email); diff --git a/scripts/members/sync_members_ldap2dolibarr.php b/scripts/members/sync_members_ldap2dolibarr.php index 37a7898527e..b54d3f1a33e 100644 --- a/scripts/members/sync_members_ldap2dolibarr.php +++ b/scripts/members/sync_members_ldap2dolibarr.php @@ -181,23 +181,25 @@ if ($result >= 0) $member = new Adherent($db); // Propriete membre - $member->prenom=$ldapuser[$conf->global->LDAP_FIELD_FIRSTNAME]; - $member->nom=$ldapuser[$conf->global->LDAP_FIELD_NAME]; + $member->prenom=$ldapuser[$conf->global->LDAP_FIELD_FIRSTNAME]; // deprecated + $member->nom=$ldapuser[$conf->global->LDAP_FIELD_NAME]; // deprecated + $member->firstname=$ldapuser[$conf->global->LDAP_FIELD_FIRSTNAME]; + $member->lastname=$ldapuser[$conf->global->LDAP_FIELD_NAME]; $member->login=$ldapuser[$conf->global->LDAP_FIELD_LOGIN]; $member->pass=$ldapuser[$conf->global->LDAP_FIELD_PASSWORD]; //$member->societe; - $member->adresse=$ldapuser[$conf->global->LDAP_FIELD_ADDRESS]; // TODO obsolete + $member->adresse=$ldapuser[$conf->global->LDAP_FIELD_ADDRESS]; // deprecated $member->address=$ldapuser[$conf->global->LDAP_FIELD_ADDRESS]; - $member->cp=$ldapuser[$conf->global->LDAP_FIELD_ZIP]; // TODO obsolete + $member->cp=$ldapuser[$conf->global->LDAP_FIELD_ZIP]; // deprecated $member->zip=$ldapuser[$conf->global->LDAP_FIELD_ZIP]; - $member->ville=$ldapuser[$conf->global->LDAP_FIELD_TOWN]; // TODO obsolete + $member->ville=$ldapuser[$conf->global->LDAP_FIELD_TOWN]; // deprecated $member->town=$ldapuser[$conf->global->LDAP_FIELD_TOWN]; - $member->pays=$ldapuser[$conf->global->LDAP_FIELD_COUNTRY]; // TODO obsolete + $member->pays=$ldapuser[$conf->global->LDAP_FIELD_COUNTRY]; // deprecated $member->country=$ldapuser[$conf->global->LDAP_FIELD_COUNTRY]; - $member->pays_id=$countries[$hashlib2rowid[strtolower($member->country)]]['rowid']; // TODO obsolete + $member->pays_id=$countries[$hashlib2rowid[strtolower($member->country)]]['rowid']; // deprecated $member->country_id=$countries[$hashlib2rowid[strtolower($member->country)]]['rowid']; - $member->pays_code=$countries[$hashlib2rowid[strtolower($member->country)]]['code']; // TODO obsolete + $member->pays_code=$countries[$hashlib2rowid[strtolower($member->country)]]['code']; // deprecated $member->country_code=$countries[$hashlib2rowid[strtolower($member->country)]]['code']; $member->phone=$ldapuser[$conf->global->LDAP_FIELD_PHONE]; diff --git a/scripts/user/sync_groups_dolibarr2ldap.php b/scripts/user/sync_groups_dolibarr2ldap.php index 8eaa5051894..0deafa514e9 100644 --- a/scripts/user/sync_groups_dolibarr2ldap.php +++ b/scripts/user/sync_groups_dolibarr2ldap.php @@ -82,7 +82,7 @@ if ($resql) $fgroup->id = $obj->rowid; $fgroup->fetch($fgroup->id); - print $langs->trans("UpdateGroup")." rowid=".$fgroup->id." ".$fgroup->nom; + print $langs->trans("UpdateGroup")." rowid=".$fgroup->id." ".$fgroup->name; $oldobject=$fgroup; From 8c934d3ddebd03902405409b1ba5942060bdcfa9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Jan 2012 20:08:11 +0100 Subject: [PATCH 11/21] Rename custom code into customs code --- build/launchpad/README | 4 +++ htdocs/langs/el_GR/products.lang | 34 -------------------------- htdocs/langs/en_US/products.lang | 2 +- htdocs/product/class/product.class.php | 4 +-- htdocs/product/fiche.php | 6 ++--- 5 files changed, 10 insertions(+), 40 deletions(-) diff --git a/build/launchpad/README b/build/launchpad/README index 68794bf0b1a..a18e4389aef 100644 --- a/build/launchpad/README +++ b/build/launchpad/README @@ -17,6 +17,7 @@ a package onto LaunchPad - Create Project - Link project to official SCM server - Upload SSH public key onto account +- Upload you GPG sign key - Run from command line: bzr launchpad-login yourlogin bzr whoami "Your Name " @@ -24,6 +25,9 @@ a package onto LaunchPad COMPONENTS="main universe multiverse restricted" - Create chroot ubuntu env sudo pbuilder create [--distribution sid|squeeze] +- Edit file ~/.bashrc ti add +DEBFULLNAME="" +DEBEMAIL="" # Init package tools for launchpad - Create a Bazaar directory diff --git a/htdocs/langs/el_GR/products.lang b/htdocs/langs/el_GR/products.lang index 05fd0b00727..5e679ead1a9 100644 --- a/htdocs/langs/el_GR/products.lang +++ b/htdocs/langs/el_GR/products.lang @@ -73,15 +73,12 @@ ContractStatusClosed=Κλειστό ContractStatusRunning=Ενεργό ContractStatusExpired=Ληγμένο ContractStatusOnHold=Ανενεργό -ContractStatusToRun=A mettre en service ContractNotRunning=Το Συμβόλαιο είναι Ανενεργό ErrorProductAlreadyExists=Ένα προϊόν με κωδικό %s υπάρχει ήδη. -ErrorProductBadRefOrLabel=Wrong value for reference or label. Suppliers=Προμηθευτές SupplierRef=Κωδ. Προμηθευτή ShowProduct=Εμφάνιση προϊόντων ShowService=Εμφάνιση Υπηρεσίας -ProductsAndServicesArea=Product and Services area ProductsArea=Περιοχή Προϊόντων ServicesArea=Περιοχή Υπηρεσιών AddToMyProposals=Προσθήκη στις Προτάσεις μου @@ -95,19 +92,15 @@ NoPhotoYet=Δεν υπάρχει φωτογραφία BuiingPrice=Τιμή Αγοράς SupplierCard=Κάρτα προμηθευτή CommercialCard=Εμπορική Κάρτα -AllWays=Path to find your product in stock NoCat=Το προϊόν σας, δεν ανήκει σε κάποια κατηγορία PrimaryWay=Κύρια διαδρομή DeleteFromCat=Αφαίρεση από την κατηγορία PriceRemoved=Η τιμή αφαιρέθηκε -BarCode=Barcode BarcodeType=τύπος Barcode SetDefaultBarcodeType=Ορισμός τύπου barcode BarcodeValue=ΤΙμή Barcode -GenbarcodeLocation=Bar code generation command line tool (used by phpbarcode engine for some bar code types) NoteNotVisibleOnBill=Σημείωση (μη ορατή σε τιμολόγια, προτάσεις...) CreateCopy=Δημιουργία Αντιγράφου -ServiceLimitedDuration=If product is a service with limited duration: MultiPricesAbility=Ενεργοποίηση πολυ-τιμών MultiPricesNumPrices=Αριθμός τιμής MultiPriceLevelsName=Κατηγορίες τιμών @@ -122,48 +115,21 @@ ProductToAddSearch=Εύρεση προϊόντως προς προσθήκη AddDel=Προσθήκη/Διαγραφή Quantity=Ποσότητα NoMatchFound=Δεν βρέθηκε κατάλληλη εγγραφή -ProductAssociationList=List of related products/services: name of product/service (quantity affected) -ErrorAssociationIsFatherOfThis=One of selected product is parent with current product DeleteProduct=Διαγραφή προϊόντος/υπηρεσίας -ConfirmDeleteProduct=Are you sure you want to delete this product/service? -ProductDeleted=Product/Service "%s" deleted from database. DeletePicture=Διαγραφή εικόνας ConfirmDeletePicture=Είστε σίγουροι ότι θέλετε να διαγράψετε την εικόνα; ExportDataset_produit_1=Προϊόντα ExportDataset_service_1=Υπηρεσίες ImportDataset_produit_1=Προϊόντα ImportDataset_service_1=Υπηρεσίες -DeleteProductLine=Delete product line -ConfirmDeleteProductLine=Are you sure you want to delete this product line? -NoProductMatching=No product/service match your criteria -MatchingProducts=Matching products/services -NoStockForThisProduct=No stock for this product NoStock=Χωρίς απόθεμα -Restock=Restock -ProductSpecial=Special -QtyMin=Quantity minimum -PriceQty=Price for this quantity -PriceQtyMin=Price quantity min. -NoPriceDefinedForThisSupplier=No price/qty defined for this supplier/product -NoSupplierPriceDefinedForThisProduct=No supplier price/qty defined for this product -RecordedProducts=Products recorded -RecordedProductsAndServices=Products/services recorded GenerateThumb=Δημιουργία μικρογραφίας -ProductCanvasAbility=Use special "canvas" addons ServiceNb=Υπηρεσία #%s -ListProductServiceByPopularity=List of products/services by popularity -ListProductByPopularity=List of products by popularity -ListServiceByPopularity=List of services by popularity Finished=Κατασκευασμένο Προϊόν RowMaterial=Πρώτη ύλη CloneProduct=Κλώνοποίηση προϊόντος ή υπηρεσίας -ConfirmCloneProduct=Are you sure you want to clone product or service %s ? -CloneContentProduct=Clone all main informations of product/service -ClonePricesProduct=Clone main informations and prices ProductIsUsed=Μεταχειρισμένο NewRefForClone=Ref. of new product/service CustomerPrices=Τιμές πελατών SuppliersPrices=Τιμές προμηθευτών -CustomCode=Custom code CountryOrigin=Χώρα προέλευσης -HiddenIntoCombo=Hidden into select lists diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index f008150b5d3..0dfb6cb9eac 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -166,6 +166,6 @@ ProductIsUsed=This product is used NewRefForClone=Ref. of new product/service CustomerPrices=Customers prices SuppliersPrices=Suppliers prices -CustomCode=Custom code +CustomCode=Customs code CountryOrigin=Origin country HiddenIntoCombo=Hidden into select lists \ No newline at end of file diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index f072d5c709e..e8e2b9b6935 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -88,7 +88,7 @@ class Product extends CommonObject // Statut indique si le produit est un produit fini '1' ou une matiere premiere '0' var $finished; - var $customcode; // Custom code + var $customcode; // Customs code var $country_id; // Country origin id var $country_code; // Country origin code (US, FR, ...) @@ -479,7 +479,7 @@ class Product extends CommonObject return -2; } } - + if (! $notrigger) { // Appel des triggers diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 690f6c8ea7f..79ec4d6f9ce 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -771,7 +771,7 @@ else print ''; } - // Custom code + // Customs code print ''.$langs->trans("CustomCode").''; // Origin country @@ -961,7 +961,7 @@ else print ''; } - // Custom code + // Customs code print ''.$langs->trans("CustomCode").''; // Origin country @@ -1177,7 +1177,7 @@ else print "\n"; } - // Custom code + // Customs code print ''.$langs->trans("CustomCode").''.$object->customcode.''; // Origin country code From 0331c4b98f2f5487dafef9e950d1e14e80257477 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Jan 2012 22:56:40 +0100 Subject: [PATCH 12/21] Update doc --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index d61e62fb701..b4c26f0574a 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,10 @@ Url depends on choice made on first step: http://localhost/dolibarr/htdocs/install/ or + http://localhost/dolibarr/install/ or + http://yourdolibarrvirtualhost/install/ - Follow instructions provided by installer... @@ -45,8 +47,10 @@ This URL should looks like: http://localhost/dolibarr/htdocs/install/ or + http://localhost/dolibarr/install/ or + http://yourdolibarrhost/install/ Then choose the "update" option according to your case. From 761def3cc0cefae1f6da63d2515bd380425bb8b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Jan 2012 23:57:55 +0100 Subject: [PATCH 13/21] Work on debian package --- build/debian/README.howto | 6 ++-- build/debian/copyright | 32 ++++++++++++++++--- build/debian/{config => dolibarr.config} | 0 build/debian/dolibarr.doc-base | 10 ++++++ build/debian/{install => dolibarr.install} | 3 ++ build/debian/{postinst => dolibarr.postinst} | 0 build/debian/{postrm => dolibarr.postrm} | 0 .../debian/{templates => dolibarr.templates} | 0 ...mplates.futur => dolibarr.templates.futur} | 0 build/debian/po/POTFILES.in | 2 +- build/debian/po/fr.po | 2 -- build/debian/source/format | 2 +- build/makepack-dolibarr.pl | 32 +++++++++---------- 13 files changed, 62 insertions(+), 27 deletions(-) rename build/debian/{config => dolibarr.config} (100%) create mode 100644 build/debian/dolibarr.doc-base rename build/debian/{install => dolibarr.install} (75%) rename build/debian/{postinst => dolibarr.postinst} (100%) rename build/debian/{postrm => dolibarr.postrm} (100%) rename build/debian/{templates => dolibarr.templates} (100%) rename build/debian/{templates.futur => dolibarr.templates.futur} (100%) diff --git a/build/debian/README.howto b/build/debian/README.howto index 197a2d27886..6e0c7a75d06 100644 --- a/build/debian/README.howto +++ b/build/debian/README.howto @@ -17,8 +17,10 @@ with format .DEB (for Debian, Ubuntu, ...). # # gpg --gen-key Generate a GPG key # -# debconf-updatepo To run into po dir to regenate templates.pot -# podebconf-report-po --from eldy@destailleur.fr To send email to ask translations +# debconf-updatepo To run into po dir to regenate templates.pot +# podebconf-report-po --from email@email.com To send email to ask translations +# Edit manually file XX.po and remove all lines "#, fuzzy" when translation is complete +# msgfmt -v -c -o /dev/null XX.po To have status of translation for language XX # # lintian --pedantic -E -I package.deb To test a package # diff --git a/build/debian/copyright b/build/debian/copyright index e63fa08b5db..46f70f5bd00 100644 --- a/build/debian/copyright +++ b/build/debian/copyright @@ -5,24 +5,39 @@ Source: git@github.com:Dolibarr/dolibarr.git Files: * Copyright: 2002-2009, Rodolphe Quiedeville - 2003-2011, Laurent Destailleur - 2004-2011, Regis Houssin - 2006-2011, Auguria SARL - 2010-2011, Juanjo Menent 2003-2006, Jean-Louis Bergamo + 2003-2012, Laurent Destailleur 2003, Xavier Dutoit + 2004-2012, Regis Houssin 2004, Sebastien Di Cintio 2004, Benoit Mortier 2004, Christophe Combelles + 2004, Guillaume Delecourt 2004, Eric Seigne + 2005, Brice Davoleau + 2005, Kai Blankenhorn + 2005-2006, Marc Barilley/Ocebo + 2005, Matthieu Valleton 2005, Patrick Rouillon - 2005, Marc Barilley / Ocebo + 2005, Simon TOSSER 2006, Andre Cianfarani + 2006-2011, Auguria SARL 2006, Jean Heimburger + 2006, Roman Ozana + 2006, Yannick Warnier 2007, Patrick Raguin + 2007, Franky Van Liedekerke 2007-2008, Jeremie Ollivier + 2008, Matteli 2008, Raphael Bertrand (Resultic) + 2010, Francois Legastelois + 2010-2012, Juanjo Menent + 2010-2012, Philippe Grand + 2010, Pierre Morin 2010, Servitux Servicios Informaticos + 2011, Herve Prot + 2011, Remy Younes + 2012, Christophe Battarel License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public @@ -43,6 +58,7 @@ License: GPL-2+ License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. + Files: htdocs/includes/fpdi/* Copyright: FPDFI team License: GPL-2+ @@ -65,6 +81,7 @@ License: GPL-2+ License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. + Files: htdocs/includes/jquery/* Copyright: JQuery team License: MIT or GPL-2+ @@ -105,11 +122,13 @@ License: MIT or GPL-2+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + Files: htdocs/includes/jquery/plugins/flot/* Copyright: Flot team License: Public Domain This work is not subject to copyright in any jurisdiction + Files: htdocs/includes/jsgantt/* Copyright: JSGantt team License: GPL-2+ @@ -132,11 +151,13 @@ License: GPL-2+ License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. + Files: htdocs/includes/phpexcel/* Copyright: PHPExcel team License: LGPL 2.1 See http://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html + Files: htdocs/includes/odtphp/* Copyright: 2008, Julien Pauli 2008, Cyril PIERRE de GEYER @@ -161,6 +182,7 @@ License: GPL-2+ License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. + Files: htdocs/includes/tcpdf/* Copyright: TCPDF team License: LGPL 3.0 diff --git a/build/debian/config b/build/debian/dolibarr.config similarity index 100% rename from build/debian/config rename to build/debian/dolibarr.config diff --git a/build/debian/dolibarr.doc-base b/build/debian/dolibarr.doc-base new file mode 100644 index 00000000000..d7d5666d883 --- /dev/null +++ b/build/debian/dolibarr.doc-base @@ -0,0 +1,10 @@ +Document: dolibarr +Title: Dolibarr ERP & CRM documentation +Author: Dolibarr team +Abstract: This documentation covers the install, use and administration of + Dolibarr ERP & CRM software. +Section: Office + +Format: HTML +Index: /usr/share/doc/dolibarr/index.html +Files: /usr/share/doc/dolibarr/*.html \ No newline at end of file diff --git a/build/debian/install b/build/debian/dolibarr.install similarity index 75% rename from build/debian/install rename to build/debian/dolibarr.install index 911d25cae8a..beae194006d 100755 --- a/build/debian/install +++ b/build/debian/dolibarr.install @@ -2,6 +2,9 @@ debian/dolibarr.desktop usr/share/applications debian/dolibarr.xpm usr/share/pixmaps ChangeLog usr/share/doc/dolibarr README usr/share/doc/dolibarr +doc/install usr/share/doc/dolibarr +doc/user usr/share/doc/dolibarr +doc/index.html usr/share/doc/dolibarr build/debian/apache.conf etc/dolibarr build/debian/lighttpd.conf etc/dolibarr build usr/share/dolibarr diff --git a/build/debian/postinst b/build/debian/dolibarr.postinst similarity index 100% rename from build/debian/postinst rename to build/debian/dolibarr.postinst diff --git a/build/debian/postrm b/build/debian/dolibarr.postrm similarity index 100% rename from build/debian/postrm rename to build/debian/dolibarr.postrm diff --git a/build/debian/templates b/build/debian/dolibarr.templates similarity index 100% rename from build/debian/templates rename to build/debian/dolibarr.templates diff --git a/build/debian/templates.futur b/build/debian/dolibarr.templates.futur similarity index 100% rename from build/debian/templates.futur rename to build/debian/dolibarr.templates.futur diff --git a/build/debian/po/POTFILES.in b/build/debian/po/POTFILES.in index 98e8416d9a3..40130aadd20 100755 --- a/build/debian/po/POTFILES.in +++ b/build/debian/po/POTFILES.in @@ -1 +1 @@ -[type: gettext/rfc822deb] templates \ No newline at end of file +[type: gettext/rfc822deb] dolibarr.templates \ No newline at end of file diff --git a/build/debian/po/fr.po b/build/debian/po/fr.po index 3bbe762283a..a96cd360299 100755 --- a/build/debian/po/fr.po +++ b/build/debian/po/fr.po @@ -45,7 +45,6 @@ msgstr "" #. Type: boolean #. Description #: ../templates:2001 -#, fuzzy msgid "Delete database and uploaded files ?" msgstr "Effacer la base de donnée et les fichiers uploadés ?" @@ -53,7 +52,6 @@ msgstr "Effacer la base de donnée et les fichiers uploadés ?" #. Type: boolean #. Description #: ../templates:2001 -#, fuzzy msgid "" "Answer if you want to removed the Dolibarr MySQL database and all other " "datas (datas related to this question are the Dolibarr DBMS account, all " diff --git a/build/debian/source/format b/build/debian/source/format index 9f8e9b69a33..9f6742789cd 100644 --- a/build/debian/source/format +++ b/build/debian/source/format @@ -1 +1 @@ -1.0 \ No newline at end of file +3.0 (native) \ No newline at end of file diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 21a0f53096c..2d7ec389c59 100644 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -569,20 +569,19 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/debian/source`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/changelog`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/compat`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/config`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/control*`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/copyright`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.config`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.desktop`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.doc-base`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.install`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.lintian-overrides`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/format`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/install`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/menu`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/postrm`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/postinst`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.postrm`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.postinst`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.templates`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.templates.futur`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/rules`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/README.howto`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/templates`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/templates.futur`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/wash`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/doap`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/exe`; @@ -608,20 +607,21 @@ if ($nboftargetok) { $ret=`cp -f "$SOURCE/build/debian/compat" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/control" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/copyright" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/dolibarr.xpm" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/dolibarr.desktop" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.doc-base" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.install" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/dolibarr.lintian-overrides" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/install" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -fr "$SOURCE/build/debian/patches" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -fr "$SOURCE/build/debian/po" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.xpm" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/README.source" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/rules" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -fr "$SOURCE/build/debian/patches" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -fr "$SOURCE/build/debian/po" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -fr "$SOURCE/build/debian/source" "$BUILDROOT/$PROJECT.tmp/debian"`; # Add files also required to build binary package - $ret=`cp -f "$SOURCE/build/debian/config" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/postinst" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/postrm" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/templates" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.config" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.postinst" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.postrm" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.templates" "$BUILDROOT/$PROJECT.tmp/debian"`; # Set owners and permissions print "Set owners on files/dir\n"; From 1e8fd73810ef5a759d8166dce16af6eb67448839 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Jan 2012 23:58:13 +0100 Subject: [PATCH 14/21] Remove non utf char --- htdocs/boutique/notification/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/boutique/notification/index.php b/htdocs/boutique/notification/index.php index 7516bfad6c2..06715f51588 100644 --- a/htdocs/boutique/notification/index.php +++ b/htdocs/boutique/notification/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2003 �ric Seigne + * Copyright (C) 2003 Eric Seigne * Copyright (C) 2004-2006 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify From ed4a0742c87df3511a500b31079fe9da9ff615d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Jan 2012 00:51:52 +0100 Subject: [PATCH 15/21] Add a test to be sure module is on --- htdocs/product/class/product.class.php | 30 ++++++-------------------- test/phpunit/ProductTest.php | 2 ++ 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e8e2b9b6935..eb2644f440a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -526,23 +526,6 @@ class Product extends CommonObject { $this->db->begin(); - // Delete supplier prices log - /*if (! $error) - { - $sql = 'DELETE pfpl'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'product_fournisseur_price_log as pfpl, '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp'; - $sql.= ' WHERE pfpl.fk_product_fournisseur = pfp.rowid'; - $sql.= ' AND pf.fk_product = '.$id; - dol_syslog(get_class($this).'::delete sql='.$sql, LOG_DEBUG); - $result = $this->db->query($sql); - if (! $result) - { - $error++; - $this->error = $this->db->lasterror(); - dol_syslog(get_class($this).'::delete error '.$this->error, LOG_ERR); - } - }*/ - // Delete supplier prices if (! $error) { @@ -639,6 +622,7 @@ class Product extends CommonObject return 0; } } + return 0; } /** @@ -1018,13 +1002,13 @@ class Product extends CommonObject global $langs, $conf; - dol_syslog("Product::fetch id=$id ref=$ref ref_ext=$ref_ext"); + dol_syslog(get_class($this)."::fetch id=".$id." ref=".$ref." ref_ext=".$ref_ext); // Check parameters if (! $id && ! $ref && ! $ref_ext) { $this->error=$langs->trans('ErrorWrongParameters'); - dol_print_error("Product::fetch ".$this->error, LOG_ERR); + dol_print_error(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } @@ -1039,7 +1023,7 @@ class Product extends CommonObject else if ($ref) $sql.= " WHERE ref = '".$this->db->escape($ref)."'"; else if ($ref_ext) $sql.= " WHERE ref_ext = '".$this->db->escape($ref_ext)."'"; - dol_syslog("Product::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch sql=".$sql); $resql = $this->db->query($sql); if ( $resql ) { @@ -2371,7 +2355,7 @@ class Product extends CommonObject /** * Load information about stock of a product into stock_warehouse[] and stock_reel * - * @return int < 0 si erreur, > 0 si ok + * @return int < 0 if KO, > 0 if OK */ function load_stock() { @@ -2381,7 +2365,7 @@ class Product extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."product_stock"; $sql.= " WHERE fk_product = '".$this->id."'"; - dol_syslog("Product::load_stock sql=".$sql); + dol_syslog(get_class($this)."::load_stock sql=".$sql); $result = $this->db->query($sql); if ($result) { @@ -2403,7 +2387,7 @@ class Product extends CommonObject } else { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); return -1; } } diff --git a/test/phpunit/ProductTest.php b/test/phpunit/ProductTest.php index 40c6dc3cc20..7e3f36e6ada 100755 --- a/test/phpunit/ProductTest.php +++ b/test/phpunit/ProductTest.php @@ -77,6 +77,8 @@ class ProductTest extends PHPUnit_Framework_TestCase { global $conf,$user,$langs,$db; + if (empty($conf->produit->enabled)) { print __METHOD__." Module Product must be enabled.\n"; die(); } + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. print __METHOD__."\n"; From 783c9d124fc6febd912f0b118ff1cafc07975b69 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Jan 2012 12:18:43 +0100 Subject: [PATCH 16/21] Minor look enhancement --- htdocs/adherents/card_subscriptions.php | 14 +++++++------- htdocs/core/class/html.formactions.class.php | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 7f4f00f8234..497ec4532d4 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -1,7 +1,7 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2012 Laurent Destailleur * * 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 @@ -894,11 +894,11 @@ if ($rowid) print ' '.$langs->trans("MoreActionBankDirect").'
'; } - if ($conf->banque->enabled && $conf->societe->enabled && $conf->facture->enabled) + if ($conf->societe->enabled && $conf->facture->enabled) { - print 'fk_soc) || empty($bankviainvoice)) print ' disabled="disabled"'; - print '> '.$langs->trans("MoreActionBankViaInvoice"); + print '> '.$langs->trans("MoreActionInvoiceOnly"); if ($adh->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')'; else { @@ -909,11 +909,11 @@ if ($rowid) } print '
'; } - if ($conf->societe->enabled && $conf->facture->enabled) + if ($conf->banque->enabled && $conf->societe->enabled && $conf->facture->enabled) { - print 'fk_soc) || empty($bankviainvoice)) print ' disabled="disabled"'; - print '> '.$langs->trans("MoreActionInvoiceOnly"); + print '> '.$langs->trans("MoreActionBankViaInvoice"); if ($adh->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')'; else { diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 207f29b74e4..efb5fde0093 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -133,7 +133,7 @@ class FormActions print_titre($title); $total = 0; $var=true; - print ''; + print '
'; print ''; print "\n"; From 7d0a41f3cf3aa226584ebda52d65c70883178737 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Jan 2012 20:29:21 +0100 Subject: [PATCH 17/21] New: Trigger now have a priority to define sort execution order. --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index f5140e17a10..8c8b7693823 100644 --- a/ChangeLog +++ b/ChangeLog @@ -54,6 +54,7 @@ For developers: - New: Log module outputs can be setup with "or" rule (not only "xor"). - New: Add FirePHP output for logging module. - New: Add trigger ACTION_DELETE and ACTION_MODIFY. +- New: Trigger now have a priority to define sort execution order. - New: Can define different requests according to database type into migration files. - New: Add "canvas" feature to overwrite page of thirdparty, contact, product with yours. - New: Removed artichow deprecated libraries. From 0011b1daddd597d95c7e191421f16eafa752fbb5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Jan 2012 20:32:26 +0100 Subject: [PATCH 18/21] New: Trigger now have a priority to define sort execution order. --- build/exe/doliwamp/doliwamp.iss | 2 +- build/makepack-dolibarrmodule.conf | 8 +- build/tgz/tar_exclude.txt | 9 - build/zip/zip_exclude.txt | 9 - htdocs/admin/notification.php | 2 +- htdocs/admin/triggers.php | 12 +- htdocs/core/class/interfaces.class.php | 178 +++--- .../interface_all_Demo.class.php-NORUN | 526 --------------- .../interface_all_Logevents.class.php | 255 -------- .../interface_modAgenda_ActionsAuto.class.php | 598 ------------------ .../interface_modLdap_Ldapsynchro.class.php | 536 ---------------- ...ace_modNotification_Notification.class.php | 256 -------- ...terface_modPaypal_PaypalWorkflow.class.php | 138 ---- ...face_modWorkflow_WorkflowManager.class.php | 134 ---- htdocs/install/mysql/tables/llx_events.sql | 2 +- htdocs/societe/notify/fiche.php | 2 +- htdocs/theme/eldy/style.css.php | 8 +- 17 files changed, 113 insertions(+), 2562 deletions(-) delete mode 100644 htdocs/core/triggers/interface_all_Demo.class.php-NORUN delete mode 100644 htdocs/core/triggers/interface_all_Logevents.class.php delete mode 100644 htdocs/core/triggers/interface_modAgenda_ActionsAuto.class.php delete mode 100644 htdocs/core/triggers/interface_modLdap_Ldapsynchro.class.php delete mode 100644 htdocs/core/triggers/interface_modNotification_Notification.class.php delete mode 100644 htdocs/core/triggers/interface_modPaypal_PaypalWorkflow.class.php delete mode 100755 htdocs/core/triggers/interface_modWorkflow_WorkflowManager.class.php diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index 440aed7060a..35db3685573 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -107,7 +107,7 @@ Source: "C:\Program Files\Wamp\bin\mysql\mysql5.0.45\*.*"; DestDir: "{app}\bin\m ; Mysql data files (does not overwrite if exists) Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db" ; Dolibarr -Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,telephonie\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\install.forced.php,*\modBookmark4u.class.php,*\modDocument.class.php,*\modDroitPret.class.php,*\modEditeur.class.php,*\modPostnuke.class.php,*\modTelephonie.class.php,*\interface_modEditeur_Editeur.class.php*,*\bureau2crea,*\rodolphe" +Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,telephonie\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\install.forced.php" Source: "dev\*.*"; DestDir: "{app}\www\dolibarr\dev"; Flags: ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db,dbmodel\*,fpdf\*,initdata\*,iso-normes\*,licence\*,phpcheckstyle\*,phpunit\*,samples\*,test\*,uml\*,xdebug\*" Source: "doc\*.*"; DestDir: "{app}\www\dolibarr\doc"; Flags: ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db,wiki\*,plaquette\*,dev\*,images\dolibarr_screenshot2.png,images\dolibarr_screenshot3.png,images\dolibarr_screenshot4.png,images\dolibarr_screenshot5.png,images\dolibarr_screenshot6.png,images\dolibarr_screenshot7.png,images\dolibarr_screenshot8.png,images\dolibarr_screenshot9.png,images\dolibarr_screenshot10.png,images\dolibarr_screenshot11.png,images\dolibarr_screenshot12.png" Source: "scripts\*.*"; DestDir: "{app}\www\dolibarr\scripts"; Flags: ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db,product\materiel.net.php,product\import-product.php" diff --git a/build/makepack-dolibarrmodule.conf b/build/makepack-dolibarrmodule.conf index 8fddcd07a3b..33cd433ea98 100644 --- a/build/makepack-dolibarrmodule.conf +++ b/build/makepack-dolibarrmodule.conf @@ -3,13 +3,13 @@ # Goal: Goal of module # Version: 1.0 # Author: Copyright 2008 - Author name here -# Licence: Not yet defined +# Licence: GPL # Install: Just unpack content of module package in Dolibarr directory. -# Setup: Go on Dolibarr setup - modules page to enable module. +# Setup: Go on Dolibarr setup - modules to enable module. # # Files in module -htdocs/core/modules/modMyModule.class.php -htdocs/core/triggers/interface_mymodule.class.php +htdocs/mymodule/core/modules/modMyModule.class.php +htdocs/mymodule/core/triggers/interface_mymodule.class.php htdocs/mymodule/page1.php htdocs/mymodule/page2.php htdocs/mymodule/sql/script1.sql diff --git a/build/tgz/tar_exclude.txt b/build/tgz/tar_exclude.txt index af3d3aac3ef..5b7eb73e07a 100644 --- a/build/tgz/tar_exclude.txt +++ b/build/tgz/tar_exclude.txt @@ -31,15 +31,6 @@ htdocs/conf/conf.php.mysql htdocs/conf/conf.php.old htdocs/conf/conf.php.postgres htdocs/avoir -htdocs/core/modules/modBookmark4u.class.php -htdocs/core/modules/modDocument.class.php -htdocs/core/modules/modDroitPret.class.php -htdocs/core/modules/modEditeur.class.php -htdocs/core/modules/modPostnuke.class.php -htdocs/core/modules/modTelephonie.class.php -htdocs/core/triggers/interface_user.class.php -htdocs/core/triggers/interface_contractfrombill.class.php-NORUN -htdocs/core/triggers/interface_modEditeur_Editeur.class.php-NORUN htdocs/custom htdocs/custom2 htdocs/customleave diff --git a/build/zip/zip_exclude.txt b/build/zip/zip_exclude.txt index 512aa41f368..1409e7ee9db 100644 --- a/build/zip/zip_exclude.txt +++ b/build/zip/zip_exclude.txt @@ -27,15 +27,6 @@ */htdocs/conf/conf.php.mysql */htdocs/conf/conf.php.old */htdocs/conf/conf.php.postgres -*/htdocs/core/modules/modBookmark4u.class.php -*/htdocs/core/modules/modClickToDial.class.php -*/htdocs/core/modules/modDocument.class.php -*/htdocs/core/modules/modDomain.class.php -*/htdocs/core/modules/modDroitPret.class.php -*/htdocs/core/modules/modEditeur.class.php -*/htdocs/core/modules/modPostnuke.class.php -*/htdocs/core/triggers/interface_user.class.php -*/htdocs/core/triggers/interface_contractfrombill.class.php-NORUN */htdocs/custom/* */htdocs/custom2/* */htdocs/document/* diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index 9855c45a0dc..bc228be0711 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -24,7 +24,7 @@ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/core/triggers/interface_modNotification_Notification.class.php"); +require_once(DOL_DOCUMENT_ROOT."/core/triggers/interface_50_modNotification_Notification.class.php"); $langs->load("admin"); $langs->load("other"); diff --git a/htdocs/admin/triggers.php b/htdocs/admin/triggers.php index 39f185c4a21..d3860512d1e 100644 --- a/htdocs/admin/triggers.php +++ b/htdocs/admin/triggers.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2012 Laurent Destailleur * * 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 @@ -17,7 +17,7 @@ /** * \file htdocs/admin/triggers.php - * \brief Page de configuration et activation des triggers + * \brief Page to view triggers */ require("../main.inc.php"); @@ -25,13 +25,13 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/interfaces.class.php"); $langs->load("admin"); -if (!$user->admin) - accessforbidden(); +if (!$user->admin) accessforbidden(); /* * Action */ +// None /* @@ -50,9 +50,11 @@ print "
\n"; $template_dir = DOL_DOCUMENT_ROOT.'/core/tpl/'; $interfaces = new Interfaces($db); -$triggers = $interfaces->getTriggersList(0); +$triggers = $interfaces->getTriggersList(0,'priority'); include($template_dir.'triggers.tpl.php'); llxFooter(); + +$db->close(); ?> diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php index eb3395e7397..c13aa28800b 100644 --- a/htdocs/core/class/interfaces.class.php +++ b/htdocs/core/class/interfaces.class.php @@ -67,6 +67,13 @@ class Interfaces dol_syslog(get_class($this).'::run_triggers was called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf), LOG_WARNING); } + $nbfile = $nbtotal = $nbok = $nbko = 0; + + $files = array(); + $modules = array(); + $orders = array(); + $i=0; + foreach($conf->triggers_modules as $reldir) { $dir=dol_buildpath($reldir,0); @@ -76,111 +83,116 @@ class Interfaces if (!is_dir($dir)) continue; $handle=opendir($dir); - $modules = array(); - $nbfile = $nbtotal = $nbok = $nbko = 0; if (is_resource($handle)) { while (($file = readdir($handle))!==false) { - if (is_readable($dir."/".$file) && preg_match('/^interface_([^_]+)_(.+)\.class\.php$/i',$file,$reg)) + if (is_readable($dir."/".$file) && preg_match('/^interface_([0-9]+)_([^_]+)_(.+)\.class\.php$/i',$file,$reg)) { + $part1=$reg[1]; + $part2=$reg[2]; + $part3=$reg[3]; + $nbfile++; - $modName = "Interface".ucfirst($reg[2]); + $modName = "Interface".ucfirst($reg[3]); //print "file=$file"; print "modName=$modName"; exit; if (in_array($modName,$modules)) { $langs->load("errors"); - dol_syslog("Interface::run_triggers action=".$action." ".$langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/core/triggers/"),LOG_ERR); + dol_syslog(get_class($this)."::run_triggers action=".$action." ".$langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/core/triggers/"),LOG_ERR); continue; } + else + { + include_once($dir.'/'.$file); + } // Check if trigger file is disabled by name - if (preg_match('/NORUN$/i',$file)) - { - continue; - } + if (preg_match('/NORUN$/i',$file)) continue; // Check if trigger file is for a particular module $qualified=true; - if (strtolower($reg[1]) != 'all') + if (strtolower($reg[2]) != 'all') { - $module=preg_replace('/^mod/i','',$reg[1]); + $module=preg_replace('/^mod/i','',$reg[2]); $constparam='MAIN_MODULE_'.strtoupper($module); if (empty($conf->global->$constparam)) $qualified=false; } if (! $qualified) { - dol_syslog("Interfaces::run_triggers action=".$action." Triggers for file '".$file."' need module to be enabled",LOG_INFO); + dol_syslog(get_class($this)."::run_triggers action=".$action." Triggers for file '".$file."' need module to be enabled",LOG_INFO); continue; } - - include_once($dir."/".$file); - $objMod = new $modName($this->db); - $i=0; - if ($objMod) - { - // Bypass if workflow module is enabled and if the trigger asked to be disable in such case - if (! empty($conf->workflow->enabled) && ! empty($objMod->disabled_if_workflow)) - { - dol_syslog("Interfaces::run_triggers action=".$action." Bypass triggers for file '".$file."'",LOG_INFO); - continue; - } - - dol_syslog("Interfaces::run_triggers action=".$action." Launch triggers for file '".$file."'",LOG_INFO); - - $modules[$i] = $modName; - //dol_syslog("Interfaces::run_triggers Launch triggers for file '".$file."'",LOG_INFO); - $result=$objMod->run_trigger($action,$object,$user,$langs,$conf); - if ($result > 0) - { - // Action OK - $nbtotal++; - $nbok++; - } - if ($result == 0) - { - // Aucune action faite - $nbtotal++; - } - if ($result < 0) - { - // Action KO - $nbtotal++; - $nbko++; - $this->errors[]=$objMod->error; - } - $i++; - } - else - { - dol_syslog("Interfaces::run_triggers action=".$action." Failed to instantiate trigger for file '".$file."'",LOG_ERR); - } + + $modules[$i] = $modName; + $files[$i] = $file; + $orders[$i] = $part1.'_'.$part2.'_'.$part3; // Set sort criteria value + + $i++; } } - closedir($handle); + } + } + + asort($orders); + + // Loop on each trigger + foreach ($orders as $key => $value) + { + $modName = $modules[$key]; + if (empty($modName)) continue; + + $objMod = new $modName($this->db); + if ($objMod) + { + dol_syslog(get_class($this)."::run_triggers action=".$action." Launch triggers for file '".$files[$key]."'",LOG_INFO); + + $result=$objMod->run_trigger($action,$object,$user,$langs,$conf); + if ($result > 0) + { + // Action OK + $nbtotal++; + $nbok++; + } + if ($result == 0) + { + // Aucune action faite + $nbtotal++; + } + if ($result < 0) + { + // Action KO + $nbtotal++; + $nbko++; + $this->errors[]=$objMod->error; + } + } + else + { + dol_syslog(get_class($this)."::run_triggers action=".$action." Failed to instantiate trigger for file '".$files[$key]."'",LOG_ERR); } } if ($nbko) { - dol_syslog("Interfaces::run_triggers action=".$action." Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko, LOG_ERR); + dol_syslog(get_class($this)."::run_triggers action=".$action." Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko, LOG_ERR); return -$nbko; } else { - //dol_syslog("Interfaces::run_triggers Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko, LOG_DEBUG); + //dol_syslog(get_class($this)."::run_triggers Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko, LOG_DEBUG); return $nbok; } } /** - * Return list of triggers. Function used by admin page htdoc/admin/triggers + * Return list of triggers. Function used by admin page htdoc/admin/triggers. + * List is sorted by trigger filename so by priority to run. * - * @param int $workflow 0=Return all triggers, 1=Return only triggers not disabled if workflow module activated * @return array Array list of triggers */ - function getTriggersList($workflow=0) + function getTriggersList() { global $conf, $langs; @@ -204,31 +216,29 @@ class Interfaces { while (($file = readdir($handle))!==false) { - if (is_readable($dir.'/'.$file) && preg_match('/^interface_([^_]+)_(.+)\.class\.php/',$file,$reg)) + if (is_readable($dir.'/'.$file) && preg_match('/^interface_([0-9]+)_([^_]+)_(.+)\.class\.php/',$file,$reg)) { - $modName = 'Interface'.ucfirst($reg[2]); + $part1=$reg[1]; + $part2=$reg[2]; + $part3=$reg[3]; + + $modName = 'Interface'.ucfirst($reg[3]); //print "file=$file"; print "modName=$modName"; exit; if (in_array($modName,$modules)) { $langs->load("errors"); print '
'.$langs->trans("Error").' : '.$langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/core/triggers/").'
'; - $objMod = new $modName($this->db); - - $modules[$i] = $modName; - $files[$i] = $file; - $orders[$i] = $objMod->family; // Tri par famille - $i++; } else { include_once($dir.'/'.$file); - $objMod = new $modName($this->db); - - $modules[$i] = $modName; - $files[$i] = $file; - $orders[$i] = $objMod->family; // Tri par famille - $i++; } + + $files[$i] = $file; + $modules[$i] = $modName; + $orders[$i] = $part1.'_'.$part2.'_'.$part3; // Set sort criteria value + + $i++; } } closedir($handle); @@ -244,27 +254,27 @@ class Interfaces foreach ($orders as $key => $value) { $modName = $modules[$key]; - if ($modName) - { - $objMod = new $modName($this->db); - // Bypass if workflow module is enabled and if the trigger is compatible - if ($workflow && ! empty($objMod->disabled_if_workflow)) continue; - } + if (empty($modName)) continue; + + $objMod = new $modName($this->db); // Define disabledbyname and disabledbymodule $disabledbyname=0; $disabledbymodule=1; $module=''; + + // Check if trigger file is disabled by name if (preg_match('/NORUN$/i',$files[$key])) $disabledbyname=1; - if (preg_match('/^interface_([^_]+)_(.+)\.class\.php/i',$files[$key],$reg)) + // Check if trigger file is for a particular module + if (preg_match('/^interface_([0-9]+)_([^_]+)_(.+)\.class\.php/i',$files[$key],$reg)) { - // Check if trigger file is for a particular module - $module=preg_replace('/^mod/i','',$reg[1]); + $module=preg_replace('/^mod/i','',$reg[2]); $constparam='MAIN_MODULE_'.strtoupper($module); - if (strtolower($reg[1]) == 'all') $disabledbymodule=0; + if (strtolower($reg[2]) == 'all') $disabledbymodule=0; else if (empty($conf->global->$constparam)) $disabledbymodule=2; } + // We set info of modules $triggers[$j]['picto'] = $objMod->picto?img_object('',$objMod->picto):img_object('','generic'); $triggers[$j]['file'] = $files[$key]; $triggers[$j]['version'] = $objMod->getVersion(); diff --git a/htdocs/core/triggers/interface_all_Demo.class.php-NORUN b/htdocs/core/triggers/interface_all_Demo.class.php-NORUN deleted file mode 100644 index 8c02ba961d2..00000000000 --- a/htdocs/core/triggers/interface_all_Demo.class.php-NORUN +++ /dev/null @@ -1,526 +0,0 @@ - - * Copyright (C) 2005-2011 Regis Houssin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/core/triggers/interface_all_Demo.class.php - * \ingroup core - * \brief Fichier de demo de personalisation des actions du workflow - * \remarks Son propre fichier d'actions peut etre cree par recopie de celui-ci: - * - Le nom du fichier doit etre: interface_modMymodule_Mytrigger.class.php - * ou: interface_all_Mytrigger.class.php - * - Le fichier doit rester stocke dans core/triggers - * - Le nom de la classe doit etre InterfaceMytrigger - * - Le nom de la methode constructeur doit etre InterfaceMytrigger - * - Le nom de la propriete name doit etre Mytrigger - */ - - -/** - * \class InterfaceDemo - * \brief Class of triggers for demo module - */ -class InterfaceDemo -{ - var $db; - - /** - * Constructor. - * @param DB Database handler - */ - function InterfaceDemo($DB) - { - $this->db = $DB ; - - $this->name = preg_replace('/^Interface/i','',get_class($this)); - $this->family = "demo"; - $this->description = "Triggers of this module are empty functions. They have no effect. They are provided for tutorial purpose only."; - $this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version - $this->picto = 'technic'; - } - - - /** - * Return name of trigger file - * @return string Name of trigger file - */ - function getName() - { - return $this->name; - } - - /** - * Return description of trigger file - * @return string Description of trigger file - */ - function getDesc() - { - return $this->description; - } - - /** - * Return version of trigger file - * @return string Version of trigger file - */ - function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'development') return $langs->trans("Development"); - elseif ($this->version == 'experimental') return $langs->trans("Experimental"); - elseif ($this->version == 'dolibarr') return DOL_VERSION; - elseif ($this->version) return $this->version; - else return $langs->trans("Unknown"); - } - - /** - * Function called when a Dolibarrr business event is done. - * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers - * @param action Code de l'evenement - * @param object Objet concerne - * @param user Objet user - * @param langs Objet langs - * @param conf Objet conf - * @return int <0 if KO, 0 if no triggered ran, >0 if OK - */ - function run_trigger($action,$object,$user,$langs,$conf) - { - // Put here code you want to execute when a Dolibarr business events occurs. - // Data and type of action are stored into $object and $action - - // Users - if ($action == 'USER_LOGIN') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_UPDATE_SESSION') - { - // Warning: To increase performances, this action is triggered only if - // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_CREATE_FROM_CONTACT') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_NEW_PASSWORD') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_ENABLEDISABLE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_LOGOUT') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_SETINGROUP') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_REMOVEFROMGROUP') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Groups - elseif ($action == 'GROUP_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'GROUP_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'GROUP_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Companies - elseif ($action == 'COMPANY_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'COMPANY_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'COMPANY_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Contacts - elseif ($action == 'CONTACT_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'CONTACT_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'CONTACT_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Products - elseif ($action == 'PRODUCT_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PRODUCT_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PRODUCT_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Customer orders - elseif ($action == 'ORDER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_CLONE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_BUILDDOC') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_SENTBYMAIL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEORDER_INSERT') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEORDER_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Supplier orders - elseif ($action == 'ORDER_SUPPLIER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_SUPPLIER_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Proposals - elseif ($action == 'PROPAL_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROPAL_CLONE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROPAL_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROPAL_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROPAL_BUILDDOC') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROPAL_SENTBYMAIL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROPAL_CLOSE_SIGNED') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROPAL_CLOSE_REFUSED') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROPAL_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEPROPAL_INSERT') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEPROPAL_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEPROPAL_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Contracts - elseif ($action == 'CONTRACT_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'CONTRACT_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'CONTRACT_ACTIVATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'CONTRACT_CANCEL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'CONTRACT_CLOSE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'CONTRACT_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Bills - elseif ($action == 'BILL_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'BILL_CLONE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'BILL_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'BILL_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'BILL_BUILDDOC') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'BILL_SENTBYMAIL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'BILL_CANCEL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'BILL_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEBILL_INSERT') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEBILL_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Payments - elseif ($action == 'PAYMENT_CUSTOMER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PAYMENT_SUPPLIER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PAYMENT_ADD_TO_BANK') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PAYMENT_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Interventions - elseif ($action == 'FICHEINTER_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Members - elseif ($action == 'MEMBER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'MEMBER_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'MEMBER_SUBSCRIPTION') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'MEMBER_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'MEMBER_NEW_PASSWORD') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'MEMBER_RESILIATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'MEMBER_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Categories - elseif ($action == 'CATEGORY_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'CATEGORY_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'CATEGORY_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Projects - elseif ($action == 'PROJECT_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROJECT_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROJECT_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Project tasks - elseif ($action == 'TASK_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'TASK_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'TASK_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Task time spent - elseif ($action == 'TASK_TIMESPENT_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'TASK_TIMESPENT_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'TASK_TIMESPENT_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Shipping - elseif ($action == 'SHIPPING_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'SHIPPING_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'SHIPPING_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'SHIPPING_SENTBYMAIL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'SHIPPING_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'SHIPPING_BUILDDOC') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // File - elseif ($action == 'FILE_UPLOAD') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'FILE_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - return 0; - } - -} -?> diff --git a/htdocs/core/triggers/interface_all_Logevents.class.php b/htdocs/core/triggers/interface_all_Logevents.class.php deleted file mode 100644 index bba2794b177..00000000000 --- a/htdocs/core/triggers/interface_all_Logevents.class.php +++ /dev/null @@ -1,255 +0,0 @@ - - * Copyright (C) 2009 Regis Houssin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/core/triggers/interface_all_Logevents.class.php - * \ingroup core - * \brief Trigger file for - */ - - -/** - * \class InterfaceLogevents - * \brief Class of triggers for security events - */ -class InterfaceLogevents -{ - var $db; - var $error; - - var $date; - var $duree; - var $texte; - var $desc; - - /** - * Constructor. - * @param DB Database handler - */ - function InterfaceLogevents($DB) - { - $this->db = $DB ; - - $this->name = preg_replace('/^Interface/i','',get_class($this)); - $this->family = "core"; - $this->description = "Triggers of this module allows to add security event records inside Dolibarr."; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version - $this->picto = 'technic'; - } - - /** - * Return name of trigger file - * @return string Name of trigger file - */ - function getName() - { - return $this->name; - } - - /** - * Return description of trigger file - * @return string Description of trigger file - */ - function getDesc() - { - return $this->description; - } - - /** - * Return version of trigger file - * @return string Version of trigger file - */ - function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'experimental') return $langs->trans("Experimental"); - elseif ($this->version == 'dolibarr') return DOL_VERSION; - elseif ($this->version) return $this->version; - else return $langs->trans("Unknown"); - } - - /** - * Function called when a Dolibarrr business event is done. - * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers - * @param action Code de l'evenement - * @param object Objet concerne - * @param user Objet user - * @param langs Objet langs - * @param conf Objet conf - * @param entity Value for instance of data (Always 1 except if module MultiCompany is installed) - * @return int <0 if KO, 0 if no triggered ran, >0 if OK - */ - function run_trigger($action,$object,$user,$langs,$conf,$entity=1) - { - if (! empty($conf->global->MAIN_LOGEVENTS_DISABLE_ALL)) return 0; // Log events is disabled (hidden features) - - $key='MAIN_LOGEVENTS_'.$action; - //dol_syslog("xxxxxxxxxxx".$key); - if (empty($conf->global->$key)) return 0; // Log events not enabled for this action - - if (empty($conf->entity)) $conf->entity = $entity; // forcing of the entity if it's not defined (ex: in login form) - - $this->date=gmmktime(); - $this->duree=0; - - // Actions - if ($action == 'USER_LOGIN') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - - // Initialisation donnees (date,duree,texte,desc) - $this->texte="(UserLogged,".$object->login.")"; - $this->desc="(UserLogged,".$object->login.")"; - } - if ($action == 'USER_LOGIN_FAILED') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - - // Initialisation donnees (date,duree,texte,desc) - $this->texte=$object->trigger_mesg; // Message direct - $this->desc=$object->trigger_mesg; // Message direct - } - if ($action == 'USER_LOGOUT') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - - // Initialisation donnees (date,duree,texte,desc) - $this->texte="(UserLogoff,".$object->login.")"; - $this->desc="(UserLogoff,".$object->login.")"; - } - if ($action == 'USER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("users"); - - // Initialisation donnees (date,duree,texte,desc) - $this->texte=$langs->transnoentities("NewUserCreated",$object->login); - $this->desc=$langs->transnoentities("NewUserCreated",$object->login); - } - elseif ($action == 'USER_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("users"); - - // Initialisation donnees (date,duree,texte,desc) - $this->texte=$langs->transnoentities("EventUserModified",$object->login); - $this->desc=$langs->transnoentities("EventUserModified",$object->login); - } - elseif ($action == 'USER_NEW_PASSWORD') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("users"); - - // Initialisation donnees (date,duree,texte,desc) - $this->texte=$langs->transnoentities("NewUserPassword",$object->login); - $this->desc=$langs->transnoentities("NewUserPassword",$object->login); - } - elseif ($action == 'USER_ENABLEDISABLE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("users"); - // Initialisation donnees (date,duree,texte,desc) - if ($object->statut == 0) - { - $this->texte=$langs->transnoentities("UserEnabled",$object->login); - $this->desc=$langs->transnoentities("UserEnabled",$object->login); - } - if ($object->statut == 1) - { - $this->texte=$langs->transnoentities("UserDisabled",$object->login); - $this->desc=$langs->transnoentities("UserDisabled",$object->login); - } - } - elseif ($action == 'USER_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("users"); - // Initialisation donnees (date,duree,texte,desc) - $this->texte=$langs->transnoentities("UserDeleted",$object->login); - $this->desc=$langs->transnoentities("UserDeleted",$object->login); - } - - // Groupes - elseif ($action == 'GROUP_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("users"); - // Initialisation donnees (date,duree,texte,desc) - $this->texte=$langs->transnoentities("NewGroupCreated",$object->nom); - $this->desc=$langs->transnoentities("NewGroupCreated",$object->nom); - } - elseif ($action == 'GROUP_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("users"); - // Initialisation donnees (date,duree,texte,desc) - $this->texte=$langs->transnoentities("GroupModified",$object->nom); - $this->desc=$langs->transnoentities("GroupModified",$object->nom); - } - elseif ($action == 'GROUP_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("users"); - // Initialisation donnees (date,duree,texte,desc) - $this->texte=$langs->transnoentities("GroupDeleted",$object->nom); - $this->desc=$langs->transnoentities("GroupDeleted",$object->nom); - } - - // If not found -/* - else - { - dol_syslog("Trigger '".$this->name."' for action '$action' was ran by ".__FILE__." but no handler found for this action."); - return 0; - } -*/ - - // Add entry in event table - if ($this->date) - { - include_once(DOL_DOCUMENT_ROOT.'/core/class/events.class.php'); - - $event=new Events($this->db); - $event->type=$action; - $event->dateevent=$this->date; - $event->label=$this->texte; - $event->description=$this->desc; - $event->user_agent=$_SERVER["HTTP_USER_AGENT"]; - - $result=$event->create($user); - if ($result > 0) - { - return 1; - } - else - { - $error ="Failed to insert security event: ".$event->error; - $this->error=$error; - - dol_syslog("interface_all_Logevents.class.php: ".$this->error, LOG_ERR); - return -1; - } - } - - return 0; - } - -} -?> diff --git a/htdocs/core/triggers/interface_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_modAgenda_ActionsAuto.class.php deleted file mode 100644 index 2551fba0731..00000000000 --- a/htdocs/core/triggers/interface_modAgenda_ActionsAuto.class.php +++ /dev/null @@ -1,598 +0,0 @@ - - * Copyright (C) 2009-2011 Regis Houssin - * Copyright (C) 2011 Juanjo Menent - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/core/triggers/interface_modAgenda_ActionsAuto.class.php - * \ingroup agenda - * \brief Trigger file for agenda module - */ - - -/** - * \class InterfaceActionsAuto - * \brief Class of triggered functions for agenda module - */ -class InterfaceActionsAuto -{ - var $db; - var $error; - - var $date; - var $duree; - var $texte; - var $desc; - - /** - * Constructor. - * @param DB Database handler - */ - function InterfaceActionsAuto($DB) - { - $this->db = $DB ; - - $this->name = preg_replace('/^Interface/i','',get_class($this)); - $this->family = "agenda"; - $this->description = "Triggers of this module add actions in agenda according to setup made in agenda setup."; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version - $this->picto = 'action'; - } - - /** - * Return name of trigger file - * @return string Name of trigger file - */ - function getName() - { - return $this->name; - } - - /** - * Return description of trigger file - * @return string Description of trigger file - */ - function getDesc() - { - return $this->description; - } - - /** - * Return version of trigger file - * @return string Version of trigger file - */ - function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'experimental') return $langs->trans("Experimental"); - elseif ($this->version == 'dolibarr') return DOL_VERSION; - elseif ($this->version) return $this->version; - else return $langs->trans("Unknown"); - } - - /** - * Function called when a Dolibarrr business event is done. - * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers - * - * Following properties must be filled: - * $object->actiontypecode (translation action code: AC_OTH, ...) - * $object->actionmsg (note, long text) - * $object->actionmsg2 (label, short text) - * $object->sendtoid (id of contact) - * $object->socid - * Optionnal: - * $object->fk_element - * $object->elementtype - * - * @param action Event code (COMPANY_CREATE, PROPAL_VALIDATE, ...) - * @param object Object action is done on - * @param user Object user - * @param langs Object langs - * @param conf Object conf - * @return int <0 if KO, 0 if no action are done, >0 if OK - */ - function run_trigger($action,$object,$user,$langs,$conf) - { - $key='MAIN_AGENDA_ACTIONAUTO_'.$action; - //dol_syslog("xxxxxxxxxxx".$key); - - if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing - if (empty($conf->global->$key)) return 0; // Log events not enabled for this action - - $ok=0; - - // Actions - if ($action == 'COMPANY_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("other"); - $langs->load("agenda"); - - $object->actiontypecode='AC_OTH'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("NewCompanyToDolibarr",$object->nom); - $object->actionmsg=$langs->transnoentities("NewCompanyToDolibarr",$object->nom); - if ($object->prefix) $object->actionmsg.=" (".$object->prefix.")"; - //$this->desc.="\n".$langs->transnoentities("Customer").': '.yn($object->client); - //$this->desc.="\n".$langs->transnoentities("Supplier").': '.yn($object->fournisseur); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - - $object->sendtoid=0; - $object->socid=$object->id; - $ok=1; - } - elseif ($action == 'CONTRACT_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("other"); - $langs->load("contracts"); - $langs->load("agenda"); - - $object->actiontypecode='AC_OTH'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractValidatedInDolibarr",$object->ref); - $object->actionmsg=$langs->transnoentities("ContractValidatedInDolibarr",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - - $object->sendtoid=0; - $ok=1; - } - elseif ($action == 'PROPAL_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("propal"); - $langs->load("agenda"); - - $object->actiontypecode='AC_OTH'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr",$object->ref); - $object->actionmsg=$langs->transnoentities("PropalValidatedInDolibarr",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - - $object->sendtoid=0; - $ok=1; - } - elseif ($action == 'PROPAL_SENTBYMAIL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("propal"); - $langs->load("agenda"); - - $object->actiontypecode='AC_EMAIL'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail",$object->ref); - if (empty($object->actionmsg)) - { - $object->actionmsg=$langs->transnoentities("ProposalSentByEMail",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - } - - // Parameters $object->sendtoid defined by caller - //$object->sendtoid=0; - $ok=1; - } - elseif ($action == 'PROPAL_CLOSE_SIGNED') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("propal"); - $langs->load("agenda"); - - $object->actiontypecode='AC_OTH'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); - $object->actionmsg=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - - $object->sendtoid=0; - $ok=1; - } - elseif ($action == 'PROPAL_CLOSE_REFUSED') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("propal"); - $langs->load("agenda"); - - $object->actiontypecode='AC_OTH'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); - $object->actionmsg=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - - $object->sendtoid=0; - $ok=1; - } - elseif ($action == 'ORDER_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("orders"); - $langs->load("agenda"); - - $object->actiontypecode='AC_OTH'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); - $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - - $object->sendtoid=0; - $ok=1; - } - elseif ($action == 'ORDER_SENTBYMAIL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("orders"); - $langs->load("agenda"); - - $object->actiontypecode='AC_EMAIL'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderSentByEMail",$object->ref); - if (empty($object->actionmsg)) - { - $object->actionmsg=$langs->transnoentities("OrderSentByEMail",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - } - - // Parameters $object->sendtoid defined by caller - //$object->sendtoid=0; - $ok=1; - } - elseif ($action == 'BILL_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("other"); - $langs->load("bills"); - $langs->load("agenda"); - - $object->actiontypecode='AC_OTH'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref); - $object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - - $object->sendtoid=0; - $ok=1; - } - elseif ($action == 'BILL_SENTBYMAIL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("other"); - $langs->load("bills"); - $langs->load("agenda"); - - $object->actiontypecode='AC_EMAIL'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceSentByEMail",$object->ref); - if (empty($object->actionmsg)) - { - $object->actionmsg=$langs->transnoentities("InvoiceSentByEMail",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - } - - // Parameters $object->sendtoid defined by caller - //$object->sendtoid=0; - $ok=1; - } - elseif ($action == 'BILL_PAYED') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("other"); - $langs->load("bills"); - $langs->load("agenda"); - - $object->actiontypecode='AC_OTH'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); - $object->actionmsg=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - - $object->sendtoid=0; - $ok=1; - } - elseif ($action == 'BILL_CANCEL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("other"); - $langs->load("bills"); - $langs->load("agenda"); - - $object->actiontypecode='AC_OTH'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); - $object->actionmsg=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - - $object->sendtoid=0; - $ok=1; - } - elseif ($action == 'FICHEINTER_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("other"); - $langs->load("interventions"); - $langs->load("agenda"); - - $object->actiontypecode='AC_OTH'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionValidatedInDolibarr",$object->ref); - $object->actionmsg=$langs->transnoentities("InterventionValidatedInDolibarr",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - - $object->sendtoid=0; - $object->fk_element=0; - $object->elementtype=''; - $ok=1; - } - elseif ($action == 'FICHEINTER_SENTBYMAIL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("other"); - $langs->load("interventions"); - $langs->load("agenda"); - - $object->actiontypecode='AC_EMAIL'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionSentByEMail",$object->ref); - $object->actionmsg=$langs->transnoentities("InterventionSentByEMail",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - - // Parameters $object->sendotid defined by caller - //$object->sendtoid=0; - $ok=1; - } - elseif ($action == 'SHIPPING_SENTBYMAIL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("other"); - $langs->load("sendings"); - $langs->load("agenda"); - - $object->actiontypecode='AC_SHIP'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingSentByEMail",$object->ref); - if (empty($object->actionmsg)) - { - $object->actionmsg=$langs->transnoentities("ShippingSentByEMail",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - } - - // Parameters $object->sendtoid defined by caller - //$object->sendtoid=0; - $ok=1; - } - elseif ($action == 'ORDER_SUPPLIER_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("orders"); - $langs->load("agenda"); - - $object->actiontypecode='AC_OTH'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); - $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - - $object->sendtoid=0; - $ok=1; - } - elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("other"); - $langs->load("bills"); - $langs->load("agenda"); - $langs->load("orders"); - - $object->actiontypecode='AC_EMAIL'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderSentByEMail",$object->ref); - if (empty($object->actionmsg)) - { - $object->actionmsg=$langs->transnoentities("SupplierOrderSentByEMail",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - } - - // Parameters $object->sendotid defined by caller - //$object->sendtoid=0; - $ok=1; - } - elseif ($action == 'BILL_SUPPLIER_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("other"); - $langs->load("bills"); - $langs->load("agenda"); - - $object->actiontypecode='AC_OTH'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref); - $object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - - $object->sendtoid=0; - $ok=1; - } - elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("other"); - $langs->load("bills"); - $langs->load("agenda"); - $langs->load("orders"); - - $object->actiontypecode='AC_EMAIL'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierInvoiceSentByEMail",$object->ref); - if (empty($object->actionmsg)) - { - $object->actionmsg=$langs->transnoentities("SupplierInvoiceSentByEMail",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - } - - // Parameters $object->sendtoid defined by caller - //$object->sendtoid=0; - $ok=1; - } - elseif ($action == 'BILL_SUPPLIER_PAYED') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("other"); - $langs->load("bills"); - $langs->load("agenda"); - - $object->actiontypecode='AC_OTH'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); - $object->actionmsg=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - - $object->sendtoid=0; - $ok=1; - } - elseif ($action == 'BILL_SUPPLIER_CANCELED') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("other"); - $langs->load("bills"); - $langs->load("agenda"); - - $object->actiontypecode='AC_OTH'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); - $object->actionmsg=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - - $object->sendtoid=0; - $ok=1; - } - - // Members - elseif ($action == 'MEMBER_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("other"); - $langs->load("members"); - $langs->load("agenda"); - - $object->actiontypecode='AC_OTH'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberValidatedInDolibarr",$object->ref); - $object->actionmsg=$langs->transnoentities("MemberValidatedInDolibarr",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); - $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - - $object->sendtoid=0; - $ok=1; - } - elseif ($action == 'MEMBER_SUBSCRIPTION') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("other"); - $langs->load("members"); - $langs->load("agenda"); - - $object->actiontypecode='AC_OTH'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref); - $object->actionmsg=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); - $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; - $object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount; - $object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start,'day').' - '.dol_print_date($object->last_subscription_date_end,'day'); - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - - $object->sendtoid=0; - $ok=1; - } - elseif ($action == 'MEMBER_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'MEMBER_RESILIATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("other"); - $langs->load("members"); - $langs->load("agenda"); - - $object->actiontypecode='AC_OTH'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberResiliatedInDolibarr",$object->ref); - $object->actionmsg=$langs->transnoentities("MemberResiliatedInDolibarr",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); - $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - - $object->sendtoid=0; - $ok=1; - } - elseif ($action == 'MEMBER_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("other"); - $langs->load("members"); - $langs->load("agenda"); - - $object->actiontypecode='AC_OTH'; - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberDeletedInDolibarr",$object->ref); - $object->actionmsg=$langs->transnoentities("MemberDeletedInDolibarr",$object->ref); - $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); - $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; - $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - - $object->sendtoid=0; - $ok=1; - } - - // If not found - /* - else - { - dol_syslog("Trigger '".$this->name."' for action '$action' was ran by ".__FILE__." but no handler found for this action."); - return 0; - } - */ - - // Add entry in event table - if ($ok) - { - $now=dol_now(); - - require_once(DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'); - require_once(DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'); - $contactforaction=new Contact($this->db); - $societeforaction=new Societe($this->db); - if ($object->sendtoid > 0) $contactforaction->fetch($object->sendtoid); - if ($object->socid > 0) $societeforaction->fetch($object->socid); - - // Insertion action - require_once(DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'); - $actioncomm = new ActionComm($this->db); - $actioncomm->type_code = $object->actiontypecode; - $actioncomm->label = $object->actionmsg2; - $actioncomm->note = $object->actionmsg; - $actioncomm->datep = $now; - $actioncomm->datef = $now; - $actioncomm->durationp = 0; - $actioncomm->punctual = 1; - $actioncomm->percentage = -1; // Not applicable - $actioncomm->contact = $contactforaction; - $actioncomm->societe = $societeforaction; - $actioncomm->author = $user; // User saving action - //$actioncomm->usertodo = $user; // User affected to action - $actioncomm->userdone = $user; // User doing action - - $actioncomm->fk_element = $object->id; - $actioncomm->elementtype = $object->element; - - $ret=$actioncomm->add($user); // User qui saisit l'action - if ($ret > 0) - { - return 1; - } - else - { - $error ="Failed to insert : ".$actioncomm->error." "; - $this->error=$error; - - dol_syslog("interface_modAgenda_ActionsAuto.class.php: ".$this->error, LOG_ERR); - return -1; - } - } - - return 0; - } - -} -?> diff --git a/htdocs/core/triggers/interface_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_modLdap_Ldapsynchro.class.php deleted file mode 100644 index 542150f217b..00000000000 --- a/htdocs/core/triggers/interface_modLdap_Ldapsynchro.class.php +++ /dev/null @@ -1,536 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/core/triggers/interface_modLdap_Ldapsynchro.class.php - * \ingroup core - * \brief Fichier de gestion des triggers LDAP - */ -require_once (DOL_DOCUMENT_ROOT."/core/class/ldap.class.php"); - - -/** - * \class InterfaceLdapsynchro - * \brief Class of triggers for ldap module - */ -class InterfaceLdapsynchro -{ - var $db; - var $error; - - - /** - * Constructor. - * @param DB Database handler - */ - function InterfaceLdapsynchro($DB) - { - $this->db = $DB ; - - $this->name = preg_replace('/^Interface/i','',get_class($this)); - $this->family = "ldap"; - $this->description = "Triggers of this module allows to synchronize Dolibarr toward a LDAP database."; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version - $this->picto = 'technic'; - } - - /** - * Return name of trigger file - * @return string Name of trigger file - */ - function getName() - { - return $this->name; - } - - /** - * Return description of trigger file - * @return string Description of trigger file - */ - function getDesc() - { - return $this->description; - } - - /** - * Return version of trigger file - * @return string Version of trigger file - */ - function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'experimental') return $langs->trans("Experimental"); - elseif ($this->version == 'dolibarr') return DOL_VERSION; - elseif ($this->version) return $this->version; - else return $langs->trans("Unknown"); - } - - /** - * Function called when a Dolibarrr business event is done. - * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers - * @param action Event code (COMPANY_CREATE, PROPAL_VALIDATE, ...) - * @param object Object action is done on - * @param user Object user - * @param langs Object langs - * @param conf Object conf - * @return int <0 if KO, 0 if no action are done, >0 if OK - */ - function run_trigger($action,$object,$user,$langs,$conf) - { - if (empty($conf->ldap->enabled)) return 0; // Module not active, we do nothing - - if (! function_exists('ldap_connect')) - { - dol_syslog("Warning, module LDAP is enabled but LDAP functions not available in this PHP", LOG_WARNING); - return 0; - } - - // Users - if ($action == 'USER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') - { - $ldap=new Ldap(); - $ldap->connect_bind(); - - $info=$object->_load_ldap_info(); - $dn=$object->_load_ldap_dn($info); - - $result=$ldap->add($dn,$info,$user); - if ($result < 0) - { - $this->error="ErrorLDAP"." ".$ldap->error; - } - return $result; - } - } - elseif ($action == 'USER_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') - { - $ldap=new Ldap(); - $ldap->connect_bind(); - - $oldinfo=$object->oldcopy->_load_ldap_info(); - $olddn=$object->oldcopy->_load_ldap_dn($oldinfo); - - // Verify if entry exist - $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); - $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; - $records=$ldap->search($container,$search); - if (count($records) && $records['count'] == 0) - { - $olddn = ''; - } - - $info=$object->_load_ldap_info(); - $dn=$object->_load_ldap_dn($info); - - $result=$ldap->update($dn,$info,$user,$olddn); - if ($result < 0) - { - $this->error="ErrorLDAP"." ".$ldap->error; - } - return $result; - } - } - elseif ($action == 'USER_NEW_PASSWORD') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') - { - $ldap=new Ldap(); - $ldap->connect_bind(); - - $oldinfo=$object->oldcopy->_load_ldap_info(); - $olddn=$object->oldcopy->_load_ldap_dn($oldinfo); - - // Verify if entry exist - $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); - $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; - $records=$ldap->search($container,$search); - if (count($records) && $records['count'] == 0) - { - $olddn = ''; - } - - $info=$object->_load_ldap_info(); - $dn=$object->_load_ldap_dn($info); - - $result=$ldap->update($dn,$info,$user,$olddn); - if ($result < 0) - { - $this->error="ErrorLDAP"." ".$ldap->error; - } - return $result; - } - } - elseif ($action == 'USER_ENABLEDISABLE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') - { - $ldap=new Ldap(); - $ldap->connect_bind(); - - $info=$object->_load_ldap_info(); - $dn=$object->_load_ldap_dn($info); - - $result=$ldap->delete($dn,$info,$user); - if ($result < 0) - { - $this->error="ErrorLDAP"." ".$ldap->error; - } - return $result; - } - } - - // Groupes - elseif ($action == 'GROUP_CREATE') - { - if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') - { - $ldap=new Ldap(); - $ldap->connect_bind(); - - $info=$object->_load_ldap_info(); - $dn=$object->_load_ldap_dn($info); - - // Get a gid number for objectclass PosixGroup - if(in_array('posixGroup',$info['objectclass'])) - $info['gidNumber'] = $ldap->getNextGroupGid(); - - $result=$ldap->add($dn,$info,$user); - if ($result < 0) - { - $this->error="ErrorLDAP"." ".$ldap->error; - } - return $result; - } - } - elseif ($action == 'GROUP_MODIFY') - { - if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') - { - $ldap=new Ldap(); - $ldap->connect_bind(); - - $oldinfo=$object->oldcopy->_load_ldap_info(); - $olddn=$object->oldcopy->_load_ldap_dn($oldinfo); - - // Verify if entry exist - $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); - $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; - $records=$ldap->search($container,$search); - if (count($records) && $records['count'] == 0) - { - $olddn = ''; - } - - $info=$object->_load_ldap_info(); - $dn=$object->_load_ldap_dn($info); - - $result=$ldap->update($dn,$info,$user,$olddn); - if ($result < 0) - { - $this->error="ErrorLDAP"." ".$ldap->error; - } - return $result; - } - } - elseif ($action == 'GROUP_DELETE') - { - if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') - { - $ldap=new Ldap(); - $ldap->connect_bind(); - - $info=$object->_load_ldap_info(); - $dn=$object->_load_ldap_dn($info); - - $result=$ldap->delete($dn,$info,$user); - if ($result < 0) - { - $this->error="ErrorLDAP"." ".$ldap->error; - } - return $result; - } - } - - // Contacts - elseif ($action == 'CONTACT_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if ($conf->ldap->enabled && $conf->global->LDAP_CONTACT_ACTIVE) - { - $ldap=new Ldap(); - $ldap->connect_bind(); - - $info=$object->_load_ldap_info(); - $dn=$object->_load_ldap_dn($info); - - $result=$ldap->add($dn,$info,$user); - if ($result < 0) - { - $this->error="ErrorLDAP"." ".$ldap->error; - } - return $result; - } - } - elseif ($action == 'CONTACT_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if ($conf->ldap->enabled && $conf->global->LDAP_CONTACT_ACTIVE) - { - $ldap=new Ldap(); - $ldap->connect_bind(); - - $oldinfo=$object->oldcopy->_load_ldap_info(); - $olddn=$object->oldcopy->_load_ldap_dn($oldinfo); - - // Verify if entry exist - $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); - $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; - $records=$ldap->search($container,$search); - if (count($records) && $records['count'] == 0) - { - $olddn = ''; - } - - $info=$object->_load_ldap_info(); - $dn=$object->_load_ldap_dn($info); - - $result=$ldap->update($dn,$info,$user,$olddn); - if ($result < 0) - { - $this->error="ErrorLDAP"." ".$ldap->error; - } - return $result; - } - } - elseif ($action == 'CONTACT_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if ($conf->ldap->enabled && $conf->global->LDAP_CONTACT_ACTIVE) - { - $ldap=new Ldap(); - $ldap->connect_bind(); - - $info=$object->_load_ldap_info(); - $dn=$object->_load_ldap_dn($info); - - $result=$ldap->delete($dn,$info,$user); - if ($result < 0) - { - $this->error="ErrorLDAP"." ".$ldap->error; - } - return $result; - } - } - - // Members - elseif ($action == 'MEMBER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE) - { - $ldap=new Ldap(); - $ldap->connect_bind(); - - $info=$object->_load_ldap_info(); - $dn=$object->_load_ldap_dn($info); - - $result=$ldap->add($dn,$info,$user); - if ($result < 0) - { - $this->error="ErrorLDAP"." ".$ldap->error; - } - return $result; - } - } - elseif ($action == 'MEMBER_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE) - { - // If status field is setup to be synchronized - if ($conf->global->LDAP_FIELD_MEMBER_STATUS) - { - $ldap=new Ldap(); - $ldap->connect_bind(); - - $info=$object->_load_ldap_info(); - $dn=$object->_load_ldap_dn($info); - $olddn=$dn; // We know olddn=dn as we change only status - - $result=$ldap->update($dn,$info,$user,$olddn); - if ($result < 0) - { - $this->error="ErrorLDAP"." ".$ldap->error; - } - return $result; - } - } - } - elseif ($action == 'MEMBER_SUBSCRIPTION') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE) - { - // If subscriptions fields are setup to be synchronized - if ($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE - || $conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT - || $conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE - || $conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT - || $conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION) - { - $ldap=new Ldap(); - $ldap->connect_bind(); - - $info=$object->_load_ldap_info(); - $dn=$object->_load_ldap_dn($info); - $olddn=$dn; // We know olddn=dn as we change only subscriptions - - $result=$ldap->update($dn,$info,$user,$olddn); - if ($result < 0) - { - $this->error="ErrorLDAP"." ".$ldap->error; - } - return $result; - } - } - } - elseif ($action == 'MEMBER_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE) - { - $ldap=new Ldap(); - $ldap->connect_bind(); - - $oldinfo=$object->oldcopy->_load_ldap_info(); - $olddn=$object->oldcopy->_load_ldap_dn($oldinfo); - - // Verify if entry exist - $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); - $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; - $records=$ldap->search($container,$search); - if (count($records) && $records['count'] == 0) - { - $olddn = ''; - } - - $info=$object->_load_ldap_info(); - $dn=$object->_load_ldap_dn($info); - - $result=$ldap->update($dn,$info,$user,$olddn); - if ($result < 0) - { - $this->error="ErrorLDAP"." ".$ldap->error; - } - return $result; - } - } - elseif ($action == 'MEMBER_NEW_PASSWORD') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE) - { - // If password field is setup to be synchronized - if ($conf->global->LDAP_FIELD_PASSWORD || $conf->global->LDAP_FIELD_PASSWORD_CRYPTED) - { - $ldap=new Ldap(); - $ldap->connect_bind(); - - $info=$object->_load_ldap_info(); - $dn=$object->_load_ldap_dn($info); - $olddn=$dn; // We know olddn=dn as we change only password - - $result=$ldap->update($dn,$info,$user,$olddn); - if ($result < 0) - { - $this->error="ErrorLDAP"." ".$ldap->error; - } - return $result; - } - } - } - elseif ($action == 'MEMBER_RESILIATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE) - { - // If status field is setup to be synchronized - if ($conf->global->LDAP_FIELD_MEMBER_STATUS) - { - $ldap=new Ldap(); - $ldap->connect_bind(); - - $info=$object->_load_ldap_info(); - $dn=$object->_load_ldap_dn($info); - $olddn=$dn; // We know olddn=dn as we change only status - - $result=$ldap->update($dn,$info,$user,$olddn); - if ($result < 0) - { - $this->error="ErrorLDAP"." ".$ldap->error; - } - return $result; - } - } - } - elseif ($action == 'MEMBER_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE) - { - $ldap=new Ldap(); - $ldap->connect_bind(); - - $info=$object->_load_ldap_info(); - $dn=$object->_load_ldap_dn($info); - - $result=$ldap->delete($dn,$info,$user); - if ($result < 0) - { - $this->error="ErrorLDAP"." ".$ldap->error; - } - return $result; - } - } - - // If not found -/* - else - { - dol_syslog("Trigger '".$this->name."' for action '$action' was ran by ".__FILE__." but no handler found for this action."); - return -1; - } -*/ - return 0; - } - -} -?> diff --git a/htdocs/core/triggers/interface_modNotification_Notification.class.php b/htdocs/core/triggers/interface_modNotification_Notification.class.php deleted file mode 100644 index eff1ded2345..00000000000 --- a/htdocs/core/triggers/interface_modNotification_Notification.class.php +++ /dev/null @@ -1,256 +0,0 @@ - - * Copyright (C) 2011 Regis Houssin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/core/triggers/interface_modNotification_Notification.class.php - * \ingroup notification - * \brief File of class of triggers for notification module - */ - - -/** - * \class InterfaceNotification - * \brief Class of triggers for notification module - */ -class InterfaceNotification -{ - var $db; - var $listofmanagedevents=array('BILL_VALIDATE','ORDER_VALIDATE','PROPAL_VALIDATE', - 'FICHEINTER_VALIDATE','ORDER_SUPPLIER_APPROVE','ORDER_SUPPLIER_REFUSE'); - - /** - * Constructor. - * @param DB Database handler - */ - function InterfaceNotification($DB) - { - $this->db = $DB ; - - $this->name = preg_replace('/^Interface/i','',get_class($this)); - $this->family = "notification"; - $this->description = "Triggers of this module send email notifications according to Notification module setup."; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version - $this->picto = 'email'; - } - - /** - * Return name of trigger file - * @return string Name of trigger file - */ - function getName() - { - return $this->name; - } - - /** - * Return description of trigger file - * @return string Description of trigger file - */ - function getDesc() - { - return $this->description; - } - - /** - * Return version of trigger file - * @return string Version of trigger file - */ - function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'experimental') return $langs->trans("Experimental"); - elseif ($this->version == 'dolibarr') return DOL_VERSION; - elseif ($this->version) return $this->version; - else return $langs->trans("Unknown"); - } - - /** - * Function called when a Dolibarrr business event is done. - * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers - * @param action Event code (COMPANY_CREATE, PROPAL_VALIDATE, ...) - * @param object Object action is done on - * @param user Object user - * @param langs Object langs - * @param conf Object conf - * @return int <0 if KO, 0 if no action are done, >0 if OK - */ - function run_trigger($action,$object,$user,$langs,$conf) - { - if (empty($conf->notification->enabled)) return 0; // Module not active, we do nothing - - require_once(DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'); - - if ($action == 'BILL_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - - $ref = dol_sanitizeFileName($object->ref); - $filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; - if (! file_exists($filepdf)) $filepdf=''; - $filepdf=''; // We can't add PDF as it is not generated yet. - $langs->load("other"); - $mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated",$object->ref); - - $notify = new Notify($this->db); - $notify->send($action, $object->socid, $mesg, 'facture', $object->id, $filepdf); - } - - elseif ($action == 'ORDER_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - - $ref = dol_sanitizeFileName($object->ref); - $filepdf = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf'; - if (! file_exists($filepdf)) $filepdf=''; - $filepdf=''; // We can't add PDF as it is not generated yet. - $langs->load("other"); - $mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$object->ref); - - $notify = new Notify($this->db); - $notify->send($action, $object->socid, $mesg, 'order', $object->id, $filepdf); - } - - elseif ($action == 'PROPAL_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - - $ref = dol_sanitizeFileName($object->ref); - $filepdf = $conf->propale->dir_output . '/' . $ref . '/' . $ref . '.pdf'; - if (! file_exists($filepdf)) $filepdf=''; - $filepdf=''; // We can't add PDF as it is not generated yet. - $langs->load("other"); - $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$object->ref); - - $notify = new Notify($this->db); - $notify->send($action, $object->socid, $mesg, 'propal', $object->id, $filepdf); - } - - elseif ($action == 'FICHEINTER_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - - $ref = dol_sanitizeFileName($object->ref); - $filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; - if (! file_exists($filepdf)) $filepdf=''; - $filepdf=''; // We can't add PDF as it is not generated yet. - $langs->load("other"); - $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref); - - $notify = new Notify($this->db); - $notify->send($action, $object->socid, $mesg, 'ficheinter', $object->id, $filepdf); - } - - elseif ($action == 'ORDER_SUPPLIER_APPROVE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - - $ref = dol_sanitizeFileName($object->ref); - $filepdf = $conf->fournisseur->dir_output . '/commande/' . $ref . '/' . $ref . '.pdf'; - if (! file_exists($filepdf)) $filepdf=''; - $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; - $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$object->ref,$user->getFullName($langs)); - $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; - - $notify = new Notify($this->db); - $notify->send($action, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf); - } - - elseif ($action == 'ORDER_SUPPLIER_REFUSE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - - $ref = dol_sanitizeFileName($object->ref); - $filepdf = $conf->fournisseur->dir_output . '/commande/' . $ref . '/' . $ref . '.pdf'; - if (! file_exists($filepdf)) $filepdf=''; - $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; - $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$object->ref,$user->getFullName($langs)); - $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; - - $notify = new Notify($this->db); - $notify->send($action, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf); - } - - // If not found -/* - else - { - dol_syslog("Trigger '".$this->name."' for action '$action' was ran by ".__FILE__." but no handler found for this action."); - return -1; - } -*/ - return 0; - } - - - /** - * Return list of events managed by notification module - * @return array Array of events managed by notification module - */ - function getListOfManagedEvents() - { - global $conf,$langs; - - $ret=array(); - - $sql = "SELECT rowid, code, label, description, elementtype"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger"; - $sql.= $this->db->order("elementtype, code"); - dol_syslog("Get list of notifications sql=".$sql); - $resql=$this->db->query($sql); - if ($resql) - { - $num=$this->db->num_rows($resql); - $i=0; - while ($i < $num) - { - $obj=$this->db->fetch_object($resql); - - $qualified=0; - // Check is this event is supported by notification module - if (in_array($obj->code,$this->listofmanagedevents)) $qualified=1; - // Check if module for this event is active - if ($qualified) - { - //print 'xx'.$obj->code; - $element=$obj->elementtype; - if ($element == 'order_supplier' && empty($conf->fournisseur->enabled)) $qualified=0; - elseif ($element == 'invoice_supplier' && empty($conf->fournisseur->enabled)) $qualified=0; - elseif ($element == 'withdraw' && empty($conf->prelevement->enabled)) $qualified=0; - elseif ($element == 'shipping' && empty($conf->expedition->enabled)) $qualified=0; - elseif ($element == 'member' && empty($conf->adherent->enabled)) $qualified=0; - elseif (! in_array($element,array('order_supplier','invoice_supplier','withdraw','shipping','member')) - && empty($conf->$element->enabled)) $qualified=0; - } - - if ($qualified) - { - $ret[]=array('rowid'=>$obj->rowid,'code'=>$obj->code,'label'=>$obj->label,'description'=>$obj->description,'elementtype'=>$obj->elementtype); - } - - $i++; - } - } - else dol_print_error($this->db); - - return $ret; - } - -} -?> diff --git a/htdocs/core/triggers/interface_modPaypal_PaypalWorkflow.class.php b/htdocs/core/triggers/interface_modPaypal_PaypalWorkflow.class.php deleted file mode 100644 index c44554ba466..00000000000 --- a/htdocs/core/triggers/interface_modPaypal_PaypalWorkflow.class.php +++ /dev/null @@ -1,138 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file /htdocs/core/triggers/interface_modPaypal_PaypalWorkflow.class.php - * \ingroup paypal - * \brief Trigger file for paypal workflow - */ - - -/** - * \class InterfacePaypalWorkflow - * \brief Class of triggers for paypal module - */ -class InterfacePaypalWorkflow -{ - var $db; - - /** - * Constructor - * @param DB Database handler - */ - function InterfacePaypalWorkflow($DB) - { - $this->db = $DB ; - - $this->name = preg_replace('/^Interface/i','',get_class($this)); - $this->family = "paypal"; - $this->description = "Triggers of this module allows to manage paypal workflow"; - $this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version - $this->picto = 'paypal@paypal'; - } - - - /** - * \brief Renvoi nom du lot de triggers - * \return string Nom du lot de triggers - */ - function getName() - { - return $this->name; - } - - /** - * \brief Renvoi descriptif du lot de triggers - * \return string Descriptif du lot de triggers - */ - function getDesc() - { - return $this->description; - } - - /** - * \brief Renvoi version du lot de triggers - * \return string Version du lot de triggers - */ - function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'development') return $langs->trans("Development"); - elseif ($this->version == 'experimental') return $langs->trans("Experimental"); - elseif ($this->version == 'dolibarr') return DOL_VERSION; - elseif ($this->version) return $this->version; - else return $langs->trans("Unknown"); - } - - /** - * Fonction appelee lors du declenchement d'un evenement Dolibarr. - * D'autres fonctions run_trigger peuvent etre presentes dans core/triggers - * - * @param string $action Code de l'evenement - * @param CommonObject $object Objet concerne - * @param User $user Objet user - * @param Translate $lang Objet lang - * @param Conf $conf Objet conf - * @return int <0 if fatal error, 0 si nothing done, >0 if ok - */ - function run_trigger($action,$object,$user,$langs,$conf) - { - // Mettre ici le code a executer en reaction de l'action - // Les donnees de l'action sont stockees dans $object - - if ($action == 'PAYPAL_PAYMENT_OK') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". source=".$object->source." ref=".$object->ref); - - require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); - - $soc = new Societe($this->db); - - // Parse element/subelement (ex: project_task) - $element = $path = $filename = $object->source; - if (preg_match('/^([^_]+)_([^_]+)/i',$object->source,$regs)) - { - $element = $path = $regs[1]; - $filename = $regs[2]; - } - // For compatibility - if ($element == 'order') { $path = $filename = 'commande'; } - if ($element == 'invoice') { $path = 'compta/facture'; $filename = 'facture'; } - - dol_include_once('/'.$path.'/class/'.$filename.'.class.php'); - - $classname = ucfirst($filename); - $obj = new $classname($this->db); - - $ret = $obj->fetch('',$object->ref); - if ($ret < 0) return -1; - - // Add payer id - $soc->setValueFrom('ref_int', $object->payerID, 'societe', $obj->socid); - - // Add transaction id - $obj->setValueFrom('ref_int',$object->resArray["TRANSACTIONID"]); - - } - - return 0; - } - -} -?> diff --git a/htdocs/core/triggers/interface_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_modWorkflow_WorkflowManager.class.php deleted file mode 100755 index a123bd63842..00000000000 --- a/htdocs/core/triggers/interface_modWorkflow_WorkflowManager.class.php +++ /dev/null @@ -1,134 +0,0 @@ - - * Copyright (C) 2011 Laurent Destailleur - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/core/triggers/interface_modWorkflow_WorkflowManager.class.php - * \ingroup core - * \brief Trigger file for workflows - */ - - -/** - * \class InterfaceWorkflowManager - * \brief Class of triggers for workflow module - */ - -class InterfaceWorkflowManager -{ - var $db; - - /** - * Constructor. - * @param DB Database handler - */ - function InterfaceWorkflowManager($DB) - { - $this->db = $DB ; - - $this->name = preg_replace('/^Interface/i','',get_class($this)); - $this->family = "core"; - $this->description = "Triggers of this module allows to manage workflows"; - $this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version - $this->picto = 'technic'; - } - - - /** - * Return name of trigger file - * @return string Name of trigger file - */ - function getName() - { - return $this->name; - } - - /** - * Return description of trigger file - * @return string Description of trigger file - */ - function getDesc() - { - return $this->description; - } - - /** - * Return version of trigger file - * @return string Version of trigger file - */ - function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'development') return $langs->trans("Development"); - elseif ($this->version == 'experimental') return $langs->trans("Experimental"); - elseif ($this->version == 'dolibarr') return DOL_VERSION; - elseif ($this->version) return $this->version; - else return $langs->trans("Unknown"); - } - - /** - * Function called when a Dolibarrr business event is done. - * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers - * - * @param action Event code (COMPANY_CREATE, PROPAL_VALIDATE, ...) - * @param object Object action is done on - * @param user Object user - * @param langs Object langs - * @param conf Object conf - * @return int <0 if KO, 0 if no action are done, >0 if OK - */ - function run_trigger($action,$object,$user,$langs,$conf) - { - if (empty($conf->workflow->enabled)) return 0; // Module not active, we do nothing - - // Proposals to order - if ($action == 'PROPAL_CLOSE_SIGNED') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (! empty($conf->commande->enabled) && ! empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER)) - { - include_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'); - $newobject = new Commande($this->db); - - $ret=$newobject->createFromProposal($object); - if ($ret < 0) { $this->error=$newobject->error; $this->errors[]=$newobject->error; } - return $ret; - } - } - - // Order to invoice - if ($action == 'ORDER_CLOSE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (! empty($conf->facture->enabled) && ! empty($conf->global->WORKFLOW_ORDER_AUTOCREATE_INVOICE)) - { - include_once(DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'); - $newobject = new Facture($this->db); - - $ret=$newobject->createFromOrder($object); - if ($ret < 0) { $this->error=$newobject->error; $this->errors[]=$newobject->error; } - return $ret; - } - } - - return 0; - } - -} -?> diff --git a/htdocs/install/mysql/tables/llx_events.sql b/htdocs/install/mysql/tables/llx_events.sql index 7edd4174538..7425a4e5e68 100644 --- a/htdocs/install/mysql/tables/llx_events.sql +++ b/htdocs/install/mysql/tables/llx_events.sql @@ -18,7 +18,7 @@ -- ======================================================================== -- This table logs all dolibarr security events -- Content of this table is not managed by users but by Dolibarr --- trigger interface_all_LogEvent. +-- trigger interface_20_all_Logevents. -- ======================================================================== create table llx_events diff --git a/htdocs/societe/notify/fiche.php b/htdocs/societe/notify/fiche.php index e931b35d570..18ce7e898a7 100644 --- a/htdocs/societe/notify/fiche.php +++ b/htdocs/societe/notify/fiche.php @@ -26,7 +26,7 @@ require("../../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php"); -require_once(DOL_DOCUMENT_ROOT."/core/triggers/interface_modNotification_Notification.class.php"); +require_once(DOL_DOCUMENT_ROOT."/core/triggers/interface_50_modNotification_Notification.class.php"); $langs->load("companies"); $langs->load("mails"); diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 8735efe5fdc..42aa4644afb 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -383,7 +383,7 @@ a.tmenu:link, a.tmenu:visited, a.tmenu:hover, a.tmenu:active { padding: 0px 5px 0px 5px; margin: 0px 1px 2px 1px; white-space: nowrap; - text-shadow: 1px 2px 3px #AFAFAF; + text-shadow: 1px 2px 4px #BFBFBF; } a.tmenu:hover, a.tmenu:active { margin: 0px 0px 0px 0px; @@ -394,7 +394,7 @@ a.tmenu:hover, a.tmenu:active { } a.tmenu:hover, a.tmenu:active { background: #F4F4F4; - text-shadow: 1px 2px 3px #AFAFAF; + text-shadow: 1px 2px 4px #BFBFBF; } a.tmenusel:link, a.tmenusel:visited, a.tmenusel:hover, a.tmenusel:active { @@ -408,7 +408,7 @@ a.tmenusel:link, a.tmenusel:visited, a.tmenusel:hover, a.tmenusel:active { border-: 1px solid #D8D8D8; border-bottom: 2px solid #F4F4F4; white-space: nowrap; - text-shadow: 1px 2px 3px #AFAFAF; + text-shadow: 1px 2px 4px #BFBFBF; } @@ -1693,7 +1693,7 @@ div.titre { font-weight: bold; color: rgb(); text-decoration: none; - text-shadow: 1px 2px 3px #AFAFAF; + text-shadow: 2px 2px 4px #BFBFBF; } From bf8c0226393ba4cbe26bc59a0b47053f98d721d7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Jan 2012 20:32:52 +0100 Subject: [PATCH 19/21] New: Trigger now have a priority to define sort execution order. --- .../interface_20_all_Logevents.class.php | 256 ++++++++ ...face_20_modPaypal_PaypalWorkflow.class.php | 139 ++++ ...e_20_modWorkflow_WorkflowManager.class.php | 135 ++++ ...terface_50_modAgenda_ActionsAuto.class.php | 599 ++++++++++++++++++ ...interface_50_modLdap_Ldapsynchro.class.php | 537 ++++++++++++++++ ..._50_modNotification_Notification.class.php | 257 ++++++++ .../interface_90_all_Demo.class.php-NORUN | 527 +++++++++++++++ 7 files changed, 2450 insertions(+) create mode 100755 htdocs/core/triggers/interface_20_all_Logevents.class.php create mode 100755 htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php create mode 100755 htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php create mode 100755 htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php create mode 100755 htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php create mode 100755 htdocs/core/triggers/interface_50_modNotification_Notification.class.php create mode 100755 htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php new file mode 100755 index 00000000000..508cfa19541 --- /dev/null +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -0,0 +1,256 @@ + + * Copyright (C) 2009 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/triggers/interface_20_all_Logevents.class.php + * \ingroup core + * \brief Trigger file for + */ + + +/** + * \class InterfaceLogevents + * \brief Class of triggers for security events + */ +class InterfaceLogevents +{ + var $db; + var $error; + + var $date; + var $duree; + var $texte; + var $desc; + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function InterfaceLogevents($db) + { + $this->db = $db; + + $this->name = preg_replace('/^Interface/i','',get_class($this)); + $this->family = "core"; + $this->description = "Triggers of this module allows to add security event records inside Dolibarr."; + $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + $this->picto = 'technic'; + } + + /** + * Return name of trigger file + * @return string Name of trigger file + */ + function getName() + { + return $this->name; + } + + /** + * Return description of trigger file + * @return string Description of trigger file + */ + function getDesc() + { + return $this->description; + } + + /** + * Return version of trigger file + * @return string Version of trigger file + */ + function getVersion() + { + global $langs; + $langs->load("admin"); + + if ($this->version == 'experimental') return $langs->trans("Experimental"); + elseif ($this->version == 'dolibarr') return DOL_VERSION; + elseif ($this->version) return $this->version; + else return $langs->trans("Unknown"); + } + + /** + * Function called when a Dolibarrr business event is done. + * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers + * @param action Code de l'evenement + * @param object Objet concerne + * @param user Objet user + * @param langs Objet langs + * @param conf Objet conf + * @param entity Value for instance of data (Always 1 except if module MultiCompany is installed) + * @return int <0 if KO, 0 if no triggered ran, >0 if OK + */ + function run_trigger($action,$object,$user,$langs,$conf,$entity=1) + { + if (! empty($conf->global->MAIN_LOGEVENTS_DISABLE_ALL)) return 0; // Log events is disabled (hidden features) + + $key='MAIN_LOGEVENTS_'.$action; + //dol_syslog("xxxxxxxxxxx".$key); + if (empty($conf->global->$key)) return 0; // Log events not enabled for this action + + if (empty($conf->entity)) $conf->entity = $entity; // forcing of the entity if it's not defined (ex: in login form) + + $this->date=gmmktime(); + $this->duree=0; + + // Actions + if ($action == 'USER_LOGIN') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + + // Initialisation donnees (date,duree,texte,desc) + $this->texte="(UserLogged,".$object->login.")"; + $this->desc="(UserLogged,".$object->login.")"; + } + if ($action == 'USER_LOGIN_FAILED') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + + // Initialisation donnees (date,duree,texte,desc) + $this->texte=$object->trigger_mesg; // Message direct + $this->desc=$object->trigger_mesg; // Message direct + } + if ($action == 'USER_LOGOUT') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + + // Initialisation donnees (date,duree,texte,desc) + $this->texte="(UserLogoff,".$object->login.")"; + $this->desc="(UserLogoff,".$object->login.")"; + } + if ($action == 'USER_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("users"); + + // Initialisation donnees (date,duree,texte,desc) + $this->texte=$langs->transnoentities("NewUserCreated",$object->login); + $this->desc=$langs->transnoentities("NewUserCreated",$object->login); + } + elseif ($action == 'USER_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("users"); + + // Initialisation donnees (date,duree,texte,desc) + $this->texte=$langs->transnoentities("EventUserModified",$object->login); + $this->desc=$langs->transnoentities("EventUserModified",$object->login); + } + elseif ($action == 'USER_NEW_PASSWORD') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("users"); + + // Initialisation donnees (date,duree,texte,desc) + $this->texte=$langs->transnoentities("NewUserPassword",$object->login); + $this->desc=$langs->transnoentities("NewUserPassword",$object->login); + } + elseif ($action == 'USER_ENABLEDISABLE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("users"); + // Initialisation donnees (date,duree,texte,desc) + if ($object->statut == 0) + { + $this->texte=$langs->transnoentities("UserEnabled",$object->login); + $this->desc=$langs->transnoentities("UserEnabled",$object->login); + } + if ($object->statut == 1) + { + $this->texte=$langs->transnoentities("UserDisabled",$object->login); + $this->desc=$langs->transnoentities("UserDisabled",$object->login); + } + } + elseif ($action == 'USER_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("users"); + // Initialisation donnees (date,duree,texte,desc) + $this->texte=$langs->transnoentities("UserDeleted",$object->login); + $this->desc=$langs->transnoentities("UserDeleted",$object->login); + } + + // Groupes + elseif ($action == 'GROUP_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("users"); + // Initialisation donnees (date,duree,texte,desc) + $this->texte=$langs->transnoentities("NewGroupCreated",$object->nom); + $this->desc=$langs->transnoentities("NewGroupCreated",$object->nom); + } + elseif ($action == 'GROUP_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("users"); + // Initialisation donnees (date,duree,texte,desc) + $this->texte=$langs->transnoentities("GroupModified",$object->nom); + $this->desc=$langs->transnoentities("GroupModified",$object->nom); + } + elseif ($action == 'GROUP_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("users"); + // Initialisation donnees (date,duree,texte,desc) + $this->texte=$langs->transnoentities("GroupDeleted",$object->nom); + $this->desc=$langs->transnoentities("GroupDeleted",$object->nom); + } + + // If not found +/* + else + { + dol_syslog("Trigger '".$this->name."' for action '$action' was ran by ".__FILE__." but no handler found for this action."); + return 0; + } +*/ + + // Add entry in event table + if ($this->date) + { + include_once(DOL_DOCUMENT_ROOT.'/core/class/events.class.php'); + + $event=new Events($this->db); + $event->type=$action; + $event->dateevent=$this->date; + $event->label=$this->texte; + $event->description=$this->desc; + $event->user_agent=$_SERVER["HTTP_USER_AGENT"]; + + $result=$event->create($user); + if ($result > 0) + { + return 1; + } + else + { + $error ="Failed to insert security event: ".$event->error; + $this->error=$error; + + dol_syslog(get_class($this).": ".$this->error, LOG_ERR); + return -1; + } + } + + return 0; + } + +} +?> diff --git a/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php b/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php new file mode 100755 index 00000000000..219087a0922 --- /dev/null +++ b/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php @@ -0,0 +1,139 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file /htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php + * \ingroup paypal + * \brief Trigger file for paypal workflow + */ + + +/** + * \class InterfacePaypalWorkflow + * \brief Class of triggers for paypal module + */ +class InterfacePaypalWorkflow +{ + var $db; + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function InterfacePaypalWorkflow($db) + { + $this->db = $db; + + $this->name = preg_replace('/^Interface/i','',get_class($this)); + $this->family = "paypal"; + $this->description = "Triggers of this module allows to manage paypal workflow"; + $this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version + $this->picto = 'paypal@paypal'; + } + + + /** + * \brief Renvoi nom du lot de triggers + * \return string Nom du lot de triggers + */ + function getName() + { + return $this->name; + } + + /** + * \brief Renvoi descriptif du lot de triggers + * \return string Descriptif du lot de triggers + */ + function getDesc() + { + return $this->description; + } + + /** + * \brief Renvoi version du lot de triggers + * \return string Version du lot de triggers + */ + function getVersion() + { + global $langs; + $langs->load("admin"); + + if ($this->version == 'development') return $langs->trans("Development"); + elseif ($this->version == 'experimental') return $langs->trans("Experimental"); + elseif ($this->version == 'dolibarr') return DOL_VERSION; + elseif ($this->version) return $this->version; + else return $langs->trans("Unknown"); + } + + /** + * Fonction appelee lors du declenchement d'un evenement Dolibarr. + * D'autres fonctions run_trigger peuvent etre presentes dans core/triggers + * + * @param string $action Code de l'evenement + * @param CommonObject $object Objet concerne + * @param User $user Objet user + * @param Translate $lang Objet lang + * @param Conf $conf Objet conf + * @return int <0 if fatal error, 0 si nothing done, >0 if ok + */ + function run_trigger($action,$object,$user,$langs,$conf) + { + // Mettre ici le code a executer en reaction de l'action + // Les donnees de l'action sont stockees dans $object + + if ($action == 'PAYPAL_PAYMENT_OK') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". source=".$object->source." ref=".$object->ref); + + require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); + + $soc = new Societe($this->db); + + // Parse element/subelement (ex: project_task) + $element = $path = $filename = $object->source; + if (preg_match('/^([^_]+)_([^_]+)/i',$object->source,$regs)) + { + $element = $path = $regs[1]; + $filename = $regs[2]; + } + // For compatibility + if ($element == 'order') { $path = $filename = 'commande'; } + if ($element == 'invoice') { $path = 'compta/facture'; $filename = 'facture'; } + + dol_include_once('/'.$path.'/class/'.$filename.'.class.php'); + + $classname = ucfirst($filename); + $obj = new $classname($this->db); + + $ret = $obj->fetch('',$object->ref); + if ($ret < 0) return -1; + + // Add payer id + $soc->setValueFrom('ref_int', $object->payerID, 'societe', $obj->socid); + + // Add transaction id + $obj->setValueFrom('ref_int',$object->resArray["TRANSACTIONID"]); + + } + + return 0; + } + +} +?> diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php new file mode 100755 index 00000000000..4d9c5a42ac0 --- /dev/null +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -0,0 +1,135 @@ + + * Copyright (C) 2011 Laurent Destailleur + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php + * \ingroup core + * \brief Trigger file for workflows + */ + + +/** + * \class InterfaceWorkflowManager + * \brief Class of triggers for workflow module + */ + +class InterfaceWorkflowManager +{ + var $db; + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function InterfaceWorkflowManager($db) + { + $this->db = $db; + + $this->name = preg_replace('/^Interface/i','',get_class($this)); + $this->family = "core"; + $this->description = "Triggers of this module allows to manage workflows"; + $this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version + $this->picto = 'technic'; + } + + + /** + * Return name of trigger file + * @return string Name of trigger file + */ + function getName() + { + return $this->name; + } + + /** + * Return description of trigger file + * @return string Description of trigger file + */ + function getDesc() + { + return $this->description; + } + + /** + * Return version of trigger file + * @return string Version of trigger file + */ + function getVersion() + { + global $langs; + $langs->load("admin"); + + if ($this->version == 'development') return $langs->trans("Development"); + elseif ($this->version == 'experimental') return $langs->trans("Experimental"); + elseif ($this->version == 'dolibarr') return DOL_VERSION; + elseif ($this->version) return $this->version; + else return $langs->trans("Unknown"); + } + + /** + * Function called when a Dolibarrr business event is done. + * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers + * + * @param action Event code (COMPANY_CREATE, PROPAL_VALIDATE, ...) + * @param object Object action is done on + * @param user Object user + * @param langs Object langs + * @param conf Object conf + * @return int <0 if KO, 0 if no action are done, >0 if OK + */ + function run_trigger($action,$object,$user,$langs,$conf) + { + if (empty($conf->workflow->enabled)) return 0; // Module not active, we do nothing + + // Proposals to order + if ($action == 'PROPAL_CLOSE_SIGNED') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + if (! empty($conf->commande->enabled) && ! empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER)) + { + include_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'); + $newobject = new Commande($this->db); + + $ret=$newobject->createFromProposal($object); + if ($ret < 0) { $this->error=$newobject->error; $this->errors[]=$newobject->error; } + return $ret; + } + } + + // Order to invoice + if ($action == 'ORDER_CLOSE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + if (! empty($conf->facture->enabled) && ! empty($conf->global->WORKFLOW_ORDER_AUTOCREATE_INVOICE)) + { + include_once(DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'); + $newobject = new Facture($this->db); + + $ret=$newobject->createFromOrder($object); + if ($ret < 0) { $this->error=$newobject->error; $this->errors[]=$newobject->error; } + return $ret; + } + } + + return 0; + } + +} +?> diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php new file mode 100755 index 00000000000..77d4755134e --- /dev/null +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -0,0 +1,599 @@ + + * Copyright (C) 2009-2011 Regis Houssin + * Copyright (C) 2011 Juanjo Menent + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php + * \ingroup agenda + * \brief Trigger file for agenda module + */ + + +/** + * \class InterfaceActionsAuto + * \brief Class of triggered functions for agenda module + */ +class InterfaceActionsAuto +{ + var $db; + var $error; + + var $date; + var $duree; + var $texte; + var $desc; + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function InterfaceActionsAuto($db) + { + $this->db = $db; + + $this->name = preg_replace('/^Interface/i','',get_class($this)); + $this->family = "agenda"; + $this->description = "Triggers of this module add actions in agenda according to setup made in agenda setup."; + $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + $this->picto = 'action'; + } + + /** + * Return name of trigger file + * @return string Name of trigger file + */ + function getName() + { + return $this->name; + } + + /** + * Return description of trigger file + * @return string Description of trigger file + */ + function getDesc() + { + return $this->description; + } + + /** + * Return version of trigger file + * @return string Version of trigger file + */ + function getVersion() + { + global $langs; + $langs->load("admin"); + + if ($this->version == 'experimental') return $langs->trans("Experimental"); + elseif ($this->version == 'dolibarr') return DOL_VERSION; + elseif ($this->version) return $this->version; + else return $langs->trans("Unknown"); + } + + /** + * Function called when a Dolibarrr business event is done. + * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers + * + * Following properties must be filled: + * $object->actiontypecode (translation action code: AC_OTH, ...) + * $object->actionmsg (note, long text) + * $object->actionmsg2 (label, short text) + * $object->sendtoid (id of contact) + * $object->socid + * Optionnal: + * $object->fk_element + * $object->elementtype + * + * @param action Event code (COMPANY_CREATE, PROPAL_VALIDATE, ...) + * @param object Object action is done on + * @param user Object user + * @param langs Object langs + * @param conf Object conf + * @return int <0 if KO, 0 if no action are done, >0 if OK + */ + function run_trigger($action,$object,$user,$langs,$conf) + { + $key='MAIN_AGENDA_ACTIONAUTO_'.$action; + //dol_syslog("xxxxxxxxxxx".$key); + + if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing + if (empty($conf->global->$key)) return 0; // Log events not enabled for this action + + $ok=0; + + // Actions + if ($action == 'COMPANY_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("other"); + $langs->load("agenda"); + + $object->actiontypecode='AC_OTH'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("NewCompanyToDolibarr",$object->nom); + $object->actionmsg=$langs->transnoentities("NewCompanyToDolibarr",$object->nom); + if ($object->prefix) $object->actionmsg.=" (".$object->prefix.")"; + //$this->desc.="\n".$langs->transnoentities("Customer").': '.yn($object->client); + //$this->desc.="\n".$langs->transnoentities("Supplier").': '.yn($object->fournisseur); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $object->socid=$object->id; + $ok=1; + } + elseif ($action == 'CONTRACT_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("other"); + $langs->load("contracts"); + $langs->load("agenda"); + + $object->actiontypecode='AC_OTH'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractValidatedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("ContractValidatedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $ok=1; + } + elseif ($action == 'PROPAL_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("propal"); + $langs->load("agenda"); + + $object->actiontypecode='AC_OTH'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("PropalValidatedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $ok=1; + } + elseif ($action == 'PROPAL_SENTBYMAIL') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("propal"); + $langs->load("agenda"); + + $object->actiontypecode='AC_EMAIL'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail",$object->ref); + if (empty($object->actionmsg)) + { + $object->actionmsg=$langs->transnoentities("ProposalSentByEMail",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + } + + // Parameters $object->sendtoid defined by caller + //$object->sendtoid=0; + $ok=1; + } + elseif ($action == 'PROPAL_CLOSE_SIGNED') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("propal"); + $langs->load("agenda"); + + $object->actiontypecode='AC_OTH'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $ok=1; + } + elseif ($action == 'PROPAL_CLOSE_REFUSED') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("propal"); + $langs->load("agenda"); + + $object->actiontypecode='AC_OTH'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $ok=1; + } + elseif ($action == 'ORDER_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("orders"); + $langs->load("agenda"); + + $object->actiontypecode='AC_OTH'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $ok=1; + } + elseif ($action == 'ORDER_SENTBYMAIL') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("orders"); + $langs->load("agenda"); + + $object->actiontypecode='AC_EMAIL'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderSentByEMail",$object->ref); + if (empty($object->actionmsg)) + { + $object->actionmsg=$langs->transnoentities("OrderSentByEMail",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + } + + // Parameters $object->sendtoid defined by caller + //$object->sendtoid=0; + $ok=1; + } + elseif ($action == 'BILL_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("other"); + $langs->load("bills"); + $langs->load("agenda"); + + $object->actiontypecode='AC_OTH'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $ok=1; + } + elseif ($action == 'BILL_SENTBYMAIL') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("other"); + $langs->load("bills"); + $langs->load("agenda"); + + $object->actiontypecode='AC_EMAIL'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceSentByEMail",$object->ref); + if (empty($object->actionmsg)) + { + $object->actionmsg=$langs->transnoentities("InvoiceSentByEMail",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + } + + // Parameters $object->sendtoid defined by caller + //$object->sendtoid=0; + $ok=1; + } + elseif ($action == 'BILL_PAYED') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("other"); + $langs->load("bills"); + $langs->load("agenda"); + + $object->actiontypecode='AC_OTH'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $ok=1; + } + elseif ($action == 'BILL_CANCEL') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("other"); + $langs->load("bills"); + $langs->load("agenda"); + + $object->actiontypecode='AC_OTH'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $ok=1; + } + elseif ($action == 'FICHEINTER_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("other"); + $langs->load("interventions"); + $langs->load("agenda"); + + $object->actiontypecode='AC_OTH'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionValidatedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("InterventionValidatedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $object->fk_element=0; + $object->elementtype=''; + $ok=1; + } + elseif ($action == 'FICHEINTER_SENTBYMAIL') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("other"); + $langs->load("interventions"); + $langs->load("agenda"); + + $object->actiontypecode='AC_EMAIL'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionSentByEMail",$object->ref); + $object->actionmsg=$langs->transnoentities("InterventionSentByEMail",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + // Parameters $object->sendotid defined by caller + //$object->sendtoid=0; + $ok=1; + } + elseif ($action == 'SHIPPING_SENTBYMAIL') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("other"); + $langs->load("sendings"); + $langs->load("agenda"); + + $object->actiontypecode='AC_SHIP'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingSentByEMail",$object->ref); + if (empty($object->actionmsg)) + { + $object->actionmsg=$langs->transnoentities("ShippingSentByEMail",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + } + + // Parameters $object->sendtoid defined by caller + //$object->sendtoid=0; + $ok=1; + } + elseif ($action == 'ORDER_SUPPLIER_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("orders"); + $langs->load("agenda"); + + $object->actiontypecode='AC_OTH'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $ok=1; + } + elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("other"); + $langs->load("bills"); + $langs->load("agenda"); + $langs->load("orders"); + + $object->actiontypecode='AC_EMAIL'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderSentByEMail",$object->ref); + if (empty($object->actionmsg)) + { + $object->actionmsg=$langs->transnoentities("SupplierOrderSentByEMail",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + } + + // Parameters $object->sendotid defined by caller + //$object->sendtoid=0; + $ok=1; + } + elseif ($action == 'BILL_SUPPLIER_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("other"); + $langs->load("bills"); + $langs->load("agenda"); + + $object->actiontypecode='AC_OTH'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $ok=1; + } + elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("other"); + $langs->load("bills"); + $langs->load("agenda"); + $langs->load("orders"); + + $object->actiontypecode='AC_EMAIL'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierInvoiceSentByEMail",$object->ref); + if (empty($object->actionmsg)) + { + $object->actionmsg=$langs->transnoentities("SupplierInvoiceSentByEMail",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + } + + // Parameters $object->sendtoid defined by caller + //$object->sendtoid=0; + $ok=1; + } + elseif ($action == 'BILL_SUPPLIER_PAYED') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("other"); + $langs->load("bills"); + $langs->load("agenda"); + + $object->actiontypecode='AC_OTH'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $ok=1; + } + elseif ($action == 'BILL_SUPPLIER_CANCELED') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("other"); + $langs->load("bills"); + $langs->load("agenda"); + + $object->actiontypecode='AC_OTH'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $ok=1; + } + + // Members + elseif ($action == 'MEMBER_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("other"); + $langs->load("members"); + $langs->load("agenda"); + + $object->actiontypecode='AC_OTH'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberValidatedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("MemberValidatedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); + $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $ok=1; + } + elseif ($action == 'MEMBER_SUBSCRIPTION') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("other"); + $langs->load("members"); + $langs->load("agenda"); + + $object->actiontypecode='AC_OTH'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); + $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; + $object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount; + $object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start,'day').' - '.dol_print_date($object->last_subscription_date_end,'day'); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $ok=1; + } + elseif ($action == 'MEMBER_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'MEMBER_RESILIATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("other"); + $langs->load("members"); + $langs->load("agenda"); + + $object->actiontypecode='AC_OTH'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberResiliatedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("MemberResiliatedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); + $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $ok=1; + } + elseif ($action == 'MEMBER_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("other"); + $langs->load("members"); + $langs->load("agenda"); + + $object->actiontypecode='AC_OTH'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberDeletedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("MemberDeletedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); + $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $ok=1; + } + + // If not found + /* + else + { + dol_syslog("Trigger '".$this->name."' for action '$action' was ran by ".__FILE__." but no handler found for this action."); + return 0; + } + */ + + // Add entry in event table + if ($ok) + { + $now=dol_now(); + + require_once(DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'); + require_once(DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'); + $contactforaction=new Contact($this->db); + $societeforaction=new Societe($this->db); + if ($object->sendtoid > 0) $contactforaction->fetch($object->sendtoid); + if ($object->socid > 0) $societeforaction->fetch($object->socid); + + // Insertion action + require_once(DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'); + $actioncomm = new ActionComm($this->db); + $actioncomm->type_code = $object->actiontypecode; + $actioncomm->label = $object->actionmsg2; + $actioncomm->note = $object->actionmsg; + $actioncomm->datep = $now; + $actioncomm->datef = $now; + $actioncomm->durationp = 0; + $actioncomm->punctual = 1; + $actioncomm->percentage = -1; // Not applicable + $actioncomm->contact = $contactforaction; + $actioncomm->societe = $societeforaction; + $actioncomm->author = $user; // User saving action + //$actioncomm->usertodo = $user; // User affected to action + $actioncomm->userdone = $user; // User doing action + + $actioncomm->fk_element = $object->id; + $actioncomm->elementtype = $object->element; + + $ret=$actioncomm->add($user); // User qui saisit l'action + if ($ret > 0) + { + return 1; + } + else + { + $error ="Failed to insert : ".$actioncomm->error." "; + $this->error=$error; + + dol_syslog("interface_modAgenda_ActionsAuto.class.php: ".$this->error, LOG_ERR); + return -1; + } + } + + return 0; + } + +} +?> diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php new file mode 100755 index 00000000000..89595d96169 --- /dev/null +++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php @@ -0,0 +1,537 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php + * \ingroup core + * \brief Fichier de gestion des triggers LDAP + */ +require_once (DOL_DOCUMENT_ROOT."/core/class/ldap.class.php"); + + +/** + * \class InterfaceLdapsynchro + * \brief Class of triggers for ldap module + */ +class InterfaceLdapsynchro +{ + var $db; + var $error; + + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function InterfaceLdapsynchro($db) + { + $this->db = $db; + + $this->name = preg_replace('/^Interface/i','',get_class($this)); + $this->family = "ldap"; + $this->description = "Triggers of this module allows to synchronize Dolibarr toward a LDAP database."; + $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + $this->picto = 'technic'; + } + + /** + * Return name of trigger file + * @return string Name of trigger file + */ + function getName() + { + return $this->name; + } + + /** + * Return description of trigger file + * @return string Description of trigger file + */ + function getDesc() + { + return $this->description; + } + + /** + * Return version of trigger file + * @return string Version of trigger file + */ + function getVersion() + { + global $langs; + $langs->load("admin"); + + if ($this->version == 'experimental') return $langs->trans("Experimental"); + elseif ($this->version == 'dolibarr') return DOL_VERSION; + elseif ($this->version) return $this->version; + else return $langs->trans("Unknown"); + } + + /** + * Function called when a Dolibarrr business event is done. + * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers + * @param action Event code (COMPANY_CREATE, PROPAL_VALIDATE, ...) + * @param object Object action is done on + * @param user Object user + * @param langs Object langs + * @param conf Object conf + * @return int <0 if KO, 0 if no action are done, >0 if OK + */ + function run_trigger($action,$object,$user,$langs,$conf) + { + if (empty($conf->ldap->enabled)) return 0; // Module not active, we do nothing + + if (! function_exists('ldap_connect')) + { + dol_syslog("Warning, module LDAP is enabled but LDAP functions not available in this PHP", LOG_WARNING); + return 0; + } + + // Users + if ($action == 'USER_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') + { + $ldap=new Ldap(); + $ldap->connect_bind(); + + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info); + + $result=$ldap->add($dn,$info,$user); + if ($result < 0) + { + $this->error="ErrorLDAP"." ".$ldap->error; + } + return $result; + } + } + elseif ($action == 'USER_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') + { + $ldap=new Ldap(); + $ldap->connect_bind(); + + $oldinfo=$object->oldcopy->_load_ldap_info(); + $olddn=$object->oldcopy->_load_ldap_dn($oldinfo); + + // Verify if entry exist + $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); + $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; + $records=$ldap->search($container,$search); + if (count($records) && $records['count'] == 0) + { + $olddn = ''; + } + + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info); + + $result=$ldap->update($dn,$info,$user,$olddn); + if ($result < 0) + { + $this->error="ErrorLDAP"." ".$ldap->error; + } + return $result; + } + } + elseif ($action == 'USER_NEW_PASSWORD') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') + { + $ldap=new Ldap(); + $ldap->connect_bind(); + + $oldinfo=$object->oldcopy->_load_ldap_info(); + $olddn=$object->oldcopy->_load_ldap_dn($oldinfo); + + // Verify if entry exist + $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); + $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; + $records=$ldap->search($container,$search); + if (count($records) && $records['count'] == 0) + { + $olddn = ''; + } + + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info); + + $result=$ldap->update($dn,$info,$user,$olddn); + if ($result < 0) + { + $this->error="ErrorLDAP"." ".$ldap->error; + } + return $result; + } + } + elseif ($action == 'USER_ENABLEDISABLE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'USER_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') + { + $ldap=new Ldap(); + $ldap->connect_bind(); + + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info); + + $result=$ldap->delete($dn,$info,$user); + if ($result < 0) + { + $this->error="ErrorLDAP"." ".$ldap->error; + } + return $result; + } + } + + // Groupes + elseif ($action == 'GROUP_CREATE') + { + if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') + { + $ldap=new Ldap(); + $ldap->connect_bind(); + + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info); + + // Get a gid number for objectclass PosixGroup + if(in_array('posixGroup',$info['objectclass'])) + $info['gidNumber'] = $ldap->getNextGroupGid(); + + $result=$ldap->add($dn,$info,$user); + if ($result < 0) + { + $this->error="ErrorLDAP"." ".$ldap->error; + } + return $result; + } + } + elseif ($action == 'GROUP_MODIFY') + { + if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') + { + $ldap=new Ldap(); + $ldap->connect_bind(); + + $oldinfo=$object->oldcopy->_load_ldap_info(); + $olddn=$object->oldcopy->_load_ldap_dn($oldinfo); + + // Verify if entry exist + $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); + $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; + $records=$ldap->search($container,$search); + if (count($records) && $records['count'] == 0) + { + $olddn = ''; + } + + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info); + + $result=$ldap->update($dn,$info,$user,$olddn); + if ($result < 0) + { + $this->error="ErrorLDAP"." ".$ldap->error; + } + return $result; + } + } + elseif ($action == 'GROUP_DELETE') + { + if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') + { + $ldap=new Ldap(); + $ldap->connect_bind(); + + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info); + + $result=$ldap->delete($dn,$info,$user); + if ($result < 0) + { + $this->error="ErrorLDAP"." ".$ldap->error; + } + return $result; + } + } + + // Contacts + elseif ($action == 'CONTACT_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + if ($conf->ldap->enabled && $conf->global->LDAP_CONTACT_ACTIVE) + { + $ldap=new Ldap(); + $ldap->connect_bind(); + + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info); + + $result=$ldap->add($dn,$info,$user); + if ($result < 0) + { + $this->error="ErrorLDAP"." ".$ldap->error; + } + return $result; + } + } + elseif ($action == 'CONTACT_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + if ($conf->ldap->enabled && $conf->global->LDAP_CONTACT_ACTIVE) + { + $ldap=new Ldap(); + $ldap->connect_bind(); + + $oldinfo=$object->oldcopy->_load_ldap_info(); + $olddn=$object->oldcopy->_load_ldap_dn($oldinfo); + + // Verify if entry exist + $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); + $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; + $records=$ldap->search($container,$search); + if (count($records) && $records['count'] == 0) + { + $olddn = ''; + } + + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info); + + $result=$ldap->update($dn,$info,$user,$olddn); + if ($result < 0) + { + $this->error="ErrorLDAP"." ".$ldap->error; + } + return $result; + } + } + elseif ($action == 'CONTACT_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + if ($conf->ldap->enabled && $conf->global->LDAP_CONTACT_ACTIVE) + { + $ldap=new Ldap(); + $ldap->connect_bind(); + + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info); + + $result=$ldap->delete($dn,$info,$user); + if ($result < 0) + { + $this->error="ErrorLDAP"." ".$ldap->error; + } + return $result; + } + } + + // Members + elseif ($action == 'MEMBER_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE) + { + $ldap=new Ldap(); + $ldap->connect_bind(); + + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info); + + $result=$ldap->add($dn,$info,$user); + if ($result < 0) + { + $this->error="ErrorLDAP"." ".$ldap->error; + } + return $result; + } + } + elseif ($action == 'MEMBER_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE) + { + // If status field is setup to be synchronized + if ($conf->global->LDAP_FIELD_MEMBER_STATUS) + { + $ldap=new Ldap(); + $ldap->connect_bind(); + + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info); + $olddn=$dn; // We know olddn=dn as we change only status + + $result=$ldap->update($dn,$info,$user,$olddn); + if ($result < 0) + { + $this->error="ErrorLDAP"." ".$ldap->error; + } + return $result; + } + } + } + elseif ($action == 'MEMBER_SUBSCRIPTION') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE) + { + // If subscriptions fields are setup to be synchronized + if ($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE + || $conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT + || $conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE + || $conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT + || $conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION) + { + $ldap=new Ldap(); + $ldap->connect_bind(); + + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info); + $olddn=$dn; // We know olddn=dn as we change only subscriptions + + $result=$ldap->update($dn,$info,$user,$olddn); + if ($result < 0) + { + $this->error="ErrorLDAP"." ".$ldap->error; + } + return $result; + } + } + } + elseif ($action == 'MEMBER_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE) + { + $ldap=new Ldap(); + $ldap->connect_bind(); + + $oldinfo=$object->oldcopy->_load_ldap_info(); + $olddn=$object->oldcopy->_load_ldap_dn($oldinfo); + + // Verify if entry exist + $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); + $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; + $records=$ldap->search($container,$search); + if (count($records) && $records['count'] == 0) + { + $olddn = ''; + } + + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info); + + $result=$ldap->update($dn,$info,$user,$olddn); + if ($result < 0) + { + $this->error="ErrorLDAP"." ".$ldap->error; + } + return $result; + } + } + elseif ($action == 'MEMBER_NEW_PASSWORD') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE) + { + // If password field is setup to be synchronized + if ($conf->global->LDAP_FIELD_PASSWORD || $conf->global->LDAP_FIELD_PASSWORD_CRYPTED) + { + $ldap=new Ldap(); + $ldap->connect_bind(); + + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info); + $olddn=$dn; // We know olddn=dn as we change only password + + $result=$ldap->update($dn,$info,$user,$olddn); + if ($result < 0) + { + $this->error="ErrorLDAP"." ".$ldap->error; + } + return $result; + } + } + } + elseif ($action == 'MEMBER_RESILIATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE) + { + // If status field is setup to be synchronized + if ($conf->global->LDAP_FIELD_MEMBER_STATUS) + { + $ldap=new Ldap(); + $ldap->connect_bind(); + + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info); + $olddn=$dn; // We know olddn=dn as we change only status + + $result=$ldap->update($dn,$info,$user,$olddn); + if ($result < 0) + { + $this->error="ErrorLDAP"." ".$ldap->error; + } + return $result; + } + } + } + elseif ($action == 'MEMBER_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE) + { + $ldap=new Ldap(); + $ldap->connect_bind(); + + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info); + + $result=$ldap->delete($dn,$info,$user); + if ($result < 0) + { + $this->error="ErrorLDAP"." ".$ldap->error; + } + return $result; + } + } + + // If not found +/* + else + { + dol_syslog("Trigger '".$this->name."' for action '$action' was ran by ".__FILE__." but no handler found for this action."); + return -1; + } +*/ + return 0; + } + +} +?> diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php new file mode 100755 index 00000000000..d98c1ec0b93 --- /dev/null +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -0,0 +1,257 @@ + + * Copyright (C) 2011 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/triggers/interface_50_modNotification_Notification.class.php + * \ingroup notification + * \brief File of class of triggers for notification module + */ + + +/** + * \class InterfaceNotification + * \brief Class of triggers for notification module + */ +class InterfaceNotification +{ + var $db; + var $listofmanagedevents=array('BILL_VALIDATE','ORDER_VALIDATE','PROPAL_VALIDATE', + 'FICHEINTER_VALIDATE','ORDER_SUPPLIER_APPROVE','ORDER_SUPPLIER_REFUSE'); + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function InterfaceNotification($db) + { + $this->db = $db; + + $this->name = preg_replace('/^Interface/i','',get_class($this)); + $this->family = "notification"; + $this->description = "Triggers of this module send email notifications according to Notification module setup."; + $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + $this->picto = 'email'; + } + + /** + * Return name of trigger file + * @return string Name of trigger file + */ + function getName() + { + return $this->name; + } + + /** + * Return description of trigger file + * @return string Description of trigger file + */ + function getDesc() + { + return $this->description; + } + + /** + * Return version of trigger file + * @return string Version of trigger file + */ + function getVersion() + { + global $langs; + $langs->load("admin"); + + if ($this->version == 'experimental') return $langs->trans("Experimental"); + elseif ($this->version == 'dolibarr') return DOL_VERSION; + elseif ($this->version) return $this->version; + else return $langs->trans("Unknown"); + } + + /** + * Function called when a Dolibarrr business event is done. + * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers + * @param action Event code (COMPANY_CREATE, PROPAL_VALIDATE, ...) + * @param object Object action is done on + * @param user Object user + * @param langs Object langs + * @param conf Object conf + * @return int <0 if KO, 0 if no action are done, >0 if OK + */ + function run_trigger($action,$object,$user,$langs,$conf) + { + if (empty($conf->notification->enabled)) return 0; // Module not active, we do nothing + + require_once(DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'); + + if ($action == 'BILL_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + + $ref = dol_sanitizeFileName($object->ref); + $filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; + if (! file_exists($filepdf)) $filepdf=''; + $filepdf=''; // We can't add PDF as it is not generated yet. + $langs->load("other"); + $mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated",$object->ref); + + $notify = new Notify($this->db); + $notify->send($action, $object->socid, $mesg, 'facture', $object->id, $filepdf); + } + + elseif ($action == 'ORDER_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + + $ref = dol_sanitizeFileName($object->ref); + $filepdf = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf'; + if (! file_exists($filepdf)) $filepdf=''; + $filepdf=''; // We can't add PDF as it is not generated yet. + $langs->load("other"); + $mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$object->ref); + + $notify = new Notify($this->db); + $notify->send($action, $object->socid, $mesg, 'order', $object->id, $filepdf); + } + + elseif ($action == 'PROPAL_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + + $ref = dol_sanitizeFileName($object->ref); + $filepdf = $conf->propale->dir_output . '/' . $ref . '/' . $ref . '.pdf'; + if (! file_exists($filepdf)) $filepdf=''; + $filepdf=''; // We can't add PDF as it is not generated yet. + $langs->load("other"); + $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$object->ref); + + $notify = new Notify($this->db); + $notify->send($action, $object->socid, $mesg, 'propal', $object->id, $filepdf); + } + + elseif ($action == 'FICHEINTER_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + + $ref = dol_sanitizeFileName($object->ref); + $filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; + if (! file_exists($filepdf)) $filepdf=''; + $filepdf=''; // We can't add PDF as it is not generated yet. + $langs->load("other"); + $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref); + + $notify = new Notify($this->db); + $notify->send($action, $object->socid, $mesg, 'ficheinter', $object->id, $filepdf); + } + + elseif ($action == 'ORDER_SUPPLIER_APPROVE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + + $ref = dol_sanitizeFileName($object->ref); + $filepdf = $conf->fournisseur->dir_output . '/commande/' . $ref . '/' . $ref . '.pdf'; + if (! file_exists($filepdf)) $filepdf=''; + $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; + $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$object->ref,$user->getFullName($langs)); + $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; + + $notify = new Notify($this->db); + $notify->send($action, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf); + } + + elseif ($action == 'ORDER_SUPPLIER_REFUSE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + + $ref = dol_sanitizeFileName($object->ref); + $filepdf = $conf->fournisseur->dir_output . '/commande/' . $ref . '/' . $ref . '.pdf'; + if (! file_exists($filepdf)) $filepdf=''; + $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; + $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$object->ref,$user->getFullName($langs)); + $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; + + $notify = new Notify($this->db); + $notify->send($action, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf); + } + + // If not found +/* + else + { + dol_syslog("Trigger '".$this->name."' for action '$action' was ran by ".__FILE__." but no handler found for this action."); + return -1; + } +*/ + return 0; + } + + + /** + * Return list of events managed by notification module + * @return array Array of events managed by notification module + */ + function getListOfManagedEvents() + { + global $conf,$langs; + + $ret=array(); + + $sql = "SELECT rowid, code, label, description, elementtype"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger"; + $sql.= $this->db->order("elementtype, code"); + dol_syslog("Get list of notifications sql=".$sql); + $resql=$this->db->query($sql); + if ($resql) + { + $num=$this->db->num_rows($resql); + $i=0; + while ($i < $num) + { + $obj=$this->db->fetch_object($resql); + + $qualified=0; + // Check is this event is supported by notification module + if (in_array($obj->code,$this->listofmanagedevents)) $qualified=1; + // Check if module for this event is active + if ($qualified) + { + //print 'xx'.$obj->code; + $element=$obj->elementtype; + if ($element == 'order_supplier' && empty($conf->fournisseur->enabled)) $qualified=0; + elseif ($element == 'invoice_supplier' && empty($conf->fournisseur->enabled)) $qualified=0; + elseif ($element == 'withdraw' && empty($conf->prelevement->enabled)) $qualified=0; + elseif ($element == 'shipping' && empty($conf->expedition->enabled)) $qualified=0; + elseif ($element == 'member' && empty($conf->adherent->enabled)) $qualified=0; + elseif (! in_array($element,array('order_supplier','invoice_supplier','withdraw','shipping','member')) + && empty($conf->$element->enabled)) $qualified=0; + } + + if ($qualified) + { + $ret[]=array('rowid'=>$obj->rowid,'code'=>$obj->code,'label'=>$obj->label,'description'=>$obj->description,'elementtype'=>$obj->elementtype); + } + + $i++; + } + } + else dol_print_error($this->db); + + return $ret; + } + +} +?> diff --git a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN new file mode 100755 index 00000000000..7d28d98760f --- /dev/null +++ b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN @@ -0,0 +1,527 @@ + + * Copyright (C) 2005-2011 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/triggers/interface_90_all_Demo.class.php + * \ingroup core + * \brief Fichier de demo de personalisation des actions du workflow + * \remarks Son propre fichier d'actions peut etre cree par recopie de celui-ci: + * - Le nom du fichier doit etre: interface_99_modMymodule_Mytrigger.class.php + * ou: interface_99_all_Mytrigger.class.php + * - Le fichier doit rester stocke dans core/triggers + * - Le nom de la classe doit etre InterfaceMytrigger + * - Le nom de la methode constructeur doit etre InterfaceMytrigger + * - Le nom de la propriete name doit etre Mytrigger + */ + + +/** + * \class InterfaceDemo + * \brief Class of triggers for demo module + */ +class InterfaceDemo +{ + var $db; + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function InterfaceDemo($db) + { + $this->db = $db; + + $this->name = preg_replace('/^Interface/i','',get_class($this)); + $this->family = "demo"; + $this->description = "Triggers of this module are empty functions. They have no effect. They are provided for tutorial purpose only."; + $this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version + $this->picto = 'technic'; + } + + + /** + * Return name of trigger file + * @return string Name of trigger file + */ + function getName() + { + return $this->name; + } + + /** + * Return description of trigger file + * @return string Description of trigger file + */ + function getDesc() + { + return $this->description; + } + + /** + * Return version of trigger file + * @return string Version of trigger file + */ + function getVersion() + { + global $langs; + $langs->load("admin"); + + if ($this->version == 'development') return $langs->trans("Development"); + elseif ($this->version == 'experimental') return $langs->trans("Experimental"); + elseif ($this->version == 'dolibarr') return DOL_VERSION; + elseif ($this->version) return $this->version; + else return $langs->trans("Unknown"); + } + + /** + * Function called when a Dolibarrr business event is done. + * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers + * @param action Code de l'evenement + * @param object Objet concerne + * @param user Objet user + * @param langs Objet langs + * @param conf Objet conf + * @return int <0 if KO, 0 if no triggered ran, >0 if OK + */ + function run_trigger($action,$object,$user,$langs,$conf) + { + // Put here code you want to execute when a Dolibarr business events occurs. + // Data and type of action are stored into $object and $action + + // Users + if ($action == 'USER_LOGIN') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'USER_UPDATE_SESSION') + { + // Warning: To increase performances, this action is triggered only if + // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'USER_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'USER_CREATE_FROM_CONTACT') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'USER_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'USER_NEW_PASSWORD') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'USER_ENABLEDISABLE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'USER_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'USER_LOGOUT') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'USER_SETINGROUP') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'USER_REMOVEFROMGROUP') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + // Groups + elseif ($action == 'GROUP_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'GROUP_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'GROUP_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + // Companies + elseif ($action == 'COMPANY_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'COMPANY_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'COMPANY_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + // Contacts + elseif ($action == 'CONTACT_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'CONTACT_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'CONTACT_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + // Products + elseif ($action == 'PRODUCT_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'PRODUCT_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'PRODUCT_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + // Customer orders + elseif ($action == 'ORDER_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'ORDER_CLONE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'ORDER_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'ORDER_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'ORDER_BUILDDOC') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'ORDER_SENTBYMAIL') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'LINEORDER_INSERT') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'LINEORDER_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + // Supplier orders + elseif ($action == 'ORDER_SUPPLIER_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'ORDER_SUPPLIER_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + // Proposals + elseif ($action == 'PROPAL_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'PROPAL_CLONE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'PROPAL_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'PROPAL_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'PROPAL_BUILDDOC') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'PROPAL_SENTBYMAIL') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'PROPAL_CLOSE_SIGNED') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'PROPAL_CLOSE_REFUSED') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'PROPAL_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'LINEPROPAL_INSERT') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'LINEPROPAL_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'LINEPROPAL_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + // Contracts + elseif ($action == 'CONTRACT_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'CONTRACT_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'CONTRACT_ACTIVATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'CONTRACT_CANCEL') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'CONTRACT_CLOSE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'CONTRACT_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + // Bills + elseif ($action == 'BILL_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'BILL_CLONE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'BILL_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'BILL_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'BILL_BUILDDOC') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'BILL_SENTBYMAIL') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'BILL_CANCEL') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'BILL_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'LINEBILL_INSERT') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'LINEBILL_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + // Payments + elseif ($action == 'PAYMENT_CUSTOMER_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'PAYMENT_SUPPLIER_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'PAYMENT_ADD_TO_BANK') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'PAYMENT_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + // Interventions + elseif ($action == 'FICHEINTER_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + // Members + elseif ($action == 'MEMBER_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'MEMBER_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'MEMBER_SUBSCRIPTION') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'MEMBER_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'MEMBER_NEW_PASSWORD') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'MEMBER_RESILIATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'MEMBER_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + // Categories + elseif ($action == 'CATEGORY_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'CATEGORY_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'CATEGORY_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + // Projects + elseif ($action == 'PROJECT_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'PROJECT_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'PROJECT_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + // Project tasks + elseif ($action == 'TASK_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'TASK_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'TASK_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + // Task time spent + elseif ($action == 'TASK_TIMESPENT_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'TASK_TIMESPENT_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'TASK_TIMESPENT_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + // Shipping + elseif ($action == 'SHIPPING_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'SHIPPING_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'SHIPPING_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'SHIPPING_SENTBYMAIL') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'SHIPPING_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'SHIPPING_BUILDDOC') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + // File + elseif ($action == 'FILE_UPLOAD') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'FILE_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + return 0; + } + +} +?> From feb220587ab258a20d0fafd76eb7e95f6b830eb4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Feb 2012 00:24:16 +0100 Subject: [PATCH 20/21] Fix: Contact list --- htdocs/contact/list.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index a495a3e7323..851fa959541 100755 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Eric Seigne - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -113,8 +113,8 @@ llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Modu $form=new Form($db); -$sql = "SELECT s.rowid as socid, s.nom,"; -$sql.= " p.rowid as cidp, p.name, p.firstname, p.poste, p.email,"; +$sql = "SELECT s.rowid as socid, s.nom as name,"; +$sql.= " p.rowid as cidp, p.name as lastname, p.firstname, p.poste, p.email,"; $sql.= " p.phone, p.phone_mobile, p.fax, p.fk_pays, p.priv, p.tms,"; $sql.= " cp.code as pays_code"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as p"; @@ -338,7 +338,7 @@ if ($result) // Name print '
'.$langs->trans('Ref').''.$langs->trans('Date').''.$langs->trans('Action').''.$langs->trans('By').'
'; - $contactstatic->name=$obj->name; + $contactstatic->lastname=$obj->lastname; $contactstatic->firstname=''; $contactstatic->id=$obj->cidp; print $contactstatic->getNomUrl(1,'',20); @@ -357,7 +357,7 @@ if ($result) if ($obj->socid) { print ''; - print img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->nom,20).''; + print img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->name,20).''; } else { From 2f2cb4662218d68a505fa98b35f6ab472fdd521c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Feb 2012 09:29:26 +0100 Subject: [PATCH 21/21] Fix: Lastname --- htdocs/core/class/html.form.class.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f2c0f2aedc4..ad7f9f5f275 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -353,13 +353,13 @@ class Form /** * Show a text with a picto and a tooltip on picto * - * @param text Text to show - * @param htmltooltip Content of tooltip - * @param direction 1=Icon is after text, -1=Icon is before text, 0=no icon - * @param type Type of picto (info, help, warning, superadmin...) - * @param extracss Add a CSS style to td tags - * @param noencodehtmltext Do not encode into html entity the htmltext - * @return string HTML code of text, picto, tooltip + * @param string $text Text to show + * @param string $htmltooltip Content of tooltip + * @param int $direction 1=Icon is after text, -1=Icon is before text, 0=no icon + * @param string $type Type of picto (info, help, warning, superadmin...) + * @param string $extracss Add a CSS style to td tags + * @param int $noencodehtmltext Do not encode into html entity the htmltext + * @return string HTML code of text, picto, tooltip */ function textwithpicto($text,$htmltext,$direction=1,$type='help',$extracss='',$noencodehtmltext=0) { @@ -885,13 +885,13 @@ class Form global $conf,$langs; // On recherche les societes - $sql = "SELECT s.rowid, s.name, s.firstname, s.poste FROM"; + $sql = "SELECT s.rowid, s.name as name, s.firstname, s.poste FROM"; $sql.= " ".MAIN_DB_PREFIX ."socpeople as s"; $sql.= " WHERE entity = ".$conf->entity; if ($socid > 0) $sql.= " AND fk_soc=".$socid; $sql.= " ORDER BY s.name ASC"; - dol_syslog("Form::select_contacts sql=".$sql); + dol_syslog(get_class($this)."::select_contacts sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -913,6 +913,7 @@ class Form $contactstatic->id=$obj->rowid; $contactstatic->name=$obj->name; + $contactstatic->lastname=$obj->name; $contactstatic->firstname=$obj->firstname; if ($htmlname != 'none')