Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into

develop

Conflicts:
	htdocs/core/modules/mailings/pomme.modules.php
This commit is contained in:
Florian HENRY 2014-05-29 14:28:01 +02:00
commit d304c7785e
443 changed files with 2374 additions and 14211 deletions

View File

@ -100,8 +100,9 @@ tools:
comparison_of_bit_result: true
basic_semantic_checks:
enabled: true
# Disabled unused code. In most cases, we want to keep it.
unused_code:
enabled: true
enabled: false
deprecation_checks:
enabled: true
useless_function_calls:

View File

@ -124,7 +124,15 @@ Fix: [ bug #1362 ] Note is not saved.
Fix: tr/td balance.
Fix: [ bug #1360 ] note indicator for member tab.
Fix: Nb of notes and doc not visible onto tasks.
Fix: [ bug #1372 ] Margin calculation does not work in proposals
Fix: [ bug #1372 ] Margin calculation does not work in proposals.
Fix: [ bug #1381 ] PHP Warning when listing stock transactions page.
Fix: [ bug #1367 ] "Show invoice" link after a POS sell throws an error.
Fix: TCPDF error file not found in member card generation.
Fix: [ bug #1380 ] Customer invoices are not grouped in company results report.
Fix: [ bug #1393 ] PHP Warning when creating a supplier invoice.
Fix: [ bug #1399 ] [pgsql] Silent warning when setting a propal as "facturée" in propal.php
Fix: When number reach 9999 with default numbering module, next number
will be 10000 instead of 0000 and error.
***** ChangeLog for 3.5.2 compared to 3.5.1 *****
Fix: Can't add user for a task.

View File

@ -229,7 +229,9 @@ from origin/upstream and origin/pristine.
* If new upstream is available onto sourceforge, launch:
> debian/get-orig-source.sh
* Edit tgz file to remove ckeditor and phpexcel and renama file into dolibarr-x.y.z+dsfgw.tgz
* Edit tgz file to remove ckeditor and phpexcel and rename file into
dolibarr-x.y.z+dsfgw.tgz
(x.y.z = version, w start from 1 and is increased for each new import)
* Staying into git root directory, run
> git-import-orig -vv ../dolibarr-x.y.z+dsfgw.tgz

View File

@ -14,4 +14,3 @@ $force_install_databaserootpass='root';
$force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1';
$force_install_lockinstall='444';
?>

View File

@ -603,7 +603,7 @@ upload_max_filesize = 2M
;;;;;;;;;;;;;;;;;;
; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
allow_url_fopen = Off
allow_url_fopen = On
; Whether to allow include/require to open URLs (like http:// or ftp://) as files.
allow_url_include = Off

View File

@ -452,6 +452,7 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/adapters`; # Keep this removal in case we embed libraries
#$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/_source`; # _source must be kept into tarball
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/datatables/extras/TableTools/swf`; # Source of this flash is not available
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;

View File

@ -195,6 +195,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/product
%_datadir/dolibarr/htdocs/projet
%_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/societe
%_datadir/dolibarr/htdocs/support
%_datadir/dolibarr/htdocs/theme

View File

@ -275,6 +275,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/product
%_datadir/dolibarr/htdocs/projet
%_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/societe
%_datadir/dolibarr/htdocs/support
%_datadir/dolibarr/htdocs/theme

View File

@ -192,6 +192,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/product
%_datadir/dolibarr/htdocs/projet
%_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/societe
%_datadir/dolibarr/htdocs/support
%_datadir/dolibarr/htdocs/theme

View File

@ -203,6 +203,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/product
%_datadir/dolibarr/htdocs/projet
%_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/societe
%_datadir/dolibarr/htdocs/support
%_datadir/dolibarr/htdocs/theme

View File

@ -115,4 +115,3 @@ else
$db->close();
return $error;
?>

23
dev/rmphpclosingtag.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# vim:ft=sh:ts=3:sts=3:sw=3:et:
###
# Strips the closing php tag `?>` and any following blank lines from the
# end of any PHP file in the current working directory and sub-directories. Files
# with non-whitespace characters following the closing tag will not be affected.
#
# Author: Bryan C. Geraghty <bryan@ravensight.org>
# Date: 2009-10-28
# Source: http://bryan.ravensight.org/2010/07/remove-php-closing-tag/
##
FILES=$(pcregrep -rnM --include='^.*\.php$' '^\?\>(?=([\s\n]+)?$(?!\n))' .);
for MATCH in $FILES;
do
FILE=`echo $MATCH | awk -F ':' '{print $1}'`;
TARGET=`echo $MATCH | awk -F ':' '{print $2}'`;
LINE_COUNT=`wc -l $FILE | awk -F " " '{print $1}'`;
echo "Removing lines ${TARGET} through ${LINE_COUNT} from file $FILE...";
sed -i "${TARGET},${LINE_COUNT}d" $FILE;
done;

View File

@ -371,4 +371,3 @@ class Skeleton_Class extends CommonObject
}
}
?>

View File

@ -271,4 +271,3 @@ function createSkeleton($authentication,$skeleton)
// Return the results.
$server->service($HTTP_RAW_POST_DATA);
?>

View File

@ -338,4 +338,3 @@ class autoTranslator
}
}
?>

View File

@ -0,0 +1,266 @@
#!/usr/bin/php
<?php
/*
* strip_language_file.php
*
* (c) 2014 by FromDual GmbH, licensed under GPL v2
*
* Compares a secondary language translation file with its primary
* language file and strips redundant translations.
*
* Todo: Check if it works with multi byte (mb_*) character sets!
*
* Usage:
* cd htdocs/langs
* ../../dev/translation/strip_language_file.php <primary_lang_dir> <secondary_lang_dir> <languagefile.lang>
*
* Parameters:
* 1 - Primary Language
* 2 - Secondary Language
*
* Rules:
* secondary string == primary string -> strip
* secondary string redundant -> strip and warning
* secondary string not in primary -> strip and warning
* secondary string has no value -> strip and warning
* secondary string != primary string -> secondary.lang.delta
*
* To rename all .delta fils, you can do
* for fic in `ls *.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done
*/
/**
* \file dev/translation/strip_language_file.php
* \ingroup dev
* \brief This script clean sub-languages from duplicate keys-values
*/
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path=dirname(__FILE__).'/';
// Test if batch mode
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
$rc = 0;
// Get and check arguments
$lPrimary = isset($argv[1])?$argv[1]:'';
$lSecondary = isset($argv[2])?$argv[2]:'';
$filesToProcess = isset($argv[3])?$argv[3]:'';
if (empty($lPrimary) || empty($lSecondary) || empty($filesToProcess))
{
$rc = 1;
$msg = '***** Script to clean language files *****'."\n";
$msg.= 'Usage: ../../dev/translation/strip_language_file.php xx_XX xx_YY [file.lang|all]'."\n";
print $msg . "(rc=$rc).\n";
exit($rc);
}
$aPrimary = array();
$aSecondary = array();
// Define array $filesToProcess
if ($filesToProcess == 'all')
{
$dir = new DirectoryIterator($lPrimary);
while($dir->valid()) {
if(!$dir->isDot() && $dir->isFile() && ! preg_match('/^\./',$dir->getFilename())) {
$files[] = $dir->getFilename();
}
$dir->next();
}
$filesToProcess=$files;
}
else $filesToProcess=explode(',',$filesToProcess);
// Arguments should be OK here.
// Loop on each file
foreach($filesToProcess as $fileToProcess)
{
$lPrimaryFile = $lPrimary.'/'.$fileToProcess;
$lSecondaryFile = $lSecondary.'/'.$fileToProcess;
$output = $lSecondaryFile . '.delta';
print "---- Process language file ".$lSecondaryFile."\n";
if ( ! is_readable($lPrimaryFile) ) {
$rc = 2;
$msg = "Cannot read primary language file $lPrimaryFile.";
print $msg . " (rc=$rc).\n";
exit($rc);
}
if ( ! is_readable($lSecondaryFile) ) {
$rc = 3;
$msg = "Cannot read secondary language file $lSecondaryFile. We discard this file.";
print $msg . "\n";
continue;
}
// Start reading and parsing Secondary
if ( $handle = fopen($lSecondaryFile, 'r') )
{
print "Read Secondary File $lSecondaryFile:\n";
$cnt = 0;
while (($line = fgets($handle)) !== false)
{
$cnt++;
// strip comments
if ( preg_match("/^\w*#/", $line) ) {
continue;
}
// strip empty lines
if ( preg_match("/^\w*$/", $line) ) {
continue;
}
$a = mb_split('=', trim($line), 2);
if ( count($a) != 2 ) {
print "ERROR in file $lSecondaryFile, line $cnt: " . trim($line) . "\n";
continue;
}
list($key, $value) = $a;
// key is redundant
if ( array_key_exists($key, $aSecondary) ) {
print "Key $key is redundant in file $lSecondaryFile (line: $cnt).\n";
continue;
}
// String has no value
if ( $value == '' ) {
print "Key $key has no value in file $lSecondaryFile (line: $cnt).\n";
continue;
}
$aSecondary[$key] = trim($value);
}
if ( ! feof($handle) )
{
$rc = 5;
$msg = "Unexpected fgets() fail";
print $msg . " (rc=$rc).\n";
exit($rc);
}
fclose($handle);
}
else {
$rc = 6;
$msg = "Cannot open file $lSecondaryFile";
print $msg . " (rc=$rc).\n";
exit($rc);
}
// Start reading and parsing Primary. See rules in header!
$arrayofkeytoalwayskeep=array('DIRECTION','FONTFORPDF','FONTSIZEFORPDF','SeparatorDecimal','SeparatorThousand');
if ( $handle = fopen($lPrimaryFile, 'r') )
{
if ( ! $oh = fopen($output, 'w') )
{
print "ERROR in writing to file $output\n";
exit;
}
print "Read Primary File $lPrimaryFile and write ".$output.":\n";
fwrite($oh, "# Dolibarr language file - Source file is en_US - ".(preg_replace('/\.lang$/','',$fileToProcess))."\n");
$cnt = 0;
while (($line = fgets($handle)) !== false)
{
$cnt++;
// strip comments
if ( preg_match("/^\w*#/", $line) ) {
continue;
}
// strip empty lines
if ( preg_match("/^\w*$/", $line) ) {
continue;
}
$a = mb_split('=', trim($line), 2);
if ( count($a) != 2 ) {
print "ERROR in file $lPrimaryFile, line $cnt: " . trim($line) . "\n";
continue;
}
list($key, $value) = $a;
// key is redundant
if ( array_key_exists($key, $aPrimary) ) {
print "Key $key is redundant in file $lPrimaryFile (line: $cnt) - Already found into ".$fileFirstFound[$key]." (line: ".$lineFirstFound[$key].").\n";
continue;
}
else
{
$fileFirstFound[$key] = $fileToProcess;
$lineFirstFound[$key] = $cnt;
}
// String has no value
if ( $value == '' ) {
print "Key $key has no value in file $lPrimaryFile (line: $cnt).\n";
continue;
}
$aPrimary[$key] = trim($value);
$fileFirstFound[$key] = $fileToProcess;
$lineFirstFound[$key] = $cnt;
// ----- Process output now -----
// Key not in other file
if (in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/',$key) || preg_match('/^FormatHour/',$key))
{
//print "Key $key is a key we always want to see into secondary file (line: $cnt).\n";
}
else if ( ! array_key_exists($key, $aSecondary))
{
//print "Key $key does NOT exist in secondary language (line: $cnt).\n";
continue;
}
// String exists in both files and does not match
if ((! empty($aSecondary[$key]) && $aSecondary[$key] != $aPrimary[$key]) || in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/',$key) || preg_match('/^FormatHour/',$key))
{
//print "Key $key differs so we add it into new secondary language (line: $cnt).\n";
fwrite($oh, $key."=".(empty($aSecondary[$key])?$aPrimary[$key]:$aSecondary[$key])."\n");
}
}
if ( ! feof($handle) ) {
$rc = 7;
$msg = "Unexpected fgets() fail";
print $msg . " (rc=$rc).\n";
exit($rc);
}
fclose($oh);
fclose($handle);
}
else {
$rc = 8;
$msg = "Cannot open file $lPrimaryFile";
print $msg . " (rc=$rc).\n";
exit($rc);
}
print "Output can be found at $output.\n";
}
return 0;

View File

@ -13,7 +13,13 @@ then
echo "This pull remote transifex files to local dir."
echo "Note: If you pull a language file (not source), file will be skipped if local file is newer."
echo " Using -f will overwrite local file (does not work with 'all')."
echo "Usage: txpull.sh (all|xx_XX) [-r dolibarr.file] [-f]"
echo "Usage: ./dev/translation/txpull.sh (all|xx_XX) [-r dolibarr.file] [-f]"
exit
fi
if [ ! -d ".tx" ]
then
echo "Script must be ran from root directory of project with command ./dev/translation/txpull.sh"
exit
fi

View File

@ -13,10 +13,15 @@ then
echo "This push local files to transifex."
echo "Note: If you push a language file (not source), file will be skipped if transifex file is newer."
echo " Using -f will overwrite translation but not memory."
echo "Usage: txpush.sh (source|all|xx_XX) [-r dolibarr.file] [-f] [--no-interactive]"
echo "Usage: ./dev/translation/txpush.sh (source|all|xx_XX) [-r dolibarr.file] [-f] [--no-interactive]"
exit
fi
if [ ! -d ".tx" ]
then
echo "Script must be ran from root directory of project with command ./dev/translation/txpush.sh"
exit
fi
if [ "x$1" = "xall" ]
then

View File

@ -93,4 +93,3 @@ class AccountancyAccount
}
}
?>

View File

@ -62,7 +62,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
*/
private function getTitle($action)
{
global $langs;
global $langs,$conf;
$out='';

View File

@ -138,7 +138,7 @@ if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights
if ($_POST["userid"] != $object->user_id) // If link differs from currently in database
{
$result=$object->setUserId($_POST["userid"]);
if ($result < 0) dol_print_error($object->db,$object->error);
if ($result < 0) dol_print_error('',$object->error);
$_POST['action']='';
$action='';
}
@ -172,7 +172,7 @@ if ($action == 'setsocid')
if (! $error)
{
$result=$object->setThirdPartyId(GETPOST('socid','int'));
if ($result < 0) dol_print_error($object->db,$object->error);
if ($result < 0) dol_print_error('',$object->error);
$_POST['action']='';
$action='';
}
@ -1101,4 +1101,3 @@ else
llxFooter();
$db->close();
?>

View File

@ -280,4 +280,3 @@ print '<br>';
llxFooter();
$db->close();
?>

View File

@ -95,6 +95,8 @@ class Adherent extends CommonObject
var $first_subscription_date;
var $first_subscription_amount;
var $last_subscription_date;
var $last_subscription_date_start;
var $last_subscription_date_end;
var $last_subscription_amount;
var $subscriptions=array();

View File

@ -99,8 +99,10 @@ class AdherentType extends CommonObject
*/
function update($user)
{
global $hookmanager;
global $hookmanager,$conf;
$error=0;
$this->libelle=trim($this->libelle);
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type ";
@ -116,6 +118,8 @@ class AdherentType extends CommonObject
$result = $this->db->query($sql);
if ($result)
{
$action='update';
// Actions on extra fields (by external module or standard code)
$hookmanager->initHooks(array('membertypedao'));
$parameters=array('membertype'=>$this->id);
@ -132,8 +136,8 @@ class AdherentType extends CommonObject
}
}
else if ($reshook < 0) $error++;
return 1;
}
else

View File

@ -64,7 +64,7 @@ else if ($action == 'update')
{
if (GETPOST('submit_GENBARCODE_LOCATION'))
{
$location = GETPOST('genbarcodelocation','alpha');
$location = GETPOST('GENBARCODE_LOCATION','alpha');
$res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity);
}
if (GETPOST('submit_PRODUIT_DEFAULT_BARCODE_TYPE'))

View File

@ -57,7 +57,7 @@ if ($action == 'add')
$db->begin();
// Initialize distinctfkuser with all already existing values of fk_user (user that use a personalized view of boxes for pos)
// Initialize distinct fkuser with all already existing values of fk_user (user that use a personalized view of boxes for page "pos")
$distinctfkuser=array();
if (! $error)
{
@ -85,14 +85,31 @@ if ($action == 'add')
}
}
$distinctfkuser['0']='0'; // Add entry for fk_user = 0. We must use string as key and val
foreach($distinctfkuser as $fk_user)
{
if (! $error && $fk_user != 0) // We will add fk_user = 0 later.
if (! $error && $fk_user != '')
{
$nbboxonleft=$nbboxonright=0;
$sql = "SELECT box_order FROM ".MAIN_DB_PREFIX."boxes WHERE position = ".GETPOST("pos","alpha")." AND fk_user = ".$fk_user." AND entity = ".$conf->entity;
dol_syslog("boxes.php activate box sql=".$sql);
$resql = $db->query($sql);
if ($resql)
{
while($obj = $db->fetch_object($resql))
{
$boxorder=$obj->box_order;
if (preg_match('/A/',$boxorder)) $nbboxonleft++;
if (preg_match('/B/',$boxorder)) $nbboxonright++;
}
}
else dol_print_error($db);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (";
$sql.= "box_id, position, box_order, fk_user, entity";
$sql.= ") values (";
$sql.= GETPOST("boxid","int").", ".GETPOST("pos","alpha").", 'A01', ".$fk_user.", ".$conf->entity;
$sql.= GETPOST("boxid","int").", ".GETPOST("pos","alpha").", '".(($nbboxonleft > $nbboxonright) ? 'B01' : 'A01')."', ".$fk_user.", ".$conf->entity;
$sql.= ")";
dol_syslog("boxes.php activate box sql=".$sql);
@ -105,24 +122,6 @@ if ($action == 'add')
}
}
// If value 0 was not included, we add it.
if (! $error)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (";
$sql.= "box_id, position, box_order, fk_user, entity";
$sql.= ") values (";
$sql.= GETPOST("boxid","int").", ".GETPOST("pos","alpha").", 'A01', 0, ".$conf->entity;
$sql.= ")";
dol_syslog("boxes.php activate box sql=".$sql);
$resql = $db->query($sql);
if (! $resql)
{
$errmesg=$db->lasterror();
$error++;
}
}
if (! $error)
{
header("Location: boxes.php");
@ -469,4 +468,3 @@ print '</table>';
llxFooter();
$db->close();
?>

View File

@ -170,4 +170,3 @@ print '<br /><br /><div style="text-align:center"><input type="submit" class="bu
$db->close();
llxFooter();
?>

View File

@ -532,9 +532,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$result = $db->query($sql);
if ($result) // Add is ok
{
//$oldid=$id;
//$_POST=array('id'=>$oldid); // Clean $_POST array, we keep only
//$_GET["id"]=$_POST["id"]; // Force affichage dictionnaire en cours d'edition
$_POST=array('id'=>$id); // Clean $_POST array, we keep only
}
else
{

View File

@ -511,4 +511,3 @@ print '<br>';
$db->close();
llxFooter();
?>

View File

@ -116,4 +116,3 @@ if (empty($reshook))
llxFooter();
$db->close();
?>

View File

@ -143,4 +143,3 @@ print '</form>';
llxFooter();
$db->close();
?>

View File

@ -703,4 +703,3 @@ else
llxFooter();
$db->close();
?>

View File

@ -540,4 +540,3 @@ if ($mode != 'marketplace') print '<div class="info">'.showModulesExludedForExte
llxFooter();
$db->close();
?>

View File

@ -157,4 +157,3 @@ if ($action == 'edit' && ! empty($attrname))
llxFooter();
$db->close();
?>

View File

@ -88,4 +88,3 @@ print "</TABLE>";
$db->close();
llxFooter();
?>

View File

@ -156,4 +156,3 @@ if ($action == 'edit' && ! empty($attrname))
llxFooter();
$db->close();
?>

View File

@ -253,4 +253,3 @@ print "</form>\n";
llxFooter();
$db->close();
?>

View File

@ -113,28 +113,23 @@ print '<li><a href="http://plus.google.com/+DolibarrOrg" target="_blank">Google
print '</ul>';
print $langs->trans("OfficialWebHostingService").':';
$url='http://wiki.dolibarr.org/index.php/Cloud_Solutions'; $title=$langs->trans('List');
print $langs->trans("OtherResources").':';
print '<ul>';
$url='http://saas.dolibarr.org'; $title=$langs->trans("OfficialWebHostingService");
if (preg_match('/^fr_/i',$langs->getDefaultLang())) $url='http://wiki.dolibarr.org/index.php/Solutions_de_Cloud';
if (preg_match('/^es_/i',$langs->getDefaultLang())) $url='http://wiki.dolibarr.org/index.php/Soluciones_en_la_Nube';
print '<ul>';
print '<li>';
print '<a target="_blank" href="'.$url.'">'.$title.'</a>';
print '</li>';
$url='http://partners.dolibarr.org'; $title=$langs->trans("ReferencedPreferredPartners");
print '<li>';
print '<a target="_blank" href="'.$url.'">'.$title.'</a>';
print '</li>';
print '</ul>';
llxFooter();
$db->close();
?>

View File

@ -51,4 +51,3 @@ print '</table>';
llxFooter();
?>

View File

@ -120,4 +120,3 @@ foreach($phparray as $key => $value)
llxFooter();
$db->close();
?>

View File

@ -64,4 +64,3 @@ print '</table>';
llxFooter();
$db->close();
?>

View File

@ -214,4 +214,3 @@ print '<br>';
llxFooter();
$db->close();
?>

View File

@ -141,4 +141,3 @@ class Auth
}
?>

View File

@ -653,4 +653,3 @@ class Facturation
}
?>

View File

@ -166,4 +166,3 @@ $_SESSION['serObjFacturation'] = serialize($obj_facturation);
header('Location: '.$redirection);
exit;
?>

View File

@ -142,4 +142,3 @@ else
exit;
}
?>

View File

@ -26,4 +26,3 @@ $form=new Form($db);
// Affichage des templates
require ('tpl/validation1.tpl.php');
?>

View File

@ -179,4 +179,3 @@ else
llxFooter();
$db->close();
?>

View File

@ -103,16 +103,18 @@ if ($action == 'add')
if ($result > 0)
{
setEventMessage($langs->trans("XTargetsAdded",$result),'mesgs');
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
}
if ($result == 0)
{
$mesg='<div class="warning">'.$langs->trans("WarningNoEMailsAdded").'</div>';
setEventMessage($langs->trans("WarningNoEMailsAdded"),'warnings');
}
if ($result < 0)
{
$mesg='<div class="error">'.$langs->trans("Error").($obj->error?' '.$obj->error:'').'</div>';
setEventMessage($langs->trans("Error").($obj->error?' '.$obj->error:''),'errors');
}
}

View File

@ -54,7 +54,7 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('mailingcard'));
// Tableau des substitutions possibles
// Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
$object->substitutionarray=array(
'__ID__' => 'IdRecord',
'__EMAIL__' => 'EMail',
@ -213,19 +213,20 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
$tmpfield=explode('=',$other[2],2); $other3=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
$tmpfield=explode('=',$other[3],2); $other4=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
$tmpfield=explode('=',$other[4],2); $other5=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
// Array of possible substitutions (See also fie mailing-send.php that should manage same substitutions)
$substitutionarray=array(
'__ID__' => $obj->source_id,
'__EMAIL__' => $obj->email,
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
'__UNSUBSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>',
'__MAILTOEMAIL__' => '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>',
'__LASTNAME__' => $obj->lastname,
'__FIRSTNAME__' => $obj->firstname,
'__MAILTOEMAIL__' => '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>',
'__OTHER1__' => $other1,
'__OTHER2__' => $other2,
'__OTHER3__' => $other3,
'__OTHER4__' => $other4,
'__OTHER5__' => $other5
'__OTHER5__' => $other5,
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
'__UNSUBSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>'
);
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN))
{
@ -731,7 +732,7 @@ else
// Pour des raisons de securite, on ne permet pas cette fonction via l'IHM,
// on affiche donc juste un message
$mesgembedded.='<div class="warning">'.$langs->trans("MailingNeedCommand").'</div>';
$mesgembedded.='<br><textarea cols="60" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>';
$mesgembedded.='<br><textarea cols="60" rows="'.ROWS_1.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>';
$mesgembedded.='<br><br><div class="warning">'.$langs->trans("MailingNeedCommand2").'</div>';
$_GET["action"]='';
}
@ -915,7 +916,11 @@ else
print '<br><br></div>';
}
if (! empty($mesgembedded)) dol_htmloutput_mesg($mesgembedded,'','warning',1);
if (! empty($mesgembedded))
{
dol_htmloutput_mesg($mesgembedded,'','warning',1);
print '<br>';
}
// Affichage formulaire de TEST
if ($action == 'test')

View File

@ -1724,7 +1724,7 @@ class Propal extends CommonObject
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
$sql.= " SET fk_statut = ".$statut.", note_private = '".$this->db->escape($note)."', date_cloture=".$this->db->idate($now).", fk_user_cloture=".$user->id;
$sql.= " SET fk_statut = ".$statut.", note_private = '".$this->db->escape($note)."', date_cloture='".$this->db->idate($now)."', fk_user_cloture=".$user->id;
$sql.= " WHERE rowid = ".$this->id;
$resql=$this->db->query($sql);

View File

@ -142,4 +142,3 @@ else
llxFooter();
$db->close();
?>

View File

@ -210,6 +210,15 @@ if ($search_user > 0)
$sql.= ' ORDER BY '.$sortfield.' '.$sortorder.', p.ref DESC';
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($limit + 1,$offset);
$result=$db->query($sql);
@ -236,7 +245,7 @@ if ($result)
if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
if ($search_author) $param.='&search_author='.$search_author;
if ($search_town) $param.='&search_town='.$search_town;
print_barre_liste($langs->trans('ListOfProposals').' '.($socid?'- '.$soc->nom:''), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num);
print_barre_liste($langs->trans('ListOfProposals').' '.($socid?'- '.$soc->nom:''), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
// Lignes des champs de filtre
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -466,4 +466,3 @@ else
llxFooter();
$db->close();
?>

View File

@ -2541,7 +2541,7 @@ class Commande extends CommonOrder
$this->nbtodo=$this->nbtodolate=0;
$clause = " WHERE";
$sql = "SELECT c.rowid, c.date_creation as datec, c.fk_statut";
$sql = "SELECT c.rowid, c.date_creation as datec, c.date_livraison as delivery_date, c.fk_statut";
$sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
if (!$user->rights->societe->client->voir && !$user->societe_id)
{
@ -2560,7 +2560,9 @@ class Commande extends CommonOrder
while ($obj=$this->db->fetch_object($resql))
{
$this->nbtodo++;
if ($obj->fk_statut != 3 && $this->db->jdate($obj->datec) < ($now - $conf->commande->client->warning_delay)) $this->nbtodolate++;
$date_to_test = empty($obj->delivery_date) ? $obj->datec : $obj->delivery_date;
if ($obj->fk_statut != 3 && $this->db->jdate($date_to_test) < ($now - $conf->commande->client->warning_delay)) $this->nbtodolate++;
}
return 1;
}

View File

@ -224,4 +224,3 @@ if ($id > 0 || ! empty($ref))
$db->close();
llxFooter();
?>

View File

@ -200,6 +200,15 @@ if ($search_user > 0)
}
$sql.= ' ORDER BY '.$sortfield.' '.$sortorder;
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($limit + 1,$offset);
//print $sql;
@ -245,7 +254,7 @@ if ($resql)
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
$num = $db->num_rows($resql);
print_barre_liste($title, $page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num);
print_barre_liste($title, $page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
$i = 0;
// Lignes des champs de filtre

View File

@ -855,4 +855,3 @@ else
llxFooter();
$db->close();
?>

View File

@ -167,9 +167,9 @@ if ($resql)
print '<form method="post" action="search.php" name="search_form">';
$moreforfilter .= $langs->trans('Period') . ' ' . $langs->trans('DateOperationShort') . ': ';
$moreforfilter .= $langs->trans('Period') . ' ' . $langs->trans('StartDate') . ': ';
$moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 1, 1);
$moreforfilter .= $langs->trans('PeriodEndDate') . ':' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 1, 1);
$moreforfilter .= $langs->trans('EndDate') . ':' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 1, 1);
if ($moreforfilter) {

View File

@ -798,7 +798,8 @@ else if ($action == 'add' && $user->rights->facture->creer)
$object->fetch_thirdparty();
// If creation from another object of another module (Example: origin=propal, originid=1)
if ($_POST['origin'] && $_POST['originid']) {
if ($_POST['origin'] && $_POST['originid'])
{
// Parse element/subelement (ex: project_task)
$element = $subelement = $_POST['origin'];
if (preg_match('/^([^_]+)_([^_]+)/i', $_POST['origin'], $regs)) {
@ -835,15 +836,20 @@ else if ($action == 'add' && $user->rights->facture->creer)
$id = $object->create($user);
if ($id > 0) {
if ($id > 0)
{
// If deposit invoice
if ($_POST['type'] == 3) {
if ($_POST['type'] == 3)
{
$typeamount = GETPOST('typedeposit', 'alpha');
$valuedeposit = GETPOST('valuedeposit', 'int');
if ($typeamount == 'amount') {
if ($typeamount == 'amount')
{
$amountdeposit = $valuedeposit;
} else {
}
else
{
$amountdeposit = 0;
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
@ -853,7 +859,8 @@ else if ($action == 'add' && $user->rights->facture->creer)
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add deposit lines");
$result = $srcobject->fetch($object->origin_id);
if ($result > 0) {
if ($result > 0)
{
$totalamount = 0;
$lines = $srcobject->lines;
$numlines=count($lines);
@ -898,7 +905,9 @@ else if ($action == 'add' && $user->rights->facture->creer)
0,
$langs->trans('Deposit')
);
} else {
}
else
{
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
@ -907,10 +916,10 @@ else if ($action == 'add' && $user->rights->facture->creer)
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
$result = $srcobject->fetch($object->origin_id);
if ($result > 0) {
if ($result > 0)
{
$lines = $srcobject->lines;
if (empty($lines) && method_exists($srcobject, 'fetch_lines'))
$lines = $srcobject->fetch_lines();
if (empty($lines) && method_exists($srcobject, 'fetch_lines')) $lines = $srcobject->fetch_lines();
$fk_parent_line=0;
$num=count($lines);
@ -919,7 +928,8 @@ else if ($action == 'add' && $user->rights->facture->creer)
$label=(! empty($lines[$i]->label)?$lines[$i]->label:'');
$desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);
if ($lines [$i]->subprice < 0) {
if ($lines [$i]->subprice < 0)
{
// Negative line, we create a discount line
$discount = new DiscountAbsolute($db);
$discount->fk_soc = $object->socid;
@ -1659,19 +1669,19 @@ else if ($action == 'builddoc') // En get ou en post
if (GETPOST('fk_bank'))
$object->fk_bank = GETPOST('fk_bank');
// Define output language
// Define output language
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id'))
$newlang = GETPOST('lang_id');
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
$newlang = $object->client->default_lang;
if (! empty($newlang)) {
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$result = facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) {
if ($result <= 0)
{
dol_print_error($db, $result);
exit();
}

View File

@ -156,4 +156,3 @@ if ($action == 'edit' && ! empty($attrname))
llxFooter();
$db->close();
?>

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
@ -587,7 +587,7 @@ class Facture extends CommonInvoice
*/
function createFromClone($socid=0)
{
global $conf,$user,$langs;
global $conf,$user,$langs,$hookmanager;
$error=0;
@ -2056,7 +2056,7 @@ class Facture extends CommonInvoice
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc);
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, '', $localtaxes_type);
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
@ -2133,7 +2133,7 @@ class Facture extends CommonInvoice
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
// Mise a jour informations denormalisees au niveau de la facture meme
$result=$this->update_price(1,'auto'); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
$result=$this->update_price(1,'auto',0,$mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
if ($result > 0)
{
$this->db->commit();

View File

@ -166,4 +166,3 @@ else
$db->close();
llxFooter();
?>

View File

@ -231,6 +231,15 @@ $sql.= ' ORDER BY ';
$listfield=explode(',',$sortfield);
foreach ($listfield as $key => $value) $sql.= $listfield[$key].' '.$sortorder.',';
$sql.= ' f.rowid DESC ';
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($limit+1,$offset);
//print $sql;
@ -255,7 +264,7 @@ if ($resql)
if ($search_user > 0) $param.='&search_user=' .$search_user;
if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
if ($search_montant_ttc) $param.='&search_montant_ttc='.$search_montant_ttc;
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->nom:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num);
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->nom:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
$i = 0;
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'."\n";

View File

@ -310,4 +310,3 @@ print '</table>';
$db->close();
llxFooter();
?>

View File

@ -79,7 +79,7 @@ if ($result)
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("WithdrawalReceipts"),"bons.php","p.ref",'','','class="liste_titre"');
print_liste_field_titre($langs->trans("WithdrawalsReceipts"),"bons.php","p.ref",'','','class="liste_titre"');
print_liste_field_titre($langs->trans("Date"),"bons.php","p.datec","","",'class="liste_titre" align="center"');
print '<td class="liste_titre" align="right">'.$langs->trans("Amount").'</td>';
print '</tr>';

View File

@ -47,7 +47,7 @@ $page = GETPOST('page','int');
$sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha');
$sortfield = ((GETPOST('sortfield','alpha')=="")) ? "p.ref" : GETPOST('sortfield','alpha');
llxHeader('',$langs->trans("WithdrawalReceipts"));
llxHeader('',$langs->trans("WithdrawalsReceipts"));
if ($prev_id)
{
@ -56,7 +56,7 @@ if ($prev_id)
if ($bon->fetch($prev_id) == 0)
{
$head = prelevement_prepare_head($bon);
dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalReceipts"), '', 'payment');
dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), '', 'payment');
print '<table class="border" width="100%">';

View File

@ -46,7 +46,7 @@ $page = GETPOST('page','int');
/*
* View
*/
llxHeader('',$langs->trans("WithdrawalReceipts"));
llxHeader('',$langs->trans("WithdrawalsReceipts"));
if ($prev_id)
{
@ -55,7 +55,7 @@ if ($prev_id)
if ($bon->fetch($prev_id) == 0)
{
$head = prelevement_prepare_head($bon);
dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalReceipts"), '', 'payment');
dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalsReceipts"), '', 'payment');
print '<table class="border" width="100%">';

View File

@ -44,7 +44,7 @@ $page = GETPOST('page','int');
* View
*/
llxHeader('',$langs->trans("WithdrawalReceipts"));
llxHeader('',$langs->trans("WithdrawalsReceipts"));
if ($prev_id)
{
@ -53,7 +53,7 @@ if ($prev_id)
if ($bon->fetch($prev_id) == 0)
{
$head = prelevement_prepare_head($bon);
dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalReceipts"), '', 'payment');
dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), '', 'payment');
print '<table class="border" width="100%">';

View File

@ -133,7 +133,7 @@ if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
$bon = new BonPrelevement($db,"");
$form = new Form($db);
llxHeader('',$langs->trans("WithdrawalReceipts"));
llxHeader('',$langs->trans("WithdrawalsReceipts"));
if ($id > 0)
@ -141,7 +141,7 @@ if ($id > 0)
$bon->fetch($id);
$head = prelevement_prepare_head($bon);
dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalReceipts"), '', 'payment');
dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalsReceipts"), '', 'payment');
if (GETPOST('error','alpha')!='')
{
@ -151,7 +151,7 @@ if ($id > 0)
/*if ($action == 'credite')
{
print $form->formconfirm("fiche.php?id=".$bon->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite",'',1,1);
}*/
print '<table class="border" width="100%">';

View File

@ -130,7 +130,7 @@ if ($id)
print '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans("WithdrawalReceipts").'</td><td>';
print '<tr><td width="20%">'.$langs->trans("WithdrawalsReceipts").'</td><td>';
print '<a href="fiche.php?id='.$lipre->bon_rowid.'">'.$lipre->bon_ref.'</a></td></tr>';
print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($lipre->amount).'</td></tr>';

View File

@ -54,7 +54,7 @@ $sortfield = ((GETPOST('sortfield','alpha')=="")) ? "pl.fk_soc" : GETPOST('sortf
* View
*/
llxHeader('',$langs->trans("WithdrawalReceipts"));
llxHeader('',$langs->trans("WithdrawalsReceipts"));
if ($prev_id)
{
@ -63,7 +63,7 @@ if ($prev_id)
if ($bon->fetch($prev_id) == 0)
{
$head = prelevement_prepare_head($bon);
dol_fiche_head($head, 'lines', $langs->trans("WithdrawalReceipts"), '', 'payment');
dol_fiche_head($head, 'lines', $langs->trans("WithdrawalsReceipts"), '', 'payment');
print '<table class="border" width="100%">';

View File

@ -111,7 +111,7 @@ if ($result)
print '<tr class="liste_titre">';
print '<td class="liste_titre">'.$langs->trans("Line").'</td>';
print_liste_field_titre($langs->trans("WithdrawalReceipts"),$_SERVER["PHP_SELF"],"p.ref");
print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref");
print_liste_field_titre($langs->trans("Bill"),$_SERVER["PHP_SELF"],"f.facnumber",'',$urladd);
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom");
print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client",'','','align="center"');

View File

@ -188,7 +188,7 @@ else
$sql.= " AND f.entity = ".$conf->entity;
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
$sql.= " GROUP BY s.nom, s.rowid";
$sql.= " ORDER BY s.nom";
$sql.= " ORDER BY s.nom, s.rowid";
dol_syslog("get customer invoices sql=".$sql);
$result = $db->query($sql);
@ -282,11 +282,11 @@ print '</tr>';
/*
* Frais, factures fournisseurs.
* Suppliers invoices
*/
if ($modecompta == 'CREANCES-DETTES')
{
$sql = "SELECT s.nom, s.rowid as socid, date_format(f.datef,'%Y-%m') as dm, sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc";
$sql = "SELECT s.nom, s.rowid as socid, sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f";
$sql.= " WHERE f.fk_soc = s.rowid";
@ -300,7 +300,7 @@ if ($modecompta == 'CREANCES-DETTES')
}
else
{
$sql = "SELECT s.nom, s.rowid as socid, date_format(p.datep,'%Y-%m') as dm, sum(pf.amount) as amount_ttc";
$sql = "SELECT s.nom, s.rowid as socid, sum(pf.amount) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p";
$sql.= ", ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as f";
@ -313,7 +313,7 @@ else
}
$sql.= " AND f.entity = ".$conf->entity;
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
$sql .= " GROUP BY s.nom, s.rowid, dm";
$sql .= " GROUP BY s.nom, s.rowid";
$sql .= " ORDER BY s.nom, s.rowid";
print '<tr><td colspan="4">'.$langs->trans("SuppliersInvoices").'</td></tr>';
@ -373,11 +373,11 @@ print '</tr>';
* Charges sociales non deductibles
*/
print '<tr><td colspan="4">'.$langs->trans("SocialContributions").'</td></tr>';
print '<tr><td colspan="4">'.$langs->trans("SocialContributions").' ('.$langs->trans("Type").' 0)</td></tr>';
if ($modecompta == 'CREANCES-DETTES')
{
$sql = "SELECT c.libelle as nom, sum(cs.amount) as amount";
$sql = "SELECT c.id, c.libelle as nom, sum(cs.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= " WHERE cs.fk_type = c.id";
@ -387,7 +387,7 @@ if ($modecompta == 'CREANCES-DETTES')
}
else
{
$sql = "SELECT c.libelle as nom, sum(p.amount) as amount";
$sql = "SELECT c.id, c.libelle as nom, sum(p.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p";
@ -398,8 +398,8 @@ else
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
}
$sql.= " AND cs.entity = ".$conf->entity;
$sql.= " GROUP BY c.libelle";
$sql.= " ORDER BY c.libelle";
$sql.= " GROUP BY c.libelle, c.id";
$sql.= " ORDER BY c.libelle, c.id";
dol_syslog("get social contributions deductible=0 sql=".$sql);
$result=$db->query($sql);
@ -447,11 +447,11 @@ print '</tr>';
* Charges sociales deductibles
*/
print '<tr><td colspan="4">'.$langs->trans("SocialContributions").'</td></tr>';
print '<tr><td colspan="4">'.$langs->trans("SocialContributions").' ('.$langs->trans("Type").' 1)</td></tr>';
if ($modecompta == 'CREANCES-DETTES')
{
$sql = "SELECT c.libelle as nom, sum(cs.amount) as amount";
$sql = "SELECT c.id, c.libelle as nom, sum(cs.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= " WHERE cs.fk_type = c.id";
@ -459,12 +459,12 @@ if ($modecompta == 'CREANCES-DETTES')
if (! empty($date_start) && ! empty($date_end))
$sql.= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'";
$sql.= " AND cs.entity = ".$conf->entity;
$sql.= " GROUP BY c.libelle";
$sql.= " ORDER BY c.libelle";
$sql.= " GROUP BY c.libelle, c.id";
$sql.= " ORDER BY c.libelle, c.id";
}
else
{
$sql = "SELECT c.libelle as nom, sum(p.amount) as amount";
$sql = "SELECT c.id, c.libelle as nom, sum(p.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p";
@ -474,8 +474,8 @@ else
if (! empty($date_start) && ! empty($date_end))
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
$sql.= " AND cs.entity = ".$conf->entity;
$sql.= " GROUP BY c.libelle";
$sql.= " ORDER BY c.libelle";
$sql.= " GROUP BY c.libelle, c.id";
$sql.= " ORDER BY c.libelle, c.id";
}
dol_syslog("get social contributions deductible=1 sql=".$sql);
@ -542,6 +542,7 @@ if ($mysoc->tva_assuj == 'franchise') // Non assujeti
/*
* VAT
*/
print '<tr><td colspan="4">'.$langs->trans("VAT").'</td></tr>';
$subtotal_ht = 0;
$subtotal_ttc = 0;
@ -565,12 +566,15 @@ if ($modecompta == 'CREANCES-DETTES')
dol_syslog("get vat to pay sql=".$sql);
$result=$db->query($sql);
if ($result) {
if ($result)
{
$num = $db->num_rows($result);
$var=false;
$i = 0;
if ($num) {
while ($i < $num) {
if ($num)
{
while ($i < $num)
{
$obj = $db->fetch_object($result);
$amount -= $obj->amount;
@ -607,12 +611,15 @@ if ($modecompta == 'CREANCES-DETTES')
dol_syslog("get vat received back sql=".$sql);
$result=$db->query($sql);
if ($result) {
if ($result)
{
$num = $db->num_rows($result);
$var=true;
$i = 0;
if ($num) {
while ($i < $num) {
if ($num)
{
while ($i < $num)
{
$obj = $db->fetch_object($result);
$amount += $obj->amount;
@ -635,7 +642,7 @@ if ($modecompta == 'CREANCES-DETTES')
}
else
{
// TVA reellement deja payee
// VAT really already paid
$amount=0;
$sql = "SELECT date_format(t.datev,'%Y-%m') as dm, sum(t.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
@ -676,7 +683,7 @@ else
print "<td align=\"right\">".price($amount)."</td>\n";
print "</tr>\n";
// TVA recuperee
// VAT really received
$amount=0;
$sql = "SELECT date_format(t.datev,'%Y-%m') as dm, sum(t.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";

View File

@ -179,4 +179,3 @@ else
$db->close();
llxFooter();
?>

View File

@ -1094,4 +1094,3 @@ class Contact extends CommonObject
}
}
?>

View File

@ -249,4 +249,3 @@ if ($action != 'edit')
llxFooter();
$db->close();
?>

View File

@ -29,6 +29,7 @@
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
require_once(DOL_DOCUMENT_ROOT ."/margin/lib/margins.lib.php");
/**

View File

@ -58,4 +58,3 @@ print '</div>';
$db->close();
llxFooter();
?>

View File

@ -253,4 +253,3 @@ if ($section)
// Close db if mode is not noajax
if ((! isset($mode) || $mode != 'noajax') && is_object($db)) $db->close();
?>

View File

@ -71,4 +71,3 @@ if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $
exit;
}
?>

View File

@ -115,4 +115,3 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
}
}
?>

View File

@ -156,4 +156,3 @@ class box_actions extends ModeleBoxes
}
?>

View File

@ -165,4 +165,3 @@ class AntiVir
}
?>

View File

@ -198,4 +198,3 @@ class Canvas
}
}
?>

View File

@ -627,25 +627,25 @@ abstract class CommonObject
/**
* Load data for barcode into properties ->barcode_type*
* Properties ->barcode_type is used to find others.
* If not defined, ->element must be defined to know default barcode type.
* Properties ->barcode_type that is id of barcode type is used to find other properties, but
* if it is not defined, ->element must be defined to know default barcode type.
*
* @return int <0 if KO, >=0 if OK
* @return int <0 if KO, 0 if can't guess type of barcode (ISBN, EAN13...), >0 if OK (all barcode properties loaded)
*/
function fetch_barcode()
{
global $conf;
dol_syslog(get_class($this).'::fetch_barcode this->element='.$this->element.' this->barcode_type='.$this->barcode_type);
$idtype=$this->barcode_type;
if (! $idtype)
if (empty($idtype) && $idtype != '0') // If type of barcode no set, we try to guess. If set to '0' it means we forced to have type remain not defined
{
if ($this->element == 'product') $idtype = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;
else if ($this->element == 'societe') $idtype = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY;
else dol_print_error('','Call fetch_barcode with barcode_type not defined and cant be guessed');
else dol_syslog('Call fetch_barcode with barcode_type not defined and cant be guessed', LOG_WARNING);
}
if ($idtype > 0)
{
if (empty($this->barcode_type) || empty($this->barcode_type_code) || empty($this->barcode_type_label) || empty($this->barcode_type_coder)) // If data not already loaded
@ -1518,7 +1518,7 @@ abstract class CommonObject
* @param int $exclspec >0 = Exclude special product (product_type=9)
* @param string $roundingadjust 'none'=Do nothing, 'auto'=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND if defined, or '0'), '0'=Force use total of rounding, '1'=Force use rounding of total
* @param int $nodatabaseupdate 1=Do not update database. Update only properties of object.
* @param Societe $seller If roundingadjust is 0, it means we recalculate total for lines before calculating total for object. For this, we need seller object.
* @param Societe $seller If roundingadjust is '0' or '1', it means we recalculate total for lines before calculating total for object. For this, we need seller object.
* @return int <0 if KO, >0 if OK
*/
function update_price($exclspec=0,$roundingadjust='none',$nodatabaseupdate=0,$seller='')
@ -1615,7 +1615,7 @@ abstract class CommonObject
//print 'Line '.$i.' rowid='.$obj->rowid.' vat_rate='.$obj->vatrate.' total_ht='.$obj->total_ht.' total_tva='.$obj->total_tva.' total_ttc='.$obj->total_ttc.' total_ht_by_vats='.$total_ht_by_vats[$obj->vatrate].' total_tva_by_vats='.$total_tva_by_vats[$obj->vatrate].' (new calculation = '.$tmpvat.') total_ttc_by_vats='.$total_ttc_by_vats[$obj->vatrate].($diff?" => DIFF":"")."<br>\n";
if ($diff)
{
if (abs($diff) > 0.1) { dol_syslog('','A rounding difference was detected into TOTAL but is too high to be corrected', LOG_WARNING); exit; }
if (abs($diff) > 0.1) { dol_syslog('A rounding difference was detected into TOTAL but is too high to be corrected', LOG_WARNING); exit; }
$sqlfix="UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldtva." = ".($obj->total_tva - $diff).", total_ttc = ".($obj->total_ttc - $diff)." WHERE rowid = ".$obj->rowid;
dol_syslog('We found a difference of '.$diff.' for line rowid = '.$obj->rowid.". We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix);
$resqlfix=$this->db->query($sqlfix);

View File

@ -4087,11 +4087,11 @@ class Form
// Complete object if not complete
if (empty($object->barcode_type_code) || empty($object->barcode_type_coder))
{
$result = $object->fetch_barcode();
//Check if fetch_barcode() failed
$result = $object->fetch_barcode();
//Check if fetch_barcode() failed
if ($result < 1) return '<!-- ErrorFetchBarcode -->';
}
// Barcode image
$url=DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code);
$out ='<!-- url barcode = '.$url.' -->';

View File

@ -1184,4 +1184,3 @@ class FormFile
}
?>

View File

@ -1164,4 +1164,3 @@ class FormOther
}
?>

View File

@ -775,4 +775,3 @@ function xml2php($xml)
}
?>

View File

@ -196,7 +196,8 @@ class DoliDBPgsql extends DoliDB
// nuke unsigned
$line=preg_replace('/(int\w+|smallint)\s+unsigned/i','\\1',$line);
$line=preg_replace('/as signed/i','as integer',$line);
// blob -> text
$line=preg_replace('/\w*blob/i','text',$line);

View File

@ -108,4 +108,3 @@ function SendErrorNode($number, $text)
else
echo '<Error number="' . $number . '" />' ;
}
?>

View File

@ -416,4 +416,3 @@ function barcode_outimage($text, $bars, $scale = 1, $mode = "png", $total_y = 0,
}
}
?>

View File

@ -119,4 +119,3 @@ function contract_admin_prepare_head()
return $head;
}
?>

View File

@ -134,4 +134,3 @@ function fichinter_admin_prepare_head()
}
?>

View File

@ -198,4 +198,3 @@ function supplierorder_admin_prepare_head($object)
}
?>

View File

@ -4589,4 +4589,3 @@ function natural_search($fields, $value)
return " AND " . ($end > 1? '(' : '') . $res;
}
?>

View File

@ -536,7 +536,7 @@ function array2table($data,$tableMarkup=1,$tableoptions='',$troptions='',$tdopti
* @param Societe $objsoc The company that own the object we need a counter for
* @param string $date Date to use for the {y},{m},{d} tags.
* @param string $mode 'next' for next value or 'last' for last value
* @return string New value
* @return string New value (numeric) or error message
*/
function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$mode='next')
{
@ -798,6 +798,12 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
{
$counter++;
// If value for $counter has a length higher than $maskcounter chars
if ($counter >= pow(10, dol_strlen($maskcounter)))
{
$counter='ErrorMaxNumberReachForThisMask';
}
if (! empty($maskrefclient_maskcounter))
{
//print "maskrefclient_maskcounter=".$maskrefclient_maskcounter." maskwithnocode=".$maskwithnocode." maskrefclient=".$maskrefclient."\n<br>";
@ -839,6 +845,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
$maskrefclient_counter = $maskrefclient_obj->val;
}
else dol_print_error($db);
if (empty($maskrefclient_counter) || preg_match('/[^0-9]/i',$maskrefclient_counter)) $maskrefclient_counter=$maskrefclient_maskoffset;
$maskrefclient_counter++;
}

View File

@ -286,4 +286,3 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
else return $result;
}
?>

View File

@ -44,4 +44,3 @@ function mailmanspip_admin_prepare_head()
);
}
?>

Some files were not shown because too many files have changed in this diff Show More