diff --git a/build/makepack-dolibarrtheme.pl b/build/makepack-dolibarrtheme.pl index 1c828f6cc30..435734870e6 100644 --- a/build/makepack-dolibarrtheme.pl +++ b/build/makepack-dolibarrtheme.pl @@ -2,7 +2,6 @@ #----------------------------------------------------------------------------- # \file build/makepack-dolibarrtheme.pl # \brief Script to build a theme Package for Dolibarr -# \version $Revision: 1.10 $ # \author (c)2005-2009 Laurent Destailleur #----------------------------------------------------------------------------- @@ -25,7 +24,7 @@ $PROJECT="dolibarr"; use vars qw/ $REVISION $VERSION /; -$REVISION='$Revision: 1.10 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1; +$REVISION='1.11'; $VERSION="1.0 (build $REVISION)"; @@ -75,10 +74,14 @@ my $copyalreadydone=0; my $batch=0; print "Makepack theme version $VERSION\n"; -print "Enter name of theme to package: "; +print "Enter name of theme(s) to package (separated with space): "; $PROJECT=; chomp($PROJECT); +@PROJECTLIST=split(/ /,$PROJECT); +$PROJECT=join('',@PROJECTLIST); + + # Ask and set version $MAJOR and $MINOR print "Enter value for version: "; $PROJVERSION=; @@ -94,6 +97,8 @@ if ($MINOR eq '') $FILENAME="$PROJECT"; $FILENAMETGZ="theme_$PROJECT-$MAJOR.$MINOR"; +$FILENAMEZIP="theme_$PROJECT-$MAJOR.$MINOR"; + if (-d "/usr/src/redhat") { # redhat $RPMDIR="/usr/src/redhat"; @@ -202,11 +207,13 @@ if ($nboftargetok) { mkdir "$BUILDROOT"; mkdir "$BUILDROOT/htdocs"; mkdir "$BUILDROOT/htdocs/theme"; - mkdir "$BUILDROOT/htdocs/theme/$PROJECT"; print "Copy $SOURCE into $BUILDROOT\n"; mkdir "$BUILDROOT"; - $ret=`cp -pr "$SOURCE/htdocs/theme/$PROJECT" "$BUILDROOT/htdocs/theme"`; + foreach my $tmp (@PROJECTLIST) + { + $ret=`cp -pr "$SOURCE/htdocs/theme/$tmp" "$BUILDROOT/htdocs/theme"`; + } } print "Clean $BUILDROOT\n"; $ret=`rm -fr $BUILDROOT/htdocs/theme/$PROJECT/Thumbs.db $BUILDROOT/htdocs/theme/$PROJECT/*/Thumbs.db $BUILDROOT/htdocs/theme/$PROJECT/*/*/Thumbs.db $BUILDROOT/htdocs/theme/$PROJECT/*/*/*/Thumbs.db`; @@ -222,16 +229,12 @@ if ($nboftargetok) { if ($target eq 'TGZ') { unlink $FILENAMETGZ.tgz; -# unlink $BUILDROOT/$FILENAMETGZ.tgz; print "Compress $BUILDROOT/htdocs into $FILENAMETGZ.tgz...\n"; $cmd="tar --exclude-vcs --exclude-from \"$DESTI/tgz/tar_exclude.txt\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$FILENAMETGZ.tgz\" htdocs"; $ret=`$cmd`; -# $cmd="tar --exclude-vcs --exclude-from \"$DESTI/tgz/tar_exclude.txt\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$BUILDROOT/$FILENAMETGZ.tgz\" htdocs\n"; -# $ret=`$cmd`; if ($OS =~ /windows/i) { print "Move $FILENAMETGZ.tgz to $DESTI/$FILENAMETGZ.tgz\n"; $ret=`mv "$FILENAMETGZ.tgz" "$DESTI/$FILENAMETGZ.tgz"`; -# $ret=`mv "$BUILDROOT/$FILENAMETGZ.tgz" "$DESTI/$FILENAMETGZ.tgz"`; } next; } @@ -240,56 +243,9 @@ if ($nboftargetok) { unlink $FILENAMEZIP.zip; print "Compress $FILENAMETGZ into $FILENAMEZIP.zip...\n"; chdir("$BUILDROOT"); - #print "cd $BUILDROOTNT & 7z a -r -tzip -mx $BUILDROOT/$FILENAMEZIP.zip $FILENAMETGZ\\*.*\n"; - #$ret=`cd $BUILDROOTNT & 7z a -r -tzip -mx $BUILDROOT/$FILENAMEZIP.zip $FILENAMETGZ\\*.*`; - $ret=`7z a -r -tzip -mx $BUILDROOT/$FILENAMEZIP.zip $FILENAMETGZ\\*.*`; - print "Move $FILENAMEZIP.zip to $DESTI\n"; - rename("$BUILDROOT/$FILENAMEZIP.zip","$DESTI/$FILENAMEZIP.zip"); - next; - } - - if ($target eq 'RPM') { # Linux only - $BUILDFIC="$FILENAME.spec"; - unlink $FILENAMETGZ.tgz; - print "Compress $FILENAMETGZ into $FILENAMETGZ.tgz...\n"; - $ret=`tar --exclude-vcs --exclude-from "$SOURCE/build/tgz/tar_exclude.txt" --directory "$BUILDROOT" --group=500 --owner=500 -czvf "$BUILDROOT/$FILENAMETGZ.tgz" $FILENAMETGZ`; - - print "Move $FILENAMETGZ.tgz to $RPMDIR/SOURCES/$FILENAMETGZ.tgz\n"; - $cmd="mv \"$BUILDROOT/$FILENAMETGZ.tgz\" \"$RPMDIR/SOURCES/$FILENAMETGZ.tgz\""; - $ret=`$cmd`; - - print "Copy $SOURCE/make/rpm/${BUILDFIC} to $BUILDROOT\n"; -# $ret=`cp -p "$SOURCE/make/rpm/${BUILDFIC}" "$BUILDROOT"`; - open (SPECFROM,"<$SOURCE/make/rpm/${BUILDFIC}") || die "Error"; - open (SPECTO,">$BUILDROOT/$BUILDFIC") || die "Error"; - while () { - $_ =~ s/__VERSION__/$MAJOR.$MINOR.$BUILD/; - print SPECTO $_; - } - close SPECFROM; - close SPECTO; - - print "Launch RPM build (rpm --clean -ba $BUILDROOT/${BUILDFIC})\n"; - $ret=`rpm --clean -ba $BUILDROOT/${BUILDFIC}`; - - print "Move $RPMDIR/RPMS/noarch/${FILENAMERPM}.noarch.rpm into $DESTI/${FILENAMERPM}.noarch.rpm\n"; - $cmd="mv \"$RPMDIR/RPMS/noarch/${FILENAMERPM}.noarch.rpm\" \"$DESTI/${FILENAMERPM}.noarch.rpm\""; - $ret=`$cmd`; - next; - } - - if ($target eq 'DEB') { - print "Automatic build for DEB is not yet supported.\n"; - } - - if ($target eq 'EXE') { - unlink "$FILENAMEEXE.exe"; - print "Compress into $FILENAMEEXE.exe by $FILENAMEEXE.nsi...\n"; - $command="\"$REQUIREMENTTARGET{$target}\" /DMUI_VERSION_DOT=$MAJOR.$MINOR.$BUILD /X\"SetCompressor bzip2\" \"$SOURCE\\build\\exe\\$FILENAME.nsi\""; - print "$command\n"; - $ret=`$command`; - print "Move $FILENAMEEXE.exe to $DESTI\n"; - rename("$SOURCE\\build\\exe\\$FILENAMEEXE.exe","$DESTI/$FILENAMEEXE.exe"); + $ret=`7z a -r -tzip -mx $BUILDROOT/$FILENAMEZIP.zip htdocs`; + print "Move $FILENAMEZIP.zip to $DESTI\n"; + $ret=`mv "$FILENAMEZIP.zip" "$DESTI/$FILENAMEZIP.zip"`; next; } diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php index 720b7d3d00f..b1a2ad1ac52 100644 --- a/htdocs/cashdesk/admin/cashdesk.php +++ b/htdocs/cashdesk/admin/cashdesk.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-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 @@ -89,7 +89,7 @@ print "\n"; $var=!$var; print ''.$langs->trans("CashDeskThirdPartyForSell").''; print ''; -print $form->select_societes($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client=1',1,1); +print $form->select_societes($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',1,1); print ''; if ($conf->banque->enabled) { diff --git a/htdocs/cashdesk/index.php b/htdocs/cashdesk/index.php index a27d91d98fd..c416f90856a 100644 --- a/htdocs/cashdesk/index.php +++ b/htdocs/cashdesk/index.php @@ -87,7 +87,7 @@ print ''; $disabled=0; $langs->load("companies"); if (! empty($conf->global->CASHDESK_ID_THIRDPARTY)) $disabled=1; // If a particular third party is defined, we disable choice -$form->select_societes(GETPOST('socid')?GETPOST('socid'):$conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client=1',!$disabled,$disabled,1); +$form->select_societes(GETPOST('socid')?GETPOST('socid'):$conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',!$disabled,$disabled,1); //print ''; print ''; print "\n"; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 02ac9c26e67..ec6c4b2fe73 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -57,6 +57,7 @@ class Categorie /** * Constructor + * * @param DB acces base de donnees * @param id id de la categorie */ @@ -70,6 +71,7 @@ class Categorie /** * Load category into memory from database + * @param id id of category */ function fetch($id) @@ -79,7 +81,7 @@ class Categorie $sql.= " WHERE rowid = ".$id; dol_syslog("Categorie::fetch sql=".$sql); - $resql = $this->db->query ($sql); + $resql = $this->db->query($sql); if ($resql) { $res = $this->db->fetch_array($resql); @@ -95,16 +97,16 @@ class Categorie } else { - dol_print_error ($this->db); + dol_print_error($this->db); return -1; } $sql = "SELECT fk_categorie_mere"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_association"; - $sql.= " WHERE fk_categorie_fille = '".$id."'"; + $sql.= " WHERE fk_categorie_fille = ".$id; dol_syslog("Categorie::fetch sql=".$sql); - $resql = $this->db->query ($sql); + $resql = $this->db->query($sql); if ($resql) { $res = $this->db->fetch_array($resql); @@ -114,13 +116,14 @@ class Categorie } else { - dol_print_error ($this->db); + dol_print_error($this->db); return -1; } } /** * Add category into database + * * @return int -1 : erreur SQL * -2 : nouvel ID inconnu * -3 : categorie invalide @@ -159,10 +162,10 @@ class Categorie //$sql.= ",".$this->parentId; $sql.= ")"; - $res = $this->db->query ($sql); + $res = $this->db->query($sql); if ($res) { - $id = $this->db->last_insert_id (MAIN_DB_PREFIX."categorie"); + $id = $this->db->last_insert_id(MAIN_DB_PREFIX."categorie"); if ($id > 0) { @@ -192,13 +195,14 @@ class Categorie } else { - dol_print_error ($this->db); + dol_print_error($this->db); return -1; } } /** * Update category + * * @return int 1 : OK * -1 : SQL error * -2 : invalid category @@ -211,18 +215,19 @@ class Categorie $this->label=trim($this->label); $this->description=trim($this->description); $this->parentId = ($this->id_mere) != "" ? intval($this->id_mere) : 0; - + $this->visible = ($this->visible) != "" ? intval($this->visible) : 0; + if ($this->already_exists()) { $this->error=$langs->trans("ImpossibleUpdateCat"); $this->error.=" : ".$langs->trans("CategoryExistsAtSameLevel"); return -1; - } - + } + $this->db->begin(); $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'categorie_association'; - $sql .= ' WHERE fk_categorie_fille = "'.$this->id.'"'; + $sql.= ' WHERE fk_categorie_fille = '.$this->id; dol_syslog("Categorie::update sql=".$sql); if (! $this->db->query($sql)) @@ -235,7 +240,7 @@ class Categorie if($this->id_mere !="" && $this->id_mere!=$this->id) { $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'categorie_association(fk_categorie_mere,fk_categorie_fille)'; - $sql .= ' VALUES ("'.$this->id_mere.'","'.$this->id.'")'; + $sql.= ' VALUES ('.$this->id_mere.', '.$this->id.')'; dol_syslog("Categorie::update sql=".$sql); if (! $this->db->query($sql)) @@ -284,6 +289,7 @@ class Categorie /** * Delete a category from database + * * @param user Object user that ask to delete */ function delete($user) @@ -544,21 +550,21 @@ class Categorie $sql = "SELECT fk_categorie_fille FROM ".MAIN_DB_PREFIX."categorie_association "; $sql .= "WHERE fk_categorie_mere = ".$this->id; - $res = $this->db->query ($sql); + $res = $this->db->query($sql); if ($res) { $cats = array (); - while ($rec = $this->db->fetch_array ($res)) + while ($rec = $this->db->fetch_array($res)) { - $cat = new Categorie ($this->db, $rec['fk_categorie_fille']); + $cat = new Categorie($this->db, $rec['fk_categorie_fille']); $cats[] = $cat; } return $cats; } else { - dol_print_error ($this->db); + dol_print_error($this->db); return -1; } } @@ -567,13 +573,13 @@ class Categorie /** * retourne la description d'une categorie */ - function get_desc ($cate) + function get_desc($cate) { $sql = "SELECT description FROM ".MAIN_DB_PREFIX."categorie "; - $sql .= "WHERE rowid = '".$cate."'"; + $sql .= "WHERE rowid = ".$cate; - $res = $this->db->query ($sql); - $n = $this->db->fetch_array ($res); + $res = $this->db->query($sql); + $n = $this->db->fetch_array($res); return ($n[0]); } @@ -581,12 +587,12 @@ class Categorie /** * La categorie $fille est-elle une fille de cette categorie ? */ - function is_fille ($fille) + function is_fille($fille) { $sql = "SELECT count(fk_categorie_fille) FROM ".MAIN_DB_PREFIX."categorie_association "; $sql .= "WHERE fk_categorie_mere = ".$this->id." AND fk_categorie_fille = ".$fille->id; - $res = $this->db->query ($sql); + $res = $this->db->query($sql); $n = $this->db->fetch_array($res); @@ -627,7 +633,7 @@ class Categorie } else { - dol_print_error ($this->db); + dol_print_error($this->db); return -1; } @@ -660,7 +666,7 @@ class Categorie } else { - dol_print_error ($this->db); + dol_print_error($this->db); return -1; } @@ -778,20 +784,20 @@ class Categorie { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie"; - $res = $this->db->query ($sql); + $res = $this->db->query($sql); if ($res) { $cats = array (); - while ($record = $this->db->fetch_array ($res)) + while ($record = $this->db->fetch_array($res)) { - $cat = new Categorie ($this->db, $record['rowid']); + $cat = new Categorie($this->db, $record['rowid']); $cats[$record['rowid']] = $cat; } return $cats; } else { - dol_print_error ($this->db); + dol_print_error($this->db); return -1; } } @@ -804,7 +810,7 @@ class Categorie { $sql = "SELECT count(rowid)"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie"; - $res = $this->db->query ($sql); + $res = $this->db->query($sql); if ($res) { $res = $this->db->fetch_array($res); @@ -866,7 +872,7 @@ class Categorie } else { - dol_print_error ($this->db); + dol_print_error($this->db); return -1; } } @@ -874,22 +880,22 @@ class Categorie /** * \brief Retourne les categories de premier niveau (qui ne sont pas filles) */ - function get_main_categories () + function get_main_categories() { - $allcats = $this->get_all_categories (); + $allcats = $this->get_all_categories(); $maincats = array (); $filles = array (); $sql = "SELECT fk_categorie_fille FROM ".MAIN_DB_PREFIX."categorie_association"; - $res = $this->db->query ($sql); - while ($res = $this->db->fetch_array ($res)) + $res = $this->db->query($sql); + while ($res = $this->db->fetch_array($res)) { $filles[] = $res['fk_categorie_fille']; } foreach ($allcats as $cat) { - if (!in_array ($cat->id, $filles)) + if (! in_array($cat->id, $filles)) { $maincats[] = $cat; } @@ -943,7 +949,7 @@ class Categorie { if(sizeof($way)<$primary_way["taille"] || $primary_way["taille"]<0) { - $primary_way["taille"] = sizeOf($way); + $primary_way["taille"] = count($way); $primary_way["chemin"] = $way; } } @@ -978,26 +984,26 @@ class Categorie /** * Retourne un tableau contenant la liste des categories meres */ - function get_meres () + function get_meres() { - $meres = array (); + $meres = array(); $sql = "SELECT fk_categorie_mere FROM ".MAIN_DB_PREFIX."categorie_association "; $sql .= "WHERE fk_categorie_fille = ".$this->id; - $res = $this->db->query ($sql); + $res = $this->db->query($sql); if ($res) { - while ($cat = $this->db->fetch_array ($res)) + while ($cat = $this->db->fetch_array($res)) { - $meres[] = new Categorie ($this->db, $cat['fk_categorie_mere']); + $meres[] = new Categorie($this->db, $cat['fk_categorie_mere']); } return $meres; } else { - dol_print_error ($this->db); + dol_print_error($this->db); return -1; } } @@ -1010,9 +1016,9 @@ class Categorie { $ways = array (); - foreach ($this->get_meres () as $mere) + foreach ($this->get_meres() as $mere) { - foreach ($mere->get_all_ways () as $way) + foreach ($mere->get_all_ways() as $way) { $w = $way; $w[] = $this; @@ -1021,7 +1027,7 @@ class Categorie } } - if (sizeof ($ways) == 0) + if (count($ways) == 0) $ways[0][0] = $this; return $ways; @@ -1046,21 +1052,21 @@ class Categorie $sql = "SELECT ct.fk_categorie"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$type." as ct"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON ct.fk_categorie = c.rowid"; - $sql.= " WHERE ct.fk_".$table." = ".$id." AND c.type = ".$typeid; + $sql.= " WHERE ct.fk_".$table." = ".$id." AND c.type = ".$typeid; - $res = $this->db->query ($sql); + $res = $this->db->query($sql); if ($res) { - while ($cat = $this->db->fetch_array ($res)) + while ($cat = $this->db->fetch_array($res)) { - $cats[] = new Categorie ($this->db, $cat['fk_categorie']); + $cats[] = new Categorie($this->db, $cat['fk_categorie']); } return $cats; } else { - dol_print_error ($this->db); + dol_print_error($this->db); return -1; } } @@ -1081,7 +1087,7 @@ class Categorie { if (! $exact) { - $nom = '%'.str_replace ('*', '%', $nom).'%'; + $nom = '%'.str_replace('*', '%', $nom).'%'; } $sql.= "AND label LIKE '".$nom."'"; } @@ -1090,12 +1096,12 @@ class Categorie $sql.="AND rowid = '".$id."'"; } - $res = $this->db->query ($sql); + $res = $this->db->query($sql); if ($res) { - while ($id = $this->db->fetch_array ($res)) + while ($id = $this->db->fetch_array($res)) { - $cats[] = new Categorie ($this->db, $id['rowid']); + $cats[] = new Categorie($this->db, $id['rowid']); } return $cats; diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index 225398bfa23..2722ae7b426 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2004-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 @@ -19,8 +19,7 @@ /** * \file htdocs/comm/remise.php * \ingroup societe - * \brief Onglet remise de la societe - * \version $Id: remise.php,v 1.35 2011/08/03 00:46:27 eldy Exp $ + * \brief Page to edit relative discount of a customer */ require("../main.inc.php"); @@ -31,15 +30,25 @@ $langs->load("companies"); $langs->load("orders"); $langs->load("bills"); -$_socid = $_GET["id"]; +$socid = GETPOST("id"); // Security check if ($user->societe_id > 0) { - $_socid = $user->societe_id; + $socid = $user->societe_id; } -if ($_POST["action"] == 'setremise') +/* + * Actions + */ + +if (GETPOST('cancel') && GETPOST('backtopage')) +{ + Header("Location: ".GETPOST("backtopage")); + exit; +} + +if (GETPOST("action") == 'setremise') { $soc = New Societe($db); $soc->fetch($_GET["id"]); @@ -47,8 +56,16 @@ if ($_POST["action"] == 'setremise') if ($result > 0) { - Header("Location: remise.php?id=".$_GET["id"]); - exit; + if (GETPOST('backtopage')) + { + Header("Location: ".GETPOST('backtopage')); + exit; + } + else + { + Header("Location: remise.php?id=".$_GET["id"]); + exit; + } } else { @@ -71,21 +88,15 @@ llxHeader(); * Mode fiche * *********************************************************************************/ -if ($_socid > 0) +if ($socid > 0) { // On recupere les donnees societes par l'objet $objsoc = new Societe($db); - $objsoc->id=$_socid; - $objsoc->fetch($_socid,$to); + $objsoc->id=$socid; + $objsoc->fetch($socid); - if ($errmesg) - { - print '
'.$errmesg.'

'; - } + dol_htmloutput_errors($errmesg); - /* - * Affichage onglets - */ $head = societe_prepare_head($objsoc); dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"),0,'company'); @@ -111,6 +122,7 @@ if ($_socid > 0) print '
'; print ''; print ''; + print ''; print ''; @@ -122,13 +134,21 @@ if ($_socid > 0) print ''; - print ''; - print "
'; print $langs->trans("NoteReason").'
"; + print '
'; + print ''; + if (GETPOST("backtopage")) + { + print '    '; + print ''; + } + print '
'; + print "
"; - print "\n"; + dol_fiche_end(); + print '
'; @@ -180,5 +200,5 @@ if ($_socid > 0) $db->close(); -llxFooter('$Date: 2011/08/03 00:46:27 $ - $Revision: 1.35 $'); +llxFooter(); ?> diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index d836864b7bb..e6b79bc44bc 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -21,7 +21,6 @@ * \file htdocs/comm/remx.php * \ingroup societe * \brief Page to edit absolute discounts for a customer - * \version $Id: remx.php,v 1.53 2011/08/04 21:46:51 eldy Exp $ */ require("../main.inc.php"); @@ -34,10 +33,10 @@ $langs->load("bills"); $langs->load("companies"); // Security check -$_socid = $_GET["id"]; +$socid = GETPOST("id"); if ($user->societe_id > 0) { - $_socid = $user->societe_id; + $socid = $user->societe_id; } @@ -205,16 +204,16 @@ if (GETPOST("action") == 'confirm_remove' && GETPOST("confirm")=='yes') $form=new Form($db); $facturestatic=new Facture($db); -llxHeader(); +llxHeader('',$langs->trans("GlobalDiscount")); -if ($_socid > 0) +if ($socid > 0) { dol_htmloutput_mesg($mesg); // On recupere les donnees societes par l'objet $objsoc = new Societe($db); - $objsoc->id=$_socid; - $objsoc->fetch($_socid,$to); + $objsoc->id=$socid; + $objsoc->fetch($socid); /* * Affichage onglets @@ -257,10 +256,10 @@ if ($_socid > 0) } print ''.$langs->trans("CustomerAbsoluteDiscountAllUsers").''; - print ''.$remise_all.' '.$langs->trans("Currency".$conf->monnaie).''; + print ''.$remise_all.' '.$langs->trans("Currency".$conf->monnaie).' '.$langs->trans("HT").''; print ''.$langs->trans("CustomerAbsoluteDiscountMy").''; - print ''.$remise_user.' '.$langs->trans("Currency".$conf->monnaie).''; + print ''.$remise_user.' '.$langs->trans("Currency".$conf->monnaie).' '.$langs->trans("HT").''; print ''; print '
'; @@ -270,23 +269,25 @@ if ($_socid > 0) print ' '.$langs->trans("Currency".$conf->monnaie).''; print ''.$langs->trans("VAT").''; print ''; - print $form->load_tva('tva_tx','0','',$mysoc,''); + print $form->load_tva('tva_tx',GETPOST('tva_tx'),'',$mysoc,''); print ''; print ''.$langs->trans("NoteReason").''; print ''; - print ''; + print ""; + + print '
'; print ''; if (GETPOST("backtopage")) { print '    '; print ''; } - print ''; + print '
'; - print ""; + print ''; - print "\n"; + dol_fiche_end(); print '
'; @@ -538,5 +539,5 @@ if ($_socid > 0) $db->close(); -llxFooter('$Date: 2011/08/04 21:46:51 $ - $Revision: 1.53 $'); +llxFooter(); ?> diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index c8c1516b9ad..f98efed5e94 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -734,14 +734,33 @@ if ($action == 'add' && $user->rights->facture->creer) if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines(); $fk_parent_line=0; - $num=sizeof($lines); + $num=count($lines); for ($i=0;$i<$num;$i++) { if ($lines[$i]->subprice < 0) { // Negative line, we create a discount line - // TODO + $discount = new DiscountAbsolute($db); + $discount->fk_soc=$object->socid; + $discount->amount_ht=abs($lines[$i]->total_ht); + $discount->amount_tva=abs($lines[$i]->total_tva); + $discount->amount_ttc=abs($lines[$i]->total_ttc); + $discount->tva_tx=$lines[$i]->tva_tx; + $discount->fk_user=$user->id; + $discount->description=$desc; + $discountid=$discount->create($user); + if ($discountid > 0) + { + $result=$object->insert_discount($discountid); + //$result=$discount->link_to_invoice($lineid,$id); + } + else + { + $mesg=$discount->error; + $error++; + break; + } } else { @@ -791,8 +810,13 @@ if ($action == 'add' && $user->rights->facture->creer) $fk_parent_line ); - if ($result < 0) + if ($result > 0) { + $lineid=$result; + } + else + { + $lineid=0; $error++; break; } @@ -956,7 +980,7 @@ if (($action == 'addline' || $action == 'addline_predef') && $user->rights->fact } $desc = $prod->description; - $desc.= ($prod->description && $_POST['np_desc']) ? ((dol_textishtml($prod->description) || dol_textishtml($_POST['np_desc']))?"
\n":"\n") : ""; + $desc.= ($prod->description && $_POST['np_desc']) ? ((dol_textishtml($prod->description) || dol_textishtml($_POST['np_desc']))?"
\n":"\n") : ""; $desc.= $_POST['np_desc']; if (! empty($prod->customcode) || ! empty($prod->country_code)) { @@ -965,7 +989,7 @@ if (($action == 'addline' || $action == 'addline_predef') && $user->rights->fact if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt.=' - '; if (! empty($prod->country_code)) $tmptxt.=$langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code,0,$db,$langs,0); $tmptxt.=')'; - $desc.= (dol_textishtml($desc)?"
\n":"\n").$tmptxt; + $desc.= (dol_textishtml($desc)?"
\n":"\n").$tmptxt; } $type = $prod->type; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d0242e9a77c..370b63a2c54 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -236,7 +236,7 @@ class Facture extends CommonObject $sql.= ", ".$conf->entity; $sql.= ", '".$this->type."'"; $sql.= ", '".$socid."'"; - $sql.= ", ".$this->db->idate($now); + $sql.= ", '".$this->db->idate($now)."'"; $sql.= ", '".$totalht."'"; $sql.= ",".($this->remise_absolue>0?$this->remise_absolue:'NULL'); $sql.= ",".($this->remise_percent>0?$this->remise_percent:'NULL'); diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index 0b9203df4da..4e8506adc3f 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -55,7 +55,9 @@ if ($_POST["action"] == "builddoc" && $user->rights->facture->lire) require_once(DOL_DOCUMENT_ROOT."/includes/fpdf/fpdfi/fpdi.php"); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); - $factures = dol_dir_list($conf->facture->dir_output,'all',1,implode('\.pdf|',$_POST['toGenerate']).'\.pdf','\.meta$|\.png','date',SORT_DESC) ; + $arrayofexclusion=array(); + foreach($_POST['toGenerate'] as $tmppdf) $arrayofexclusion[]=preg_quote($tmppdf.'.pdf','/'); + $factures = dol_dir_list($conf->facture->dir_output,'all',1,implode('|',$arrayofexclusion),'\.meta$|\.png','date',SORT_DESC); // liste les fichiers $files = array() ; @@ -63,7 +65,7 @@ if ($_POST["action"] == "builddoc" && $user->rights->facture->lire) foreach($_POST['toGenerate'] as $basename){ foreach($factures as $facture){ if(strstr($facture["name"],$basename)){ - $files[] = $conf->facture->dir_output.'/'.$basename.'/'.$facture["name"] ; + $files[] = $conf->facture->dir_output.'/'.$basename.'/'.$facture["name"]; } } } diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 2002f743795..1f6c0baa3dc 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -553,7 +553,7 @@ if ($conf->don->enabled && $user->rights->societe->lire) } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print '
'; } diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 233e241667f..4498c265786 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -361,7 +361,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''.$langs->trans('Comments').''; $rowspan=5; - if ($conf->use_javascript_ajax) $rowspan++; + if ($conf->use_javascript_ajax && !empty($conf->global->MAIN_JS_ON_PAYMENT)) $rowspan++; // Payment mode print ''.$langs->trans('PaymentMode').''; diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index b4d5d19ba47..df3264c50b4 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -288,9 +288,9 @@ if (sizeof($amount)) // Other stats print ''; - if ($conf->propal->enabled && $key>0) print ' '.img_picto($langs->trans("ProposalStats"),"stats").' '; - if ($conf->commande->enabled && $key>0) print ' '.img_picto($langs->trans("OrderStats"),"stats").' '; - if ($conf->facture->enabled && $key>0) print ' '.img_picto($langs->trans("InvoiceStats"),"stats").' '; + if ($conf->propal->enabled && $key>0) print ' '.img_picto($langs->trans("ProposalStats"),"stats").' '; + if ($conf->commande->enabled && $key>0) print ' '.img_picto($langs->trans("OrderStats"),"stats").' '; + if ($conf->facture->enabled && $key>0) print ' '.img_picto($langs->trans("InvoiceStats"),"stats").' '; print ''; print "\n"; diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index 3c828e438a6..780039a8c40 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -167,7 +167,7 @@ if ($resql) $arrayofoperators=array('<'=>'<','>'=>'>'); print $form->selectarray('filter_op1',$arrayofoperators,$_REQUEST['filter_op1'],1); print ' '; - $filter_date1=dol_mktime(0,0,0,$_REQUEST['op1month'],$_REQUEST['op1day'],$_REQUEST['"op1year']); + $filter_date1=dol_mktime(0,0,0,$_REQUEST['op1month'],$_REQUEST['op1day'],$_REQUEST['op1year']); print $form->select_date($filter_date1,'op1',0,0,1); print ''; print ''; diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index f6c46e9ed46..91a35373b70 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -34,6 +34,7 @@ class DiscountAbsolute var $error; var $id; // Id remise + var $fk_soc; var $amount_ht; // var $amount_tva; // var $amount_ttc; // diff --git a/htdocs/includes/modules/societe/mod_codeclient_elephant.php b/htdocs/includes/modules/societe/mod_codeclient_elephant.php index a000c4f4cb8..c478a1c415a 100644 --- a/htdocs/includes/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/includes/modules/societe/mod_codeclient_elephant.php @@ -255,7 +255,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode { $sql = "SELECT code_client FROM ".MAIN_DB_PREFIX."societe"; $sql.= " WHERE code_client = '".$code."'"; - $sql.= " AND rowid != '".$soc->id."'"; + if ($soc->id > 0) $sql.= " AND rowid != ".$soc->id; $resql=$db->query($sql); if ($resql) diff --git a/htdocs/includes/modules/societe/mod_codeclient_monkey.php b/htdocs/includes/modules/societe/mod_codeclient_monkey.php index c5735dd63e0..a59ecc100ac 100644 --- a/htdocs/includes/modules/societe/mod_codeclient_monkey.php +++ b/htdocs/includes/modules/societe/mod_codeclient_monkey.php @@ -203,7 +203,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode { $sql = "SELECT code_client FROM ".MAIN_DB_PREFIX."societe"; $sql.= " WHERE code_client = '".$code."'"; - $sql.= " AND rowid != '".$soc->id."'"; + if ($soc->id > 0) $sql.= " AND rowid != ".$soc->id; $resql=$db->query($sql); if ($resql) 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 7a8b75d08b5..58441034789 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 @@ -60,8 +60,6 @@ ALTER TABLE llx_facture_fourn ADD COLUMN ref_ext varchar(30) AFTER entity; ALTER TABLE llx_commande_fournisseur ADD COLUMN ref_ext varchar(30) AFTER entity; ALTER TABLE llx_adherent ADD COLUMN ref_ext varchar(30) after entity; -ALTER TABLE llx_commande ADD COLUMN fk_demand_reason integer AFTER fk_availability; - ALTER TABLE llx_facturedet DROP INDEX uk_fk_remise_except; ALTER TABLE llx_facturedet ADD UNIQUE INDEX uk_fk_remise_except (fk_remise_except, fk_facture); @@ -115,6 +113,8 @@ INSERT INTO llx_c_availability (rowid,code,label,active) VALUES (2, 'AV_1W', '1 INSERT INTO llx_c_availability (rowid,code,label,active) VALUES (3, 'AV_2W', '2 weeks', 1); INSERT INTO llx_c_availability (rowid,code,label,active) VALUES (4, 'AV_3W', '3 weeks', 1); +ALTER TABLE llx_commande ADD COLUMN fk_demand_reason integer AFTER fk_availability; + ALTER TABLE llx_propaldet ADD INDEX idx_propaldet_fk_product (fk_product); ALTER TABLE llx_commandedet ADD INDEX idx_commandedet_fk_product (fk_product); ALTER TABLE llx_facturedet ADD INDEX idx_facturedet_fk_product (fk_product); @@ -486,4 +486,7 @@ ALTER TABLE llx_don ADD phone varchar(24) after email; ALTER TABLE llx_user ADD civilite varchar(6) after entity; ALTER TABLE llx_element_element MODIFY sourcetype varchar(32) NOT NULL; -ALTER TABLE llx_element_element MODIFY targettype varchar(32) NOT NULL; \ No newline at end of file +ALTER TABLE llx_element_element MODIFY targettype varchar(32) NOT NULL; + +ALTER TABLE llx_societe_prices MODIFY tms timestamp NULL; +-- ALTER TABLE llx_societe_prices ALTER COLUMN tms DROP NOT NULL; diff --git a/htdocs/install/mysql/tables/llx_societe_prices.sql b/htdocs/install/mysql/tables/llx_societe_prices.sql index ade6a40a80d..5a22d0277f2 100644 --- a/htdocs/install/mysql/tables/llx_societe_prices.sql +++ b/htdocs/install/mysql/tables/llx_societe_prices.sql @@ -21,7 +21,7 @@ create table llx_societe_prices ( rowid integer AUTO_INCREMENT PRIMARY KEY, fk_soc integer DEFAULT 0, - tms timestamp NOT NULL, + tms timestamp, datec datetime, fk_user_author integer, price_level tinyint DEFAULT 1 diff --git a/htdocs/public/paypal/newpayment.php b/htdocs/public/paypal/newpayment.php index 860d2c3ab55..f00441f68ad 100755 --- a/htdocs/public/paypal/newpayment.php +++ b/htdocs/public/paypal/newpayment.php @@ -308,7 +308,7 @@ $var=false; $valid=true; if (! empty($conf->global->PAYPAL_SECURITY_TOKEN) ) { - $token = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . $SOURCE . $ref, 2); + $token = $conf->global->PAYPAL_SECURITY_TOKEN; if ($SECUREKEY != $token) $valid=false; } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 33afee55676..9ce94dec23d 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1329,15 +1329,17 @@ class Societe extends CommonObject { if ($this->id) { + $now=dol_now(); + $sql = "UPDATE ".MAIN_DB_PREFIX."societe "; $sql .= " SET price_level = '".$price_level."'"; - $sql .= " WHERE rowid = " . $this->id .";"; + $sql .= " WHERE rowid = " . $this->id; $this->db->query($sql); $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_prices "; $sql .= " ( datec, fk_soc, price_level, fk_user_author )"; - $sql .= " VALUES (".$this->db->idate(mktime()).",".$this->id.",'".$price_level."',".$user->id.")"; + $sql .= " VALUES ('".$this->db->idate($now)."',".$this->id.",'".$price_level."',".$user->id.")"; if (! $this->db->query($sql) ) {