forked from Wavyzz/dolibarr
Normalized line endings to LF
This commit is contained in:
@@ -60,10 +60,10 @@ $fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'11';
|
|||||||
$fontlist='arial,tahoma,verdana,helvetica';
|
$fontlist='arial,tahoma,verdana,helvetica';
|
||||||
//$fontlist='Verdana,Helvetica,Arial,sans-serif';
|
//$fontlist='Verdana,Helvetica,Arial,sans-serif';
|
||||||
|
|
||||||
$dol_hide_topmenu=$conf->dol_hide_topmenu;
|
$dol_hide_topmenu=$conf->dol_hide_topmenu;
|
||||||
$dol_hide_leftmenu=$conf->dol_hide_leftmenu;
|
$dol_hide_leftmenu=$conf->dol_hide_leftmenu;
|
||||||
$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen;
|
$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen;
|
||||||
$dol_no_mouse_hover=$conf->dol_no_mouse_hover;
|
$dol_no_mouse_hover=$conf->dol_no_mouse_hover;
|
||||||
$dol_use_jmobile=$conf->dol_use_jmobile;
|
$dol_use_jmobile=$conf->dol_use_jmobile;
|
||||||
|
|
||||||
$path=''; // This value may be used in future for external module to overwrite theme
|
$path=''; // This value may be used in future for external module to overwrite theme
|
||||||
|
|||||||
@@ -60,10 +60,10 @@ $fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'11';
|
|||||||
$fontlist='arial,tahoma,verdana,helvetica';
|
$fontlist='arial,tahoma,verdana,helvetica';
|
||||||
//$fontlist='Verdana,Helvetica,Arial,sans-serif';
|
//$fontlist='Verdana,Helvetica,Arial,sans-serif';
|
||||||
|
|
||||||
$dol_hide_topmenu=$conf->dol_hide_topmenu;
|
$dol_hide_topmenu=$conf->dol_hide_topmenu;
|
||||||
$dol_hide_leftmenu=$conf->dol_hide_leftmenu;
|
$dol_hide_leftmenu=$conf->dol_hide_leftmenu;
|
||||||
$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen;
|
$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen;
|
||||||
$dol_no_mouse_hover=$conf->dol_no_mouse_hover;
|
$dol_no_mouse_hover=$conf->dol_no_mouse_hover;
|
||||||
$dol_use_jmobile=$conf->dol_use_jmobile;
|
$dol_use_jmobile=$conf->dol_use_jmobile;
|
||||||
|
|
||||||
$path=''; // This value may be used in future for external module to overwrite theme
|
$path=''; // This value may be used in future for external module to overwrite theme
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ if (GETPOST('theme')) $conf->theme=GETPOST('theme'); // If theme was forced on
|
|||||||
$langs->load("main",0,1);
|
$langs->load("main",0,1);
|
||||||
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
|
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
|
||||||
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
|
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
|
||||||
$fontsize=empty($conf->dol_optimize_smallscreen)?'12':'12';
|
$fontsize=empty($conf->dol_optimize_smallscreen)?'12':'12';
|
||||||
$fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'11';
|
$fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'11';
|
||||||
|
|
||||||
$path=''; // This value may be used in future for external module to overwrite theme
|
$path=''; // This value may be used in future for external module to overwrite theme
|
||||||
$theme='eldy'; // Value of theme
|
$theme='eldy'; // Value of theme
|
||||||
@@ -70,10 +70,10 @@ $fontlist='arial,tahoma,verdana,helvetica'; //$fontlist='Verdana,Helvetica,Ar
|
|||||||
$img_head=dol_buildpath($path.'/theme/'.$theme.'/img/headbg2.jpg',1);
|
$img_head=dol_buildpath($path.'/theme/'.$theme.'/img/headbg2.jpg',1);
|
||||||
$img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png',1);
|
$img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png',1);
|
||||||
$dol_hide_topmenu=$conf->dol_hide_topmenu;
|
$dol_hide_topmenu=$conf->dol_hide_topmenu;
|
||||||
$dol_hide_leftmenu=$conf->dol_hide_leftmenu;
|
$dol_hide_leftmenu=$conf->dol_hide_leftmenu;
|
||||||
$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen;
|
$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen;
|
||||||
$dol_no_mouse_hover=$conf->dol_no_mouse_hover;
|
$dol_no_mouse_hover=$conf->dol_no_mouse_hover;
|
||||||
$dol_use_jmobile=$conf->dol_use_jmobile;
|
$dol_use_jmobile=$conf->dol_use_jmobile;
|
||||||
|
|
||||||
|
|
||||||
// Define reference colors
|
// Define reference colors
|
||||||
|
|||||||
@@ -1113,9 +1113,9 @@ class User extends CommonObject
|
|||||||
$this->note = trim($this->note);
|
$this->note = trim($this->note);
|
||||||
$this->openid = trim(empty($this->openid)?'':$this->openid); // Avoid warning
|
$this->openid = trim(empty($this->openid)?'':$this->openid); // Avoid warning
|
||||||
$this->admin = $this->admin?$this->admin:0;
|
$this->admin = $this->admin?$this->admin:0;
|
||||||
$this->address = empty($this->address)?'':$this->address;
|
$this->address = empty($this->address)?'':$this->address;
|
||||||
$this->zip = empty($this->zip)?'':$this->zip;
|
$this->zip = empty($this->zip)?'':$this->zip;
|
||||||
$this->town = empty($this->town)?'':$this->town;
|
$this->town = empty($this->town)?'':$this->town;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email))
|
if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email))
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ if ($action == 'update' && ! $_POST['cancel'])
|
|||||||
$edituser->clicktodial_url = GETPOST("url");
|
$edituser->clicktodial_url = GETPOST("url");
|
||||||
$edituser->clicktodial_login = GETPOST("login");
|
$edituser->clicktodial_login = GETPOST("login");
|
||||||
$edituser->clicktodial_password = GETPOST("password");
|
$edituser->clicktodial_password = GETPOST("password");
|
||||||
$edituser->clicktodial_poste = GETPOST("poste");
|
$edituser->clicktodial_poste = GETPOST("poste");
|
||||||
|
|
||||||
$result=$edituser->update_clicktodial();
|
$result=$edituser->update_clicktodial();
|
||||||
if ($result < 0) setEventMessage($edituser->error,'errors');
|
if ($result < 0) setEventMessage($edituser->error,'errors');
|
||||||
@@ -155,10 +155,10 @@ if ($id > 0)
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br><center><input class="button" type="submit" value="'.$langs->trans("Save").'">';
|
print '<br><center><input class="button" type="submit" value="'.$langs->trans("Save").'">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||||
print '</center>';
|
print '</center>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ if (! empty($conf->global->MAIN_LOGOUT_GOTO_URL)) $url=$conf->global->MAIN_LOGOU
|
|||||||
|
|
||||||
if (GETPOST('dol_hide_topmenu')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_hide_topmenu=1';
|
if (GETPOST('dol_hide_topmenu')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_hide_topmenu=1';
|
||||||
if (GETPOST('dol_hide_leftmenu')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_hide_leftmenu=1';
|
if (GETPOST('dol_hide_leftmenu')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_hide_leftmenu=1';
|
||||||
if (GETPOST('dol_optimize_smallscreen')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_optimize_smallscreen=1';
|
if (GETPOST('dol_optimize_smallscreen')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_optimize_smallscreen=1';
|
||||||
if (GETPOST('dol_no_mouse_hover')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_no_mouse_hover=1';
|
if (GETPOST('dol_no_mouse_hover')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_no_mouse_hover=1';
|
||||||
if (GETPOST('dol_use_jmobile')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_use_jmobile=1';
|
if (GETPOST('dol_use_jmobile')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_use_jmobile=1';
|
||||||
|
|
||||||
// Destroy session
|
// Destroy session
|
||||||
$prefix=dol_getprefix();
|
$prefix=dol_getprefix();
|
||||||
@@ -77,8 +77,8 @@ session_destroy();
|
|||||||
dol_syslog("End of session ".$sessionname);
|
dol_syslog("End of session ".$sessionname);
|
||||||
|
|
||||||
// TODO Not sure this is required
|
// TODO Not sure this is required
|
||||||
unset($_SESSION['dol_login']);
|
unset($_SESSION['dol_login']);
|
||||||
unset($_SESSION['dol_entity']);
|
unset($_SESSION['dol_entity']);
|
||||||
|
|
||||||
header("Location: ".$url);
|
header("Location: ".$url);
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -122,10 +122,10 @@ $title = $langs->trans("User");
|
|||||||
|
|
||||||
if ($action == 'edit')
|
if ($action == 'edit')
|
||||||
{
|
{
|
||||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -55,11 +55,11 @@ $conf->entity = (GETPOST('entity') ? GETPOST('entity') : 1);
|
|||||||
$hookmanager->initHooks(array('passwordforgottenpage'));
|
$hookmanager->initHooks(array('passwordforgottenpage'));
|
||||||
|
|
||||||
|
|
||||||
if (GETPOST('dol_hide_leftmenu') || ! empty($_SESSION['dol_hide_leftmenu'])) $conf->dol_hide_leftmenu=1;
|
if (GETPOST('dol_hide_leftmenu') || ! empty($_SESSION['dol_hide_leftmenu'])) $conf->dol_hide_leftmenu=1;
|
||||||
if (GETPOST('dol_hide_topmenu') || ! empty($_SESSION['dol_hide_topmenu'])) $conf->dol_hide_topmenu=1;
|
if (GETPOST('dol_hide_topmenu') || ! empty($_SESSION['dol_hide_topmenu'])) $conf->dol_hide_topmenu=1;
|
||||||
if (GETPOST('dol_optimize_smallscreen') || ! empty($_SESSION['dol_optimize_smallscreen'])) $conf->dol_optimize_smallscreen=1;
|
if (GETPOST('dol_optimize_smallscreen') || ! empty($_SESSION['dol_optimize_smallscreen'])) $conf->dol_optimize_smallscreen=1;
|
||||||
if (GETPOST('dol_no_mouse_hover') || ! empty($_SESSION['dol_no_mouse_hover'])) $conf->dol_no_mouse_hover=1;
|
if (GETPOST('dol_no_mouse_hover') || ! empty($_SESSION['dol_no_mouse_hover'])) $conf->dol_no_mouse_hover=1;
|
||||||
if (GETPOST('dol_use_jmobile') || ! empty($_SESSION['dol_use_jmobile'])) $conf->dol_use_jmobile=1;
|
if (GETPOST('dol_use_jmobile') || ! empty($_SESSION['dol_use_jmobile'])) $conf->dol_use_jmobile=1;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -272,8 +272,8 @@ print '</tr>'."\n";
|
|||||||
print '</table><br>';
|
print '</table><br>';
|
||||||
|
|
||||||
if ($user->admin) print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules"), 0, 1).'<br>';
|
if ($user->admin) print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules"), 0, 1).'<br>';
|
||||||
// Show warning about external users
|
// Show warning about external users
|
||||||
if (empty($user->societe_id)) print showModulesExludedForExternal($modules).'<br><br>'."\n";
|
if (empty($user->societe_id)) print showModulesExludedForExternal($modules).'<br><br>'."\n";
|
||||||
|
|
||||||
// For multicompany transversal mode
|
// For multicompany transversal mode
|
||||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))
|
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ function llxHeader() { }
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function llxFooter() { }
|
function llxFooter() { }
|
||||||
|
|
||||||
require 'main.inc.php';
|
require 'main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
@@ -97,15 +97,15 @@ else $type=dol_mimetype($original_file);
|
|||||||
// Suppression de la chaine de caractere ../ dans $original_file
|
// Suppression de la chaine de caractere ../ dans $original_file
|
||||||
$original_file = str_replace("../","/", $original_file);
|
$original_file = str_replace("../","/", $original_file);
|
||||||
|
|
||||||
// Find the subdirectory name as the reference
|
// Find the subdirectory name as the reference
|
||||||
$refname=basename(dirname($original_file)."/");
|
$refname=basename(dirname($original_file)."/");
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
|
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
|
||||||
$check_access = dol_check_secure_access_document($modulepart,$original_file,$entity,$refname);
|
$check_access = dol_check_secure_access_document($modulepart,$original_file,$entity,$refname);
|
||||||
$accessallowed = $check_access['accessallowed'];
|
$accessallowed = $check_access['accessallowed'];
|
||||||
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||||
$original_file = $check_access['original_file'];
|
$original_file = $check_access['original_file'];
|
||||||
|
|
||||||
// Security:
|
// Security:
|
||||||
// Limit access if permissions are wrong
|
// Limit access if permissions are wrong
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
README (english)
|
README (english)
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
This directory contains files to make Dolibarr a server
|
This directory contains files to make Dolibarr a server
|
||||||
of SOAP Web Services.
|
of SOAP Web Services.
|
||||||
|
|
||||||
* To see all Webservices provided by Dolibarr, just call following Url:
|
* To see all Webservices provided by Dolibarr, just call following Url:
|
||||||
http://mydomain.com/dolibarr/webservices/server.php
|
http://mydomain.com/dolibarr/webservices/server.php
|
||||||
|
|
||||||
* WSDL file of Web services provided by Dolibarr can be obtained at:
|
* WSDL file of Web services provided by Dolibarr can be obtained at:
|
||||||
http://mydomain.com/dolibarr/webservices/server.php?wsdl
|
http://mydomain.com/dolibarr/webservices/server.php?wsdl
|
||||||
and is also saved in file:
|
and is also saved in file:
|
||||||
server.wsdl
|
server.wsdl
|
||||||
|
|
||||||
Note, you can test this Webservices by calling the page client.php.
|
Note, you can test this Webservices by calling the page client.php.
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ function getSupplierInvoicesForThirdParty($authentication,$idthirdparty)
|
|||||||
$result=$invoice->fetch($obj->facid);
|
$result=$invoice->fetch($obj->facid);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorcode=$result; $errorlabel=$invoice->error;
|
$errorcode=$result; $errorlabel=$invoice->error;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,33 +33,33 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once($path."../../htdocs/master.inc.php");
|
require_once($path."../../htdocs/master.inc.php");
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
|
||||||
|
|
||||||
// Global variables
|
// Global variables
|
||||||
$version=DOL_VERSION;
|
$version=DOL_VERSION;
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Main
|
* Main
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
|
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
|
||||||
|
|
||||||
if (! isset($argv[3]) || ! $argv[3]) {
|
if (! isset($argv[3]) || ! $argv[3]) {
|
||||||
print "Usage: $script_file bank_ref bank_receipt_number (csv|tsv|excel|excel2007) [lang=xx_XX]\n";
|
print "Usage: $script_file bank_ref bank_receipt_number (csv|tsv|excel|excel2007) [lang=xx_XX]\n";
|
||||||
@@ -68,52 +68,52 @@ if (! isset($argv[3]) || ! $argv[3]) {
|
|||||||
$bankref=$argv[1];
|
$bankref=$argv[1];
|
||||||
$num=$argv[2];
|
$num=$argv[2];
|
||||||
$model=$argv[3];
|
$model=$argv[3];
|
||||||
$newlangid='en_EN'; // To force a new lang id
|
$newlangid='en_EN'; // To force a new lang id
|
||||||
|
|
||||||
|
|
||||||
$invoicestatic=new Facture($db);
|
$invoicestatic=new Facture($db);
|
||||||
$invoicesupplierstatic=new FactureFournisseur($db);
|
$invoicesupplierstatic=new FactureFournisseur($db);
|
||||||
$societestatic=new Societe($db);
|
$societestatic=new Societe($db);
|
||||||
$chargestatic=new ChargeSociales($db);
|
$chargestatic=new ChargeSociales($db);
|
||||||
$memberstatic=new Adherent($db);
|
$memberstatic=new Adherent($db);
|
||||||
$paymentstatic=new Paiement($db);
|
$paymentstatic=new Paiement($db);
|
||||||
$paymentsupplierstatic=new PaiementFourn($db);
|
$paymentsupplierstatic=new PaiementFourn($db);
|
||||||
$paymentsocialcontributionstatic=new PaymentSocialContribution($db);
|
$paymentsocialcontributionstatic=new PaymentSocialContribution($db);
|
||||||
$paymentvatstatic=new Tva($db);
|
$paymentvatstatic=new Tva($db);
|
||||||
$bankstatic=new Account($db);
|
$bankstatic=new Account($db);
|
||||||
$banklinestatic=new AccountLine($db);
|
$banklinestatic=new AccountLine($db);
|
||||||
|
|
||||||
|
|
||||||
// Parse parameters
|
// Parse parameters
|
||||||
foreach ($argv as $key => $value)
|
foreach ($argv as $key => $value)
|
||||||
{
|
{
|
||||||
$found=false;
|
$found=false;
|
||||||
|
|
||||||
// Define options
|
// Define options
|
||||||
if (preg_match('/^lang=/i',$value))
|
if (preg_match('/^lang=/i',$value))
|
||||||
{
|
{
|
||||||
$found=true;
|
$found=true;
|
||||||
$valarray=explode('=',$value);
|
$valarray=explode('=',$value);
|
||||||
$newlangid=$valarray[1];
|
$newlangid=$valarray[1];
|
||||||
print 'Use language '.$newlangid.".\n";
|
print 'Use language '.$newlangid.".\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
if (! empty($newlangid))
|
if (! empty($newlangid))
|
||||||
{
|
{
|
||||||
if ($outputlangs->defaultlang != $newlangid)
|
if ($outputlangs->defaultlang != $newlangid)
|
||||||
{
|
{
|
||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
$outputlangs->setDefaultLang($newlangid);
|
$outputlangs->setDefaultLang($newlangid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$outputlangs->load("main");
|
$outputlangs->load("main");
|
||||||
$outputlangs->load("bills");
|
$outputlangs->load("bills");
|
||||||
$outputlangs->load("companies");
|
$outputlangs->load("companies");
|
||||||
$outputlangs->load("banks");
|
$outputlangs->load("banks");
|
||||||
$outputlangs->load("members");
|
$outputlangs->load("members");
|
||||||
$outputlangs->load("compta");
|
$outputlangs->load("compta");
|
||||||
|
|
||||||
|
|
||||||
$acct=new Account($db);
|
$acct=new Account($db);
|
||||||
$result=$acct->fetch('',$bankref);
|
$result=$acct->fetch('',$bankref);
|
||||||
@@ -128,22 +128,22 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Creation de la classe d'export du model ExportXXX
|
// Creation de la classe d'export du model ExportXXX
|
||||||
$dir = DOL_DOCUMENT_ROOT . "/core/modules/export/";
|
$dir = DOL_DOCUMENT_ROOT . "/core/modules/export/";
|
||||||
$file = "export_".$model.".modules.php";
|
$file = "export_".$model.".modules.php";
|
||||||
$classname = "Export".$model;
|
$classname = "Export".$model;
|
||||||
if (! dol_is_file($dir.$file))
|
if (! dol_is_file($dir.$file))
|
||||||
{
|
{
|
||||||
print "No driver to export with format ".$model."\n";
|
print "No driver to export with format ".$model."\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
require_once $dir.$file;
|
require_once $dir.$file;
|
||||||
$objmodel = new $classname($db);
|
$objmodel = new $classname($db);
|
||||||
|
|
||||||
|
|
||||||
// Define target path
|
// Define target path
|
||||||
$dirname = $conf->banque->dir_temp;
|
$dirname = $conf->banque->dir_temp;
|
||||||
$filename = 'export-bank-receipts-'.$bankref.'-'.$num.'.'.$objmodel->extension;
|
$filename = 'export-bank-receipts-'.$bankref.'-'.$num.'.'.$objmodel->extension;
|
||||||
|
|
||||||
|
|
||||||
$array_fields=array(
|
$array_fields=array(
|
||||||
@@ -154,21 +154,21 @@ $array_fields=array(
|
|||||||
'soldbefore'=>$outputlangs->transnoentitiesnoconv("BankBalanceBefore"), 'soldafter'=>$outputlangs->transnoentitiesnoconv("BankBalanceAfter"),
|
'soldbefore'=>$outputlangs->transnoentitiesnoconv("BankBalanceBefore"), 'soldafter'=>$outputlangs->transnoentitiesnoconv("BankBalanceAfter"),
|
||||||
'comment'=>$outputlangs->transnoentitiesnoconv("Comment")
|
'comment'=>$outputlangs->transnoentitiesnoconv("Comment")
|
||||||
);
|
);
|
||||||
$array_selected=array(
|
$array_selected=array(
|
||||||
'bankreceipt'=>'bankreceipt', 'bankaccount'=>'bankaccount',
|
'bankreceipt'=>'bankreceipt', 'bankaccount'=>'bankaccount',
|
||||||
'dateop'=>'dateop','dateval'=>'dateval','type'=>'type',
|
'dateop'=>'dateop','dateval'=>'dateval','type'=>'type',
|
||||||
'description'=>'description', 'thirdparty'=>'thirdparty', 'accountelem'=>'accountelem',
|
'description'=>'description', 'thirdparty'=>'thirdparty', 'accountelem'=>'accountelem',
|
||||||
'debit'=>'debit', 'credit'=>'credit',
|
'debit'=>'debit', 'credit'=>'credit',
|
||||||
'soldbefore'=>'soldbefore','soldafter'=>'soldafter',
|
'soldbefore'=>'soldbefore','soldafter'=>'soldafter',
|
||||||
'comment'=>'comment'
|
'comment'=>'comment'
|
||||||
);
|
);
|
||||||
$array_export_TypeFields=array(
|
$array_export_TypeFields=array(
|
||||||
'bankreceipt'=>'Text', 'bankaccount'=>'Text',
|
'bankreceipt'=>'Text', 'bankaccount'=>'Text',
|
||||||
'dateop'=>'Date','dateval'=>'Date','type'=>'Text',
|
'dateop'=>'Date','dateval'=>'Date','type'=>'Text',
|
||||||
'description'=>'Text', 'thirdparty'=>'Text', 'accountelem'=>'Text',
|
'description'=>'Text', 'thirdparty'=>'Text', 'accountelem'=>'Text',
|
||||||
'debit'=>'Number', 'credit'=>'Number',
|
'debit'=>'Number', 'credit'=>'Number',
|
||||||
'soldbefore'=>'Number','soldafter'=>'Number',
|
'soldbefore'=>'Number','soldafter'=>'Number',
|
||||||
'comment'=>'Text'
|
'comment'=>'Text'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -180,69 +180,69 @@ foreach($arraynum as $val)
|
|||||||
if ($listofnum != "'") $listofnum.="','";
|
if ($listofnum != "'") $listofnum.="','";
|
||||||
$listofnum.=$val;
|
$listofnum.=$val;
|
||||||
}
|
}
|
||||||
$listofnum.="'";
|
$listofnum.="'";
|
||||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,";
|
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,";
|
||||||
$sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,";
|
$sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,";
|
||||||
$sql.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel";
|
$sql.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."bank as b";
|
$sql.= ", ".MAIN_DB_PREFIX."bank as b";
|
||||||
$sql.= " WHERE b.num_releve IN (".$listofnum.")";
|
$sql.= " WHERE b.num_releve IN (".$listofnum.")";
|
||||||
if (!isset($num)) $sql.= " OR b.num_releve is null";
|
if (!isset($num)) $sql.= " OR b.num_releve is null";
|
||||||
$sql.= " AND b.fk_account = ".$acct->id;
|
$sql.= " AND b.fk_account = ".$acct->id;
|
||||||
$sql.= " AND b.fk_account = ba.rowid";
|
$sql.= " AND b.fk_account = ba.rowid";
|
||||||
$sql.= $db->order("b.num_releve, b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day
|
$sql.= $db->order("b.num_releve, b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day
|
||||||
//print $sql;
|
//print $sql;
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$balancebefore=array();
|
$balancebefore=array();
|
||||||
|
|
||||||
$numrows = $db->num_rows($resql);
|
$numrows = $db->num_rows($resql);
|
||||||
|
|
||||||
if ($numrows > 0)
|
if ($numrows > 0)
|
||||||
{
|
{
|
||||||
// Open file
|
// Open file
|
||||||
print 'Open file '.$filename.' into directory '.$dirname."\n";
|
print 'Open file '.$filename.' into directory '.$dirname."\n";
|
||||||
dol_mkdir($dirname);
|
dol_mkdir($dirname);
|
||||||
$result=$objmodel->open_file($dirname."/".$filename, $outputlangs);
|
$result=$objmodel->open_file($dirname."/".$filename, $outputlangs);
|
||||||
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
print 'Failed to create file '.$filename.' into dir '.$dirname.'.'."\n";
|
print 'Failed to create file '.$filename.' into dir '.$dirname.'.'."\n";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Genere en-tete
|
// Genere en-tete
|
||||||
$objmodel->write_header($outputlangs);
|
$objmodel->write_header($outputlangs);
|
||||||
|
|
||||||
// Genere ligne de titre
|
// Genere ligne de titre
|
||||||
$objmodel->write_title($array_fields,$array_selected,$outputlangs,$array_export_TypeFields);
|
$objmodel->write_title($array_fields,$array_selected,$outputlangs,$array_export_TypeFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
$i=0;
|
$i=0;
|
||||||
while ($i < $numrows)
|
while ($i < $numrows)
|
||||||
{
|
{
|
||||||
$thirdparty='';
|
$thirdparty='';
|
||||||
$accountelem='';
|
$accountelem='';
|
||||||
$comment='';
|
$comment='';
|
||||||
|
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
|
|
||||||
// Calculate start balance
|
// Calculate start balance
|
||||||
if (! isset($balancebefore[$objp->num_releve]))
|
if (! isset($balancebefore[$objp->num_releve]))
|
||||||
{
|
{
|
||||||
print 'Calculate start balance for receipt '.$objp->num_releve."\n";
|
print 'Calculate start balance for receipt '.$objp->num_releve."\n";
|
||||||
|
|
||||||
$sql2 = "SELECT sum(b.amount) as amount";
|
$sql2 = "SELECT sum(b.amount) as amount";
|
||||||
$sql2.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
$sql2.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||||
$sql2.= " WHERE b.num_releve < '".$db->escape($objp->num_releve)."'";
|
$sql2.= " WHERE b.num_releve < '".$db->escape($objp->num_releve)."'";
|
||||||
$sql2.= " AND b.fk_account = ".$objp->bankid;
|
$sql2.= " AND b.fk_account = ".$objp->bankid;
|
||||||
$resql2=$db->query($sql2);
|
$resql2=$db->query($sql2);
|
||||||
if ($resql2)
|
if ($resql2)
|
||||||
{
|
{
|
||||||
$obj2=$db->fetch_object($resql2);
|
$obj2=$db->fetch_object($resql2);
|
||||||
$balancebefore[$objp->num_releve] = ($obj2->amount?$obj2->amount:0);
|
$balancebefore[$objp->num_releve] = ($obj2->amount?$obj2->amount:0);
|
||||||
$db->free($resql2);
|
$db->free($resql2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -254,44 +254,44 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$totalbefore = $total;
|
$totalbefore = $total;
|
||||||
$total = $total + $objp->amount;
|
$total = $total + $objp->amount;
|
||||||
|
|
||||||
$var=!$var;
|
|
||||||
|
|
||||||
// Date operation
|
|
||||||
$dateop=$db->jdate($objp->do);
|
|
||||||
|
|
||||||
// Date de valeur
|
|
||||||
$datevalue=$db->jdate($objp->dv);
|
|
||||||
|
|
||||||
// Num cheque
|
|
||||||
$numchq=($objp->num_chq?$objp->num_chq:'');
|
|
||||||
|
|
||||||
// Libelle
|
|
||||||
$reg=array();
|
|
||||||
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthese on tente recherche de traduction
|
|
||||||
if ($reg[1] && $langs->transnoentitiesnoconv($reg[1])!=$reg[1]) $description=$langs->transnoentitiesnoconv($reg[1]);
|
|
||||||
else $description=$objp->label;
|
|
||||||
|
|
||||||
/*
|
$var=!$var;
|
||||||
* Ajout les liens (societe, company...)
|
|
||||||
*/
|
// Date operation
|
||||||
$links = $acct->get_url($objp->rowid);
|
$dateop=$db->jdate($objp->do);
|
||||||
foreach($links as $key=>$val)
|
|
||||||
{
|
// Date de valeur
|
||||||
if ($links[$key]['type']=='payment')
|
$datevalue=$db->jdate($objp->dv);
|
||||||
{
|
|
||||||
|
// Num cheque
|
||||||
|
$numchq=($objp->num_chq?$objp->num_chq:'');
|
||||||
|
|
||||||
|
// Libelle
|
||||||
|
$reg=array();
|
||||||
|
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthese on tente recherche de traduction
|
||||||
|
if ($reg[1] && $langs->transnoentitiesnoconv($reg[1])!=$reg[1]) $description=$langs->transnoentitiesnoconv($reg[1]);
|
||||||
|
else $description=$objp->label;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ajout les liens (societe, company...)
|
||||||
|
*/
|
||||||
|
$links = $acct->get_url($objp->rowid);
|
||||||
|
foreach($links as $key=>$val)
|
||||||
|
{
|
||||||
|
if ($links[$key]['type']=='payment')
|
||||||
|
{
|
||||||
$paymentstatic->fetch($links[$key]['url_id']);
|
$paymentstatic->fetch($links[$key]['url_id']);
|
||||||
$tmparray=$paymentstatic->getBillsArray('');
|
$tmparray=$paymentstatic->getBillsArray('');
|
||||||
foreach($tmparray as $key => $val)
|
foreach($tmparray as $key => $val)
|
||||||
{
|
{
|
||||||
$invoicestatic->fetch($val);
|
$invoicestatic->fetch($val);
|
||||||
if ($accountelem) $accountelem.= ', ';
|
if ($accountelem) $accountelem.= ', ';
|
||||||
$accountelem.=$invoicestatic->ref;
|
$accountelem.=$invoicestatic->ref;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($links[$key]['type']=='payment_supplier')
|
elseif ($links[$key]['type']=='payment_supplier')
|
||||||
{
|
{
|
||||||
$paymentsupplierstatic->fetch($links[$key]['url_id']);
|
$paymentsupplierstatic->fetch($links[$key]['url_id']);
|
||||||
$tmparray=$paymentsupplierstatic->getBillsArray('');
|
$tmparray=$paymentsupplierstatic->getBillsArray('');
|
||||||
foreach($tmparray as $key => $val)
|
foreach($tmparray as $key => $val)
|
||||||
@@ -300,94 +300,94 @@ if ($resql)
|
|||||||
if ($accountelem) $accountelem.= ', ';
|
if ($accountelem) $accountelem.= ', ';
|
||||||
$accountelem.=$invoicesupplierstatic->ref;
|
$accountelem.=$invoicesupplierstatic->ref;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($links[$key]['type']=='payment_sc')
|
elseif ($links[$key]['type']=='payment_sc')
|
||||||
{
|
{
|
||||||
$paymentsocialcontributionstatic->fetch($links[$key]['url_id']);
|
$paymentsocialcontributionstatic->fetch($links[$key]['url_id']);
|
||||||
if ($accountelem) $accountelem.= ', ';
|
if ($accountelem) $accountelem.= ', ';
|
||||||
$accountelem.=$langs->transnoentitiesnoconv("SocialContribution").' '.$paymentsocialcontributionstatic->ref;
|
$accountelem.=$langs->transnoentitiesnoconv("SocialContribution").' '.$paymentsocialcontributionstatic->ref;
|
||||||
}
|
}
|
||||||
elseif ($links[$key]['type']=='payment_vat')
|
elseif ($links[$key]['type']=='payment_vat')
|
||||||
{
|
{
|
||||||
$paymentvatstatic->fetch($links[$key]['url_id']);
|
$paymentvatstatic->fetch($links[$key]['url_id']);
|
||||||
if ($accountelem) $accountelem.= ', ';
|
if ($accountelem) $accountelem.= ', ';
|
||||||
$accountelem.=$langs->transnoentitiesnoconv("VATPayments").' '.$paymentvatstatic->ref;
|
$accountelem.=$langs->transnoentitiesnoconv("VATPayments").' '.$paymentvatstatic->ref;
|
||||||
}
|
}
|
||||||
elseif ($links[$key]['type']=='banktransfert')
|
elseif ($links[$key]['type']=='banktransfert')
|
||||||
{
|
{
|
||||||
$comment=$outputlangs->transnoentitiesnoconv("Transfer");
|
$comment=$outputlangs->transnoentitiesnoconv("Transfer");
|
||||||
if ($objp->amount > 0)
|
if ($objp->amount > 0)
|
||||||
{
|
{
|
||||||
if ($comment) $comment.= ' ';
|
if ($comment) $comment.= ' ';
|
||||||
$banklinestatic->fetch($links[$key]['url_id']);
|
$banklinestatic->fetch($links[$key]['url_id']);
|
||||||
$bankstatic->id=$banklinestatic->fk_account;
|
$bankstatic->id=$banklinestatic->fk_account;
|
||||||
$bankstatic->label=$banklinestatic->bank_account_label;
|
$bankstatic->label=$banklinestatic->bank_account_label;
|
||||||
$comment.= ' ('.$langs->transnoentitiesnoconv("from").' ';
|
$comment.= ' ('.$langs->transnoentitiesnoconv("from").' ';
|
||||||
$comment.= $bankstatic->getNomUrl(1,'transactions');
|
$comment.= $bankstatic->getNomUrl(1,'transactions');
|
||||||
$comment.= ' '.$langs->transnoentitiesnoconv("toward").' ';
|
$comment.= ' '.$langs->transnoentitiesnoconv("toward").' ';
|
||||||
$bankstatic->id=$objp->bankid;
|
$bankstatic->id=$objp->bankid;
|
||||||
$bankstatic->label=$objp->bankref;
|
$bankstatic->label=$objp->bankref;
|
||||||
$comment.= $bankstatic->getNomUrl(1,'');
|
$comment.= $bankstatic->getNomUrl(1,'');
|
||||||
$comment.= ')';
|
$comment.= ')';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($comment) $comment.= ' ';
|
if ($comment) $comment.= ' ';
|
||||||
$bankstatic->id=$objp->bankid;
|
$bankstatic->id=$objp->bankid;
|
||||||
$bankstatic->label=$objp->bankref;
|
$bankstatic->label=$objp->bankref;
|
||||||
$comment.= ' ('.$langs->transnoentitiesnoconv("from").' ';
|
$comment.= ' ('.$langs->transnoentitiesnoconv("from").' ';
|
||||||
$comment.= $bankstatic->getNomUrl(1,'');
|
$comment.= $bankstatic->getNomUrl(1,'');
|
||||||
$comment.= ' '.$langs->transnoentitiesnoconv("toward").' ';
|
$comment.= ' '.$langs->transnoentitiesnoconv("toward").' ';
|
||||||
$banklinestatic->fetch($links[$key]['url_id']);
|
$banklinestatic->fetch($links[$key]['url_id']);
|
||||||
$bankstatic->id=$banklinestatic->fk_account;
|
$bankstatic->id=$banklinestatic->fk_account;
|
||||||
$bankstatic->label=$banklinestatic->bank_account_label;
|
$bankstatic->label=$banklinestatic->bank_account_label;
|
||||||
$comment.= $bankstatic->getNomUrl(1,'transactions');
|
$comment.= $bankstatic->getNomUrl(1,'transactions');
|
||||||
$comment.= ')';
|
$comment.= ')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($links[$key]['type']=='company')
|
elseif ($links[$key]['type']=='company')
|
||||||
{
|
{
|
||||||
if ($thirdparty) $thirdparty.= ', ';
|
if ($thirdparty) $thirdparty.= ', ';
|
||||||
$thirdparty.= dol_trunc($links[$key]['label'],24);
|
$thirdparty.= dol_trunc($links[$key]['label'],24);
|
||||||
$newline=0;
|
$newline=0;
|
||||||
}
|
}
|
||||||
elseif ($links[$key]['type']=='member')
|
elseif ($links[$key]['type']=='member')
|
||||||
{
|
{
|
||||||
if ($thirdparty) $accountelem.= ', ';
|
if ($thirdparty) $accountelem.= ', ';
|
||||||
$thirdparty.= $links[$key]['label'];
|
$thirdparty.= $links[$key]['label'];
|
||||||
$newline=0;
|
$newline=0;
|
||||||
}
|
}
|
||||||
/*elseif ($links[$key]['type']=='sc')
|
/*elseif ($links[$key]['type']=='sc')
|
||||||
{
|
{
|
||||||
if ($accountelem) $accountelem.= ', ';
|
if ($accountelem) $accountelem.= ', ';
|
||||||
//$accountelem.= '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$links[$key]['url_id'].'">';
|
//$accountelem.= '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$links[$key]['url_id'].'">';
|
||||||
//$accountelem.= img_object($langs->transnoentitiesnoconv('ShowBill'),'bill').' ';
|
//$accountelem.= img_object($langs->transnoentitiesnoconv('ShowBill'),'bill').' ';
|
||||||
$accountelem.= $langs->transnoentitiesnoconv("SocialContribution");
|
$accountelem.= $langs->transnoentitiesnoconv("SocialContribution");
|
||||||
//$accountelem.= '</a>';
|
//$accountelem.= '</a>';
|
||||||
$newline=0;
|
$newline=0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($accountelem) $accountelem.= ', ';
|
if ($accountelem) $accountelem.= ', ';
|
||||||
//$accountelem.= '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
|
//$accountelem.= '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
|
||||||
$accountelem.= $links[$key]['label'];
|
$accountelem.= $links[$key]['label'];
|
||||||
//$accountelem.= '</a>';
|
//$accountelem.= '</a>';
|
||||||
$newline=0;
|
$newline=0;
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
$debit=$credit='';
|
$debit=$credit='';
|
||||||
if ($objp->amount < 0)
|
if ($objp->amount < 0)
|
||||||
{
|
{
|
||||||
$totald = $totald + abs($objp->amount);
|
$totald = $totald + abs($objp->amount);
|
||||||
$debit=price2num($objp->amount * -1);
|
$debit=price2num($objp->amount * -1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$totalc = $totalc + abs($objp->amount);
|
$totalc = $totalc + abs($objp->amount);
|
||||||
$credit=price2num($objp->amount);
|
$credit=price2num($objp->amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
$rec=new stdClass();
|
$rec=new stdClass();
|
||||||
@@ -399,25 +399,25 @@ if ($resql)
|
|||||||
$rec->description=$description;
|
$rec->description=$description;
|
||||||
$rec->thirdparty=$thirdparty;
|
$rec->thirdparty=$thirdparty;
|
||||||
$rec->accountelem=$accountelem;
|
$rec->accountelem=$accountelem;
|
||||||
$rec->debit=$debit;
|
$rec->debit=$debit;
|
||||||
$rec->credit=$credit;
|
$rec->credit=$credit;
|
||||||
$rec->sold=$sold;
|
$rec->sold=$sold;
|
||||||
$rec->comment=$comment;
|
$rec->comment=$comment;
|
||||||
$rec->soldbefore=price2num($totalbefore);
|
$rec->soldbefore=price2num($totalbefore);
|
||||||
$rec->soldafter=price2num($total);
|
$rec->soldafter=price2num($total);
|
||||||
|
|
||||||
// end of special operation processing
|
// end of special operation processing
|
||||||
$objmodel->write_record($array_selected,$rec,$outputlangs,$array_export_TypeFields);
|
$objmodel->write_record($array_selected,$rec,$outputlangs,$array_export_TypeFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($numrows > 0)
|
if ($numrows > 0)
|
||||||
{
|
{
|
||||||
print "Found ".$numrows." records for receipt ".$num."\n";
|
print "Found ".$numrows." records for receipt ".$num."\n";
|
||||||
|
|
||||||
// Genere en-tete
|
// Genere en-tete
|
||||||
$objmodel->write_footer($outputlangs);
|
$objmodel->write_footer($outputlangs);
|
||||||
|
|
||||||
// Close file
|
// Close file
|
||||||
$objmodel->close_file();
|
$objmodel->close_file();
|
||||||
|
|
||||||
print 'File '.$filename.' was generated into dir '.$dirname.'.'."\n";
|
print 'File '.$filename.' was generated into dir '.$dirname.'.'."\n";
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ require_once(PHPEXCEL_PATH."/PHPExcel.php");
|
|||||||
//require_once(PHPEXCEL_PATH."/PHPExcel/Writer/Excel2007.php");
|
//require_once(PHPEXCEL_PATH."/PHPExcel/Writer/Excel2007.php");
|
||||||
require_once(PHPEXCEL_PATH."/PHPExcel/Writer/Excel5.php");
|
require_once(PHPEXCEL_PATH."/PHPExcel/Writer/Excel5.php");
|
||||||
|
|
||||||
// Global variables
|
// Global variables
|
||||||
$version=DOL_VERSION;
|
$version=DOL_VERSION;
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
|
||||||
@@ -58,8 +58,8 @@ $error=0;
|
|||||||
* Main
|
* Main
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
|
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
|
||||||
|
|
||||||
$fname = DOL_DATA_ROOT.'/export-contacts.xls';
|
$fname = DOL_DATA_ROOT.'/export-contacts.xls';
|
||||||
|
|
||||||
|
|||||||
@@ -55,16 +55,16 @@ $langs->load('main');
|
|||||||
$langs->load('contracts');
|
$langs->load('contracts');
|
||||||
|
|
||||||
|
|
||||||
// Global variables
|
// Global variables
|
||||||
$version=DOL_VERSION;
|
$version=DOL_VERSION;
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Main
|
* Main
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
|
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
|
||||||
|
|
||||||
$now=dol_now('tzserver');
|
$now=dol_now('tzserver');
|
||||||
@@ -72,7 +72,7 @@ $duration_value=isset($argv[2])?$argv[2]:'none';
|
|||||||
|
|
||||||
print $script_file." launched with mode ".$mode.(is_numeric($duration_value)?" delay=".$duration_value:"")."\n";
|
print $script_file." launched with mode ".$mode.(is_numeric($duration_value)?" delay=".$duration_value:"")."\n";
|
||||||
|
|
||||||
if ($mode != 'confirm') $conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
if ($mode != 'confirm') $conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
||||||
|
|
||||||
$sql = "SELECT DISTINCT s.nom as name, c.ref, cd.date_fin_validite, cd.total_ttc, p.label label, s.email, s.default_lang";
|
$sql = "SELECT DISTINCT s.nom as name, c.ref, cd.date_fin_validite, cd.total_ttc, p.label label, s.email, s.default_lang";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe AS s";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe AS s";
|
||||||
@@ -110,10 +110,10 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldcustomer,$duration_value);
|
envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldcustomer,$duration_value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($oldemail != 'none') print "- No email sent for ".$oldcustomer.", total: ".$total."\n";
|
if ($oldemail != 'none') print "- No email sent for ".$oldcustomer.", total: ".$total."\n";
|
||||||
}
|
}
|
||||||
$oldemail = $obj->email;
|
$oldemail = $obj->email;
|
||||||
$oldlang = $obj->lang;
|
$oldlang = $obj->lang;
|
||||||
$oldcustomer=$obj->name;
|
$oldcustomer=$obj->name;
|
||||||
@@ -133,9 +133,9 @@ if ($resql)
|
|||||||
print "Service to expire ".$obj->ref.", label ".$obj->label.", due date ".dol_print_date($db->jdate($obj->date_fin_validite),'day')." (linked to company ".$obj->nom.", sale representative ".dolGetFirstLastname($obj->firstname, $obj->lastname).", email ".$obj->email."): ";
|
print "Service to expire ".$obj->ref.", label ".$obj->label.", due date ".dol_print_date($db->jdate($obj->date_fin_validite),'day')." (linked to company ".$obj->nom.", sale representative ".dolGetFirstLastname($obj->firstname, $obj->lastname).", email ".$obj->email."): ";
|
||||||
if (dol_strlen($obj->email)) print "qualified.";
|
if (dol_strlen($obj->email)) print "qualified.";
|
||||||
else print "disqualified (no email).";
|
else print "disqualified (no email).";
|
||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
$total += $obj->total_ttc;
|
$total += $obj->total_ttc;
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@@ -147,9 +147,9 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldcustomer,$duration_value);
|
envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldcustomer,$duration_value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($oldemail != 'none') print "- No email sent for ".$oldcustomer.", total: ".$total."\n";
|
if ($oldemail != 'none') print "- No email sent for ".$oldcustomer.", total: ".$total."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -181,7 +181,7 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldcustomer,$dura
|
|||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
if (getenv('DOL_FORCE_EMAIL_TO')) $oldemail=getenv('DOL_FORCE_EMAIL_TO');
|
if (getenv('DOL_FORCE_EMAIL_TO')) $oldemail=getenv('DOL_FORCE_EMAIL_TO');
|
||||||
|
|
||||||
$newlangs=new Translate('',$conf);
|
$newlangs=new Translate('',$conf);
|
||||||
$newlangs->setDefaultLang(empty($userlang)?(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT):$userlang);
|
$newlangs->setDefaultLang(empty($userlang)?(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT):$userlang);
|
||||||
|
|||||||
@@ -55,16 +55,16 @@ $langs->load('main');
|
|||||||
$langs->load('contracts');
|
$langs->load('contracts');
|
||||||
|
|
||||||
|
|
||||||
// Global variables
|
// Global variables
|
||||||
$version=DOL_VERSION;
|
$version=DOL_VERSION;
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Main
|
* Main
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
|
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
|
||||||
|
|
||||||
$now=dol_now('tzserver');
|
$now=dol_now('tzserver');
|
||||||
@@ -72,7 +72,7 @@ $duration_value=isset($argv[2])?$argv[2]:'none';
|
|||||||
|
|
||||||
print $script_file." launched with mode ".$mode.(is_numeric($duration_value)?" delay=".$duration_value:"")."\n";
|
print $script_file." launched with mode ".$mode.(is_numeric($duration_value)?" delay=".$duration_value:"")."\n";
|
||||||
|
|
||||||
if ($mode != 'confirm') $conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
if ($mode != 'confirm') $conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
||||||
|
|
||||||
$sql = "SELECT DISTINCT s.nom, c.ref, cd.date_fin_validite, cd.total_ttc, p.label label, c.fk_soc,u.rowid AS uid, u.lastname, u.firstname, u.email, u.lang";
|
$sql = "SELECT DISTINCT s.nom, c.ref, cd.date_fin_validite, cd.total_ttc, p.label label, c.fk_soc,u.rowid AS uid, u.lastname, u.firstname, u.email, u.lang";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe AS s, ".MAIN_DB_PREFIX."contrat AS c, ".MAIN_DB_PREFIX."contratdet AS cd";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe AS s, ".MAIN_DB_PREFIX."contrat AS c, ".MAIN_DB_PREFIX."contratdet AS cd";
|
||||||
@@ -147,10 +147,10 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldsalerepresentative,$duration_value);
|
envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldsalerepresentative,$duration_value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($oldemail != 'none') print "- No email sent for ".$oldsalerepresentative.", total: ".$total."\n";
|
if ($oldemail != 'none') print "- No email sent for ".$oldsalerepresentative.", total: ".$total."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -244,11 +244,11 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldsalerepresenta
|
|||||||
if ($mode == 'confirm')
|
if ($mode == 'confirm')
|
||||||
{
|
{
|
||||||
$result=$mail->sendfile();
|
$result=$mail->sendfile();
|
||||||
if (! $result)
|
if (! $result)
|
||||||
{
|
{
|
||||||
print "Error sending email ".$mail->error."\n";
|
print "Error sending email ".$mail->error."\n";
|
||||||
dol_syslog("Error sending email ".$mail->error."\n");
|
dol_syslog("Error sending email ".$mail->error."\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -59,16 +59,16 @@ require_once (DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php");
|
|||||||
require_once (DOL_DOCUMENT_ROOT.'/user/class/user.class.php');
|
require_once (DOL_DOCUMENT_ROOT.'/user/class/user.class.php');
|
||||||
require_once (DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php");
|
require_once (DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php");
|
||||||
|
|
||||||
// Global variables
|
// Global variables
|
||||||
$version=DOL_VERSION;
|
$version=DOL_VERSION;
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Main
|
|
||||||
*/
|
|
||||||
|
|
||||||
@set_time_limit(0);
|
|
||||||
|
/*
|
||||||
|
* Main
|
||||||
|
*/
|
||||||
|
|
||||||
|
@set_time_limit(0);
|
||||||
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
|
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
|
||||||
|
|
||||||
// Check security key
|
// Check security key
|
||||||
|
|||||||
@@ -109,8 +109,8 @@ if ($resql)
|
|||||||
if ($resql2)
|
if ($resql2)
|
||||||
{
|
{
|
||||||
$num2 = $db->num_rows($resql2);
|
$num2 = $db->num_rows($resql2);
|
||||||
dol_syslog("Nb of targets = ".$num2, LOG_DEBUG);
|
dol_syslog("Nb of targets = ".$num2, LOG_DEBUG);
|
||||||
print "Nb of targets = ".$num2."\n";
|
print "Nb of targets = ".$num2."\n";
|
||||||
|
|
||||||
if ($num2)
|
if ($num2)
|
||||||
{
|
{
|
||||||
@@ -122,7 +122,7 @@ if ($resql)
|
|||||||
if (! $resqlstartdate)
|
if (! $resqlstartdate)
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look on each email and sent message
|
// Look on each email and sent message
|
||||||
@@ -210,7 +210,7 @@ if ($resql)
|
|||||||
if (! $resqlok)
|
if (! $resqlok)
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -224,7 +224,7 @@ if ($resql)
|
|||||||
if (! $resqlx)
|
if (! $resqlx)
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update status communication of contact prospect
|
//Update status communication of contact prospect
|
||||||
@@ -260,11 +260,11 @@ if ($resql)
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg="Emailing id ".$id." has no recipient to target";
|
$mesg="Emailing id ".$id." has no recipient to target";
|
||||||
print $mesg."\n";
|
print $mesg."\n";
|
||||||
dol_syslog($mesg,LOG_ERR);
|
dol_syslog($mesg,LOG_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop finished, set global statut of mail
|
// Loop finished, set global statut of mail
|
||||||
@@ -291,9 +291,9 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg="No validated emailing id to send found.";
|
$mesg="No validated emailing id to send found.";
|
||||||
print $mesg."\n";
|
print $mesg."\n";
|
||||||
dol_syslog($mesg,LOG_ERR);
|
dol_syslog($mesg,LOG_ERR);
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,18 +54,18 @@ require_once (DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php");
|
|||||||
|
|
||||||
$langs->load('main');
|
$langs->load('main');
|
||||||
|
|
||||||
// Global variables
|
// Global variables
|
||||||
$version=DOL_VERSION;
|
$version=DOL_VERSION;
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Main
|
* Main
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
|
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
|
||||||
|
|
||||||
$now=dol_now('tzserver');
|
$now=dol_now('tzserver');
|
||||||
$duration_value=isset($argv[3])?$argv[3]:'none';
|
$duration_value=isset($argv[3])?$argv[3]:'none';
|
||||||
@@ -73,7 +73,7 @@ $duration_value=isset($argv[3])?$argv[3]:'none';
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
print $script_file." launched with mode ".$mode.(is_numeric($duration_value)?" delay=".$duration_value:"")."\n";
|
print $script_file." launched with mode ".$mode.(is_numeric($duration_value)?" delay=".$duration_value:"")."\n";
|
||||||
|
|
||||||
if ($mode != 'confirm') $conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
if ($mode != 'confirm') $conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
||||||
|
|
||||||
$sql = "SELECT f.facnumber, f.total_ttc, f.date_lim_reglement as due_date,";
|
$sql = "SELECT f.facnumber, f.total_ttc, f.date_lim_reglement as due_date,";
|
||||||
$sql.= " s.rowid as sid, s.nom as name, s.email, s.default_lang";
|
$sql.= " s.rowid as sid, s.nom as name, s.email, s.default_lang";
|
||||||
@@ -113,8 +113,8 @@ if ($resql)
|
|||||||
// Check if this record is a break after previous one
|
// Check if this record is a break after previous one
|
||||||
$startbreak=false;
|
$startbreak=false;
|
||||||
if ($newemail <> $oldemail || $oldemail == 'none') $startbreak=true;
|
if ($newemail <> $oldemail || $oldemail == 'none') $startbreak=true;
|
||||||
if ($obj->sid && $obj->sid <> $oldsid) $startbreak=true;
|
if ($obj->sid && $obj->sid <> $oldsid) $startbreak=true;
|
||||||
if ($obj->cid && $obj->cid <> $oldcid) $startbreak=true;
|
if ($obj->cid && $obj->cid <> $oldcid) $startbreak=true;
|
||||||
|
|
||||||
if ($startbreak)
|
if ($startbreak)
|
||||||
{
|
{
|
||||||
@@ -124,14 +124,14 @@ if ($resql)
|
|||||||
envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldtarget);
|
envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldtarget);
|
||||||
$trackthirdpartiessent[$oldsid.'|'.$oldemail]='contact id '.$oldcid;
|
$trackthirdpartiessent[$oldsid.'|'.$oldemail]='contact id '.$oldcid;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($oldemail != 'none')
|
if ($oldemail != 'none')
|
||||||
{
|
{
|
||||||
if (empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) print "- No email sent for '".$oldtarget."', total: ".$total."\n";
|
if (empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) print "- No email sent for '".$oldtarget."', total: ".$total."\n";
|
||||||
else print "- No email sent for '".$oldtarget."', total: ".$total." (already sent to ".$trackthirdpartiessent[$oldsid.'|'.$oldemail].")\n";
|
else print "- No email sent for '".$oldtarget."', total: ".$total." (already sent to ".$trackthirdpartiessent[$oldsid.'|'.$oldemail].")\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$oldemail = $newemail;
|
$oldemail = $newemail;
|
||||||
$oldsid = $obj->sid;
|
$oldsid = $obj->sid;
|
||||||
$oldcid = $obj->cid;
|
$oldcid = $obj->cid;
|
||||||
@@ -150,12 +150,12 @@ if ($resql)
|
|||||||
dol_syslog("email_unpaid_invoices_to_customers.php: ".$newemail." ".$message);
|
dol_syslog("email_unpaid_invoices_to_customers.php: ".$newemail." ".$message);
|
||||||
$foundtoprocess++;
|
$foundtoprocess++;
|
||||||
}
|
}
|
||||||
print "Unpaid invoice ".$obj->facnumber.", price ".price2num($obj->total_ttc).", due date ".dol_print_date($db->jdate($obj->due_date),'day')." customer id ".$obj->sid." ".$obj->name.", ".($obj->cid?"contact id ".$obj->cid." ".$obj->clastname." ".$obj->cfirstname.",":"")." email ".$newemail.": ";
|
print "Unpaid invoice ".$obj->facnumber.", price ".price2num($obj->total_ttc).", due date ".dol_print_date($db->jdate($obj->due_date),'day')." customer id ".$obj->sid." ".$obj->name.", ".($obj->cid?"contact id ".$obj->cid." ".$obj->clastname." ".$obj->cfirstname.",":"")." email ".$newemail.": ";
|
||||||
if (dol_strlen($newemail)) print "qualified.";
|
if (dol_strlen($newemail)) print "qualified.";
|
||||||
else print "disqualified (no email).";
|
else print "disqualified (no email).";
|
||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
$total += $obj->total_ttc;
|
$total += $obj->total_ttc;
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@@ -168,13 +168,13 @@ if ($resql)
|
|||||||
envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldtarget);
|
envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldtarget);
|
||||||
$trackthirdpartiessent[$oldsid.'|'.$oldemail]='contact id '.$oldcid;
|
$trackthirdpartiessent[$oldsid.'|'.$oldemail]='contact id '.$oldcid;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($oldemail != 'none')
|
if ($oldemail != 'none')
|
||||||
{
|
{
|
||||||
if (empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) print "- No email sent for '".$oldtarget."', total: ".$total."\n";
|
if (empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) print "- No email sent for '".$oldtarget."', total: ".$total."\n";
|
||||||
else print "- No email sent for '".$oldtarget."', total: ".$total." (already sent to ".$trackthirdpartiessent[$oldsid.'|'.$oldemail].")\n";
|
else print "- No email sent for '".$oldtarget."', total: ".$total." (already sent to ".$trackthirdpartiessent[$oldsid.'|'.$oldemail].")\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,7 +205,7 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldtarget)
|
|||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
if (getenv('DOL_FORCE_EMAIL_TO')) $oldemail=getenv('DOL_FORCE_EMAIL_TO');
|
if (getenv('DOL_FORCE_EMAIL_TO')) $oldemail=getenv('DOL_FORCE_EMAIL_TO');
|
||||||
|
|
||||||
$newlangs=new Translate('',$conf);
|
$newlangs=new Translate('',$conf);
|
||||||
$newlangs->setDefaultLang(empty($userlang)?(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT):$userlang);
|
$newlangs->setDefaultLang(empty($userlang)?(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT):$userlang);
|
||||||
@@ -264,11 +264,11 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldtarget)
|
|||||||
if ($mode == 'confirm')
|
if ($mode == 'confirm')
|
||||||
{
|
{
|
||||||
$result=$mail->sendfile();
|
$result=$mail->sendfile();
|
||||||
if (! $result)
|
if (! $result)
|
||||||
{
|
{
|
||||||
print "Error sending email ".$mail->error."\n";
|
print "Error sending email ".$mail->error."\n";
|
||||||
dol_syslog("Error sending email ".$mail->error."\n");
|
dol_syslog("Error sending email ".$mail->error."\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ $duration_value=isset($argv[2])?$argv[2]:'none';
|
|||||||
|
|
||||||
print $script_file." launched with mode ".$mode.(is_numeric($duration_value)?" delay=".$duration_value:"")."\n";
|
print $script_file." launched with mode ".$mode.(is_numeric($duration_value)?" delay=".$duration_value:"")."\n";
|
||||||
|
|
||||||
if ($mode != 'confirm') $conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
if ($mode != 'confirm') $conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
||||||
|
|
||||||
$sql = "SELECT f.facnumber, f.total_ttc, f.date_lim_reglement as due_date, s.nom as name, u.rowid as uid, u.lastname, u.firstname, u.email, u.lang";
|
$sql = "SELECT f.facnumber, f.total_ttc, f.date_lim_reglement as due_date, s.nom as name, u.rowid as uid, u.lastname, u.firstname, u.email, u.lang";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||||
@@ -239,11 +239,11 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldsalerepresenta
|
|||||||
if ($mode == 'confirm')
|
if ($mode == 'confirm')
|
||||||
{
|
{
|
||||||
$result=$mail->sendfile();
|
$result=$mail->sendfile();
|
||||||
if (! $result)
|
if (! $result)
|
||||||
{
|
{
|
||||||
print "Error sending email ".$mail->error."\n";
|
print "Error sending email ".$mail->error."\n";
|
||||||
dol_syslog("Error sending email ".$mail->error."\n");
|
dol_syslog("Error sending email ".$mail->error."\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -122,10 +122,10 @@ foreach ($argv as $key => $value)
|
|||||||
|
|
||||||
$paymentdateafter=dol_stringtotime($argv[$key+1]);
|
$paymentdateafter=dol_stringtotime($argv[$key+1]);
|
||||||
$paymentdatebefore=dol_stringtotime($argv[$key+2]);
|
$paymentdatebefore=dol_stringtotime($argv[$key+2]);
|
||||||
if (empty($paymentdateafter) || empty($paymentdatebefore))
|
if (empty($paymentdateafter) || empty($paymentdatebefore))
|
||||||
{
|
{
|
||||||
print 'Error: Bad date format'."\n";
|
print 'Error: Bad date format'."\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
print 'Rebuild PDF for invoices with at least one payment between '.dol_print_date($paymentdateafter,'day')." and ".dol_print_date($paymentdatebefore,'day').".\n";
|
print 'Rebuild PDF for invoices with at least one payment between '.dol_print_date($paymentdateafter,'day')." and ".dol_print_date($paymentdatebefore,'day').".\n";
|
||||||
}
|
}
|
||||||
@@ -196,16 +196,16 @@ if (empty($option) && count($filter) <= 0)
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
// Check if there is no uncompatible choice
|
// Check if there is no uncompatible choice
|
||||||
if (in_array('payments',$filter) && in_array('nopayment',$filter))
|
if (in_array('payments',$filter) && in_array('nopayment',$filter))
|
||||||
{
|
{
|
||||||
usage();
|
usage();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if (in_array('bank',$filter) && in_array('nopayment',$filter))
|
if (in_array('bank',$filter) && in_array('nopayment',$filter))
|
||||||
{
|
{
|
||||||
usage();
|
usage();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Define SQL and SQL request to select invoices
|
// Define SQL and SQL request to select invoices
|
||||||
|
|||||||
@@ -41,13 +41,13 @@ require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php");
|
|||||||
require_once(DOL_DOCUMENT_ROOT."/adherents/class/cotisation.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/adherents/class/cotisation.class.php");
|
||||||
|
|
||||||
$langs->load("main");
|
$langs->load("main");
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
|
|
||||||
|
|
||||||
// Global variables
|
// Global variables
|
||||||
$version=DOL_VERSION;
|
$version=DOL_VERSION;
|
||||||
$error=0;
|
$error=0;
|
||||||
$forcecommit=0;
|
$forcecommit=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -125,16 +125,16 @@ print "Mapped LDAP fields=".join(',',$required_fields)."\n";
|
|||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (empty($conf->global->LDAP_MEMBER_DN))
|
if (empty($conf->global->LDAP_MEMBER_DN))
|
||||||
{
|
{
|
||||||
print $langs->trans("Error").': '.$langs->trans("LDAP setup for members not defined inside Dolibarr")."\n";
|
print $langs->trans("Error").': '.$langs->trans("LDAP setup for members not defined inside Dolibarr")."\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if ($typeid <= 0)
|
if ($typeid <= 0)
|
||||||
{
|
{
|
||||||
print $langs->trans("Error").': Parameter id_member_type is not a valid ref of an existing member type'."\n";
|
print $langs->trans("Error").': Parameter id_member_type is not a valid ref of an existing member type'."\n";
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print "Press a key to confirm...";
|
print "Press a key to confirm...";
|
||||||
|
|||||||
@@ -35,28 +35,28 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once($path."../../htdocs/master.inc.php");
|
require_once($path."../../htdocs/master.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/ldap.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/ldap.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php");
|
||||||
|
|
||||||
$langs->load("main");
|
$langs->load("main");
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
|
|
||||||
|
|
||||||
// Global variables
|
// Global variables
|
||||||
$version=DOL_VERSION;
|
$version=DOL_VERSION;
|
||||||
$error=0;
|
$error=0;
|
||||||
$forcecommit=0;
|
$forcecommit=0;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Main
|
* Main
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
|
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
|
||||||
|
|
||||||
|
|
||||||
// List of fields to get from LDAP
|
// List of fields to get from LDAP
|
||||||
|
|||||||
@@ -34,14 +34,14 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once($path."../../htdocs/master.inc.php");
|
require_once($path."../../htdocs/master.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/ldap.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/ldap.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php");
|
||||||
|
|
||||||
$langs->load("main");
|
$langs->load("main");
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
|
|
||||||
|
|
||||||
// Global variables
|
// Global variables
|
||||||
$version=DOL_VERSION;
|
$version=DOL_VERSION;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ global $conf,$user,$langs,$db;
|
|||||||
require_once 'PHPUnit/Autoload.php';
|
require_once 'PHPUnit/Autoload.php';
|
||||||
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
|
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
|
||||||
require_once dirname(__FILE__).'/../../htdocs/adherents/class/adherent.class.php';
|
require_once dirname(__FILE__).'/../../htdocs/adherents/class/adherent.class.php';
|
||||||
require_once dirname(__FILE__).'/../../htdocs/adherents/class/adherent_type.class.php';
|
require_once dirname(__FILE__).'/../../htdocs/adherents/class/adherent_type.class.php';
|
||||||
|
|
||||||
if (empty($user->id))
|
if (empty($user->id))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -191,11 +191,11 @@ class CategorieTest extends PHPUnit_Framework_TestCase
|
|||||||
$localobject2->tva_npr=1;
|
$localobject2->tva_npr=1;
|
||||||
$result=$localobject2->create($user);
|
$result=$localobject2->create($user);
|
||||||
$cat = new Categorie($this->savdb);
|
$cat = new Categorie($this->savdb);
|
||||||
$cat->id = $catid;
|
$cat->id = $catid;
|
||||||
$result=$cat->add_type($localobject2,"product");
|
$result=$cat->add_type($localobject2,"product");
|
||||||
|
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertGreaterThan(0, $result);
|
$this->assertGreaterThan(0, $result);
|
||||||
|
|
||||||
// Get list of categories for product
|
// Get list of categories for product
|
||||||
$localcateg=new Categorie($this->savdb);
|
$localcateg=new Categorie($this->savdb);
|
||||||
|
|||||||
@@ -160,10 +160,10 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
|
|||||||
$result3=$localobject2->validate($user, $result); // create invoice by forcing ref
|
$result3=$localobject2->validate($user, $result); // create invoice by forcing ref
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals('1916-0002', $result); // counter must not be reseted so be 2
|
$this->assertEquals('1916-0002', $result); // counter must not be reseted so be 2
|
||||||
$result=$localobject2->is_erasable();
|
$result=$localobject2->is_erasable();
|
||||||
print __METHOD__." is_erasable=".$result."\n";
|
print __METHOD__." is_erasable=".$result."\n";
|
||||||
$this->assertEquals(1, $result); // Can be deleted
|
$this->assertEquals(1, $result); // Can be deleted
|
||||||
$result=$localobject->is_erasable();
|
$result=$localobject->is_erasable();
|
||||||
print __METHOD__." is_erasable=".$result."\n";
|
print __METHOD__." is_erasable=".$result."\n";
|
||||||
$this->assertEquals(0, $result); // Case 1 can not be deleted (case 2 is more recent)
|
$this->assertEquals(0, $result); // Case 1 can not be deleted (case 2 is more recent)
|
||||||
|
|
||||||
@@ -191,9 +191,9 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
|
|||||||
$result3=$localobject->validate($user, $result);
|
$result3=$localobject->validate($user, $result);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals('192001-0001', $result); // counter must start to 1
|
$this->assertEquals('192001-0001', $result); // counter must start to 1
|
||||||
$result=$localobject->is_erasable();
|
$result=$localobject->is_erasable();
|
||||||
print __METHOD__." is_erasable=".$result."\n";
|
print __METHOD__." is_erasable=".$result."\n";
|
||||||
$this->assertEquals(1, $result); // Can be deleted
|
$this->assertEquals(1, $result); // Can be deleted
|
||||||
|
|
||||||
$localobject2=new Facture($this->savdb);
|
$localobject2=new Facture($this->savdb);
|
||||||
$localobject2->initAsSpecimen();
|
$localobject2->initAsSpecimen();
|
||||||
@@ -204,12 +204,12 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
|
|||||||
$result3=$localobject2->validate($user, $result);
|
$result3=$localobject2->validate($user, $result);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals('192101-0001', $result); // counter must be reseted to 1
|
$this->assertEquals('192101-0001', $result); // counter must be reseted to 1
|
||||||
$result=$localobject2->is_erasable();
|
$result=$localobject2->is_erasable();
|
||||||
print __METHOD__." is_erasable=".$result."\n";
|
print __METHOD__." is_erasable=".$result."\n";
|
||||||
$this->assertEquals(1, $result); // Can be deleted
|
$this->assertEquals(1, $result); // Can be deleted
|
||||||
$result=$localobject->is_erasable();
|
$result=$localobject->is_erasable();
|
||||||
print __METHOD__." is_erasable=".$result."\n";
|
print __METHOD__." is_erasable=".$result."\n";
|
||||||
$this->assertEquals(1, $result); // Case 1 can be deleted (because there was a reset for case 2)
|
$this->assertEquals(1, $result); // Case 1 can be deleted (because there was a reset for case 2)
|
||||||
|
|
||||||
|
|
||||||
// Now we try with a different fiscal month (forced by mask)
|
// Now we try with a different fiscal month (forced by mask)
|
||||||
@@ -228,9 +228,9 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
|
|||||||
$result3=$localobject->validate($user, $result);
|
$result3=$localobject->validate($user, $result);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals('193001-0001', $result); // counter must start to 1
|
$this->assertEquals('193001-0001', $result); // counter must start to 1
|
||||||
$result=$numbering->getNextValue($mysoc, $localobject, 'last');
|
$result=$numbering->getNextValue($mysoc, $localobject, 'last');
|
||||||
print __METHOD__." result for last=".$result."\n";
|
print __METHOD__." result for last=".$result."\n";
|
||||||
$this->assertEquals('193001-0001', $result); // last ref into reset range should be same than last created
|
$this->assertEquals('193001-0001', $result); // last ref into reset range should be same than last created
|
||||||
|
|
||||||
$localobject=new Facture($this->savdb);
|
$localobject=new Facture($this->savdb);
|
||||||
$localobject->initAsSpecimen();
|
$localobject->initAsSpecimen();
|
||||||
|
|||||||
@@ -269,53 +269,53 @@ class UserTest extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit an object to test updates
|
* Edit an object to test updates
|
||||||
*
|
*
|
||||||
* @param mixed &$localobject Object Facture
|
* @param mixed &$localobject Object Facture
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function changeProperties(&$localobject)
|
public function changeProperties(&$localobject)
|
||||||
{
|
{
|
||||||
$localobject->note='New note after update';
|
$localobject->note='New note after update';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare all public properties values of 2 objects
|
* Compare all public properties values of 2 objects
|
||||||
*
|
*
|
||||||
* @param Object $oA Object operand 1
|
* @param Object $oA Object operand 1
|
||||||
* @param Object $oB Object operand 2
|
* @param Object $oB Object operand 2
|
||||||
* @param boolean $ignoretype False will not report diff if type of value differs
|
* @param boolean $ignoretype False will not report diff if type of value differs
|
||||||
* @param array $fieldstoignorearray Array of fields to ignore in diff
|
* @param array $fieldstoignorearray Array of fields to ignore in diff
|
||||||
* @return array Array with differences
|
* @return array Array with differences
|
||||||
*/
|
*/
|
||||||
public function objCompare($oA,$oB,$ignoretype=true,$fieldstoignorearray=array('id'))
|
public function objCompare($oA,$oB,$ignoretype=true,$fieldstoignorearray=array('id'))
|
||||||
{
|
{
|
||||||
$retAr=array();
|
$retAr=array();
|
||||||
|
|
||||||
if (get_class($oA) !== get_class($oB))
|
if (get_class($oA) !== get_class($oB))
|
||||||
{
|
{
|
||||||
$retAr[]="Supplied objects are not of same class.";
|
$retAr[]="Supplied objects are not of same class.";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$oVarsA=get_object_vars($oA);
|
$oVarsA=get_object_vars($oA);
|
||||||
$oVarsB=get_object_vars($oB);
|
$oVarsB=get_object_vars($oB);
|
||||||
$aKeys=array_keys($oVarsA);
|
$aKeys=array_keys($oVarsA);
|
||||||
foreach($aKeys as $sKey)
|
foreach($aKeys as $sKey)
|
||||||
{
|
{
|
||||||
if (in_array($sKey,$fieldstoignorearray)) continue;
|
if (in_array($sKey,$fieldstoignorearray)) continue;
|
||||||
if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey])
|
if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey])
|
||||||
{
|
{
|
||||||
$retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
|
$retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
|
||||||
}
|
}
|
||||||
if ($ignoretype && $oVarsA[$sKey] != $oVarsB[$sKey])
|
if ($ignoretype && $oVarsA[$sKey] != $oVarsB[$sKey])
|
||||||
{
|
{
|
||||||
$retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
|
$retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $retAr;
|
return $retAr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user