Merge remote branch 'dolibarr/3.1-beta' into 3.1-beta

This commit is contained in:
Regis Houssin 2011-09-15 09:07:35 +02:00
commit e0a5f8441c
20 changed files with 192 additions and 177 deletions

View File

@ -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 <eldy@users.sourceforge.net>
#-----------------------------------------------------------------------------
@ -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=<STDIN>;
chomp($PROJECT);
@PROJECTLIST=split(/ /,$PROJECT);
$PROJECT=join('',@PROJECTLIST);
# Ask and set version $MAJOR and $MINOR
print "Enter value for version: ";
$PROJVERSION=<STDIN>;
@ -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 (<SPECFROM>) {
$_ =~ 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;
}

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 "</tr>\n";
$var=!$var;
print '<tr '.$bc[$var].'><td width=\"50%\">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
print '<td colspan="2">';
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 '</td></tr>';
if ($conf->banque->enabled)
{

View File

@ -87,7 +87,7 @@ print '<td>';
$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 '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
print '</td>';
print "</tr>\n";

View File

@ -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;

View File

@ -1,6 +1,6 @@
<?PHP
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 '<div class="error">'.$errmesg.'</div><br>';
}
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 '<form method="POST" action="remise.php?id='.$objsoc->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setremise">';
print '<input type="hidden" name="backtopage" value="'.GETPOST('backtopage').'">';
print '<table class="border" width="100%">';
@ -122,13 +134,21 @@ if ($_socid > 0)
print '<tr><td colspan="2" width="25%">';
print $langs->trans("NoteReason").'</td><td colspan="2"><input type="text" size="60" name="note" value="'.$_POST["note"].'"></td></tr>';
print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
print "</table>";
print '<center>';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
if (GETPOST("backtopage"))
{
print '&nbsp; &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
}
print '</center>';
print "</form>";
print "</div>\n";
dol_fiche_end();
print '<br>';
@ -180,5 +200,5 @@ if ($_socid > 0)
$db->close();
llxFooter('$Date: 2011/08/03 00:46:27 $ - $Revision: 1.35 $');
llxFooter();
?>

View File

@ -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 '<tr><td width="38%">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>';
print '<td>'.$remise_all.'&nbsp;'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
print '<td>'.$remise_all.'&nbsp;'.$langs->trans("Currency".$conf->monnaie).' '.$langs->trans("HT").'</td></tr>';
print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>';
print '<td>'.$remise_user.'&nbsp;'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
print '<td>'.$remise_user.'&nbsp;'.$langs->trans("Currency".$conf->monnaie).' '.$langs->trans("HT").'</td></tr>';
print '</table>';
print '<br>';
@ -270,23 +269,25 @@ if ($_socid > 0)
print '<td><input type="text" size="5" name="amount_ht" value="'.$_POST["amount_ht"].'">&nbsp;'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
print '<tr><td width="38%">'.$langs->trans("VAT").'</td>';
print '<td>';
print $form->load_tva('tva_tx','0','',$mysoc,'');
print $form->load_tva('tva_tx',GETPOST('tva_tx'),'',$mysoc,'');
print '</td></tr>';
print '<tr><td>'.$langs->trans("NoteReason").'</td>';
print '<td><input type="text" size="60" name="desc" value="'.$_POST["desc"].'"></td></tr>';
print '<tr><td align="center" colspan="2">';
print "</table>";
print '<center>';
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">';
if (GETPOST("backtopage"))
{
print '&nbsp; &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
}
print '</td></tr>';
print '</center>';
print "</table></form>";
print '</form>';
print "</div>\n";
dol_fiche_end();
print '<br>';
@ -538,5 +539,5 @@ if ($_socid > 0)
$db->close();
llxFooter('$Date: 2011/08/04 21:46:51 $ - $Revision: 1.53 $');
llxFooter();
?>

View File

@ -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']))?"<br />\n":"\n") : "";
$desc.= ($prod->description && $_POST['np_desc']) ? ((dol_textishtml($prod->description) || dol_textishtml($_POST['np_desc']))?"<br>\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)?"<br />\n":"\n").$tmptxt;
$desc.= (dol_textishtml($desc)?"<br>\n":"\n").$tmptxt;
}
$type = $prod->type;
}

View File

@ -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');

View File

@ -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"];
}
}
}

View File

@ -553,7 +553,7 @@ if ($conf->don->enabled && $user->rights->societe->lire)
}
else
{
print '<tr '.$bc[$var].'><td colspan="2">'.$langs->trans("None").'</td></tr>';
print '<tr '.$bc[$var].'><td colspan="4">'.$langs->trans("None").'</td></tr>';
}
print '</table><br>';
}

View File

@ -361,7 +361,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<td>'.$langs->trans('Comments').'</td></tr>';
$rowspan=5;
if ($conf->use_javascript_ajax) $rowspan++;
if ($conf->use_javascript_ajax && !empty($conf->global->MAIN_JS_ON_PAYMENT)) $rowspan++;
// Payment mode
print '<tr><td><span class="fieldrequired">'.$langs->trans('PaymentMode').'</span></td><td>';

View File

@ -288,9 +288,9 @@ if (sizeof($amount))
// Other stats
print '<td align="center">';
if ($conf->propal->enabled && $key>0) print '&nbsp;<a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("ProposalStats"),"stats").'</a>&nbsp;';
if ($conf->commande->enabled && $key>0) print '&nbsp;<a href="'.DOL_URL_ROOT.'/commande/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("OrderStats"),"stats").'</a>&nbsp;';
if ($conf->facture->enabled && $key>0) print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("InvoiceStats"),"stats").'</a>&nbsp;';
if ($conf->propal->enabled && $key>0) print '&nbsp;<a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$key.'">'.img_picto($langs->trans("ProposalStats"),"stats").'</a>&nbsp;';
if ($conf->commande->enabled && $key>0) print '&nbsp;<a href="'.DOL_URL_ROOT.'/commande/stats/index.php?socid='.$key.'">'.img_picto($langs->trans("OrderStats"),"stats").'</a>&nbsp;';
if ($conf->facture->enabled && $key>0) print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?socid='.$key.'">'.img_picto($langs->trans("InvoiceStats"),"stats").'</a>&nbsp;';
print '</td>';
print "</tr>\n";

View File

@ -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 '</td>';
print '<td class="liste_titre" align="center">';

View File

@ -34,6 +34,7 @@ class DiscountAbsolute
var $error;
var $id; // Id remise
var $fk_soc;
var $amount_ht; //
var $amount_tva; //
var $amount_ttc; //

View File

@ -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)

View File

@ -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)

View File

@ -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;
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;

View File

@ -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

View File

@ -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;
}

View File

@ -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) )
{