diff --git a/build/.cvsignore b/build/.cvsignore index 830b8b91924..53dd6ee2abd 100644 --- a/build/.cvsignore +++ b/build/.cvsignore @@ -14,3 +14,6 @@ version-phpsane.txt makepack-phpsane.conf html *.deb +*.dsc +*.tar.gz +*.changes diff --git a/build/deb/README b/build/deb/README index 76be8f1596c..edb46ffd5a3 100644 --- a/build/deb/README +++ b/build/deb/README @@ -49,5 +49,5 @@ For first ITP submission of Dolibarr, bug id was 634783. - Call for a mentor on ML debian-mentors to upload packages - Once package is uploaded, following URL are available: -http://packages.qa.debian.org/package +http://packages.qa.debian.org/package.html http://bugs.debian.org/package diff --git a/build/deb/changelog b/build/deb/changelog index 47667b3cfb5..b035f18ae1d 100644 --- a/build/deb/changelog +++ b/build/deb/changelog @@ -4,6 +4,6 @@ dolibarr (3.1.0-1.1) unstable; urgency=low * New upstream release. closes: bug#634783 - -- Laurent Destailleur Mon, 18 Jul 2011 12:00:00 +0100 + -- Laurent Destailleur Mon, 30 Jul 2011 12:00:00 +0100 -# More information into /usr/share/dolibarr/ChangeLog file. \ No newline at end of file +# For a changelog file dedicated to users, see /usr/share/doc/dolibarr/UserChangeLog.gz file. \ No newline at end of file diff --git a/build/deb/install.forced.php.install b/build/deb/install.forced.php.install index c266426209b..7de8616ac15 100755 --- a/build/deb/install.forced.php.install +++ b/build/deb/install.forced.php.install @@ -4,19 +4,19 @@ // This file must be present into htdocs/install directory // during install process to be used. // -// $Id: install.forced.php.install,v 1.8 2011/07/27 16:45:47 eldy Exp $ +// $Id: install.forced.php.install,v 1.9 2011/07/30 14:56:12 eldy Exp $ // -$force_install_noedit=1; +$force_install_noedit=2; $force_install_message='KeepDefaultValuesDeb'; #$force_install_main_data_root='/usr/share/dolibarr/documents'; $force_install_main_data_root='/var/lib/dolibarr/documents'; $force_install_type='mysqli'; $force_install_dbserver='localhost'; $force_install_port='3306'; -$force_install_database='dolibarr'; +$force_install_database='dolibarrdebian'; $force_install_createdatabase='1'; -$force_install_databaselogin='dolibarrmysql'; +$force_install_databaselogin='dolibarrdebian'; $force_install_databasepass=''; $force_install_createuser='1'; $force_install_databaserootlogin='__SUPERUSERLOGIN__'; diff --git a/build/deb/postinst b/build/deb/postinst index dd03156a6d2..ca5fd1645dd 100644 --- a/build/deb/postinst +++ b/build/deb/postinst @@ -24,23 +24,31 @@ db_version 2.0 echo Run the dolibarr postinst script +# Define vars docdir='/var/lib/dolibarr/documents' #docdir='/usr/share/dolibarr/documents' - +apachefileorig="/usr/share/dolibarr/build/deb/apache.conf" +apacheconfig="/etc/dolibarr/apache.conf" +installfileorig="/usr/share/dolibarr/build/deb/install.forced.php.install" +installconfig="/etc/dolibarr/install.forced.php" +#config="/usr/share/dolibarr/htdocs/conf/conf.php" +config="/etc/dolibarr/conf.php" case "$1" in configure) - # Copy apache.conf file into target directory. - #fileorig="/usr/share/dolibarr/build/deb/apache.conf" - #config="/etc/dolibarr/apache.conf" - #mkdir -p /etc/dolibarr - #cp -p $fileorig $config + # Create document directory for uploaded data files + mkdir -p $docdir + chown -R www-data:www-data $docdir + chmod -R 775 $docdir + chmod -R g+s $docdir - # Edit install.forced.php to match Debian values - fileorig="/usr/share/dolibarr/build/deb/install.forced.php.install" - config="/usr/share/dolibarr/htdocs/install/install.forced.php" + # Copy apache.conf file into target directory + #mkdir -p /etc/dolibarr + #cp -p $apachefileorig $apacheconfig + + # Copy install config file (with matching Debian) values into target directory superuserlogin='' superuserpassword='' if [ -f /etc/mysql/debian.cnf ] ; then @@ -50,29 +58,24 @@ case "$1" in fi echo Mysql superuser found to use is $superuserlogin if [ -z "$superuserlogin" ] ; then - cat $fileorig | sed -e 's/__SUPERUSERLOGIN__/root/g' | sed -e 's/__SUPERUSERPASSWORD__//g' > $config + cat $installfileorig | sed -e 's/__SUPERUSERLOGIN__/root/g' | sed -e 's/__SUPERUSERPASSWORD__//g' > $installconfig else - cat $fileorig | sed -e 's/__SUPERUSERLOGIN__/'$superuserlogin'/g' | sed -e 's/__SUPERUSERPASSWORD__/'$superuserpassword'/g' > $config + cat $installfileorig | sed -e 's/__SUPERUSERLOGIN__/'$superuserlogin'/g' | sed -e 's/__SUPERUSERPASSWORD__/'$superuserpassword'/g' > $installconfig fi - - # Create document directory for uploaded data files - mkdir -p $docdir - chown -R www-data:www-data $docdir - chmod -R 775 $docdir - chmod -R g+s $docdir + chown -R root:www-data $installconfig + chmod -R 660 $installconfig # Create an empty conf.php with permission to web server - if [ ! -f /usr/share/dolibarr/htdocs/conf/conf.php ] + if [ ! -f $config ] then - echo Create empty file /usr/share/dolibarr/htdocs/conf/conf.php - touch /usr/share/dolibarr/htdocs/conf/conf.php - chown -R root:www-data /usr/share/dolibarr/htdocs/conf/conf.php - chmod -R 660 /usr/share/dolibarr/htdocs/conf/conf.php + echo Create empty file $config + touch $config + chown -R root:www-data $config + chmod -R 660 $config fi - #db_reset "dolibarr/webserver" - # Get the web server type (use db_get for interactive mode). + #db_reset "dolibarr/webserver" #db_get "dolibarr/webserver" # Read value for webserver. #webserver="$RET" @@ -102,7 +105,7 @@ case "$1" in # Set permissions to web server chown -R $webuser:$webgroup /usr/share/dolibarr - chown -R root:$webgroup /usr/share/dolibarr/htdocs/conf/conf.php + chown -R root:$webgroup $config # Add link to config file echo Setup web server $server to add dolibarr config file @@ -110,26 +113,6 @@ case "$1" in done - #echo "Install menu entry" - # This one is for Gnome ubuntu - #fileorig="/usr/share/dolibarr/build/deb/dolibarr.desktop" - #target="/usr/share/applications/" - #cp -f $fileorig $target - # Not sure this is usefull - #if test -x /usr/bin/update-menus; then - # echo "update-menus" - # update-menus; - #fi - - # TODO Create the file to force parameters in Web installer - #if grep DBHOST /usr/share/dolibarr/htdocs/conf/conf.php > /dev/null - #then - # perl -pi -e "s/DBHOST/$dbserver/" /usr/share/dolibarr/htdocs/conf/conf.php - # perl -pi -e "s/DBNAME/$dbname/" /usr/share/dolibarr/htdocs/conf/conf.php - # perl -pi -e "s/DBUSER/$dbuser/" /usr/share/dolibarr/htdocs/conf/conf.php - # perl -pi -e "s/DBPASS/$dbpass/" /usr/share/dolibarr/htdocs/conf/conf.php - #fi - # Restart servers servers="apache2-ssl apache2 mysql" # Another way to restart diff --git a/build/deb/postrm b/build/deb/postrm index 8be194f0a41..9eae81b022b 100644 --- a/build/deb/postrm +++ b/build/deb/postrm @@ -26,6 +26,11 @@ echo Run the dolibarr postrm script docdir='/var/lib/dolibarr/documents' #docdir='/usr/share/dolibarr/documents' +apachefileorig="/usr/share/dolibarr/build/deb/apache.conf" +apacheconfig="/etc/dolibarr/apache.conf" +#config="/usr/share/dolibarr/htdocs/conf/conf.php" +config="/etc/dolibarr/conf.php" +lockfile="/usr/share/dolibarr/install.lock" export webserver="" @@ -36,13 +41,38 @@ case $webserver in Both) webservers="apache2 apache2-ssl" ;; *) webservers="apache2 apache2-ssl" ;; esac -export includefile=/etc/dolibarr/apache.conf case "$1" in + + # Call when we upgrade + upgrade) + ;; + + # Call when we uninstall + remove) + rm -f $lockfile + + # Remove include files + export restart="" + for server in $webservers ; do + export conffile="/etc/$server/conf.d/dolibarr.conf" + if [ -f $conffile ] ; + then + echo Delete link $conffile + rm -f $conffile + status=purge + fi + + if [ "x$status" = "xpurge" ] ; + then restart="$restart $server" + fi + done + ;; + # Call when we uninstall and purge purge) - echo "postrm purge webservers=$webservers includefile=$includefile" + echo "postrm purge webservers=$webservers apacheconfig=$apacheconfig" # Ask if we must delete database echo "postrm db_input dolibarr/postrm" @@ -59,7 +89,8 @@ case "$1" in echo postrm Mysql database deletion # Get database configuration dbserver="localhost" - dbname="dolibarrmysql" + dbuser="dolibarrdebian" + dbname="dolibarrdebian" #db_get "dolibarr/db/name" #dbname="$RET" superuserlogin='' @@ -120,23 +151,31 @@ case "$1" in fi mysqlcmd="mysql $hostopt $passopt -u $dbadmin" - # Now run the drop commands - if eval $mysqlcmd -f -e "\"show databases;\"" | grep -e "^$dbname" > /dev/null 2>&1 ; then - log="${log}Droping database $dbname." - if eval $mysqlcmd -f -e "\"DROP DATABASE $dbname;\"" ; then - if eval $mysqlcmd -f -e "\"show databases;\"" | grep -e "^$dbname" > /dev/null 2>&1 ; then - error="Database $dbname NOT successfully droped. You have to do it manually." - echo $error - else - status=drop - fi + # Now run the drop user + if eval $mysqlcmd -f -e "\"DROP USER '$dbuser'@'localhost';\"" ; then + echo Database login $dbuser removed else - error="Unable to run the drop database script." + error="Unable to run $mysqlcmd -f -e \"DROP USER '$dbuser'@'localhost';\"" echo $error fi + + # Now run the drop commands + if eval $mysqlcmd -f -e "\"show databases;\"" | grep -e "^$dbname" > /dev/null 2>&1 ; then + log="${log}Droping database $dbname." + if eval $mysqlcmd -f -e "\"DROP DATABASE $dbname;\"" ; then + if eval $mysqlcmd -f -e "\"show databases;\"" | grep -e "^$dbname" > /dev/null 2>&1 ; then + error="Database $dbname NOT successfully droped. You have to do it manually." + echo $error + else + status=drop + fi + else + error="Unable to run the drop database script." + echo $error + fi else - status=nothing - log="${log}Database $dbname already not exists." + status=nothing + log="${log}Database $dbname already not exists." fi echo "Remove directory $docdir" @@ -178,18 +217,6 @@ case "$1" in set -e done - # Remove file and conf file - for dir in /usr/share/dolibarr; do - if [ -d $dir ] ; then - # We disable blocking errors - set +e - echo "Remove directory $dir" - rm -rf $dir ; - # We restore blocking errors - set -e - fi - done - # We clean variable (we ignore errors because db_reset can fails if var was never set) set +e db_reset "dolibarr/postrm" @@ -198,34 +225,6 @@ case "$1" in #db_purge ;; - # Call when we uninstall - remove) - echo "postrm Force remove of /usr/share/dolibarr/htdocs/install" - rm -fr /usr/share/dolibarr/htdocs/install - - echo "postrm Force remove of /usr/share/dolibarr/htdocs/conf" - rm -fr /usr/share/dolibarr/htdocs/conf - - # Remove include files - export restart="" - for server in $webservers ; do - export conffile="/etc/$server/conf.d/dolibarr.conf" - if [ -f $conffile ] ; - then - echo Delete file $conffile - rm -f $conffile - status=purge - fi - - if [ "x$status" = "xpurge" ] ; - then restart="$restart $server" - fi - done - ;; - - upgrade) - ;; - failed-upgrade|abort-install|abort-upgrade|disappear) ;; diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index f191d88c7f9..d3c47e6b28d 100644 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -2,7 +2,7 @@ #---------------------------------------------------------------------------- # \file build/makepack-dolibarr.pl # \brief Dolibarr package builder (tgz, zip, rpm, deb, exe, aps) -# \version $Id: makepack-dolibarr.pl,v 1.121 2011/07/28 23:05:13 eldy Exp $ +# \version $Id: makepack-dolibarr.pl,v 1.128 2011/07/31 22:08:13 eldy Exp $ # \author (c)2004-2011 Laurent Destailleur #---------------------------------------------------------------------------- @@ -11,7 +11,7 @@ use Cwd; $PROJECT="dolibarr"; $MAJOR="3"; $MINOR="1"; -$BUILD="0-dev"; # Mettre x pour release, x-dev pour dev, x-beta pour beta, x-rc pour release candidate +$BUILD="0-beta"; # Mettre x pour release, x-dev pour dev, x-beta pour beta, x-rc pour release candidate $RPMSUBVERSION="auto"; # auto use value found into BUILD @LISTETARGET=("TGZ","ZIP","RPM","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages @@ -48,7 +48,7 @@ if (-d "/usr/src/RPM") { use vars qw/ $REVISION $VERSION /; -$REVISION='$Revision: 1.121 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1; +$REVISION='$Revision: 1.128 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1; $VERSION="1.0 (build $REVISION)"; @@ -254,15 +254,18 @@ if ($nboftargetok) { $ret=`rm -f $BUILDROOT/$PROJECT/build/DoliW*-*`; $ret=`rm -f $BUILDROOT/$PROJECT/build/DoliM*-*`; - $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.deb`; + $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.changes`; $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.deb`; $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.dsc`; + $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.tar.gz`; + $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.deb`; $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.rpm`; $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar`; $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar.gz`; $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tgz`; $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.zip`; $ret=`rm -f $BUILDROOT/$PROJECT/build/doxygen/doxygen_warnings.log`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php.mysql`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php.old`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php.postgres`; @@ -273,6 +276,10 @@ if ($nboftargetok) { $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/barcode/php-barcode/fonts/Veranda*.ttf`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/fckeditor/fckeditor.py`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/mssql/README`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/mysql/README`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/pgsql/README`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/spec`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/licence`; @@ -291,11 +298,6 @@ if ($nboftargetok) { $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot12.png`; $ret=`rm -fr $BUILDROOT/$PROJECT/documents`; $ret=`rm -fr $BUILDROOT/$PROJECT/document`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf.php`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf.php.mysql`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf.php.old`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf.php.postgres`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf*sav*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom2`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/theme/bureau2crea`; @@ -306,6 +308,7 @@ if ($nboftargetok) { $ret=`rm -fr $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/htdocs/includes/php_writeexcel/php.bmp`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/smarty`; #$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF/fonts/utils/freetype6.dll`; #$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF/fonts/utils/zlib1.dll`; #$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF/fonts/utils/pfm2afm`; @@ -413,14 +416,19 @@ if ($nboftargetok) { } if ($target eq 'RPM') { # Linux only - $ARCH='i386'; + #$ARCH='i386'; + $ARCH='noarch'; if ($RPMDIR eq "") { $RPMDIR=$ENV{'HOME'}."/rpmbuild"; } $newbuild = $BUILD; - $newbuild =~ s/(dev|alpha)/0/gi; # dev - $newbuild =~ s/beta/1/gi; # beta - $newbuild =~ s/rc./2/gi; # rc + # For fedora + $newbuild =~ s/(dev|alpha)/0.1.a/gi; # dev + $newbuild =~ s/beta/0.2.beta1/gi; # beta + $newbuild =~ s/rc./0.3.rc1/gi; # rc if ($newbuild !~ /-/) { $newbuild.='-3'; } # finale - # now newbuild is 0-0 or 0-3 for example + #$newbuild =~ s/(dev|alpha)/0/gi; # dev + #$newbuild =~ s/beta/1/gi; # beta + #$newbuild =~ s/rc./2/gi; # rc + #if ($newbuild !~ /-/) { $newbuild.='-3'; } # finale $REL1 = $newbuild; $REL1 =~ s/-.*$//gi; if ($RPMSUBVERSION eq 'auto') { $RPMSUBVERSION = $newbuild; $RPMSUBVERSION =~ s/^.*-//gi; } print "Version is $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n"; @@ -438,16 +446,93 @@ if ($nboftargetok) { print "Remove other files\n"; $ret=`rm -f $BUILDROOT/$FILENAMETGZ2/htdocs/includes/barcode/php-barcode/genbarcode/genbarcode`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/aps`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/deb`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/dmg`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/doap`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/exe`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/live`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/patch`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/zip`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/perl`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/README`; + $ret=`rm -f $BUILDROOT/$FILENAMETGZ2/$PROJECT/build/README`; + $ret=`rm -f $BUILDROOT/$FILENAMETGZ2/$PROJECT/build/README-FR`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/build/aps`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/build/deb`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/build/dmg`; + $ret=`rm -f $BUILDROOT/$FILENAMETGZ2/$PROJECT/build/pad/README`; + $ret=`rm -f $BUILDROOT/$FILENAMETGZ2/$PROJECT/build/tgz/README`; + $ret=`rm -f $BUILDROOT/$FILENAMETGZ2/$PROJECT/build/deb/README`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/build/doap`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/build/exe`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/build/live`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/build/patch`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/build/zip`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/build/perl`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/dev/dbmodel`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/dev/fpdf`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/dev/initdata`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/dev/iso-normes`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/dev/phpcheckstyle`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/dev/phpunit`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/doc/flyer`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/doc/font`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/doc/tshirt`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/doc/rollup`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/test`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/htdocs/cashdesk/include/jscalendar/doc/html/CVS`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/htdocs/cashdesk/include/jscalendar/skins/aqua/CVS`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/htdocs/includes/ckeditor/plugins/*/dialogs/CVS`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/htdocs/includes/ckeditor/plugins/*/images/CVS`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/htdocs/includes/fpdf/fpdf`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/htdocs/includes/nusoap/lib/Mail`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/htdocs/includes/odtphp/zip/.svn`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/htdocs/includes/odtphp/zip/pclzip/.svn`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/htdocs/includes/smarty`; + $ret=`rm -f $BUILDROOT/$FILENAMETGZ2/$PROJECT/COPYING`; + $ret=`rm -f $BUILDROOT/$FILENAMETGZ2/$PROJECT/htdocs/includes/barcode/php-barcode/genbarcode/genbarcode`; + # To remove once stable + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/$PROJECT/htdocs/htdocs/theme/bureau2crea`; + + # Apache conf files + #print "Copy apache.conf file into $BUILDROOT/$FILENAMETGZ2/etc/$PROJECT/apache.conf\n"; + #$ret=`mkdir -p "$BUILDROOT/$FILENAMETGZ2/etc/$PROJECT"`; + #$ret=`cp "$SOURCE/build/deb/apache.conf" "$BUILDROOT/$FILENAMETGZ2/etc/$PROJECT/apache.conf"`; + + # Dolibarr conf files + # TODO + + # dolibarr.desktop + #print "Create directory $BUILDROOT/$FILENAMETGZ2/usr/share/applications\n"; + #$ret=`mkdir -p "$BUILDROOT/$FILENAMETGZ2/usr/share/applications"`; + #print "Copy desktop file into $BUILDROOT/$FILENAMETGZ2/usr/share/applications/dolibarr.desktop\n"; + #$ret=`cp "$SOURCE/build/rpm/dolibarr.desktop" "$BUILDROOT/$FILENAMETGZ2/usr/share/applications/dolibarr.desktop"`; + + # pixmap + #print "Create directory $BUILDROOT/$FILENAMETGZ2/usr/share/pixmaps\n"; + #$ret=`mkdir -p "$BUILDROOT/$FILENAMETGZ2/usr/share/pixmaps"`; + #print "Copy pixmap file into $BUILDROOT/$FILENAMETGZ2/usr/share/pixmaps/dolibarr.xpm\n"; + #$ret=`cp "$SOURCE/doc/images/dolibarr.xpm" "$BUILDROOT/$FILENAMETGZ2/usr/share/pixmaps/dolibarr.xpm"`; + + # Set owners + print "Set owners on files/dir\n"; + $ret=`chown -R root.root $BUILDROOT/$FILENAMETGZ2`; + + print "Set permissions on files/dir\n"; + $ret=`chmod -R 755 $BUILDROOT/$FILENAMETGZ2`; + $cmd="find $BUILDROOT/$FILENAMETGZ2 -type f -exec chmod 644 {} \\; "; + $ret=`$cmd`; + $cmd="find $BUILDROOT/$FILENAMETGZ2/build -name '*.php' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + $cmd="find $BUILDROOT/$FILENAMETGZ2/build -name '*.pl' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + $cmd="find $BUILDROOT/$FILENAMETGZ2/dev -name '*.php' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + $ret=`chmod -R 644 $BUILDROOT/$FILENAMETGZ2/dev/translation/langAutoParser.class.php`; + $ret=`chmod -R 644 $BUILDROOT/$FILENAMETGZ2/dev/skeletons/skeleton_page.php`; + $ret=`chmod -R 644 $BUILDROOT/$FILENAMETGZ2/dev/skeletons/modMyModule.class.php`; + $ret=`chmod -R 644 $BUILDROOT/$FILENAMETGZ2/dev/skeletons/skeleton_class.class.php`; + $cmd="find $BUILDROOT/$FILENAMETGZ2/scripts -name '*.php' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + $cmd="find $BUILDROOT/$FILENAMETGZ2/htdocs/includes/geoip -name 'sample*.php' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + $cmd="find $BUILDROOT/$FILENAMETGZ2/htdocs/includes/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts -name '*.pl' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + + # Build tgz print "Compress $FILENAMETGZ2 into $FILENAMETGZ2.tgz...\n"; $ret=`tar --exclude-from "$SOURCE/build/tgz/tar_exclude.txt" --directory "$BUILDROOT" -czvf "$BUILDROOT/$FILENAMETGZ2.tgz" $FILENAMETGZ2`; @@ -475,6 +560,10 @@ if ($nboftargetok) { print "Move $RPMDIR/RPMS/".$ARCH."/".$FILENAMETGZ2."-".$RPMSUBVERSION.".".$ARCH.".rpm into $DESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION.".".$ARCH.".rpm\n"; $cmd="mv \"$RPMDIR/RPMS/".$ARCH."/".$FILENAMETGZ2."-".$RPMSUBVERSION.".".$ARCH.".rpm\" \"$DESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION.".".$ARCH.".rpm\""; $ret=`$cmd`; + print "Move $RPMDIR/SRPMS/".$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm into $DESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm\n"; + $cmd="mv \"$RPMDIR/SRPMS/".$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm\" \"$DESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm\""; + $ret=`$cmd`; + next; } @@ -525,20 +614,33 @@ if ($nboftargetok) { print "Version set to $MAJOR.$MINOR.$newbuild\n"; print "Remove other files\n"; + $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/deb/README`; + #$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/po`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/changelog`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/compat`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/config`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/control.*`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/copyright`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/dolibarr.desktop`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/dolibarr.menu`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/format`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/install`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/menu`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/postrm`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/postinst`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/rules`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/README.debian`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/templates`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/templates.futur`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/wash`; @@ -598,17 +700,7 @@ if ($nboftargetok) { print "Create directory $BUILDROOT/$PROJECT.tmp/usr/share/doc/$PROJECT\n"; $ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/usr/share/doc/$PROJECT"`; - #print "Copy README file into $BUILDROOT/$PROJECT.tmp/DEBIAN\n"; - #$ret=`cp "$SOURCE/README" "$BUILDROOT/$PROJECT.tmp/usr/share/doc/$PROJECT/README"`; - - # copyright (to build binary package directly without sources. Useless if we build from sources) - #print "Copy copyright file into $BUILDROOT/$PROJECT.tmp/usr/share/doc/$PROJECT/copyright\n"; - #$ret=`cp "$SOURCE/build/deb/copyright" "$BUILDROOT/$PROJECT.tmp/usr/share/doc/$PROJECT/copyright"`; - - # changelog (to build binary package directly without sources. Useless if we build from sources) - #$ret=`gzip -9 -c "$SOURCE/build/deb/changelog" > $BUILDROOT/$PROJECT.tmp/usr/share/doc/$PROJECT/changelog.Debian.gz`; - #$ret=`gzip -9 -c "$SOURCE/build/deb/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`; @@ -652,29 +744,25 @@ if ($nboftargetok) { $ret=`mkdir "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`mkdir "$BUILDROOT/$PROJECT.tmp/debian/source"`; $ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/DEBIAN"`; - $ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/pom.xml"`; - $ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/COPYRIGHT"`; - $ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/INSTALL"`; - $ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/README"`; - $ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/README-FR"`; $ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/doc"`; print "Copy $SOURCE/build/deb/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/deb/README.debian" "$BUILDROOT/$PROJECT.tmp/usr/share/doc/dolibarr/README"`; - $ret=`cp -f "$SOURCE/build/deb/changelog" "$BUILDROOT/$PROJECT.tmp/debian/changelog"`; - $ret=`cp -f "$SOURCE/build/deb/control.debian" "$BUILDROOT/$PROJECT.tmp/debian/control"`; - $ret=`cp -f "$SOURCE/build/deb/install" "$BUILDROOT/$PROJECT.tmp/debian/install"`; - $ret=`cp -f "$SOURCE/build/deb/rules" "$BUILDROOT/$PROJECT.tmp/debian/rules"`; - $ret=`cp -f "$SOURCE/build/deb/copyright" "$BUILDROOT/$PROJECT.tmp/debian/copyright"`; - $ret=`cp -f "$SOURCE/build/deb/compat" "$BUILDROOT/$PROJECT.tmp/debian/compat"`; - $ret=`cp -f "$SOURCE/build/deb/format" "$BUILDROOT/$PROJECT.tmp/debian/source/format"`; - $ret=`cp -fr "$SOURCE/build/deb/po" "$BUILDROOT/$PROJECT.tmp/debian/po"`; + $ret=`cp -f "$SOURCE/ChangeLog" "$BUILDROOT/$PROJECT.tmp/usr/share/doc/dolibarr/UserChangeLog"`; + $ret=`cp -f "$SOURCE/build/deb/README.debian" "$BUILDROOT/$PROJECT.tmp/usr/share/doc/dolibarr/README"`; + $ret=`cp -f "$SOURCE/build/deb/changelog" "$BUILDROOT/$PROJECT.tmp/debian/changelog"`; + $ret=`cp -f "$SOURCE/build/deb/control.debian" "$BUILDROOT/$PROJECT.tmp/debian/control"`; + $ret=`cp -f "$SOURCE/build/deb/install" "$BUILDROOT/$PROJECT.tmp/debian/install"`; + $ret=`cp -f "$SOURCE/build/deb/rules" "$BUILDROOT/$PROJECT.tmp/debian/rules"`; + $ret=`cp -f "$SOURCE/build/deb/copyright" "$BUILDROOT/$PROJECT.tmp/debian/copyright"`; + $ret=`cp -f "$SOURCE/build/deb/compat" "$BUILDROOT/$PROJECT.tmp/debian/compat"`; + $ret=`cp -f "$SOURCE/build/deb/format" "$BUILDROOT/$PROJECT.tmp/debian/source/format"`; + $ret=`cp -fr "$SOURCE/build/deb/po" "$BUILDROOT/$PROJECT.tmp/debian/po"`; + $ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/debian/po/CVS"`; # Add files also required to build binary package with dpkg-buildpackages - $ret=`cp -f "$SOURCE/build/deb/config" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/deb/postinst" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/deb/postrm" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/deb/templates" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/deb/config" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/deb/postinst" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/deb/postrm" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/deb/templates" "$BUILDROOT/$PROJECT.tmp/debian"`; $cmd="mv $BUILDROOT/$PROJECT.tmp $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build"; $ret=`$cmd`; @@ -690,12 +778,18 @@ if ($nboftargetok) { if ($OS =~ /windows/i) { print "Move *_all.deb to $DESTI\n"; - $ret=`mv "$BUILDROOT/*_all.deb" "$DESTI/"`; + $ret=`mv $BUILDROOT/*_all.deb "$DESTI/"`; + $ret=`mv $BUILDROOT/*.dsc "$DESTI/"`; + $ret=`mv $BUILDROOT/*.tar.gz "$DESTI/"`; + $ret=`mv $BUILDROOT/*.changes "$DESTI/"`; } else { print "Move *_all.deb to $DESTI\n"; - $ret=`mv "$BUILDROOT/*_all.deb" "$DESTI/"`; + $ret=`mv $BUILDROOT/*_all.deb "$DESTI/"`; + $ret=`mv $BUILDROOT/*.dsc "$DESTI/"`; + $ret=`mv $BUILDROOT/*.tar.gz "$DESTI/"`; + $ret=`mv $BUILDROOT/*.changes "$DESTI/"`; } next; } diff --git a/build/rpm/dolibarr.desktop b/build/rpm/dolibarr.desktop index 33fadf7624f..4b4fb60dadb 100755 --- a/build/rpm/dolibarr.desktop +++ b/build/rpm/dolibarr.desktop @@ -19,7 +19,7 @@ Exec=xdg-open http://localhost/dolibarr Icon=dolibarr Terminal=false Type=Application -Categories=Office +Categories=Office; StartupNotify=true InitialPreference=5 #NoDisplay=true diff --git a/htdocs/admin/system/constall.php b/htdocs/admin/system/constall.php index f478b65e3a8..a07b28bd2cf 100644 --- a/htdocs/admin/system/constall.php +++ b/htdocs/admin/system/constall.php @@ -14,13 +14,14 @@ * 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 . + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * \file htdocs/admin/system/constall.php * \brief Page to show all Dolibarr setup (config file and database constants) - * \version $Id: constall.php,v 1.24 2011/07/31 22:23:14 eldy Exp $ + * \version $Id: constall.php,v 1.23 2011/07/30 10:23:26 eldy Exp $ */ require("../../main.inc.php"); diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index ee18392f767..b2d73348949 100755 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -14,7 +14,8 @@ * 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 . + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ require("../../main.inc.php"); @@ -203,5 +204,5 @@ print ""; // End of page $db->close(); -llxFooter('$Date: 2011/07/31 22:08:25 $ - $Revision: 1.10 $'); +llxFooter('$Date: 2011/07/31 21:26:51 $ - $Revision: 1.9 $'); ?> \ No newline at end of file diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index acb0b5d9167..e6559c2ae2e 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -16,7 +16,8 @@ * 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 . + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** @@ -24,7 +25,7 @@ * \ingroup core * \brief File of class to manage storage of current setup * Config is stored into file conf.php - * \version $Id: conf.class.php,v 1.63 2011/07/31 23:45:13 eldy Exp $ + * \version $Id: conf.class.php,v 1.62 2011/07/30 10:23:26 eldy Exp $ */ diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index c7e0858fe09..13a97bf54b3 100755 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -28,7 +28,7 @@ * \file htdocs/filefunc.inc.php * \ingroup core * \brief File that include conf.php file and functions.lib.php - * \version $Id: filefunc.inc.php,v 1.19 2011/07/21 22:11:30 eldy Exp $ + * \version $Id: filefunc.inc.php,v 1.20 2011/07/30 10:23:24 eldy Exp $ */ define('DOL_VERSION','3.1.0-beta'); // Also defined in htdocs/install/inc.php (Ex: x.y.z-alpha, x.y.z) @@ -61,8 +61,17 @@ error_reporting(E_ALL ^ E_NOTICE); //error_reporting(E_ALL); +$conffiletoshowshort = "conf.php"; +# Define localization of conf file +$conffile = "conf/conf.php"; +$conffiletoshow = "htdocs/conf/conf.php"; +# For debian like systems +#$conffile = "/etc/dolibarr/conf.php"; +#$conffiletoshow = "/etc/dolibarr/conf.php"; + + // Include configuration -$result=@include_once("conf/conf.php"); +$result=@include_once($conffile); if (! $result && ! empty($_SERVER["GATEWAY_INTERFACE"])) // If install not done and we are in a web session { header("Location: install/index.php"); diff --git a/htdocs/index.php b/htdocs/index.php index f027e94a35a..5998094d362 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -14,13 +14,14 @@ * 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 . + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * \file htdocs/index.php * \brief Dolibarr home page - * \version $Id: index.php,v 1.200 2011/07/31 23:19:05 eldy Exp $ + * \version $Id: index.php,v 1.199 2011/07/30 10:23:24 eldy Exp $ */ define('NOCSRFCHECK',1); // This is login page. We must be able to go on it from another web site. @@ -573,7 +574,7 @@ if ($user->admin && empty($conf->global->MAIN_REMOVE_INSTALL_WARNING)) $db->close(); -llxFooter('$Date: 2011/07/31 23:19:05 $ - $Revision: 1.200 $'); +llxFooter('$Date: 2011/07/30 10:23:24 $ - $Revision: 1.199 $'); /** diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 9b19d9793fc..3724ef23d95 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -15,14 +15,15 @@ * 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 . + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * \file htdocs/install/check.php * \ingroup install * \brief Test if file conf can be modified and if does not exists, test if install process can create it - * \version $Id: check.php,v 1.87 2011/07/31 23:26:19 eldy Exp $ + * \version $Id: check.php,v 1.86 2011/07/30 14:56:43 eldy Exp $ */ include_once("./inc.php"); diff --git a/htdocs/install/etape0.php b/htdocs/install/etape0.php index 737e16cc10c..20ef1080e85 100644 --- a/htdocs/install/etape0.php +++ b/htdocs/install/etape0.php @@ -14,14 +14,15 @@ * 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 . + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * \file htdocs/install/etape0.php * \ingroup install * \brief Show and ask charset for database - * \version $Id: etape0.php,v 1.42 2011/07/31 23:26:25 eldy Exp $ + * \version $Id: etape0.php,v 1.41 2011/07/30 14:56:43 eldy Exp $ */ define('DONOTLOADCONF',1); // To avoid loading conf by file inc.php diff --git a/htdocs/install/etape1.php b/htdocs/install/etape1.php index c9713870c22..5d7fca530f2 100644 --- a/htdocs/install/etape1.php +++ b/htdocs/install/etape1.php @@ -16,14 +16,15 @@ * 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 . + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * \file htdocs/install/etape1.php * \ingroup install * \brief Build conf file on disk - * \version $Id: etape1.php,v 1.136 2011/07/31 23:26:18 eldy Exp $ + * \version $Id: etape1.php,v 1.135 2011/07/30 14:56:42 eldy Exp $ */ define('DONOTLOADCONF',1); // To avoid loading conf by file inc.php diff --git a/htdocs/install/etape2.php b/htdocs/install/etape2.php index e7b45a476f1..d7df4ac6929 100644 --- a/htdocs/install/etape2.php +++ b/htdocs/install/etape2.php @@ -13,14 +13,15 @@ * 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 . + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * \file htdocs/install/etape2.php * \ingroup install * \brief Create tables, primary keys, foreign keys, indexes and functions into database and then load reference data - * \version $Id: etape2.php,v 1.106 2011/07/31 23:26:19 eldy Exp $ + * \version $Id: etape2.php,v 1.105 2011/07/30 14:56:43 eldy Exp $ */ include("./inc.php"); diff --git a/htdocs/install/etape4.php b/htdocs/install/etape4.php index 62e0a4a90cf..9a0dd0fcc43 100644 --- a/htdocs/install/etape4.php +++ b/htdocs/install/etape4.php @@ -15,14 +15,15 @@ * 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 . + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * \file htdocs/install/etape4.php * \ingroup install * \brief Ask login and password of Dolibarr admin user - * \version $Id: etape4.php,v 1.38 2011/07/31 23:26:26 eldy Exp $ + * \version $Id: etape4.php,v 1.37 2011/07/30 14:56:43 eldy Exp $ */ diff --git a/htdocs/install/etape5.php b/htdocs/install/etape5.php index 50fa9904890..0037190af06 100644 --- a/htdocs/install/etape5.php +++ b/htdocs/install/etape5.php @@ -16,14 +16,15 @@ * 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 . + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * \file htdocs/install/etape5.php * \ingroup install * \brief Last page of upgrade or install process - * \version $Id: etape5.php,v 1.107 2011/07/31 23:26:19 eldy Exp $ + * \version $Id: etape5.php,v 1.106 2011/07/31 13:28:45 eldy Exp $ */ include_once("./inc.php"); diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 2e0fccb0051..6d19b01e197 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -17,14 +17,15 @@ * 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 . + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * \file htdocs/install/fileconf.php * \ingroup install * \brief Ask all informations required to build Dolibarr htdocs/conf/conf.php file (will be wrote on disk on next page) - * \version $Id: fileconf.php,v 1.94 2011/07/31 23:26:27 eldy Exp $ + * \version $Id: fileconf.php,v 1.93 2011/07/30 14:56:43 eldy Exp $ */ include_once("./inc.php"); diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 223a2eb6d92..3050d37833c 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -15,13 +15,14 @@ * 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 . + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** \file htdocs/install/inc.php * \ingroup core * \brief File that define environment for install pages - * \version $Id: inc.php,v 1.137 2011/07/31 23:26:18 eldy Exp $ + * \version $Id: inc.php,v 1.136 2011/07/30 10:23:25 eldy Exp $ */ define('DOL_VERSION','3.1.0-beta'); // Also defined in htdocs/master.inc.php (Ex: x.y.z-alpha, x.y.z) @@ -74,12 +75,10 @@ $conffiletoshowshort = "conf.php"; # Define localization of conf file $conffile = "../conf/conf.php"; $conffiletoshow = "htdocs/conf/conf.php"; -$lockfile = '../../install.lock'; -# For debian/redhat like systems +# For debian like systems #$conffile = "/etc/dolibarr/conf.php"; #$conffiletoshow = "/etc/dolibarr/conf.php"; -#$lockfile = '/etc/dolibarr/install.lock'; # Web has no permission to write here -$lockfile = '../../install.lock'; + if (! defined('DONOTLOADCONF') && file_exists($conffile)) { @@ -179,7 +178,7 @@ if (preg_match('/install.lock/i',$_SERVER["SCRIPT_FILENAME"])) } exit; } -if (file_exists($lockfile)) +if (file_exists('../../install.lock')) { print 'Install pages have been disabled for security reason (by lock file install.lock into dolibarr root directory).
'; if (! empty($dolibarr_main_url_root)) diff --git a/htdocs/install/licence.php b/htdocs/install/licence.php index 841136fff8b..c786f91346c 100644 --- a/htdocs/install/licence.php +++ b/htdocs/install/licence.php @@ -13,14 +13,15 @@ * 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 . + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * \file htdocs/install/licence.php * \ingroup install * \brief Page to show licence (Removed from install process to save time) - * \version $Id: licence.php,v 1.21 2011/07/31 23:26:22 eldy Exp $ + * \version $Id: licence.php,v 1.20 2011/07/30 14:56:42 eldy Exp $ */ include_once("./inc.php"); diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index 1c43326d70f..1f046a29bc4 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -21,7 +21,7 @@ -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- --- $Id: llx_10_c_regions.sql,v 1.12 2011/07/28 18:34:46 eldy Exp $ +-- $Id: llx_10_c_regions.sql,v 1.13 2011/07/31 12:31:00 eldy Exp $ -- -- @@ -158,21 +158,21 @@ insert into llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, act insert into llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) values (7001, 70, 7001, '', 0, 'Colombie', 1); -- Regions Chile (id country=67) -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6701, 01, 67, NULL, NULL, 'Tarapacá', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6702, 02, 67, NULL, NULL, 'Antofagasta', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6703, 03, 67, NULL, NULL, 'Atacama', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6704, 04, 67, NULL, NULL, 'Coquimbo', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6705, 05, 67, NULL, NULL, 'Valparaíso', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6706, 06, 67, NULL, NULL, 'General Bernardo O Higgins', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6707, 07, 67, NULL, NULL, 'Maule', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6708, 08, 67, NULL, NULL, 'Biobío', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6709, 09, 67, NULL, NULL, 'Raucanía', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6710, 10, 67, NULL, NULL, 'Los Lagos', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6711, 11, 67, NULL, NULL, 'Aysén General Carlos Ibáñez del Campo', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6712, 12, 67, NULL, NULL, 'Magallanes y Antártica Chilena', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6713, 13, 67, NULL, NULL, 'Metropolitana de Santiago', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6714, 14, 67, NULL, NULL, 'Los Ríos', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6715, 15, 67, NULL, NULL, 'Arica y Parinacota', 1); +INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6701, 6701, 67, NULL, NULL, 'Tarapacá', 1); +INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6702, 6702, 67, NULL, NULL, 'Antofagasta', 1); +INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6703, 6703, 67, NULL, NULL, 'Atacama', 1); +INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6704, 6704, 67, NULL, NULL, 'Coquimbo', 1); +INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6705, 6705, 67, NULL, NULL, 'Valparaíso', 1); +INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6706, 6706, 67, NULL, NULL, 'General Bernardo O Higgins', 1); +INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6707, 6707, 67, NULL, NULL, 'Maule', 1); +INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6708, 6708, 67, NULL, NULL, 'Biobío', 1); +INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6709, 6709, 67, NULL, NULL, 'Raucanía', 1); +INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6710, 6710, 67, NULL, NULL, 'Los Lagos', 1); +INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6711, 6711, 67, NULL, NULL, 'Aysén General Carlos Ibáñez del Campo', 1); +INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6712, 6712, 67, NULL, NULL, 'Magallanes y Antártica Chilena', 1); +INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6713, 6713, 67, NULL, NULL, 'Metropolitana de Santiago', 1); +INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6714, 6714, 67, NULL, NULL, 'Los Ríos', 1); +INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6715, 6715, 67, NULL, NULL, 'Arica y Parinacota', 1); -- Regions San Salvador (id country=86) INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (8601, 8601, 86, NULL, NULL, 'Central', 1); diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index e3963e8e68f..9a109ab3fdc 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -21,7 +21,7 @@ -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- --- $Id: llx_20_c_departements.sql,v 1.14 2011/07/28 18:34:46 eldy Exp $ +-- $Id: llx_20_c_departements.sql,v 1.15 2011/07/31 12:31:00 eldy Exp $ -- -- @@ -566,7 +566,6 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('OAX', 15401, '', 0, 'OAX', 'Oaxaca', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PUE', 15401, '', 0, 'PUE', 'Puebla', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('QRO', 15401, '', 0, 'QRO', 'Querétaro', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('HGO', 15401, '', 0, 'HGO', 'Hidalgo', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('ROO', 15401, '', 0, 'ROO', 'Quintana Roo', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('SLP', 15401, '', 0, 'SLP', 'San Luis Potosí', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('SIN', 15401, '', 0, 'SIN', 'Sinaloa', 1); diff --git a/htdocs/install/mysql/migration/3.0.0-3.1.0.sql b/htdocs/install/mysql/migration/3.0.0-3.1.0.sql index cdc633ca281..e32055ea452 100755 --- a/htdocs/install/mysql/migration/3.0.0-3.1.0.sql +++ b/htdocs/install/mysql/migration/3.0.0-3.1.0.sql @@ -1,5 +1,5 @@ -- --- $Id: 3.0.0-3.1.0.sql,v 1.83 2011/07/28 22:22:32 eldy Exp $ +-- $Id: 3.0.0-3.1.0.sql,v 1.84 2011/07/29 19:59:10 eldy Exp $ -- -- Be carefull to requests order. -- This file must be loaded by calling /install/index.php page @@ -131,6 +131,9 @@ ALTER TABLE llx_usergroup_user ADD CONSTRAINT fk_usergroup_user_fk_user FOR -- V4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); ALTER TABLE llx_usergroup_user ADD CONSTRAINT fk_usergroup_user_fk_usergroup FOREIGN KEY (fk_usergroup) REFERENCES llx_usergroup (rowid); +-- V4.1 DELETE FROM llx_product_fournisseur where fk_product NOT IN (SELECT rowid from llx_product); +ALTER TABLE llx_product_fournisseur ADD CONSTRAINT fk_product_fournisseur_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); + ALTER TABLE llx_commande ADD COLUMN ref_int varchar(30) AFTER ref_ext; ALTER TABLE llx_facture ADD COLUMN ref_int varchar(30) AFTER ref_ext; ALTER TABLE llx_societe ADD COLUMN ref_int varchar(60) AFTER ref_ext; @@ -480,3 +483,4 @@ ALTER TABLE llx_don ADD phone_mobile varchar(24) after email; ALTER TABLE llx_don ADD phone varchar(24) after email; ALTER TABLE llx_user ADD civilite varchar(6) after entity; + diff --git a/htdocs/install/mysql/tables/llx_product_fournisseur.key.sql b/htdocs/install/mysql/tables/llx_product_fournisseur.key.sql index 8925d93d301..612755ce349 100644 --- a/htdocs/install/mysql/tables/llx_product_fournisseur.key.sql +++ b/htdocs/install/mysql/tables/llx_product_fournisseur.key.sql @@ -1,6 +1,6 @@ -- ============================================================================ -- Copyright (C) 2002-2004 Rodolphe Quiedeville --- Copyright (C) 2004-2005 Laurent Destailleur +-- Copyright (C) 2004-2011 Laurent Destailleur -- Copyright (C) 2005-2009 Regis Houssin -- -- This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- --- $Id: llx_product_fournisseur.key.sql,v 1.2 2011/07/29 06:58:52 tiaris Exp $ +-- $Id: llx_product_fournisseur.key.sql,v 1.3 2011/07/29 19:59:33 eldy Exp $ -- ============================================================================ @@ -26,4 +26,4 @@ ALTER TABLE llx_product_fournisseur ADD UNIQUE INDEX uk_product_fournisseur_ref ALTER TABLE llx_product_fournisseur ADD INDEX idx_product_fourn_fk_product (fk_product, entity); ALTER TABLE llx_product_fournisseur ADD INDEX idx_product_fourn_fk_soc (fk_soc, entity); -ALTER TABLE llx_product_fournisseur ADD CONSTRAINT fk_product_fournisseur_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); +ALTER TABLE llx_product_fournisseur ADD CONSTRAINT fk_product_fournisseur_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); diff --git a/htdocs/langs/ca_ES/admin.lang b/htdocs/langs/ca_ES/admin.lang index 87a8cd1edcc..24252ef481f 100644 --- a/htdocs/langs/ca_ES/admin.lang +++ b/htdocs/langs/ca_ES/admin.lang @@ -1246,9 +1246,9 @@ ClickToDialDesc=Aquest mòdul permet afegir una icona després del número de te CashDesk=TPV CashDeskSetup=Mòdul de configuració Terminal Punt de Venda CashDeskThirdPartyForSell=Tercer genéric a utilitzar per a les vendes -CashDeskBankAccountForSell=Compte a utilitzar per als cobraments en efectiu (caixa) -CashDeskBankAccountForCheque=Compte a utilitzar per als cobraments amb xecs -CashDeskBankAccountForCB=Compte a utilitzar per als cobraments amb targeta de crèdit +CashDeskBankAccountForSell=Compte per defecte a utilitzar per als cobraments en efectiu (caixa) +CashDeskBankAccountForCheque=Compte per defecte a utilitzar per als cobraments amb xecs +CashDeskBankAccountForCB=Compte per defecte a utilitzar per als cobraments amb targeta de crèdit CashDeskIdWareHouse=Magatzem a ultilitzar per a les vendes ##### Bookmark ##### BookmarkSetup=Configuració del mòdul Bookmark diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index eb268695a5c..c4ea6eac339 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -1246,9 +1246,9 @@ ClickToDialDesc=Este módulo permite agregar un icono después del número de te CashDesk=TPV CashDeskSetup=Configuración del módulo Terminal Punto de Venta CashDeskThirdPartyForSell=Tercero genérico a usar para la venta -CashDeskBankAccountForSell=Cuenta a utilizar para los cobros en efectivo (caja) -CashDeskBankAccountForCheque=Cuenta a utilizar para los cobros con cheques -CashDeskBankAccountForCB=Cuenta a utilizar para los cobros con tarjeta de crédito +CashDeskBankAccountForSell=Cuenta por defecto a utilizar para los cobros en efectivo (caja) +CashDeskBankAccountForCheque=Cuenta por defecto a utilizar para los cobros con cheques +CashDeskBankAccountForCB=Cuenta por defecto a utilizar para los cobros con tarjeta de crédito CashDeskIdWareHouse=Almacén a utilizar para las ventas ##### Bookmark ##### BookmarkSetup=Configuración del módulo Marcadores diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 1bdeb9562e6..49b67f9349a 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -18,14 +18,15 @@ * 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 . + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * \file htdocs/main.inc.php * \ingroup core * \brief File that defines environment for Dolibarr pages only (variables not required by scripts) - * \version $Id: main.inc.php,v 1.756 2011/07/31 23:19:05 eldy Exp $ + * \version $Id: main.inc.php,v 1.755 2011/07/30 10:23:24 eldy Exp $ */ @ini_set('memory_limit', '64M'); // This may be useless if memory is hard limited by your PHP diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 1d5b4951490..03ef2767e40 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -21,7 +21,8 @@ * 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 . + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** @@ -29,7 +30,7 @@ * \ingroup core * \brief File that defines environment for all Dolibarr process (pages or scripts) * This script reads the conf file, init $lang, $db and and empty $user - * \version $Id: master.inc.php,v 1.351 2011/07/31 23:19:04 eldy Exp $ + * \version $Id: master.inc.php,v 1.350 2011/07/30 10:23:24 eldy Exp $ */ diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index d6f7baf831e..1da2adb751e 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -25,7 +25,7 @@ * \file htdocs/product/class/product.class.php * \ingroup produit * \brief Fichier de la classe des produits predefinis - * \version $Id: product.class.php,v 1.46 2011/07/29 06:59:36 tiaris Exp $ + * \version $Id: product.class.php,v 1.47 2011/07/29 20:47:35 eldy Exp $ */ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); @@ -191,14 +191,15 @@ class Product extends CommonObject /** * Insert product into database - * @param user User making insert - * @return int id of product/service if OK or number of error < 0 + * @param user User making insert + * @param notrigger Disable triggers + * @return int Id of product/service if OK or number of error < 0 */ - function create($user) + function create($user,$notrigger=0) { - global $conf ; + global $conf, $langs; - $this->errno = 0; + $error=0; // Clean parameters $this->ref = dol_string_nospecial(trim($this->ref)); @@ -250,172 +251,149 @@ class Product extends CommonObject $this->error='ErrorWrongParameters'; return -1; } + if (empty($this->ref)) + { + $this->error='ErrorWrongParameters'; + return -2; + } dol_syslog("Product::Create ref=".$this->ref." price=".$this->price." price_ttc=".$this->price_ttc." tva_tx=".$this->tva_tx." price_base_type=".$this->price_base_type." Category : ".$this->catid, LOG_DEBUG); - if ($this->ref) + + $this->db->begin(); + + $sql = "SELECT count(*) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."product"; + $sql.= " WHERE ref = '" .$this->ref."'"; + $sql.= " AND entity = ".$conf->entity; + + $result = $this->db->query($sql); + if ($result) { - $this->db->begin(); - - $sql = "SELECT count(*)"; - $sql.= " FROM ".MAIN_DB_PREFIX."product"; - $sql.= " WHERE ref = '" .$this->ref."'"; - $sql.= " AND entity = ".$conf->entity; - - $result = $this->db->query($sql) ; - if ($result) + $obj = $this->db->fetch_object($result); + if ($obj->nb == 0) { - $row = $this->db->fetch_array($result); - if ($row[0] == 0) + // Produit non deja existant + $sql = "INSERT INTO ".MAIN_DB_PREFIX."product ("; + $sql.= "datec"; + $sql.= ", entity"; + $sql.= ", ref"; + $sql.= ", price_min"; + $sql.= ", price_min_ttc"; + $sql.= ", label"; + $sql.= ", fk_user_author"; + $sql.= ", fk_product_type"; + $sql.= ", price"; + $sql.= ", price_ttc"; + $sql.= ", price_base_type"; + $sql.= ", tobuy"; + $sql.= ", tosell"; + $sql.= ", canvas"; + $sql.= ", finished"; + $sql.= ", hidden"; + $sql.= ") VALUES ("; + $sql.= $this->db->idate(mktime()); + $sql.= ", ".$conf->entity; + $sql.= ", '".$this->ref."'"; + $sql.= ", ".price2num($price_min_ht); + $sql.= ", ".price2num($price_min_ttc); + $sql.= ", ".($this->libelle?"'".$this->db->escape($this->libelle)."'":"null"); + $sql.= ", ".$user->id; + $sql.= ", ".$this->type; + $sql.= ", ".price2num($price_ht); + $sql.= ", ".price2num($price_ttc); + $sql.= ", '".$this->price_base_type."'"; + $sql.= ", ".$this->status; + $sql.= ", ".$this->status_buy; + $sql.= ", '".$this->canvas."'"; + $sql.= ", ".$this->finished; + $sql.= ", ".$this->hidden; + $sql.= ")"; + + dol_syslog("Product::Create sql=".$sql); + $result = $this->db->query($sql); + if ( $result ) { - // Produit non deja existant - $sql = "INSERT INTO ".MAIN_DB_PREFIX."product ("; - $sql.= "datec"; - $sql.= ", entity"; - $sql.= ", ref"; - $sql.= ", price_min"; - $sql.= ", price_min_ttc"; - $sql.= ", label"; - $sql.= ", fk_user_author"; - $sql.= ", fk_product_type"; - $sql.= ", price"; - $sql.= ", price_ttc"; - $sql.= ", price_base_type"; - $sql.= ", canvas"; - $sql.= ", finished"; - $sql.= ", hidden"; - $sql.= ") VALUES ("; - $sql.= $this->db->idate(mktime()); - $sql.= ", ".$conf->entity; - $sql.= ", '".$this->ref."'"; - $sql.= ", ".price2num($price_min_ht); - $sql.= ", ".price2num($price_min_ttc); - $sql.= ", ".($this->libelle?"'".$this->db->escape($this->libelle)."'":"null"); - $sql.= ", ".$user->id; - $sql.= ", ".$this->type; - $sql.= ", ".price2num($price_ht); - $sql.= ", ".price2num($price_ttc); - $sql.= ", '".$this->price_base_type."'"; - $sql.= ", '".$this->canvas."'"; - $sql.= ", ".$this->finished; - $sql.= ", ".$this->hidden; - $sql.= ")"; + $id = $this->db->last_insert_id(MAIN_DB_PREFIX."product"); - dol_syslog("Product::Create sql=".$sql); - $result = $this->db->query($sql); - if ( $result ) + if ($id > 0) { - $id = $this->db->last_insert_id(MAIN_DB_PREFIX."product"); + $this->id = $id; + $this->price = $price_ht; + $this->price_ttc = $price_ttc; + $this->price_min = $price_min_ht; + $this->price_min_ttc = $price_min_ttc; - if ($id > 0) + $result = $this->_log_price($user); + if ($result > 0) { - $this->id = $id; - $this->price = $price_ht; - $this->price_ttc = $price_ttc; - $this->price_min = $price_min_ht; - $this->price_min_ttc = $price_min_ttc; - - $result = $this->_log_price($user); - if ($result > 0) + if ( $this->update($id, $user) > 0) { - if ( $this->update($id, $user) > 0) + if ($this->catid > 0) { - if ($this->catid > 0) - { - require_once(DOL_DOCUMENT_ROOT ."/categories/class/categorie.class.php"); - $cat = new Categorie($this->db, $this->catid); - $cat->add_type($this,"product"); - } - } - else - { - $this->_setErrNo("Create",260,$this->error); + require_once(DOL_DOCUMENT_ROOT ."/categories/class/categorie.class.php"); + $cat = new Categorie($this->db, $this->catid); + $cat->add_type($this,"product"); } } else { - $this->error=$this->db->error(); - $this->_setErrNo("Create",264,$this->error); + $error++; + $this->error='ErrorFailedToUpdateRecord'; } } else { - $this->_setErrNo("Create",259); + $error++; + $this->error=$this->db->lasterror(); } } else { - $this->error=$this->db->error(); - $this->_setErrNo("Create",258,$this->error); + $error++; + $this->error='ErrorFailedToGetInsertedId'; } } else { - // Le produit existe deja - $this->error='ErrorProductAlreadyExists'; + $error++; + $this->error=$this->db->lasterror(); } } else { - $this->_setErrNo("Create",263); - } - - /* - * END COMMIT - */ - - if ($this->errno === 0) - { - // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PRODUCT_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers - - $this->db->commit(); - return $id; - } - else - { - $this->db->rollback(); - return -1; + // Product already exists with this ref + $langs->trans("Error")." : ".$langs->trans("ErrorProductAlreadyExists",$this->ref); } } else { - $this->_setErrNo("Create",262); - - return -2; + $error++; + $this->error=$this->db->lasterror(); } - return -1; + if (! $error && ! $notrigger) + { + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('PRODUCT_CREATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Fin appel triggers + } + + if (! $error) + { + $this->db->commit(); + return $this->id; + } + else + { + $this->db->rollback(); + return -$error; + } } - /** - * Positionne le numero d'erreur - * @param func Nom de la fonction - * @param num Numero de l'erreur - * @param error string - */ - function _setErrNo($func, $num, $error='') - { - $this->errno = $num; - dol_syslog(get_class($this)."::".$func." - ERRNO(".$this->errno.")".($error?' - '.$error:''), LOG_ERR); - } - - /** - * Retourne le texte de l'erreur - */ - function error() - { - $errs[257] = "ErrorProductAlreadyExists"; - $errs[262] = "ErrorProductBadRefOrLabel"; - - return $errs[$this->errno]; - } - - /** * Update a record into database * @param id Id of product @@ -2161,7 +2139,7 @@ class Product extends CommonObject $prods[$this->db->escape($rec['label'])][$keyChild] = $valueChild; } } - + return $prods; } else