develop

Conflicts:
	ChangeLog

Change-Id: I7abbbefde190dbe86f8cb7ae43451da9eca1c9aa
This commit is contained in:
fhenry 2013-05-17 09:49:06 +02:00
commit faa2399b80
90 changed files with 3642 additions and 2778 deletions

View File

@ -7,8 +7,13 @@ For users:
- New: [ task #877 ] Reorganize menus
- New: [ task #858 ] Holiday module: note on manual holiday assignation
- New: [ task #892 ] Add option in thridparty customer/supplier admin to hide non active in select_company method
- New: [ task #531 ] Add a duration on tasks
- New: [ task #531 ] Add a workload on tasks
- New: Add graph of bank account input/output into input-output report page.
- New: Add script export-bank-receipts.
- New: Add option "filter=bank" onto script rebuild_merge_pdf.php to merge
PDF that has one payment on a specific bank account.
For developers:
- New: DolGraph can build graph with three lines.
***** ChangeLog for 3.4 compared to 3.3.2 *****
For users:

View File

@ -78,30 +78,29 @@ IV - CE QUE DOLIBARR PEUT FAIRE
-------------------------------
Modules principaux:
- Annuaires des prospects et/ou client et/ou fournisseurs
- Gestion de catalogue de produits et services
- Gestion de stock
- Gestion des comptes bancaires
- Annuaires des prospects et/ou client et/ou fournisseurs
- Annuaires des contacts
- Gestion des actions/taches avec un agenda intégré (ou lien avec webcalendar)
- Agenda partagé
- Gestion des commandes
- Gestion des propositions commerciales
- Gestion de contrats de services
- Gestion des devis, propositions commerciales
- Gestion des factures clients et fournisseurs
- Gestion de contrats de services
- Gestion des paiements
- Gestion des virements bancaires
- Gestion des expéditions
- GED (Gestion Electronique de Documents)
- EMailings de masse
- Réalisation de sondages
- Point de vente/Caisse enregistreuse
Autres modules:
- Gestion de la TVA NPR (non perçue récupérable - pour les utilisateurs français des DOM-TOM)
- Gestion des adhérents d'association
- Gestion des dons
- Gestion de marque-pages
- Agenda
- Point de vente/Caisse enregistreuse
- Fonctions d'EMailing de masses vers les clients, prospect ou utilisateurs Dolibarr
- Gestion des promesses de dons
- Gestion de la TVA NPR (non perçue récupérable - pour les utilisateurs français des DOM-TOM)
- Rapports
- Fonctions d'exports
- Imports/Exports des données
- Connectivité LDAP
- Export PDF de tous les éléments (factures, propositions commerciales, commandes, bons expéditions, etc...)
- De nombreuses autres fonctionnalités issues de modules officiels ou non (AWStats, Bittorrent, Gravatar, Google, Webcalendar...)
@ -122,7 +121,7 @@ V - CE QUE DOLIBARR NE PEUT PAS FAIRE (TACHES A FAIRE)
Voici un liste de fonctionnalites pas encore gérées par Dolibarr:
- Pas de compta analytique (uniquement gestion de trésorerie).
- Dolibarr ne gère qu'une seule monnaie à la fois (mono-devise).
- Dolibarr ne gère en standard qu'une société/institution/association (mono-société). Pour en gérer plusieurs (comme vos filiales), il faut, soit faire plusieurs installations de Dolibarr, soit installer le module MultiCompany qui permet de gérer n société/institutions/associations dans une seule instance par une isolation logique des données.
- Dolibarr ne gère en standard qu'une société/institution/association mère (mono-société). Pour en gérer plusieurs (comme vos filiales), il faut, soit faire plusieurs installations de Dolibarr, soit installer le module MultiCompany qui permet de gérer n société/institutions/associations dans une seule instance par une isolation logique des données.
- Ne gère pas la double tva (Fédérale / provinciale) du canada.
- Dolibarr ne contient pas de module de Gestion de la paie.
- Les taches du module de gestion de projets n'ont pas de dépendance entre elle.

View File

@ -75,33 +75,35 @@ See ChangeLog file found into package.
### Main modules/features:
- Products and services catalog
- Customers, Prospects or Suppliers directory
- Address book
- Products and services catalog
- Stock management
- Bank accounts management
- Orders management with PDF export
- Commercial proposals management with PDF export
- Commercial proposals management
- Contracts management
- Invoices management with PDF export
- Invoices management
- Payments management
- Standing orders management
- Shipping management
- ECM (Electronic Content Management)
- EMailings
- Agenda with ical,vcal export for third tools integration
- Management of foundation members
- Donation management
- ECM (Electronic Content Management)
- Foundations members management
- Employee's holidays management
- Mass emailing
- Realize surveys
- Point of Sale
### Other modules:
- Bookmarks management
- Can reports Dolibarr events inside Webcalendar or Phenix
- Data export tools
- Donations management
- Reporting
- Data export/import tools
- LDAP connectivity
- Third parties or products categories
- ClickToDial phone numbers
- RSS
- RSS integration
### Miscellaneous:
@ -123,11 +125,11 @@ See ChangeLog file found into package.
This is features that Dolibarr does not support completely yet:
- No accountancy (only bank management).
- No double party accountancy (only bank management).
- Dolibarr manage one currency at once (mono-currency).
- Dolibarr manage one company/foundation (mono-company). If you want to manage several companies or foundations, you must install several time the software (on same server or not). Another solution is to extend Dolibarr with the addon Module MultiCompany that allows to manage several companies in one Dolibarr instance (one database but with a logical isolation of datas).
- Dolibarr manage one master company/foundation (mono-company). If you want to manage several companies or foundations, you must install several time the software (on same server or not). Another solution is to extend Dolibarr with the addon Module MultiCompany that allows to manage several companies in one Dolibarr instance (one database but with a logical isolation of datas).
- Does not support double VAT (Federal / provincial) for Canada.
- Dolibarr does not contains Payroll module.
- Tasks on module project can't have dependencies between each other.
- Dolibarr does not include any Webmail.
- Dolibarr can't do coffee (not yet).
- Dolibarr can't do coffee (not yet).

View File

@ -690,6 +690,9 @@ class Adherent extends CommonObject
$error=0;
$errorflag=0;
// Check parameters
if (empty($rowid)) $rowid=$this->id;
$this->db->begin();
// Remove category
@ -1103,7 +1106,7 @@ class Adherent extends CommonObject
if (count($extralabels)>0) {
$this->fetch_optionals($this->id,$extralabels);
}
// Load other properties
$result=$this->fetch_subscriptions();
@ -1490,19 +1493,17 @@ class Adherent extends CommonObject
/**
* Return civility label of a contact
* Return civility label of a member
*
* @param int $nohtmlentities 0=Encode with htmlentities for HTML output, 1=No htmlentities for memory translation
* @return string Name translated of civility
* @return string Translated name of civility
*/
function getCivilityLabel($nohtmlentities=0)
function getCivilityLabel()
{
global $langs;
$langs->load("dict");
$code=$this->civilite_id;
if ($nohtmlentities) return $langs->transnoentities("Civility".$code)!="Civility".$code ? $langs->transnoentities("Civility".$code) : $code;
else return $langs->trans("Civility".$code)!="Civility".$code ? $langs->trans("Civility".$code) : $code;
return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civilite", "code", "civilite", $code);
}
/**
@ -1534,7 +1535,7 @@ class Adherent extends CommonObject
$lien = '<a href="'.DOL_URL_ROOT.'/categories/categorie.php?id='.$this->id.'&type=3">';
$lienfin='</a>';
}
$picto='user';
$label=$langs->trans("ShowMember");

View File

@ -246,9 +246,22 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
{
$birthdate=dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]);
}
$lastname=$_POST["lastname"];
$firstname=$_POST["firstname"];
$morphy=$morphy=$_POST["morphy"];;
if ($morphy != 'mor' && empty($lastname)) {
$error++;
$langs->load("errors");
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname"))."<br>\n";
}
if ($morphy != 'mor' && (!isset($firstname) || $firstname=='')) {
$error++;
$langs->load("errors");
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Firstname"))."<br>\n";
}
// Create new object
if ($result > 0)
if ($result > 0 && ! $error)
{
$object->oldcopy=dol_clone($object);
@ -389,6 +402,10 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
$action='';
}
}
else
{
$action='edit';
}
}
if ($action == 'add' && $user->rights->adherent->creer)
@ -489,7 +506,7 @@ if ($action == 'add' && $user->rights->adherent->creer)
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Password"))."<br>\n";
}
}
if (empty($lastname)) {
if ($morphy != 'mor' && empty($lastname)) {
$error++;
$langs->load("errors");
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname"))."<br>\n";

View File

@ -68,7 +68,6 @@ if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL'
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", '','chaine',0,'',$conf->entity);
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", '','chaine',0,'',$conf->entity);
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", '','chaine',0,'',$conf->entity);
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_DELETE_INVOICE", '','chaine',0,'',$conf->entity);
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_BILL','alpha'),'chaine',0,'',$conf->entity);
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity);
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER','alpha'),'chaine',0,'',$conf->entity);
@ -241,19 +240,6 @@ if (! empty($conf->fournisseur->enabled))
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</form>\n</td>\n</tr>\n";
}
if (! empty($conf->facture->enabled))
{
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("ReStockOnDeleteInvoice").'</td>';
print '<td width="160" align="right">';
print "<form method=\"post\" action=\"stock.php\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_DELETE_INVOICE\">";
print $form->selectyesno("STOCK_CALCULATE_ON_DELETE_INVOICE",$conf->global->STOCK_CALCULATE_ON_DELETE_INVOICE,1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</form>\n</td>\n</tr>\n";
}
print '</table>';

View File

@ -23,7 +23,8 @@
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$langs->load("admin");
@ -45,6 +46,23 @@ if (isset($title))
print_fiche_titre($langs->trans($title), '', 'setup');
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
print "\n";
$var=false;
// Recupere la version de l'OS
$phpversion=version_php();
print "<tr ".$bc[$var].'><td width="220px">'.$langs->trans("Version")."</td><td>".$phpversion."</td></tr>\n";
print '</table>';
print '<br>';
// Get php_info array
$phparray=phpinfo_array();
foreach($phparray as $key => $value)
@ -68,7 +86,12 @@ foreach($phparray as $key => $value)
print '<td>'.$keyparam.'</td>';
$valtoshow=$keyvalue;
if ($keyparam == 'X-ChromePhp-Data') $valtoshow=dol_trunc($keyvalue,80);
print '<td colspan="2">'.$valtoshow.'</td>';
print '<td colspan="2">';
if ($keyparam == 'Path') $valtoshow=join('; ',explode(';',trim($valtoshow)));
if ($keyparam == 'PATH') $valtoshow=join('; ',explode(';',trim($valtoshow)));
if ($keyparam == '_SERVER["PATH"]') $valtoshow=join('; ',explode(';',trim($valtoshow)));
print $valtoshow;
print '</td>';
print '</tr>';
}
else
@ -82,7 +105,7 @@ foreach($phparray as $key => $value)
print '<td>';
$valtoshow=$keyvalue2;
if ($keyparam == 'disable_functions') $valtoshow=join(', ',explode(',',trim($valtoshow)));
//print $keyparam2.' = ';
//print $keyparam;
print $valtoshow;
$i++;
print '</td>';

View File

@ -932,7 +932,7 @@ if ($id > 0)
// Busy
print '<tr><td class="nowrap">'.$langs->trans("Busy").'</td><td colspan="3">';
print yn(($act->transparency > 0)?1:0);
if ($act->usertodo->id > 0) print yn(($act->transparency > 0)?1:0); // We show nothing if event is assigned to nobody
print '</td></tr>';
// Done by

View File

@ -1858,7 +1858,7 @@ else
// Convert date into timestamp format
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
{
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key];
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$db->jdate($object->array_options['options_'.$key]);
}
if ($action == 'edit_extras' && $user->rights->propal->creer)

View File

@ -2158,7 +2158,7 @@ else
// Convert date into timestamp format
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
{
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key];
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$db->jdate($object->array_options['options_'.$key]);
}
if ($action == 'edit_extras' && $user->rights->commande->creer)

View File

@ -543,41 +543,37 @@ if ($id > 0 || ! empty($ref))
if ($links[$key]['type']=='payment')
{
$paymentstatic->id=$links[$key]['url_id'];
$paymentstatic->ref=$links[$key]['url_id'];
print ' '.$paymentstatic->getNomUrl(2);
}
else if ($links[$key]['type']=='payment_supplier')
elseif ($links[$key]['type']=='payment_supplier')
{
$paymentsupplierstatic->id=$links[$key]['url_id'];
$paymentsupplierstatic->ref=$links[$key]['url_id'];
print ' '.$paymentsupplierstatic->getNomUrl(2);
}
else if ($links[$key]['type']=='company')
elseif ($links[$key]['type']=='payment_sc')
{
}
else if ($links[$key]['type']=='payment_sc')
{
//print ' - ';
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/fiche.php?id='.$links[$key]['url_id'].'">';
print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
//print $langs->trans("SocialContributionPayment");
print '</a>';
}
else if ($links[$key]['type']=='payment_vat')
elseif ($links[$key]['type']=='payment_vat')
{
$paymentvatstatic->id=$links[$key]['url_id'];
$paymentvatstatic->ref=$links[$key]['url_id'];
print ' '.$paymentvatstatic->getNomUrl(2);
}
else if ($links[$key]['type']=='banktransfert')
elseif ($links[$key]['type']=='banktransfert')
{
// Do not show link to transfer ince there is no transfer card (avoid confusion). Can already be accessed from transaction detail.
// Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail.
if ($objp->amount > 0)
{
$banklinestatic->fetch($links[$key]['url_id']);
$bankstatic->id=$banklinestatic->fk_account;
$bankstatic->label=$banklinestatic->bank_account_label;
print ' ('.$langs->trans("From ");
print ' ('.$langs->trans("from").' ';
print $bankstatic->getNomUrl(1,'transactions');
print ' '.$langs->trans("toward").' ';
$bankstatic->id=$objp->bankid;
@ -589,7 +585,7 @@ if ($id > 0 || ! empty($ref))
{
$bankstatic->id=$objp->bankid;
$bankstatic->label=$objp->bankref;
print ' ('.$langs->trans("From ");
print ' ('.$langs->trans("from").' ';
print $bankstatic->getNomUrl(1,'');
print ' '.$langs->trans("toward").' ';
$banklinestatic->fetch($links[$key]['url_id']);
@ -600,11 +596,15 @@ if ($id > 0 || ! empty($ref))
}
//var_dump($links);
}
else if ($links[$key]['type']=='member')
elseif ($links[$key]['type']=='company')
{
}
else if ($links[$key]['type']=='sc')
elseif ($links[$key]['type']=='member')
{
}
elseif ($links[$key]['type']=='sc')
{
}

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Charles-Fr BENKE <charles.fr@benke.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,15 +21,16 @@
/**
* \file htdocs/compta/bank/annuel.php
* \ingroup banque
* \brief Page reporting mensuel Entrees/Sorties d'un compte bancaire
* \brief Page to report input-output of a bank account
*/
require('../../main.inc.php');
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("banks");
$langs->load("categories");
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$langs->load("banks");
$langs->load("categories");
$id=GETPOST('account');
$ref=GETPOST('ref');
@ -278,6 +280,237 @@ print "</tr>\n";
print "</table>";
// BUILDING GRAPHICS
$datetime = dol_now();
$year = dol_print_date($datetime, "%Y");
$month = dol_print_date($datetime, "%m");
$day = dol_print_date($datetime, "%d");
if (! empty($_GET["year"])) $year=sprintf("%04d",$_GET["year"]);
if (! empty($_GET["month"])) $month=sprintf("%02d",$_GET["month"]);
$result=dol_mkdir($conf->banque->dir_temp);
if ($result < 0)
{
$langs->load("errors");
$error++;
$mesg='<div class="error">'.$langs->trans("ErrorFailedToCreateDir").'</div>';
}
else
{
// Definition de $width et $height
$width = 550;
$height = 300;
// Calcul de $min et $max
$sql = "SELECT MIN(b.datev) as min, MAX(b.datev) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE b.fk_account = ba.rowid";
$sql.= " AND ba.entity = ".$conf->entity;
if ($id && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$id.")";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$obj = $db->fetch_object($resql);
$min = $db->jdate($obj->min);
$max = $db->jdate($obj->max);
}
else
{
dol_print_error($db);
}
$log="graph.php: min=".$min." max=".$max;
dol_syslog($log);
// CRED PART
// Chargement du tableau des années
$tblyear[0] = array();
$tblyear[1] = array();
$tblyear[2] = array();
for ($annee=0;$annee<3;$annee++)
{
$sql = "SELECT date_format(b.datev,'%m')";
$sql.= ", SUM(b.amount)";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE b.fk_account = ba.rowid";
$sql.= " AND ba.entity = ".$conf->entity;
$sql.= " AND b.datev >= '".($year-$annee)."-01-01 00:00:00'";
$sql.= " AND b.datev <= '".($year-$annee)."-12-31 23:59:59'";
$sql.= " AND b.amount > 0";
if ($id && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$id.")";
$sql .= " GROUP BY date_format(b.datev,'%m');";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($resql);
$tblyear[$annee][$row[0]] = $row[1];
$i++;
}
$db->free($resql);
}
else
{
dol_print_error($db);
}
}
// Chargement de labels et data_xxx pour tableau 4 Mouvements
$labels = array();
$data_year_0 = array();
$data_year_1 = array();
$data_year_2 = array();
for ($i = 0 ; $i < 12 ; $i++)
{
$data_year_0[$i] = isset($tblyear[0][substr("0".($i+1),-2)]) ? $tblyear[0][substr("0".($i+1),-2)] : 0;
$data_year_1[$i] = isset($tblyear[1][substr("0".($i+1),-2)]) ? $tblyear[1][substr("0".($i+1),-2)] : 0;
$data_year_2[$i] = isset($tblyear[2][substr("0".($i+1),-2)]) ? $tblyear[2][substr("0".($i+1),-2)] : 0;
$labels[$i] = dol_print_date(dol_mktime(12,0,0,$i+1,1,2000),"%b");
$datamin[$i] = 0;
}
// Fabrication tableau 4b
$file= $conf->banque->dir_temp."/credmovement".$id."-".$year.".png";
$fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/credmovement".$id."-".$year.".png";
$title=$langs->transnoentities("Credit").' - '.$langs->transnoentities("Year").': '.($year-2).' - '.($year-1)." - ".$year;
$graph_datas=array();
for($i=0;$i<12;$i++)
{
$graph_datas[$i]=array($labels[$i], $data_year_0[$i], $data_year_1[$i], $data_year_2[$i]);
}
$px1 = new DolGraph();
$px1->SetData($graph_datas);
$px1->SetLegend(array(($year),($year-1),($year-2)));
$px1->SetLegendWidthMin(180);
$px1->SetMaxValue($px1->GetCeilMaxValue()<0?0:$px1->GetCeilMaxValue());
$px1->SetMinValue($px1->GetFloorMinValue()>0?0:$px1->GetFloorMinValue());
$px1->SetTitle($title);
$px1->SetWidth($width);
$px1->SetHeight($height);
$px1->SetType(array('line','line','line'));
$px1->SetShading(3);
$px1->setBgColor('onglet');
$px1->setBgColorGrid(array(255,255,255));
$px1->SetHorizTickIncrement(1);
$px1->SetPrecisionY(0);
$px1->draw($file,$fileurl);
$show1 = $px1->show();
unset($graph_datas);
unset($px1);
unset($tblyear[0]);
unset($tblyear[1]);
unset($tblyear[2]);
// DEDBT PART
// Chargement du tableau des années
$tblyear[0] = array();
$tblyear[1] = array();
$tblyear[2] = array();
for ($annee=0;$annee<3;$annee++)
{
$sql = "SELECT date_format(b.datev,'%m')";
$sql.= ", SUM(b.amount)";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE b.fk_account = ba.rowid";
$sql.= " AND ba.entity = ".$conf->entity;
$sql.= " AND b.datev >= '".($year-$annee)."-01-01 00:00:00'";
$sql.= " AND b.datev <= '".($year-$annee)."-12-31 23:59:59'";
$sql.= " AND b.amount < 0";
if ($id && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$id.")";
$sql .= " GROUP BY date_format(b.datev,'%m');";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($resql);
$tblyear[$annee][$row[0]] = abs($row[1]);
$i++;
}
$db->free($resql);
}
else
{
dol_print_error($db);
}
}
// Chargement de labels et data_xxx pour tableau 4 Mouvements
$labels = array();
$data_year_0 = array();
$data_year_1 = array();
$data_year_2 = array();
for ($i = 0 ; $i < 12 ; $i++)
{
$data_year_0[$i] = isset($tblyear[0][substr("0".($i+1),-2)]) ? $tblyear[0][substr("0".($i+1),-2)] : 0;
$data_year_1[$i] = isset($tblyear[1][substr("0".($i+1),-2)]) ? $tblyear[1][substr("0".($i+1),-2)] : 0;
$data_year_2[$i] = isset($tblyear[2][substr("0".($i+1),-2)]) ? $tblyear[2][substr("0".($i+1),-2)] : 0;
$labels[$i] = dol_print_date(dol_mktime(12,0,0,$i+1,1,2000),"%b");
$datamin[$i] = 0;
}
$file= $conf->banque->dir_temp."/debmovement".$id."-".$year.".png";
$fileurl= DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/debmovement".$id."-".$year.".png";
$title=$langs->transnoentities("Debit").' - '.$langs->transnoentities("Year").': '.($year-2).' - '.($year-1)." - ".$year;
$graph_datas=array();
for($i=0;$i<12;$i++)
{
$graph_datas[$i]=array($labels[$i], $data_year_0[$i], $data_year_1[$i], $data_year_2[$i]);
}
$px2 = new DolGraph();
$px2->SetData($graph_datas);
$px2->SetLegend(array(($year),($year-1),($year-2)));
$px2->SetLegendWidthMin(180);
$px2->SetMaxValue($px2->GetCeilMaxValue()<0?0:$px2->GetCeilMaxValue());
$px2->SetMinValue($px2->GetFloorMinValue()>0?0:$px2->GetFloorMinValue());
$px2->SetTitle($title);
$px2->SetWidth($width);
$px2->SetHeight($height);
$px2->SetType(array('line','line','line'));
$px2->SetShading(3);
$px2->setBgColor('onglet');
$px2->setBgColorGrid(array(255,255,255));
$px2->SetHorizTickIncrement(1);
$px2->SetPrecisionY(0);
$px2->draw($file,$fileurl);
$show2 = $px2->show();
unset($graph_datas);
unset($px2);
unset($tblyear[0]);
unset($tblyear[1]);
unset($tblyear[2]);
print '<table width=100% ><tr><td align="center">';
print $show1;
print '</td>';
print '<td width=30px>&nbsp;</td>';
print '<td align="center">';
print $show2;
print '</td></tr></table>';
}
print "\n</div>\n";
llxFooter();

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
@ -20,11 +20,17 @@
/**
* \file htdocs/compta/bank/releve.php
* \ingroup banque
* \brief Page d'affichage d'un releve
* \brief Page to show a bank receipt report
*/
require('../../main.inc.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.'/adherents/class/adherent.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/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("banks");
@ -76,6 +82,14 @@ $pagenext = $page + 1;
llxHeader();
$form = new Form($db);
$societestatic=new Societe($db);
$chargestatic=new ChargeSociales($db);
$memberstatic=new Adherent($db);
$paymentstatic=new Paiement($db);
$paymentsupplierstatic=new PaiementFourn($db);
$paymentvatstatic=new TVA($db);
$bankstatic=new Account($db);
$banklinestatic=new AccountLine($db);
// Load account
@ -131,7 +145,7 @@ if (empty($num))
print_barre_liste('', $page, $_SERVER["PHP_SELF"], "&amp;account=".$acct->id, $sortfield, $sortorder,'',$numrows);
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">";
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("AccountStatement").'</td></tr>';
//while ($i < min($numrows,$conf->liste_limit)) // retrait de la limite tant qu'il n'y a pas de pagination
@ -145,7 +159,7 @@ if (empty($num))
}
else
{
print "<tr $bc[$var]><td><a href=\"releve.php?num=$objp->numr&amp;account=".$acct->id."\">$objp->numr</a></td></tr>\n";
print '<tr '.$bc[$var].'><td><a href="releve.php?num='.$objp->numr.'&amp;account='.$acct->id.'">'.$objp->numr.'</a></td></tr>'."\n";
}
$i++;
}
@ -252,16 +266,19 @@ else
}
// Recherche les ecritures pour le releve
$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.= " FROM ".MAIN_DB_PREFIX."bank as b";
$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.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= ", ".MAIN_DB_PREFIX."bank as b";
$sql.= " WHERE b.num_releve='".$db->escape($num)."'";
if (!isset($num)) $sql.= " OR b.num_releve is null";
$sql.= " AND b.fk_account = ".$acct->id;
$sql.= " ORDER BY b.datev ASC";
$sql.= " AND b.fk_account = ba.rowid";
$sql.= $db->order("b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day
dol_syslog("sql=".$sql);
$result = $db->query($sql);
if ($result)
{
$var=True;
@ -314,19 +331,61 @@ else
else print '<br>';
if ($links[$key]['type']=='payment')
{
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowPayment'),'payment').' ';
print $langs->trans("Payment");
print '</a>';
$paymentstatic->id=$links[$key]['url_id'];
$paymentstatic->ref=$langs->trans("Payment");
print ' '.$paymentstatic->getNomUrl(1);
$newline=0;
}
elseif ($links[$key]['type']=='payment_supplier') {
print '<a href="'.DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowPayment'),'payment').' ';
print $langs->trans("Payment");
print '</a>';
elseif ($links[$key]['type']=='payment_supplier')
{
$paymentsupplierstatic->id=$links[$key]['url_id'];
$paymentsupplierstatic->ref=$langs->trans("Payment");;
print ' '.$paymentsupplierstatic->getNomUrl(1);
$newline=0;
}
elseif ($links[$key]['type']=='payment_sc')
{
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/fiche.php?id='.$links[$key]['url_id'].'">';
print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
print $langs->trans("SocialContributionPayment");
print '</a>';
$newline=0;
}
elseif ($links[$key]['type']=='payment_vat')
{
$paymentvatstatic->id=$links[$key]['url_id'];
$paymentvatstatic->ref=$langs->trans("Payment");
print ' '.$paymentvatstatic->getNomUrl(2);
}
elseif ($links[$key]['type']=='banktransfert') {
// Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail.
if ($objp->amount > 0)
{
$banklinestatic->fetch($links[$key]['url_id']);
$bankstatic->id=$banklinestatic->fk_account;
$bankstatic->label=$banklinestatic->bank_account_label;
print ' ('.$langs->trans("from").' ';
print $bankstatic->getNomUrl(1,'transactions');
print ' '.$langs->trans("toward").' ';
$bankstatic->id=$objp->bankid;
$bankstatic->label=$objp->bankref;
print $bankstatic->getNomUrl(1,'');
print ')';
}
else
{
$bankstatic->id=$objp->bankid;
$bankstatic->label=$objp->bankref;
print ' ('.$langs->trans("from").' ';
print $bankstatic->getNomUrl(1,'');
print ' '.$langs->trans("toward").' ';
$banklinestatic->fetch($links[$key]['url_id']);
$bankstatic->id=$banklinestatic->fk_account;
$bankstatic->label=$banklinestatic->bank_account_label;
print $bankstatic->getNomUrl(1,'transactions');
print ')';
}
}
elseif ($links[$key]['type']=='company') {
print '<a href="'.DOL_URL_ROOT.'/societe/soc.php?socid='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowCustomer'),'company').' ';
@ -334,34 +393,19 @@ else
print '</a>';
$newline=0;
}
else if ($links[$key]['type']=='sc') {
print '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowBill'),'bill').' ';
print $langs->trans("SocialContribution");
print '</a>';
$newline=0;
}
else if ($links[$key]['type']=='payment_sc') {
print '<a href="'.DOL_URL_ROOT.'/compta/sociales/xxx.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowPayment'),'payment').' ';
print $langs->trans("SocialContributionPayment");
print '</a>';
$newline=0;
}
else if ($links[$key]['type']=='member') {
elseif ($links[$key]['type']=='member') {
print '<a href="'.DOL_URL_ROOT.'/adherents/fiche.php?rowid='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowMember'),'user').' ';
print $links[$key]['label'];
print '</a>';
$newline=0;
}
else if ($links[$key]['type']=='banktransfert') {
/* print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowTransaction'),'payment').' ';
print $langs->trans("TransactionOnTheOtherAccount");
print '</a>';
$newline=0;
*/
elseif ($links[$key]['type']=='sc') {
print '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowBill'),'bill').' ';
print $langs->trans("SocialContribution");
print '</a>';
$newline=0;
}
else {
print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';

View File

@ -3304,7 +3304,7 @@ else if ($id > 0 || ! empty($ref))
// Convert date into timestamp format
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
{
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key];
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$db->jdate($object->array_options['options_'.$key]);
}
if ($action == 'edit_extras' && $user->rights->facture->creer)

View File

@ -50,7 +50,7 @@ class RejetPrelevement
$this->motifs = array();
$this->facturer = array();
$this->motifs[0] = "";//$langs->trans("StatusMotif0");
$this->motifs[0] = ""; //$langs->trans("StatusMotif0");
$this->motifs[1] = $langs->trans("StatusMotif1");
$this->motifs[2] = $langs->trans("StatusMotif2");
$this->motifs[3] = $langs->trans("StatusMotif3");
@ -175,6 +175,7 @@ class RejetPrelevement
dol_syslog("RejetPrelevement::Create set_unpaid fac ".$fac->ref);
$fac->set_unpaid($fac->id, $user);
//TODO: Must be managed by notifications module
// Send email to sender of the standing order request
$this->_send_email($fac);
}

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -53,26 +53,36 @@ if ($action == 'confirm_rejet')
{
if ( GETPOST("confirm") == 'yes')
{
$daterej = mktime(2, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int'));
if (GETPOST('remonth','int'))
{
$daterej = mktime(2, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int'));
}
if (empty($daterej))
{
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Date")),'errors');
}
elseif ($daterej > dol_now())
{
$error++;
$langs->load("error");
setEventMessage($langs->transnoentities("ErrorDateMustBeBeforeToday"),'errors');
}
if (GETPOST('motif','alpha') == 0)
{
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("RefusedReason")),'errors');
}
$lipre = new LignePrelevement($db, $user);
if ($lipre->fetch($id) == 0)
if ( ! $error )
{
$lipre = new LignePrelevement($db, $user);
if ($lipre->fetch($id) == 0)
if ( ! $error && $daterej < time())
{
$rej = new RejetPrelevement($db, $user);
@ -81,13 +91,11 @@ if ($action == 'confirm_rejet')
header("Location: ligne.php?id=".$id);
exit;
}
else
{
dol_syslog("Motif : ".GETPOST('motif','alpha'));
dol_syslog("$daterej $time ");
$action="rejet";
}
}
else
{
$action="rejet";
}
}
else
@ -188,13 +196,13 @@ if ($id)
print '</td></tr>';
//Date
print '<tr><td class="valid">'.$langs->trans("RefusedData").'</td>';
print '<tr><td class="fieldrequired" class="valid">'.$langs->trans("RefusedData").'</td>';
print '<td colspan="2" class="valid">';
print $form->select_date('','','','','',"confirm_rejet");
print '</td></tr>';
//Reason
print '<tr><td class="valid">'.$langs->trans("RefusedReason").'</td>';
print '<tr><td class="fieldrequired" class="valid">'.$langs->trans("RefusedReason").'</td>';
print '<td class="valid">';
print $form->selectarray("motif", $rej->motifs);
print '</td></tr>';
@ -319,8 +327,6 @@ if ($id)
}
}
dol_htmloutput_mesg($mesg);
llxFooter();
$db->close();

View File

@ -35,6 +35,7 @@ class ChargeSociales extends CommonObject
public $table_element='chargesociales';
var $id;
var $ref;
var $date_ech;
var $lib;
var $type;

View File

@ -31,7 +31,8 @@ $langs->load("compta");
$langs->load("banks");
$langs->load("bills");
$id=$_REQUEST["id"];
$id=GETPOST("id");
$action=GETPOST('action');
$mesg = '';
@ -40,17 +41,25 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', '', '', 'charges');
$tva = new Tva($db);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('taxvatcard'));
/**
* Action ajout paiement tva
*/
if ($_POST["action"] == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
{
$tva = new Tva($db);
/**
* Actions
*/
if ($_POST["cancel"] == $langs->trans("Cancel"))
{
header("Location: reglement.php");
exit;
}
if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
{
$db->begin();
$datev=dol_mktime(12,0,0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]);
@ -74,13 +83,12 @@ if ($_POST["action"] == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
{
$db->rollback();
$mesg='<div class="error">'.$tva->error.'</div>';
$_GET["action"]="create";
$action="create";
}
}
if ($_GET["action"] == 'delete')
if ($action == 'delete')
{
$tva = new Tva($db);
$result=$tva->fetch($_GET['id']);
if ($tva->rappro == 0)
@ -143,7 +151,7 @@ if ($id)
}
// Formulaire saisie tva
if ($_GET["action"] == 'create')
if ($action == 'create')
{
print "<form name='add' action=\"fiche.php\" method=\"post\">\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -223,6 +231,9 @@ if ($id)
print $vatpayment->ref;
print '</td></tr>';
// Label
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$vatpayment->label.'</td></tr>';
print "<tr>";
print '<td>'.$langs->trans("DatePayment").'</td><td colspan="3">';
print dol_print_date($vatpayment->datep,'day');
@ -273,5 +284,4 @@ if ($id)
$db->close();
llxFooter();
?>
?>

View File

@ -874,9 +874,9 @@ class Contact extends CommonObject
}
/**
* Return label of a civility contact
* Return civility label of contact
*
* @return string Translated name of civility
* @return string Translated name of civility
*/
function getCivilityLabel()
{
@ -884,7 +884,7 @@ class Contact extends CommonObject
$langs->load("dict");
$code=$this->civilite_id;
return $langs->trans("Civility".$code)!="Civility".$code ? $langs->trans("Civility".$code) : '';
return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civilite", "code", "civilite", $code);
}
/**

View File

@ -44,6 +44,9 @@ abstract class CommonObject
public $civility_id;
public $array_options=array();
public $linkedObjectsIds;
public $linkedObjects;
// No constructor as it is an abstract class
@ -1649,7 +1652,7 @@ abstract class CommonObject
}
/**
* Fetch array of objects linked to current object. Links are loaded into this->linked_object array.
* Fetch array of objects linked to current object. Links are loaded into this->linkedObjects array.
*
* @param int $sourceid Object source id
* @param string $sourcetype Object source type
@ -1708,6 +1711,7 @@ abstract class CommonObject
$sql.= "(fk_source = '".$sourceid."' AND sourcetype = '".$sourcetype."')";
$sql.= " ".$clause." (fk_target = '".$targetid."' AND targettype = '".$targettype."')";
}
$sql .= ' ORDER BY sourcetype';
//print $sql;
dol_syslog(get_class($this)."::fetchObjectLink sql=".$sql);
@ -2236,7 +2240,7 @@ abstract class CommonObject
// Convert date into timestamp format
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
{
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->array_options['options_'.$key];
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->db->jdate($this->array_options['options_'.$key]);
}
$out .= '<td>'.$label.'</td>';
$out .='<td colspan="'.$colspan.'">';

File diff suppressed because it is too large Load Diff

View File

@ -825,7 +825,7 @@ class ExtraFields
$sql = 'SELECT '.$InfoFieldList[1];
$sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[0];
$sql.= ' WHERE '.$keyList.'="'.$this->db->escape($value).'"';
$sql.= ' WHERE '.$keyList.'=\''.$this->db->escape($value).'\'';
//$sql.= ' AND entity = '.$conf->entity;
dol_syslog(get_class($this).':showOutputField:$type=sellist sql='.$sql);
$resql = $this->db->query($sql);

View File

@ -194,7 +194,7 @@ class Translate
// Redefine alt
$langarray=explode('_',$langofdir);
if ($alt < 1 && strtolower($langarray[0]) == strtolower($langarray[1])) $alt=1;
if ($alt < 1 && isset($langarray[1]) && strtolower($langarray[0]) == strtolower($langarray[1])) $alt=1;
if ($alt < 2 && (strtolower($langofdir) == 'en_us' || strtolower($langofdir) == 'fr_fr' || strtolower($langofdir) == 'es_es')) $alt=2;
foreach($this->dir as $keydir => $searchdir)
@ -643,13 +643,15 @@ class Translate
* Store key-label found into cache variable $this->cache_labels to save SQL requests to get labels.
*
* @param DoliBD $db Database handler
* @param string $key Key to get label (key in language file)
* @param string $key Translation key to get label (key in language file)
* @param string $tablename Table name without prefix
* @param string $fieldkey Field for key
* @param string $fieldlabel Field for label
* @param string $keyforselect Use another value than the translation key for the where into select
* @return string Label in UTF8 (but without entities)
* @see dol_getIdFromCode
*/
function getLabelFromKey($db,$key,$tablename,$fieldkey,$fieldlabel)
function getLabelFromKey($db,$key,$tablename,$fieldkey,$fieldlabel,$keyforselect='')
{
// If key empty
if ($key == '') return '';
@ -670,7 +672,7 @@ class Translate
$sql = "SELECT ".$fieldlabel." as label";
$sql.= " FROM ".MAIN_DB_PREFIX.$tablename;
$sql.= " WHERE ".$fieldkey." = '".$key."'";
$sql.= " WHERE ".$fieldkey." = '".($keyforselect?$keyforselect:$key)."'";
dol_syslog(get_class($this).'::getLabelFromKey sql='.$sql,LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)

View File

@ -46,7 +46,7 @@ function societe_prepare_head($object)
if ($object->client==1 || $object->client==2 || $object->client==3)
{
$head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$object->id;
$head[$h][1]='';
$head[$h][1] = '';
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && ($object->client==2 || $object->client==3)) $head[$h][1] .= $langs->trans("Prospect");
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && $object->client==3) $head[$h][1] .= '/';
if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && ($object->client==1 || $object->client==3)) $head[$h][1] .= $langs->trans("Customer");
@ -60,7 +60,7 @@ function societe_prepare_head($object)
$head[$h][2] = 'supplier';
$h++;
}
if (! empty($conf->agenda->enabled))
if (! empty($conf->agenda->enabled) && !empty($user->right->agenda->lire))
{
$head[$h][0] = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Agenda");
@ -68,7 +68,7 @@ function societe_prepare_head($object)
$h++;
}
//show categorie tab
if (! empty($conf->categorie->enabled))
if (! empty($conf->categorie->enabled) && !empty($user->right->categorie->lire))
{
$type = 2;
if ($object->fournisseur) $type = 1;

View File

@ -1221,7 +1221,7 @@ function dol_uncompress($inputfile,$outputdir)
* @param string $dir Directory to scan
* @param string $regexfilter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
* @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function
* @param int $nohook Disable all hooks
* @param int $nohook Disable all hooks
* @return string Full path to most recent file
*/
function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('\.meta$','^\.'),$nohook=false)
@ -1236,11 +1236,12 @@ function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('\.meta$
* @param string $modulepart Module of document
* @param string $original_file Relative path with filename
* @param string $entity Restrict onto entity
* @param string $refname Ref of object to check permission for external users (autodetect if not provided)
* @return mixed Array with access information : accessallowed & sqlprotectagainstexternals & original_file (as full path name)
*/
function dol_check_secure_access_document($modulepart,$original_file,$entity)
function dol_check_secure_access_document($modulepart,$original_file,$entity,$refname='')
{
global $user, $conf;
global $user, $conf, $db;
if (empty($modulepart)) return 'ErrorBadParameter';
if (empty($entity)) $entity=0;
@ -1250,6 +1251,9 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity)
$sqlprotectagainstexternals='';
$ret=array();
// find the subdirectory name as the reference
if (empty($refname)) $refname=basename(dirname($original_file)."/");
// Wrapping for some images
if ($modulepart == 'companylogo')
{
@ -1425,7 +1429,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity)
$accessallowed=1;
}
$original_file=$conf->societe->multidir_output[$entity].'/'.$original_file;
$sqlprotectagainstexternals = "SELECT rowid as fk_soc FROM ".MAIN_DB_PREFIX."societe WHERE rowid='".$refname."' AND entity IN (".getEntity('societe', 1).")";
$sqlprotectagainstexternals = "SELECT rowid as fk_soc FROM ".MAIN_DB_PREFIX."societe WHERE rowid='".$db->escape($refname)."' AND entity IN (".getEntity('societe', 1).")";
}
// Wrapping for invoices
@ -1436,7 +1440,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity)
$accessallowed=1;
}
$original_file=$conf->facture->dir_output.'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$refname."' AND entity=".$conf->entity;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
}
else if ($modulepart == 'unpaid')
@ -1456,7 +1460,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity)
$accessallowed=1;
}
$original_file=$conf->ficheinter->dir_output.'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$refname."' AND entity=".$conf->entity;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
}
// Wrapping pour les deplacements et notes de frais
@ -1467,7 +1471,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity)
$accessallowed=1;
}
$original_file=$conf->deplacement->dir_output.'/'.$original_file;
//$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$refname."' AND entity=".$conf->entity;
//$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
}
// Wrapping pour les propales
else if ($modulepart == 'propal')
@ -1478,7 +1482,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity)
}
$original_file=$conf->propal->dir_output.'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."propal WHERE ref='".$refname."' AND entity=".$conf->entity;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."propal WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
}
// Wrapping pour les commandes
@ -1489,7 +1493,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity)
$accessallowed=1;
}
$original_file=$conf->commande->dir_output.'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."commande WHERE ref='".$refname."' AND entity=".$conf->entity;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."commande WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
}
// Wrapping pour les projets
@ -1500,7 +1504,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity)
$accessallowed=1;
}
$original_file=$conf->projet->dir_output.'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$refname."' AND entity=".$conf->entity;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
}
// Wrapping pour les commandes fournisseurs
@ -1511,7 +1515,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity)
$accessallowed=1;
}
$original_file=$conf->fournisseur->commande->dir_output.'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."commande_fournisseur WHERE ref='".$refname."' AND entity=".$conf->entity;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."commande_fournisseur WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
}
// Wrapping pour les factures fournisseurs
@ -1522,7 +1526,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity)
$accessallowed=1;
}
$original_file=$conf->fournisseur->facture->dir_output.'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture_fourn WHERE facnumber='".$refname."' AND entity=".$conf->entity;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture_fourn WHERE facnumber='".$db->escape($refname)."' AND entity=".$conf->entity;
}
// Wrapping pour les rapport de paiements
@ -1755,7 +1759,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity)
$sqlProtectConstName = strtoupper($modulepart).'_SQLPROTECTAGAINSTEXTERNALS_FOR_DOCUMENTS';
if (! empty($conf->global->$sqlProtectConstName)) // If module want to define its own $sqlprotectagainstexternals
{
// Example: mymodule__SQLPROTECTAGAINSTEXTERNALS_FOR_DOCUMENTS = "SELECT fk_soc FROM ".MAIN_DB_PREFIX.$modulepart." WHERE ref='".$refname."' AND entity=".$conf->entity;
// Example: mymodule__SQLPROTECTAGAINSTEXTERNALS_FOR_DOCUMENTS = "SELECT fk_soc FROM ".MAIN_DB_PREFIX.$modulepart." WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
eval('$sqlprotectagainstexternals = "'.$conf->global->$sqlProtectConstName.'";');
}
}

View File

@ -3323,7 +3323,7 @@ function picto_required()
*
* @param string $StringHtml String to clean
* @param string $removelinefeed Replace also all lines feeds by a space
* @param string $pagecodeto Encoding of input string
* @param string $pagecodeto Encoding of input/output string
* @return string String cleaned
*/
function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8')
@ -4071,6 +4071,7 @@ function dol_osencode($str)
* @param string $fieldkey Field for code
* @param string $fieldid Field for id
* @return int Id of code
* @see getLabelFromKey
*/
function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id')
{

View File

@ -42,9 +42,10 @@ require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
* @param int $usestdout Add information onto standard output
* @param int $regenerate ''=Use existing PDF files, 'nameofpdf'=Regenerate all PDF files using the template
* @param string $option Suffix to add into file name of generated PDF
* @param string $paymentbankid Only if payment on this bank account id
* @return int Error code
*/
function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate=0, $option='')
function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate=0, $option='', $paymentbankid='')
{
$sql = "SELECT DISTINCT f.rowid, f.facnumber";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
@ -71,17 +72,25 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
$sqlwhere.= " f.fk_statut > 0";
$sqlwhere.= " AND pf.fk_paiement IS NULL";
}
if (in_array('payments',$filter))
if (in_array('payments',$filter) || in_array('bank',$filter))
{
$sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf,";
$sql.= " ".MAIN_DB_PREFIX."paiement as p";
$sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p";
if (in_array('bank',$filter)) $sql.= ", ".MAIN_DB_PREFIX."bank as b";
if (empty($sqlwhere)) $sqlwhere=' WHERE ';
else $sqlwhere.=" AND";
$sqlwhere.= " f.fk_statut > 0";
$sqlwhere.= " AND f.rowid = pf.fk_facture";
$sqlwhere.= " AND pf.fk_paiement = p.rowid";
$sqlwhere.= " AND p.datep >= '".$db->idate($paymentdateafter)."'";
$sqlwhere.= " AND p.datep <= '".$db->idate($paymentdatebefore)."'";
if (in_array('payments',$filter))
{
$sqlwhere.= " AND p.datep >= '".$db->idate($paymentdateafter)."'";
$sqlwhere.= " AND p.datep <= '".$db->idate($paymentdatebefore)."'";
}
if (in_array('bank',$filter))
{
$sqlwhere.= " AND p.fk_bank = b.rowid";
$sqlwhere.= " AND b.fk_account = ".$paymentbankid;
}
$sqlorder = " ORDER BY p.datep ASC";
}
if (in_array('nodeposit',$filter))

View File

@ -187,9 +187,10 @@ class ExportCsv extends ModeleExports
* @param array $array_export_fields_label Array with list of label of fields
* @param array $array_selected_sorted Array with list of field to export
* @param Translate $outputlangs Object lang to translate values
* @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK
*/
function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs)
function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs,$array_types)
{
global $conf;
@ -204,7 +205,7 @@ class ExportCsv extends ModeleExports
foreach($array_selected_sorted as $code => $value)
{
$newvalue=$outputlangs->transnoentities($array_export_fields_label[$code]);
$newvalue=$outputlangs->transnoentities($array_export_fields_label[$code]); // newvalue is now $outputlangs->charset_output encoded
$newvalue=$this->csv_clean($newvalue,$outputlangs->charset_output);
fwrite($this->handle,$newvalue.$this->separator);
@ -242,15 +243,12 @@ class ExportCsv extends ModeleExports
if (strpos($code,' as ') == 0) $alias=str_replace(array('.','-'),'_',$code);
else $alias=substr($code, strpos($code, ' as ') + 4);
if (empty($alias)) dol_print_error('','Bad value for field with key='.$code.'. Try to redefine export.');
$newvalue=$outputlangs->convToOutputCharset($objp->$alias);
$newvalue=$outputlangs->convToOutputCharset($objp->$alias); // objp->$alias must be utf8 encoded as any var in memory // newvalue is now $outputlangs->charset_output encoded
$typefield=isset($array_types[$code])?$array_types[$code]:'';
// Translation newvalue
if (preg_match('/^\((.*)\)$/i',$newvalue,$reg))
{
$newvalue=$outputlangs->transnoentities($reg[1]);
}
if (preg_match('/^\((.*)\)$/i',$newvalue,$reg)) $newvalue=$outputlangs->transnoentities($reg[1]);
$newvalue=$this->csv_clean($newvalue,$outputlangs->charset_output);
@ -284,11 +282,12 @@ class ExportCsv extends ModeleExports
return 0;
}
/**
* Clean a cell to respect rules of CSV file cells
*
* @param string $newvalue String to clean
* @param string $charset Output character set
* @param string $charset Input AND Output character set
* @return string Value cleaned
*/
function csv_clean($newvalue, $charset)
@ -296,7 +295,9 @@ class ExportCsv extends ModeleExports
$addquote=0;
// Rule Dolibarr: No HTML
//print $charset.' '.$newvalue."\n";
$newvalue=dol_string_nohtmltag($newvalue,1,$charset);
//print $charset.' '.$newvalue."\n";
// Rule 1 CSV: No CR, LF in cells
$newvalue=str_replace("\r",'',$newvalue);

View File

@ -158,7 +158,7 @@ class ExportExcel extends ModeleExports
$outputlangs->charset_output='ISO-8859-1'; // Because Excel 5 format is ISO
}
dol_syslog("ExportExcel::open_file file=".$file);
dol_syslog(get_class($this)."::open_file file=".$file);
$this->file=$file;
$ret=1;
@ -187,7 +187,7 @@ class ExportExcel extends ModeleExports
$this->workbook->setActiveSheetIndex(0);
$this->workbook->getActiveSheet()->setTitle($outputlangs->trans("Sheet"));
$this->workbook->getActiveSheet()->getDefaultRowDimension()->setRowHeight(15);
$this->workbook->getActiveSheet()->getDefaultRowDimension()->setRowHeight(16);
}
return $ret;
}
@ -212,9 +212,10 @@ class ExportExcel extends ModeleExports
* @param array $array_export_fields_label Array with list of label of fields
* @param array $array_selected_sorted Array with list of field to export
* @param Translate $outputlangs Object lang to translate values
* @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK
*/
function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs)
function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs,$array_types)
{
// Create a format for the column headings
if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
@ -231,7 +232,7 @@ class ExportExcel extends ModeleExports
else
{
$this->workbook->getActiveSheet()->getStyle('1')->getFont()->setBold(true);
$this->workbook->getActiveSheet()->getStyle('1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$this->workbook->getActiveSheet()->getStyle('1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
}
$this->col=0;
@ -247,6 +248,10 @@ class ExportExcel extends ModeleExports
else
{
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, $outputlangs->transnoentities($alias));
if (! empty($array_types[$code]) && in_array($array_types[$code],array('Date','Number','TextAuto'))) // Set autowidth for some types
{
$this->workbook->getActiveSheet()->getColumnDimension($this->column2Letter($this->col + 1))->setAutoSize(true);
}
}
$this->col++;
}
@ -341,18 +346,17 @@ class ExportExcel extends ModeleExports
$this->worksheet->write($this->row, $this->col, $newvalue);
}
else
{
if ($typefield == 'Text')
{
if ($typefield == 'Text' || $typefield == 'TextAuto')
{
//$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->setValueExplicit($newvalue, PHPExcel_Cell_DataType::TYPE_STRING);
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, (string) $newvalue);
$coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
$this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('@');
$this->workbook->getActiveSheet()->getStyle($coord)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
}
else
{
//$coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
//if ($typefield == 'Text') $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('@');
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, $newvalue);
}
}
@ -412,6 +416,29 @@ class ExportExcel extends ModeleExports
return $newvalue;
}
/**
* Convert a column to letter (1->A, 0->B, 27->AA, ...)
*
* @param int $c Column position
* @return string Letter
*/
function column2Letter($c)
{
$c = intval($c);
if ($c <= 0) return '';
while ($c != 0)
{
$p = ($c - 1) % 26;
$c = intval(($c - $p) / 26);
$letter = chr(65 + $p) . $letter;
}
return $letter;
}
}
?>

View File

@ -72,310 +72,6 @@ class ExportExcel2007 extends ExportExcel
$this->row=0;
}
/**
* getDriverLabel
*
* @return int
*/
function getDriverId()
{
return $this->id;
}
/**
* getDriverLabel
*
* @return string Return driver label
*/
function getDriverLabel()
{
return $this->label;
}
/**
* getDriverDesc
*
* @return string
*/
function getDriverDesc()
{
return $this->desc;
}
/**
* getDriverExtension
*
* @return string
*/
function getDriverExtension()
{
return $this->extension;
}
/**
* getDriverVersion
*
* @return string
*/
function getDriverVersion()
{
return $this->version;
}
/**
* getLibLabel
*
* @return string
*/
function getLibLabel()
{
return $this->label_lib;
}
/**
* getLibVersion
*
* @return string
*/
function getLibVersion()
{
return $this->version_lib;
}
/**
* Open output file
*
* @param string $file File name to generate
* @param Translate $outputlangs Output language object
* @return int <0 if KO, >=0 if OK
*/
function open_file($file,$outputlangs)
{
global $user,$conf,$langs;
if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
{
$outputlangs->charset_output='ISO-8859-1'; // Because Excel 5 format is ISO
}
dol_syslog("ExportExcel::open_file file=".$file);
$this->file=$file;
$ret=1;
$outputlangs->load("exports");
if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
{
require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_workbookbig.inc.php';
require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_worksheet.inc.php';
require_once PHP_WRITEEXCEL_PATH.'functions.writeexcel_utility.inc.php';
$this->workbook = new writeexcel_workbookbig($file);
$this->workbook->set_tempdir($conf->export->dir_temp); // Set temporary directory
$this->workbook->set_sheetname($outputlangs->trans("Sheet"));
$this->worksheet = &$this->workbook->addworksheet();
}
else
{
require_once PHPEXCEL_PATH.'PHPExcel.php';
require_once PHPEXCEL_PATH.'PHPExcel/Style/Alignment.php';
$this->workbook = new PHPExcel();
$this->workbook->getProperties()->setCreator($user->getFullName($outputlangs).' - Dolibarr '.DOL_VERSION);
//$this->workbook->getProperties()->setLastModifiedBy('Dolibarr '.DOL_VERSION);
$this->workbook->getProperties()->setTitle($outputlangs->trans("Export").' - '.$file);
$this->workbook->getProperties()->setSubject($outputlangs->trans("Export").' - '.$file);
$this->workbook->getProperties()->setDescription($outputlangs->trans("Export").' - '.$file);
$this->workbook->setActiveSheetIndex(0);
$this->workbook->getActiveSheet()->setTitle($outputlangs->trans("Sheet"));
$this->workbook->getActiveSheet()->getDefaultRowDimension()->setRowHeight(16);
}
return $ret;
}
/**
* Write header
*
* @param Translate $outputlangs Object lang to translate values
* @return int <0 if KO, >0 if OK
*/
function write_header($outputlangs)
{
//$outputlangs->charset_output='ISO-8859-1'; // Because Excel 5 format is ISO
return 0;
}
/**
* Output title line into file
*
* @param array $array_export_fields_label Array with list of label of fields
* @param array $array_selected_sorted Array with list of field to export
* @param Translate $outputlangs Object lang to translate values
* @return int <0 if KO, >0 if OK
*/
function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs)
{
// Create a format for the column headings
if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
{
$outputlangs->charset_output='ISO-8859-1'; // Because Excel 5 format is ISO
$formatheader =$this->workbook->addformat();
$formatheader->set_bold();
$formatheader->set_color('blue');
//$formatheader->set_size(12);
//$formatheader->set_font("Courier New");
//$formatheader->set_align('center');
}
else
{
$this->workbook->getActiveSheet()->getStyle('1')->getFont()->setBold(true);
$this->workbook->getActiveSheet()->getStyle('1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
}
$this->col=0;
foreach($array_selected_sorted as $code => $value)
{
$alias=$array_export_fields_label[$code];
//print "dd".$alias;
if (empty($alias)) dol_print_error('','Bad value for field with code='.$code.'. Try to redefine export.');
if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
{
$this->worksheet->write($this->row, $this->col, $outputlangs->transnoentities($alias), $formatheader);
}
else
{
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, $outputlangs->transnoentities($alias));
}
$this->col++;
}
$this->row++;
return 0;
}
/**
* Output record line into file
*
* @param array $array_selected_sorted Array with list of field to export
* @param resource $objp A record from a fetch with all fields from select
* @param Translate $outputlangs Object lang to translate values
* @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK
*/
function write_record($array_selected_sorted,$objp,$outputlangs,$array_types)
{
// Create a format for the column headings
if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
{
$outputlangs->charset_output='ISO-8859-1'; // Because Excel 5 format is ISO
}
// Define first row
$this->col=0;
foreach($array_selected_sorted as $code => $value)
{
if (strpos($code,' as ') == 0) $alias=str_replace(array('.','-'),'_',$code);
else $alias=substr($code, strpos($code, ' as ') + 4);
if (empty($alias)) dol_print_error('','Bad value for field with code='.$code.'. Try to redefine export.');
$newvalue=$objp->$alias;
$newvalue=$this->excel_clean($newvalue);
$typefield=isset($array_types[$code])?$array_types[$code]:'';
// Traduction newvalue
if (preg_match('/^\((.*)\)$/i',$newvalue,$reg))
{
$newvalue=$outputlangs->transnoentities($reg[1]);
}
else
{
$newvalue=$outputlangs->convToOutputCharset($newvalue);
}
//var_dump($code.' '.$alias.' '.$newvalue.' '.$typefield);
if (preg_match('/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$/i',$newvalue))
{
if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
{
$formatdate=$this->workbook->addformat();
$formatdate->set_num_format('yyyy-mm-dd');
//$formatdate->set_num_format(0x0f);
$arrayvalue=preg_split('/[.,]/',xl_parse_date($newvalue));
//print "x".$arrayvalue[0].'.'.strval($arrayvalue[1]).'<br>';
$newvalue=strval($arrayvalue[0]).'.'.strval($arrayvalue[1]); // $newvalue=strval(36892.521); directly does not work because . will be convert into , later
$this->worksheet->write($this->row, $this->col, $newvalue, PHPExcel_Shared_Date::PHPToExcel($formatdate));
}
else
{
$newvalue=dol_stringtotime($newvalue);
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, PHPExcel_Shared_Date::PHPToExcel($newvalue));
$coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
$this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('yyyy-mm-dd');
}
}
elseif (preg_match('/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]$/i',$newvalue))
{
if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
{
$formatdatehour=$this->workbook->addformat();
$formatdatehour->set_num_format('yyyy-mm-dd hh:mm:ss');
//$formatdatehour->set_num_format(0x0f);
$arrayvalue=preg_split('/[.,]/',xl_parse_date($newvalue));
//print "x".$arrayvalue[0].'.'.strval($arrayvalue[1]).'<br>';
$newvalue=strval($arrayvalue[0]).'.'.strval($arrayvalue[1]); // $newvalue=strval(36892.521); directly does not work because . will be convert into , later
$this->worksheet->write($this->row, $this->col, $newvalue, $formatdatehour);
}
else
{
$newvalue=dol_stringtotime($newvalue);
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, PHPExcel_Shared_Date::PHPToExcel($newvalue));
$coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
$this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('yyyy-mm-dd h:mm:ss');
}
}
else
{
if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
{
$this->worksheet->write($this->row, $this->col, $newvalue);
}
else
{
if ($typefield == 'Text')
{
//$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->setValueExplicit($newvalue, PHPExcel_Cell_DataType::TYPE_STRING);
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, (string) $newvalue);
$coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
$this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('@');
}
else
{
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, $newvalue);
}
}
}
$this->col++;
}
$this->row++;
return 0;
}
/**
* Write footer
*
* @param Translate $outputlangs Output language object
* @return int <0 if KO, >0 if OK
*/
function write_footer($outputlangs)
{
return 0;
}
/**
* Close Excel file
@ -399,20 +95,6 @@ class ExportExcel2007 extends ExportExcel
return 0;
}
/**
* Clean a cell to respect rules of Excel file cells
*
* @param string $newvalue String to clean
* @return string Value cleaned
*/
function excel_clean($newvalue)
{
// Rule Dolibarr: No HTML
$newvalue=dol_string_nohtmltag($newvalue);
return $newvalue;
}
}
?>

View File

@ -182,13 +182,14 @@ class ExportTsv extends ModeleExports
* @param array $array_export_fields_label Array with list of label of fields
* @param array $array_selected_sorted Array with list of field to export
* @param Translate $outputlangs Object lang to translate values
* @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK
*/
function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs)
function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs,$array_types)
{
foreach($array_selected_sorted as $code => $value)
{
$newvalue=$outputlangs->transnoentities($array_export_fields_label[$code]);
$newvalue=$outputlangs->transnoentities($array_export_fields_label[$code]); // newvalue is now $outputlangs->charset_output encoded
$newvalue=$this->tsv_clean($newvalue,$outputlangs->charset_output);
fwrite($this->handle,$newvalue.$this->separator);
@ -218,14 +219,11 @@ class ExportTsv extends ModeleExports
else $alias=substr($code, strpos($code, ' as ') + 4);
if (empty($alias)) dol_print_error('','Bad value for field with code='.$code.'. Try to redefine export.');
$newvalue=$outputlangs->convToOutputCharset($objp->$alias);
$newvalue=$outputlangs->convToOutputCharset($objp->$alias); // objp->$alias must be utf8 encoded as any var in memory // newvalue is now $outputlangs->charset_output encoded
$typefield=isset($array_types[$code])?$array_types[$code]:'';
// Translation newvalue
if (preg_match('/^\((.*)\)$/i',$newvalue,$reg))
{
$newvalue=$outputlangs->transnoentities($reg[1]);
}
if (preg_match('/^\((.*)\)$/i',$newvalue,$reg)) $newvalue=$outputlangs->transnoentities($reg[1]);
$newvalue=$this->tsv_clean($newvalue,$outputlangs->charset_output);
@ -262,7 +260,7 @@ class ExportTsv extends ModeleExports
* Clean a cell to respect rules of TSV file cells
*
* @param string $newvalue String to clean
* @param string $charset Output character set
* @param string $charset Input AND Output character set
* @return string Value cleaned
*/
function tsv_clean($newvalue, $charset)

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2011-2012 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2011-2013 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -44,7 +44,7 @@ $(function () {
// Events
$('#fileupload').fileupload({
completed: function (e, data) {
stop: function (e, data) {
location.href='<?php echo $_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"]; ?>';
},
destroy: function (e, data) {

View File

@ -134,7 +134,7 @@ if ($forgetpasslink || $helpcenterlink)
echo '<br>';
echo '<div align="center" style="margin-top: 4px;">';
if ($forgetpasslink) {
echo '<a style="color: #888888; font-size: 10px" href="'.DOL_URL_ROOT.'/user/passwordforgotten.php'.$moreparam.'">(';
echo '<a class="alogin" href="'.DOL_URL_ROOT.'/user/passwordforgotten.php'.$moreparam.'">(';
echo $langs->trans('PasswordForgotten');
if (! $helpcenterlink) {
echo ')';
@ -145,7 +145,7 @@ if ($forgetpasslink || $helpcenterlink)
if ($helpcenterlink) {
$url=DOL_URL_ROOT.'/support/index.php'.$moreparam;
if (! empty($conf->global->MAIN_HELPCENTER_LINKTOUSE)) $url=$conf->global->MAIN_HELPCENTER_LINKTOUSE;
echo '<a style="color: #888888; font-size: 10px" href="'.dol_escape_htmltag($url).'" target="_blank">';
echo '<a class="alogin" href="'.dol_escape_htmltag($url).'" target="_blank">';
if ($forgetpasslink) {
echo '&nbsp;-&nbsp;';
} else {

View File

@ -97,7 +97,7 @@ $refname=basename(dirname($original_file)."/");
// Security check
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
$check_access = dol_check_secure_access_document($modulepart,$original_file,$entity);
$check_access = dol_check_secure_access_document($modulepart,$original_file,$entity,$refname);
$accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$original_file = $check_access['original_file'];

View File

@ -520,7 +520,7 @@ class Export
$objmodel->write_header($outputlangs);
// Genere ligne de titre
$objmodel->write_title($this->array_export_fields[$indice],$array_selected,$outputlangs);
$objmodel->write_title($this->array_export_fields[$indice],$array_selected,$outputlangs,$this->array_export_TypeFields[$indice]);
$var=true;

View File

@ -372,7 +372,7 @@ class Fichinter extends CommonObject
// Define new ref
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref)))
{
$num = $this->getNextNumRef($soc);
$num = $this->getNextNumRef($this->thirdparty);
}
else
{

View File

@ -380,6 +380,8 @@ class PaiementFourn extends Paiement
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf, '.MAIN_DB_PREFIX.'facture_fourn as f';
$sql.= ' WHERE pf.fk_facturefourn = f.rowid AND fk_paiementfourn = '.$this->id;
if ($filter) $sql.= ' AND '.$filter;
dol_syslog(get_class($this).'::getBillsArray sql='.$sql);
$resql = $this->db->query($sql);
if ($resql)
{
@ -399,7 +401,7 @@ class PaiementFourn extends Paiement
else
{
$this->error=$this->db->error();
dol_syslog('PaiementFourn::getBillsArray Error '.$this->error.' - sql='.$sql);
dol_syslog(get_class($this).'::getBillsArray Error '.$this->error);
return -1;
}
}

View File

@ -68,7 +68,7 @@ if ($action == 'update' && isset($_POST['update_cp']))
}
//If the user set a comment, we add it to the log comment
$comment = (isset($_POST['note_holiday'][$userID]) ? ' ('.$_POST['note_holiday'][$userID].')' : '');
$comment = ((isset($_POST['note_holiday'][$userID]) && !empty($_POST['note_holiday'][$userID])) ? ' ('.$_POST['note_holiday'][$userID].')' : '');
// We add the modification to the log
$holiday->addLogCP($user->id,$userID, $langs->trans('ManualUpdate').$comment,$userValue);
@ -150,10 +150,10 @@ print '<input type="hidden" name="action" value="update" />';
print '<table class="noborder" width="100%;">';
print "<tr class=\"liste_titre\">";
print '<td width="5%">'.$langs->trans('ID').'</td>';
print '<td width="50%">'.$langs->trans('UserName').'</td>';
print '<td width="50%">'.$langs->trans('Employee').'</td>';
print '<td width="20%" style="text-align:center">'.$langs->trans('Available').'</td>';
print '<td width="20%" style="text-align:center">'.$langs->trans('Note').'</td>';
print '<td>'.$langs->trans('UpdateButtonCP').'</td>';
print '<td style="text-align:center">'.$langs->trans('UpdateButtonCP').'</td>';
print '</tr>';
foreach($listUsers as $users)

View File

@ -854,8 +854,8 @@ else
// Si refus de la demande
if ($action == 'refuse' && $cp->statut == 2 && $user->id == $cp->fk_validator)
{
$array_input = array(array('type'=>"text",'label'=>"Entrez ci-dessous un motif de refus :",'name'=>"detail_refuse",'size'=>"50",'value'=>""));
$ret=$form->form_confirm("fiche.php?id=".$id."&action=confirm_refuse", $langs->trans("TitleRefuseCP"), "", "confirm_refuse", $array_input, 1, 0);
$array_input = array(array('type'=>"text",'label'=> $langs->trans('DetailRefusCP'),'name'=>"detail_refuse",'size'=>"50",'value'=>""));
$ret=$form->form_confirm("fiche.php?id=".$id."&action=confirm_refuse", $langs->trans("TitleRefuseCP"), $langs->trans('ConfirmRefuseCP'), "confirm_refuse", $array_input, 1, 0);
if ($ret == 'html') print '<br />';
}

View File

@ -273,7 +273,7 @@ print '<input class="flat" size="4" type="text" name="search_ref" value="'.$sear
// DATE CREATE
print '<td class="liste_titre" colspan="1" align="center">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month_create" value="'.$month_create.'">';
$formother->select_year($year_create,'year_create',1, $min_year, $max_year);
$formother->select_year($year_create,'year_create',1, $min_year, 0);
print '</td>';
// UTILISATEUR

View File

@ -119,6 +119,7 @@ ErrorFailedToAddToMailmanList=S'ha produït un error en intentar afegir un regis
ErrorFailedToRemoveToMailmanList=Error en l'eliminació de %s de la llista Mailmain %s o base SPIP
ErrorNewValueCantMatchOldValue=El Nou valor no pot ser igual al antic
ErrorFailedToValidatePasswordReset=No s'ha pogut restablir la contrasenya. És possible que aquest enllaç ja s'hagi utilitzat (aquest enllaç només es pot utilitzar una vegada). Si no és el cas prova de reiniciar el procés de restabliment de contrasenya des del principi.
ErrorDateMustBeBeforeToday=La data no pot ser superior a avui
# Warnings
WarningMandatorySetupNotComplete=Els paràmetres obligatoris de configuració no estan encara definits

View File

@ -1,8 +1,6 @@
# Dolibarr language file - ca_ES - margins
CHARSET=UTF-8
Module59000Name=Marges
Module59000Desc=Gestió de marges comercials
Margin=Marge
Margins=Marges
TotalMargin=Marge total

View File

@ -74,10 +74,6 @@ OSTZ=Ζώνη Ώρας OS server
PHPTZ=Ζώνη Ώρας PHP server
PHPServerOffsetWithGreenwich=PHP server offset width Greenwich (seconds)
ClientOffsetWithGreenwich=Client/Browser offset width Greenwich (seconds)
CurrentHour=PHP server hour
CompanyTZ= Time Zone company (main company)
CompanyHour= Hour company (main company)
CurrentSessionTimeOut=Current session timeout
OSEnv=Περιβάλλον OS
Box=Πλαίσιο
Boxes=Πλαίσια

View File

@ -109,16 +109,16 @@ ParameterInDolibarr=Parameter %s
LanguageParameter=Language parameter %s
LanguageBrowserParameter=Parameter %s
LocalisationDolibarrParameters=Localisation parameters
ClientTZ=Time Zone client (user)
ClientHour=Hour client (user)
OSTZ=Time Zone OS server
PHPTZ=Time Zone PHP server
ClientTZ=Client Time Zone(user)
ClientHour=Client time(user)
OSTZ=Servre OS Time Zone
PHPTZ=PHP server Time Zone
PHPServerOffsetWithGreenwich=PHP server offset width Greenwich (seconds)
ClientOffsetWithGreenwich=Client/Browser offset width Greenwich (seconds)
DaylingSavingTime=Daylight saving time
CurrentHour=Hour PHP (server)
CompanyTZ= Time Zone company (main company)
CompanyHour= Hour company (main company)
CurrentHour=PHP Time (server)
CompanyTZ=Company Time Zone (main company)
CompanyHour=Company Time (main company)
CurrentSessionTimeOut=Current session timeout
OSEnv=OS Environment
Box=Box
@ -129,7 +129,7 @@ Position=Order
MenusDesc=Menus managers define content of the 2 menu bars (horizontal bar and vertical bar).
MenusEditorDesc=The menu editor allow you to define personalized entries in menus. Use it carefully to avoid making dolibarr unstable and menu entries permanently unreachable.<br>Some modules add entries in the menus (in menu <b>All</b> in most cases). If you removed some of these entries by mistake, you can restore them by disabling and reenabling the module.
MenuForUsers=Menu for users
LangFile=File .lang
LangFile=.lang file
System=System
SystemInfo=System information
SystemTools=System tools

View File

@ -20,6 +20,8 @@ SavingAccount=Savings account
SavingAccounts=Savings accounts
ErrorBankLabelAlreadyExists=Financial account label already exists
BankBalance=Balance
BankBalanceBefore=Balance before
BankBalanceAfter=Balance after
BalanceMinimalAllowed=Minimum allowed balance
BalanceMinimalDesired=Minimum desired balance
InitialBankBalance=Initial balance

View File

@ -377,7 +377,7 @@ SupplierCategory=Supplier category
JuridicalStatus200=Independant
DeleteFile=Delete file
ConfirmDeleteFile=Are you sure you want to delete this file?
AllocateCommercial=Allocate a commercial
AllocateCommercial=Assigned to sale representative
SelectCountry=Select a country
SelectCompany=Select a third party
Organization=Organization

View File

@ -123,6 +123,7 @@ ErrorNewValueCantMatchOldValue=New value can't be equal to old one
ErrorFailedToValidatePasswordReset=Failed to reinit password. May be the reinit was already done (this link can be used only one time). If not, try to restart the reinit process.
ErrorToConnectToMysqlCheckInstance=Connect to database fails. Check Mysql server is running (in most cases, you can launch it from command line with 'sudo /etc/init.d/mysql start').
ErrorFailedToAddContact=Failed to add contact
ErrorDateMustBeBeforeToday=The date can not be greater than today
# Warnings
WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined

View File

@ -140,6 +140,7 @@ ConfirmClone=Choose data you want to clone :
NoCloneOptionsSpecified=No data to clone defined.
Of=of
Go=Go
Run=Run
CopyOf=Copy of
Show=Show
ShowCardHere=Show card
@ -648,6 +649,8 @@ Element=Element
NoPhotoYet=No pictures available yet
HomeDashboard=Home summary
Deductible=Deductible
from=from
toward=toward
# Week day
Monday=Monday

View File

@ -1,8 +1,6 @@
# Dolibarr language file - en_US - marges
CHARSET=UTF-8
Module59000Name=Margins
Module59000Desc=Profit margins management
Margin=Margin
Margins=Margins
TotalMargin=Total Margin

View File

@ -106,9 +106,9 @@ NoteNotVisibleOnBill=Note (not visible on invoices, proposals...)
CreateCopy=Create copy
ServiceLimitedDuration=If product is a service with limited duration:
MultiPricesAbility=Activate the multi-prices
MultiPricesNumPrices=Number of price
MultiPricesNumPrices=Number of prices
MultiPriceLevelsName=Price categories
AssociatedProductsAbility=Activate the virtual products feature
AssociatedProductsAbility=Activate the virtual products feature
AssociatedProducts=Virtual product
AssociatedProductsNumber=Number of products composing this virtual product
ParentProductsNumber=Number of parent virtual product
@ -142,11 +142,11 @@ NoStockForThisProduct=No stock for this product
NoStock=No Stock
Restock=Restock
ProductSpecial=Special
QtyMin=Quantity minimum
QtyMin=Min. Order Qty.
PriceQty=Price for this quantity
PriceQtyMin=Price quantity min. (without discount)
PriceQtyMin=MOQ Price (w/o discount)
VATRateForSupplierProduct=VAT Rate (for this supplier/product)
DiscountQtyMin=Discount quantity min. (by default)
DiscountQtyMin=MOQ Discount (by default)
NoPriceDefinedForThisSupplier=No price/qty defined for this supplier/product
NoSupplierPriceDefinedForThisProduct=No supplier price/qty defined for this product
RecordedProducts=Products recorded
@ -159,7 +159,7 @@ ListProductServiceByPopularity=List of products/services by popularity
ListProductByPopularity=List of products by popularity
ListServiceByPopularity=List of services by popularity
Finished=Manufactured product
RowMaterial=First material
RowMaterial=Raw Material
CloneProduct=Clone product or service
ConfirmCloneProduct=Are you sure you want to clone product or service <b>%s</b> ?
CloneContentProduct=Clone all main informations of product/service
@ -172,8 +172,8 @@ CustomCode=Customs code
CountryOrigin=Origin country
HiddenIntoCombo=Hidden into select lists
Nature=Nature
ProductCodeModel=Product code model
ServiceCodeModel=Service code model
ProductCodeModel=Product code template
ServiceCodeModel=Service code template
AddThisProductCard=Create product card
HelpAddThisProductCard=This option allows you to create or clone a product if it does not exist.
AddThisServiceCard=Create service card

View File

@ -122,6 +122,7 @@ ErrorFailedToAddToMailmanList=Ha ocurrido un error al intentar añadir un regist
ErrorFailedToRemoveToMailmanList=Error en la eliminación de %s de la lista Mailmain %s o base SPIP
ErrorNewValueCantMatchOldValue=El nuevo valor no puede ser igual al antiguo
ErrorFailedToValidatePasswordReset=No se ha podido restablecer la contraseña. Es posible que este enlace ya se haya utilizado (este enlace sólo puede usarse una vez). Si no es el caso, trate de reiniciar el proceso de restablecimiento de contraseña desde el principio.
ErrorDateMustBeBeforeToday=La fecha no puede ser superior a hoy
# Warnings
WarningMandatorySetupNotComplete=Los parámetros obligatorios de configuración no están todavía definidos

View File

@ -1,8 +1,6 @@
# Dolibarr language file - es_ES - margins
CHARSET=UTF-8
Module59000Name=Márgenes
Module59000Desc=Gestión de márgenes comerciales
Margin=Margen
Margins=Márgenes
TotalMargin=Margen total

View File

@ -20,6 +20,8 @@ SavingAccount=Compte épargne
SavingAccounts=Comptes épargne/placements
ErrorBankLabelAlreadyExists=Libellé de compte financier déjà existant
BankBalance=Solde
BankBalanceBefore=Solde avant
BankBalanceAfter=Solde après
BalanceMinimalAllowed=Solde minimum autorisé
BalanceMinimalDesired=Solde minimum désiré
InitialBankBalance=Solde initial

View File

@ -140,7 +140,7 @@ SellsJournal=Journal des ventes
PurchasesJournal=Journal des achats
Journaux=Journaux
InvoiceRef=Réf facture
Piece=Piece compta
Piece=Pièce compta
DescSellsJournal=Journal des ventes
DescPurchasesJournal=Journal des achats
JournalNum=Journal

View File

@ -124,6 +124,7 @@ ErrorNewValueCantMatchOldValue=La nouvelle valeur ne peut être égale à l'anci
ErrorFailedToValidatePasswordReset=Echec de la réinitialisation du mot de passe. Il est possible que ce lien ait déjà été utilisé (l'utilisation de ce lien ne fonctionne qu'une fois). Si ce n'est pas le cas, essayer de recommencer le processus de réinit de mot de passe depuis le début.
ErrorToConnectToMysqlCheckInstance=Echec de la connection au serveur de base de donnée. Vérifier que Mysql est bien lancé (dans la plupart des cas, vous pouvez le lancer depuis la ligne de commande par la commande 'sudo /etc/init.d/mysql start').
ErrorFailedToAddContact=Echec à l'ajout du contact
ErrorDateMustBeBeforeToday=La date ne peut pas être supérieure à aujourd'hui
# Warnings
WarningMandatorySetupNotComplete=Les informations de configuration obligatoire doivent être renseignées

View File

@ -141,6 +141,7 @@ ConfirmClone=Veuillez choisir votre option de clonage :
NoCloneOptionsSpecified=Aucun option de clonage n'a été spécifiée.
Of=du
Go=Aller
Run=Lancer
CopyOf=Copie de
Show=Voir
ShowCardHere=Voir la fiche ici
@ -652,6 +653,8 @@ Element=Élément
NoPhotoYet=Pas de photo disponible pour l'instant
HomeDashboard=Synthèse accueil
Deductible=Déductible
from=de
toward=vers
# Week day
Monday=Lundi

View File

@ -1,8 +1,6 @@
# Dolibarr language file - fr_FR - margins
CHARSET=UTF-8
Module59000Name=Marges
Module59000Desc=Gestion des marges commerciales
Margin=Marge
Margins=Marges
TotalMargin=Marge totale

View File

@ -86,3 +86,4 @@ TaskRDVWith =Incontro con %s
TasksHistoryForThisContact =Storico del contatto
ToDoActions =Azioni da fare
ToDoActionsFor =Azioni da fare per %s
ThirdPartiesOfSaleRepresentative=Terze parti con responsabile commerciale

View File

@ -655,3 +655,4 @@ yes =sì
Yes =Sì
Yesterday =Ieri
YouCanChangeValuesForThisListFromDictionnarySetup =È possibile modificare i valori di questo elenco dal menu Impostazioni - Dizionario
LinkedToSpecificUsers=Con collegamento ad un utente specifico

View File

@ -62,7 +62,7 @@ NotOwnerOfProject=Non proprietario di questo progetto privato
OfficerProject =Responsabile del progetto
PrivateProject=Contatti di progetto
Progress=Progressi
ProjectContact=Progetto contatti
ProjectContact=Contatti
Project =Progetto
ProjectsArea =Sezione progetti
ProjectsDedicatedToThisThirdParty=I progetti dedicati a questo terzo

View File

@ -248,7 +248,6 @@ NoOtherDeliveryAddress=Ingen alternativ leveringsadresse lagt inn
JuridicalStatus200=Uavhengig
DeleteFile=Slett fil
ConfirmDeleteFile=Er du sikker på at du vil slette denne filen?
AllocateCommercial=Allocate a commercial
SelectCountry=Velg land
SelectCompany=Velg tredjepart
Organization=Organisasjon

View File

@ -247,10 +247,11 @@ CountryME = Montenegro
CountryBL = Saint Barthelemy
CountryMF = Saint Martin
##### Civilities ##### =
CivilityMME = Mej.
CivilityMR = Dhr.
CivilityMLE = Mevr.
CivilityMME = Mevrouw
CivilityMR = Meneer
CivilityMLE = Mejuffrouw
CivilityMTRE = Meester
CivilityDR = Dokter
##### Currencies ##### =
Currencyeuros = Euro
CurrencyAUD = Australische Dollars
@ -289,17 +290,17 @@ CurrencyXOF = Francs CFA BCEAO
CurrencySingXOF = Franc CFA BCEAO
CurrencyXPF = Francs CFP
CurrencySingXPF = Franc CFP
// START - Lines generated via autotranslator.php tool (2011-10-10 01:37:25).
// Reference language: en_US -> nl_NL
CurrencyUAH=Hryvnia
CurrencySingUAH=Hryvnia
DemandReasonTypeSRC_INTE=Internet
DemandReasonTypeSRC_CAMP_MAIL=Mailing campagne
DemandReasonTypeSRC_CAMP_EMAIL=E-mailen campagne
DemandReasonTypeSRC_CAMP_PHO=Telefoon campagne
DemandReasonTypeSRC_CAMP_FAX=Fax-campagne
DemandReasonTypeSRC_COMM=Commercieel contact
DemandReasonTypeSRC_SHOP=Winkel contact
// STOP - Lines generated via autotranslator.php tool (2011-10-10 01:39:55).
// START - Lines generated via autotranslator.php tool (2011-10-10 01:37:25).
// Reference language: en_US -> nl_NL
CurrencyUAH=Hryvnia
CurrencySingUAH=Hryvnia
DemandReasonTypeSRC_INTE=Internet
DemandReasonTypeSRC_CAMP_MAIL=Mailing campagne
DemandReasonTypeSRC_CAMP_EMAIL=E-mailen campagne
DemandReasonTypeSRC_CAMP_PHO=Telefoon campagne
DemandReasonTypeSRC_CAMP_FAX=Fax-campagne
DemandReasonTypeSRC_COMM=Commercieel contact
DemandReasonTypeSRC_SHOP=Winkel contact
// STOP - Lines generated via autotranslator.php tool (2011-10-10 01:39:55).

View File

@ -1,8 +1,6 @@
# Dolibarr language file - en_US - marges
CHARSET=UTF-8
Module59000Name=Oranlar
Module59000Desc=Kar oranı yönetimi
Margin=Oran
Margins=Oranlar
TotalMargin=Toplam Oran

File diff suppressed because it is too large Load Diff

View File

@ -823,9 +823,9 @@ if (! defined('NOREQUIREMENU'))
foreach($dirmenus as $dirmenu)
{
$menufound=dol_include_once($dirmenu."standard/".$file_menu);
if ($menufound) break;
if (class_exists('MenuManager')) break;
}
if (! $menufound) // If failed to include, we try with standard
if (! class_exists('MenuManager')) // If failed to include, we try with standard eldy_menu.php
{
dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING);
$file_menu='eldy_menu.php';
@ -987,7 +987,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
//$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jquerytreeview/jquery.treeview.css" />'."\n";
}
}
print '<!-- Includes CSS for Dolibarr theme -->'."\n";

View File

@ -25,10 +25,6 @@
* \ingroup societe
*/
error_reporting(E_ALL);
ini_set('display_errors', true);
ini_set('html_errors', false);
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';

View File

@ -557,6 +557,15 @@ img.login, img.printer, img.entity {
font-weight:bold;
}
.alogin {
color: #FFF;
font-weight: normal;
}
.alogin:hover {
color: #FFF;
text-decoration:underline;
}
div.login_main_home {
color: #000000;
}

View File

@ -596,6 +596,15 @@ div.login a:hover {
text-decoration:underline;
}
.alogin, .alogin:hover {
color: #888 !important;
font-weight: normal !important;
font-size: <?php echo $fontsizesmaller; ?>px !important;
}
.alogin:hover {
text-decoration:underline !important;
}
img.login, img.printer, img.entity {
padding: <?php echo ($conf->dol_optimize_smallscreen?'0':'8')?>px 0px 0px 0px;
margin: 0px 0px 0px 8px;

View File

@ -640,6 +640,15 @@ div.login a:hover {
text-decoration:underline;
}
.alogin, .alogin:hover {
color: #888 !important;
font-weight: normal !important;
font-size: <?php echo $fontsizesmaller; ?>px !important;
}
.alogin:hover {
text-decoration:underline !important;
}
img.login, img.printer, img.entity {
padding: <?php echo ($conf->dol_optimize_smallscreen?'0':'8')?>px 0px 0px 0px;
margin: 0px 0px 0px 8px;

View File

@ -651,6 +651,15 @@ div.login a:hover {
text-decoration:underline;
}
.alogin, .alogin:hover {
color: #888 !important;
font-weight: normal !important;
font-size: <?php echo $fontsizesmaller; ?>px !important;
}
.alogin:hover {
text-decoration:underline !important;
}
img.login, img.printer, img.entity {
padding: <?php echo ($conf->dol_optimize_smallscreen?'0':'8')?>px 0px 0px 0px;
margin: 0px 0px 0px 8px;

View File

@ -854,7 +854,14 @@ div.login a:hover {
color: #<?php echo $colortextmain; ?>;
text-decoration:underline;
}
.alogin, .alogin:hover {
color: #888 !important;
font-weight: normal !important;
font-size: <?php echo $fontsizesmaller; ?>px !important;
}
.alogin:hover {
text-decoration:underline !important;
}
img.login, img.printer, img.entity {
padding: <?php echo ($conf->dol_optimize_smallscreen?'0':'8')?>px 0px 0px 0px;
margin: 0px 0px 0px 8px;
@ -870,6 +877,8 @@ img.login, img.printer, img.entity {
div.vmenu, td.vmenu {
margin-<?php print $right; ?>: 2px;
position: relative;
float: left;
padding: 0px;
padding-bottom: 0px;
padding-top: 1px;

View File

@ -57,8 +57,7 @@ $action=GETPOST('action','alpha');
$original_file=GETPOST("file");
$modulepart=GETPOST('modulepart','alpha');
$urlsource=GETPOST("urlsource");
$entity=GETPOST('entity','int');
if ($entity == '') $entity=1; // For backward compatibility
$entity=GETPOST('entity')?GETPOST('entity','int'):$conf->entity;
// Security check
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
@ -98,9 +97,12 @@ else $type=dol_mimetype($original_file);
// Suppression de la chaine de caractere ../ dans $original_file
$original_file = str_replace("../","/", $original_file);
// Find the subdirectory name as the reference
$refname=basename(dirname($original_file)."/");
// Security check
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
$check_access = dol_check_secure_access_document($modulepart,$original_file,$entity);
$check_access = dol_check_secure_access_document($modulepart,$original_file,$entity,$refname);
$accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$original_file = $check_access['original_file'];

View File

@ -173,13 +173,16 @@ function getVersions($authentication)
}
/*
/**
* Method to get a document by webservice
* \param authentication array
* \param modulepart array Properties of document
*
*/
function getDocument($authentication, $modulepart, $file)
*
* @param array $authentication Array with permissions
* @param string $modulepart Properties of document
* @param string $file Relative path
* @param string $refname Ref of object to check permission for external users (autodetect if not provided)
* @return void
*/
function getDocument($authentication, $modulepart, $file, $refname='')
{
global $db,$conf,$langs,$mysoc;
@ -194,8 +197,8 @@ function getDocument($authentication, $modulepart, $file)
// Properties of doc
$original_file = $file;
$type=dol_mimetype($original_file);
$relativefilepath = $ref . "/";
$relativepath = $relativefilepath . $ref.'.pdf';
//$relativefilepath = $ref . "/";
//$relativepath = $relativefilepath . $ref.'.pdf';
$accessallowed=0;
@ -218,10 +221,10 @@ function getDocument($authentication, $modulepart, $file)
$original_file = str_replace("../","/", $original_file);
// find the subdirectory name as the reference
$refname=basename(dirname($original_file)."/");
if (empty($refname)) $refname=basename(dirname($original_file)."/");
// Security check
$check_access = dol_check_secure_access_document($modulepart,$original_file,$conf->entity);
$check_access = dol_check_secure_access_document($modulepart,$original_file,$conf->entity,$refname);
$accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$original_file = $check_access['original_file'];
@ -320,4 +323,4 @@ function getDocument($authentication, $modulepart, $file)
// Return the results.
$server->service($HTTP_RAW_POST_DATA);
?>
?>

View File

@ -0,0 +1,443 @@
#!/usr/bin/php
<?php
/*
* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file scripts/bank/export-bank-receipts.php
* \ingroup bank
* \brief Script file to export bank receipts into Excel files
*/
$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;
}
require_once($path."../../htdocs/master.inc.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.'/societe/class/societe.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/paiement/class/paiement.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.'/compta/bank/class/account.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.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
// Global variables
$version=DOL_VERSION;
$error=0;
/*
* Main
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") *****\n";
if (! isset($argv[3]) || ! $argv[3]) {
print "Usage: $script_file bank_ref bank_receipt_number (csv|tsv|excel|excel2007) [lang=xx_XX]\n";
exit;
}
$bankref=$argv[1];
$num=$argv[2];
$model=$argv[3];
$newlangid='en_EN'; // To force a new lang id
$invoicestatic=new Facture($db);
$invoicesupplierstatic=new FactureFournisseur($db);
$societestatic=new Societe($db);
$chargestatic=new ChargeSociales($db);
$memberstatic=new Adherent($db);
$paymentstatic=new Paiement($db);
$paymentsupplierstatic=new PaiementFourn($db);
$paymentsocialcontributionstatic=new PaymentSocialContribution($db);
$paymentvatstatic=new Tva($db);
$bankstatic=new Account($db);
$banklinestatic=new AccountLine($db);
// Parse parameters
foreach ($argv as $key => $value)
{
$found=false;
// Define options
if (preg_match('/^lang=/i',$value))
{
$found=true;
$valarray=explode('=',$value);
$newlangid=$valarray[1];
print 'Use language '.$newlangid.".\n";
}
}
$outputlangs = $langs;
if (! empty($newlangid))
{
if ($outputlangs->defaultlang != $newlangid)
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlangid);
}
}
$outputlangs->load("main");
$outputlangs->load("bills");
$outputlangs->load("companies");
$outputlangs->load("banks");
$outputlangs->load("members");
$outputlangs->load("compta");
$acct=new Account($db);
$result=$acct->fetch('',$bankref);
if ($result <= 0)
{
print "Failed to find bank account with ref ".$bankref.".\n";
exit;
}
else
{
print "Export for bank account ".$acct->ref." (".$acct->label.").\n";
}
// Creation de la classe d'export du model ExportXXX
$dir = DOL_DOCUMENT_ROOT . "/core/modules/export/";
$file = "export_".$model.".modules.php";
$classname = "Export".$model;
if (! dol_is_file($dir.$file))
{
print "No driver to export with format ".$model."\n";
exit;
}
require_once $dir.$file;
$objmodel = new $classname($db);
// Define target path
$dirname = $conf->banque->dir_temp;
$filename = 'export-bank-receipts-'.$bankref.'-'.$num.'.'.$objmodel->extension;
$array_fields=array(
'bankreceipt'=>$outputlangs->transnoentitiesnoconv("AccountStatementShort"), 'bankaccount'=>$outputlangs->transnoentitiesnoconv("BankAccount"),
'dateop'=>$outputlangs->transnoentitiesnoconv("DateOperationShort"),'dateval'=>$outputlangs->transnoentitiesnoconv("DateValueShort"),'type'=>$outputlangs->transnoentitiesnoconv("Type"),
'description'=>$outputlangs->transnoentitiesnoconv("Description"), 'thirdparty'=>$outputlangs->transnoentitiesnoconv("Tiers"), 'accountelem'=>$outputlangs->transnoentitiesnoconv("Piece"),
'debit'=>$outputlangs->transnoentitiesnoconv("Debit"), 'credit'=>$outputlangs->transnoentitiesnoconv("Credit"),
'soldbefore'=>$outputlangs->transnoentitiesnoconv("BankBalanceBefore"), 'soldafter'=>$outputlangs->transnoentitiesnoconv("BankBalanceAfter"),
'comment'=>$outputlangs->transnoentitiesnoconv("Comment")
);
$array_selected=array(
'bankreceipt'=>'bankreceipt', 'bankaccount'=>'bankaccount',
'dateop'=>'dateop','dateval'=>'dateval','type'=>'type',
'description'=>'description', 'thirdparty'=>'thirdparty', 'accountelem'=>'accountelem',
'debit'=>'debit', 'credit'=>'credit',
'soldbefore'=>'soldbefore','soldafter'=>'soldafter',
'comment'=>'comment'
);
$array_export_TypeFields=array(
'bankreceipt'=>'Text', 'bankaccount'=>'Text',
'dateop'=>'Date','dateval'=>'Date','type'=>'Text',
'description'=>'Text', 'thirdparty'=>'Text', 'accountelem'=>'Text',
'debit'=>'Number', 'credit'=>'Number',
'soldbefore'=>'Number','soldafter'=>'Number',
'comment'=>'Text'
);
// Recherche les ecritures pour le releve
$listofnum="'";
$arraynum=explode(',',$num);
foreach($arraynum as $val)
{
if ($listofnum != "'") $listofnum.="','";
$listofnum.=$val;
}
$listofnum.="'";
$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.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= ", ".MAIN_DB_PREFIX."bank as b";
$sql.= " WHERE b.num_releve IN (".$listofnum.")";
if (!isset($num)) $sql.= " OR b.num_releve is null";
$sql.= " AND b.fk_account = ".$acct->id;
$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
//print $sql;
$resql=$db->query($sql);
if ($resql)
{
$balancebefore=array();
$numrows = $db->num_rows($resql);
if ($numrows > 0)
{
// Open file
print 'Open file '.$filename.' into directory '.$dirname."\n";
dol_mkdir($dirname);
$result=$objmodel->open_file($dirname."/".$filename, $outputlangs);
if ($result < 0)
{
print 'Failed to create file '.$filename.' into dir '.$dirname.'.'."\n";
return -1;
}
// Genere en-tete
$objmodel->write_header($outputlangs);
// Genere ligne de titre
$objmodel->write_title($array_fields,$array_selected,$outputlangs,$array_export_TypeFields);
}
$i=0;
while ($i < $numrows)
{
$thirdparty='';
$accountelem='';
$comment='';
$objp = $db->fetch_object($resql);
// Calculate start balance
if (! isset($balancebefore[$objp->num_releve]))
{
print 'Calculate start balance for receipt '.$objp->num_releve."\n";
$sql2 = "SELECT sum(b.amount) as amount";
$sql2.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql2.= " WHERE b.num_releve < '".$db->escape($objp->num_releve)."'";
$sql2.= " AND b.fk_account = ".$objp->bankid;
$resql2=$db->query($sql2);
if ($resql2)
{
$obj2=$db->fetch_object($resql2);
$balancebefore[$objp->num_releve] = ($obj2->amount?$obj2->amount:0);
$db->free($resql2);
}
else
{
dol_print_error($db);
exit;
}
$total = $balancebefore[$objp->num_releve];
}
$totalbefore = $total;
$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;
/*
* 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']);
$tmparray=$paymentstatic->getBillsArray('');
foreach($tmparray as $key => $val)
{
$invoicestatic->fetch($val);
if ($accountelem) $accountelem.= ', ';
$accountelem.=$invoicestatic->ref;
}
}
elseif ($links[$key]['type']=='payment_supplier')
{
$paymentsupplierstatic->fetch($links[$key]['url_id']);
$tmparray=$paymentsupplierstatic->getBillsArray('');
foreach($tmparray as $key => $val)
{
$invoicesupplierstatic->fetch($val);
if ($accountelem) $accountelem.= ', ';
$accountelem.=$invoicesupplierstatic->ref;
}
}
elseif ($links[$key]['type']=='payment_sc')
{
$paymentsocialcontributionstatic->fetch($links[$key]['url_id']);
if ($accountelem) $accountelem.= ', ';
$accountelem.=$langs->transnoentitiesnoconv("SocialContribution").' '.$paymentsocialcontributionstatic->ref;
}
elseif ($links[$key]['type']=='payment_vat')
{
$paymentvatstatic->fetch($links[$key]['url_id']);
if ($accountelem) $accountelem.= ', ';
$accountelem.=$langs->transnoentitiesnoconv("VATPayments").' '.$paymentvatstatic->ref;
}
elseif ($links[$key]['type']=='banktransfert')
{
$comment=$outputlangs->transnoentitiesnoconv("Transfer");
if ($objp->amount > 0)
{
if ($comment) $comment.= ' ';
$banklinestatic->fetch($links[$key]['url_id']);
$bankstatic->id=$banklinestatic->fk_account;
$bankstatic->label=$banklinestatic->bank_account_label;
$comment.= ' ('.$langs->transnoentitiesnoconv("from").' ';
$comment.= $bankstatic->getNomUrl(1,'transactions');
$comment.= ' '.$langs->transnoentitiesnoconv("toward").' ';
$bankstatic->id=$objp->bankid;
$bankstatic->label=$objp->bankref;
$comment.= $bankstatic->getNomUrl(1,'');
$comment.= ')';
}
else
{
if ($comment) $comment.= ' ';
$bankstatic->id=$objp->bankid;
$bankstatic->label=$objp->bankref;
$comment.= ' ('.$langs->transnoentitiesnoconv("from").' ';
$comment.= $bankstatic->getNomUrl(1,'');
$comment.= ' '.$langs->transnoentitiesnoconv("toward").' ';
$banklinestatic->fetch($links[$key]['url_id']);
$bankstatic->id=$banklinestatic->fk_account;
$bankstatic->label=$banklinestatic->bank_account_label;
$comment.= $bankstatic->getNomUrl(1,'transactions');
$comment.= ')';
}
}
elseif ($links[$key]['type']=='company')
{
if ($thirdparty) $thirdparty.= ', ';
$thirdparty.= dol_trunc($links[$key]['label'],24);
$newline=0;
}
elseif ($links[$key]['type']=='member')
{
if ($thirdparty) $accountelem.= ', ';
$thirdparty.= $links[$key]['label'];
$newline=0;
}
/*elseif ($links[$key]['type']=='sc')
{
if ($accountelem) $accountelem.= ', ';
//$accountelem.= '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$links[$key]['url_id'].'">';
//$accountelem.= img_object($langs->transnoentitiesnoconv('ShowBill'),'bill').' ';
$accountelem.= $langs->transnoentitiesnoconv("SocialContribution");
//$accountelem.= '</a>';
$newline=0;
}
else
{
if ($accountelem) $accountelem.= ', ';
//$accountelem.= '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
$accountelem.= $links[$key]['label'];
//$accountelem.= '</a>';
$newline=0;
}*/
}
$debit=$credit='';
if ($objp->amount < 0)
{
$totald = $totald + abs($objp->amount);
$debit=price2num($objp->amount * -1);
}
else
{
$totalc = $totalc + abs($objp->amount);
$credit=price2num($objp->amount);
}
$i++;
$rec=new stdClass();
$rec->bankreceipt=$objp->num_releve;
$rec->bankaccount=$objp->banklabel;
$rec->dateop=dol_print_date($dateop,'dayrfc');
$rec->dateval=dol_print_date($datevalue,'dayrfc');
$rec->type=$objp->fk_type.' '.($objp->num_chq?$objp->num_chq:'');
$rec->description=$description;
$rec->thirdparty=$thirdparty;
$rec->accountelem=$accountelem;
$rec->debit=$debit;
$rec->credit=$credit;
$rec->sold=$sold;
$rec->comment=$comment;
$rec->soldbefore=price2num($totalbefore);
$rec->soldafter=price2num($total);
// end of special operation processing
$objmodel->write_record($array_selected,$rec,$outputlangs,$array_export_TypeFields);
}
if ($numrows > 0)
{
print "Found ".$numrows." records for receipt ".$num."\n";
// Genere en-tete
$objmodel->write_footer($outputlangs);
// Close file
$objmodel->close_file();
print 'File '.$filename.' was generated into dir '.$dirname.'.'."\n";
$ret=0;
}
else
{
print "No records found for receipt ".$num."\n";
$ret=0;
}
}
else
{
dol_print_error($db);
$ret=-1;
}
$db->close();
return $ret;
?>

View File

@ -40,8 +40,6 @@ if (! isset($argv[1]) || ! $argv[1]) {
}
$now=$argv[1];
// Recupere env dolibarr
$version='1.10';
require_once($path."../../htdocs/master.inc.php");
//require_once(PHP_WRITEEXCEL_PATH."/class.writeexcel_workbook.inc.php");
@ -51,8 +49,18 @@ require_once(PHPEXCEL_PATH."/PHPExcel.php");
//require_once(PHPEXCEL_PATH."/PHPExcel/Writer/Excel2007.php");
require_once(PHPEXCEL_PATH."/PHPExcel/Writer/Excel5.php");
// Global variables
$version=DOL_VERSION;
$error=0;
/*
* Main
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") *****\n";
$fname = DOL_DATA_ROOT.'/export-contacts.xls';
//$objPHPExcel = new writeexcel_workbook($fname);

View File

@ -40,18 +40,23 @@ if (! isset($argv[1]) || ! $argv[1]) {
}
$now=$argv[1];
// Recupere env dolibarr
$version='1.25';
require_once($path."../../htdocs/master.inc.php");
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/ldap.class.php");
// Global variables
$version=DOL_VERSION;
$error=0;
print "***** $script_file ($version) *****\n";
/*
* Main
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") *****\n";
print "Mails sending disabled (useless in batch mode)\n";
$conf->global->MAIN_DISABLE_ALL_MAILS=1; // On bloque les mails

View File

@ -55,20 +55,27 @@ $langs->load('main');
$langs->load('contracts');
// Global variables
$version=DOL_VERSION;
$error=0;
/*
* Main
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") *****\n";
$now=dol_now('tzserver');
$duration_value=$argv[2];
$error = 0;
print $script_file." launched with mode ".$mode.($duration_value?" delay=".$duration_value:"")."\n";
$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 .= ", ".MAIN_DB_PREFIX."contrat AS c";
$sql .= ", ".MAIN_DB_PREFIX."contratdet AS cd";
$sql .= ", ".MAIN_DB_PREFIX."contrat AS c";
$sql .= ", ".MAIN_DB_PREFIX."contratdet AS cd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product AS p ON p.rowid = cd.fk_product";
$sql .= " WHERE s.rowid = c.fk_soc AND c.rowid = cd.fk_contrat AND c.statut > 0 AND cd.statut<5";
@ -173,10 +180,10 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldcustomer,$dura
global $conf,$langs;
$newlangs=new Translate('',$conf);
$newlangs->setDefaultLang($userlang);
$newlangs->setDefaultLang(empty($userlang)?(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT):$userlang);
$newlangs->load("main");
$newlangs->load("contracts");
if ($duration_value)
$title=$newlangs->transnoentities("ListOfServicesToExpireWithDuration",$duration_value);
else

View File

@ -55,14 +55,21 @@ $langs->load('main');
$langs->load('contracts');
// Global variables
$version=DOL_VERSION;
$error=0;
/*
* Main
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") *****\n";
$now=dol_now('tzserver');
$duration_value=$argv[2];
$error = 0;
print $script_file." launched with mode ".$mode.($duration_value?" delay=".$duration_value:"")."\n";
$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";
@ -173,7 +180,7 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldsalerepresenta
global $conf,$langs;
$newlangs=new Translate('',$conf);
$newlangs->setDefaultLang($userlang);
$newlangs->setDefaultLang(empty($userlang)?(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT):$userlang);
$newlangs->load("main");
$newlangs->load("contracts");
@ -181,7 +188,7 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldsalerepresenta
$title=$newlangs->transnoentities("ListOfServicesToExpireWithDuration",$duration_value);
else
$title= $newlangs->transnoentities("ListOfServicesToExpire");
$subject = "[".(empty($conf->global->MAIN_APPLICATION_TITLE)?'Dolibarr':$conf->global->MAIN_APPLICATION_TITLE)."] ".$title;
$sendto = $oldemail;
$from = $conf->global->MAIN_MAIL_EMAIL_FROM;

View File

@ -59,10 +59,17 @@ 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."/cron/class/cronjob.class.php");
// Global variables
$version=DOL_VERSION;
$error=0;
/*
* Main
*/
/*
* Main
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") *****\n";
// Check security key
if ($key != $conf->global->CRON_KEY)

View File

@ -45,7 +45,19 @@ require_once ($path."../../htdocs/master.inc.php");
require_once (DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php");
$error = 0;
// Global variables
$version=DOL_VERSION;
$error=0;
/*
* Main
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") *****\n";
// We get list of emailing to process

View File

@ -36,9 +36,9 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
exit;
}
if (! isset($argv[1]) || ! $argv[1] || ! in_array($argv[1],array('test','confirm')))
if (! isset($argv[2]) || ! $argv[2] || ! in_array($argv[1],array('test','confirm')) || ! in_array($argv[2],array('thirdparties','contacts')))
{
print "Usage: $script_file [test|confirm] [delay]\n";
print "Usage: $script_file (test|confirm) (thirdparties|contacts) [delay]\n";
print "\n";
print "Send an email to customers to remind all unpaid customer invoices.\n";
print "If you choose 'test' mode, no emails are sent.\n";
@ -46,6 +46,7 @@ if (! isset($argv[1]) || ! $argv[1] || ! in_array($argv[1],array('test','confirm
exit;
}
$mode=$argv[1];
$targettype=$argv[2];
require($path."../../htdocs/master.inc.php");
@ -53,24 +54,37 @@ require_once (DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php");
$langs->load('main');
/*
* Main
*/
// Global variables
$version=DOL_VERSION;
$error=0;
/*
* Main
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") *****\n";
$now=dol_now('tzserver');
$duration_value=$argv[2];
$duration_value=isset($argv[3])?$argv[3]:-1;
$error = 0;
print $script_file." launched with mode ".$mode.($duration_value?" delay=".$duration_value:"")."\n";
print $script_file." launched with mode ".$mode.($duration_value>=0?" delay=".$duration_value:"")."\n";
$sql = "SELECT f.facnumber, f.total_ttc, f.date_lim_reglement as due_date, s.nom as name, s.email, s.default_lang";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE f.fk_statut != 0 AND f.paye = 0";
$sql .= " AND f.fk_soc = s.rowid";
if ($duration_value) $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_time_plus_duree($now, $duration_value, "d"))."'";
$sql .= " ORDER BY s.email ASC, s.rowid ASC"; // Order by email to allow one message per email
$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";
if ($targettype == 'contacts') $sql.= ", sp.rowid as cid, sp.firstname as cfirstname, sp.lastname as clastname, sp.email as cemail";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
if ($targettype == 'contacts') $sql.= ", ".MAIN_DB_PREFIX."socpeople as sp";
$sql.= " WHERE f.fk_statut != 0 AND f.paye = 0";
$sql.= " AND f.fk_soc = s.rowid";
if ($duration_value>=0) $sql.= " AND f.date_lim_reglement < '".$db->idate(dol_time_plus_duree($now, $duration_value, "d"))."'";
if ($targettype == 'contacts') $sql.= " AND s.rowid = sp.fk_soc";
$sql.= " ORDER BY";
if ($targettype == 'contacts') $sql.= " sp.email, sp.rowid,";
$sql.= " s.email ASC, s.rowid ASC, f.facnumber ASC"; // Order by email to allow one message per email
//print $sql;
$resql=$db->query($sql);
@ -78,10 +92,12 @@ if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$oldemail = 'none'; $olduid = 0; $oldlang='';
$oldemail = 'none'; $oldsid = 0; $oldcid = 0; $oldlang='';
$total = 0; $foundtoprocess = 0;
print "We found ".$num." couples (unpayed validated invoice - customer) qualified\n";
dol_syslog("We found ".$num." couples (unpayed validated invoice - customer) qualified");
$trackthirdpartiessent = array();
print "We found ".$num." couples (unpayed validated invoices-".$targettype.") qualified\n";
dol_syslog("We found ".$num." couples (unpayed validated invoices-".$targettype.") qualified");
$message='';
if ($num)
@ -90,36 +106,50 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
if (($obj->email <> $oldemail || $obj->uid <> $olduid) || $oldemail == 'none')
$newemail=empty($obj->cemail)?$obj->email:$obj->cemail;
// Check if this record is a break after previous one
$startbreak=false;
if ($newemail <> $oldemail || $oldemail == 'none') $startbreak=true;
if ($obj->sid && $obj->sid <> $oldsid) $startbreak=true;
if ($obj->cid && $obj->cid <> $oldcid) $startbreak=true;
if ($startbreak)
{
// Break onto sales representative (new email or uid)
if (dol_strlen($oldemail) && $oldemail != 'none')
// Break onto sales representative (new email or cid)
if (dol_strlen($oldemail) && $oldemail != 'none' && empty($trackthirdpartiessent[$oldsid.'|'.$oldemail]))
{
envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldcustomer);
envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldtarget);
$trackthirdpartiessent[$oldsid.'|'.$oldemail]='contact id '.$oldcid;
}
else
{
if ($oldemail != 'none') print "- No email sent for ".$oldcustomer.", total: ".$total."\n";
{
if ($oldemail != 'none')
{
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";
}
}
$oldemail = $obj->email;
$olduid = $obj->uid;
$oldemail = $newemail;
$oldsid = $obj->sid;
$oldcid = $obj->cid;
$oldlang = $obj->lang;
$oldcustomer=$obj->name;
$oldtarget=(empty($obj->cfirstname) && empty($obj->clastname))?$obj->name:($obj->clastname." ".$obj->cfirstname);
$message = '';
$total = 0;
$total = 0;
$foundtoprocess = 0;
$customer=$obj->name;
if (empty($obj->email)) print "Warning: Customer ".$customer." has no email. Notice disabled.\n";
$target=(empty($obj->cfirstname) && empty($obj->clastname))?$obj->name:($obj->clastname." ".$obj->cfirstname);
//if (empty($newemail)) print "Warning: Customer ".$target." has no email. Notice disabled.\n";
}
if (dol_strlen($oldemail))
if (dol_strlen($newemail))
{
$message .= $langs->trans("Invoice")." ".$obj->facnumber." : ".price($obj->total_ttc)." : ".$obj->name."\n";
dol_syslog("email_unpaid_invoices_to_customers.php: ".$obj->email);
$message .= $langs->trans("Invoice")." ".$obj->facnumber." : ".price($obj->total_ttc)."\n";
dol_syslog("email_unpaid_invoices_to_customers.php: ".$newemail." ".$message);
$foundtoprocess++;
}
print "Unpaid invoice ".$obj->facnumber.", price ".price2num($obj->total_ttc).", due date ".dol_print_date($db->jdate($obj->due_date),'day')." customer ".$obj->name.", email ".$obj->email.": ";
if (dol_strlen($obj->email)) print "qualified.";
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.";
else print "disqualified (no email).";
print "\n";
@ -131,13 +161,18 @@ if ($resql)
// Si il reste des envois en buffer
if ($foundtoprocess)
{
if (dol_strlen($oldemail) && $oldemail != 'none') // Break onto email (new email)
if (dol_strlen($oldemail) && $oldemail != 'none' && empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) // Break onto email (new email)
{
envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldcustomer);
envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldtarget);
$trackthirdpartiessent[$oldsid.'|'.$oldemail]='contact id '.$oldcid;
}
else
{
if ($oldemail != 'none') print "- No email sent for ".$oldcustomer.", total: ".$total."\n";
if ($oldemail != 'none')
{
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";
}
}
}
}
@ -157,19 +192,19 @@ else
* Send email
*
* @param string $mode Mode (test | confirm)
* @param string $oldemail Old email
* @param string $oldemail Target email
* @param string $message Message to send
* @param string $total Total amount of unpayed invoices
* @param string $userlang Code lang to use for email output.
* @param string $oldcustomer Old customer
* @param string $oldtarget Target name
* @return int <0 if KO, >0 if OK
*/
function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldcustomer)
function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldtarget)
{
global $conf,$langs;
$newlangs=new Translate('',$conf);
$newlangs->setDefaultLang($userlang);
$newlangs->setDefaultLang(empty($userlang)?(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT):$userlang);
$newlangs->load("main");
$newlangs->load("bills");
@ -179,7 +214,7 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldcustomer)
$errorsto = $conf->global->MAIN_MAIL_ERRORS_TO;
$msgishtml = 0;
print "- Send email for ".$oldcustomer."(".$oldemail."), total: ".$total."\n";
print "- Send email for '".$oldtarget."' (".$oldemail."), total: ".$total."\n";
dol_syslog("email_unpaid_invoices_to_customers.php: send mail to ".$oldemail);
$usehtml=0;

View File

@ -54,15 +54,23 @@ require_once (DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php");
$langs->load('main');
// Global variables
$version=DOL_VERSION;
$error=0;
/*
* Main
*/
$now=dol_now('tzserver');
$duration_value=$argv[2];
@set_time_limit(0);
print "***** ".$script_file." (".$version.") *****\n";
$error = 0;
print $script_file." launched with mode ".$mode.($duration_value?" delay=".$duration_value:"")."\n";
$now=dol_now('tzserver');
$duration_value=isset($argv[2])?$argv[2]:-1;
print $script_file." launched with mode ".$mode.($duration_value>=0?" delay=".$duration_value:"")."\n";
$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";
@ -71,10 +79,10 @@ $sql .= " , ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " , ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE f.fk_statut != 0 AND f.paye = 0";
$sql .= " AND f.fk_soc = s.rowid";
if ($duration_value) $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_time_plus_duree($now, $duration_value, "d"))."'";
if ($duration_value>=0) $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_time_plus_duree($now, $duration_value, "d"))."'";
$sql .= " AND sc.fk_soc = s.rowid";
$sql .= " AND sc.fk_user = u.rowid";
$sql .= " ORDER BY u.email ASC, s.rowid ASC"; // Order by email to allow one message per email
$sql .= " ORDER BY u.email ASC, s.rowid ASC, f.facnumber ASC"; // Order by email to allow one message per email
//print $sql;
$resql=$db->query($sql);
@ -138,10 +146,10 @@ if ($resql)
{
envoi_mail($mode,$oldemail,$message,$total,$oldlang,$oldsalerepresentative);
}
else
{
if ($oldemail != 'none') print "- No email sent for ".$oldsalerepresentative.", total: ".$total."\n";
}
else
{
if ($oldemail != 'none') print "- No email sent for ".$oldsalerepresentative.", total: ".$total."\n";
}
}
}
else
@ -172,11 +180,11 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldsalerepresenta
global $conf,$langs;
$newlangs=new Translate('',$conf);
$newlangs->setDefaultLang($userlang);
$newlangs->setDefaultLang(empty($userlang)?(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT):$userlang);
$newlangs->load("main");
$newlangs->load("bills");
$subject = "[".(empty($conf->global->MAIN_APPLICATION_TITLE)?'Dolibarr':$conf->global->MAIN_APPLICATION_TITLE)."] ".$newlangs->trans("ListOfYourUnpaidInvoices");
$subject = "[".(empty($conf->global->MAIN_APPLICATION_TITLE)?'Dolibarr':$conf->global->MAIN_APPLICATION_TITLE)."] ".$newlangs->transnoentities("ListOfYourUnpaidInvoices");
$sendto = $oldemail;
$from = $conf->global->MAIN_MAIL_EMAIL_FROM;
$errorsto = $conf->global->MAIN_MAIL_ERRORS_TO;
@ -196,7 +204,7 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldsalerepresenta
}
else
{
$allmessage.= "List of unpaid invoices".($usehtml?"<br>\n":"\n").($usehtml?"<br>\n":"\n");
$allmessage.= $newlangs->transnoentities("ListOfYourUnpaidInvoices").($usehtml?"<br>\n":"\n").($usehtml?"<br>\n":"\n");
$allmessage.= "Note: This list contains only invoices for third parties you are linked to as a sale representative.".($usehtml?"<br>\n":"\n");
}
$allmessage.= $message.($usehtml?"<br>\n":"\n");

View File

@ -46,11 +46,15 @@ require_once(DOL_DOCUMENT_ROOT.'/core/lib/invoice2.lib.php');
$langs->load("main");
// Global variables
$version='1.24';
$version=DOL_VERSION;
$error=0;
// -------------------- START OF YOUR CODE HERE --------------------
/*
* Main
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") *****\n";
@ -118,6 +122,11 @@ foreach ($argv as $key => $value)
$paymentdateafter=dol_stringtotime($argv[$key+1]);
$paymentdatebefore=dol_stringtotime($argv[$key+2]);
if (empty($paymentdateafter) || empty($paymentdatebefore))
{
print 'Error: Bad date format'."\n";
exit;
}
print 'Rebuild PDF for invoices with at least one payment between '.dol_print_date($paymentdateafter,'day')." and ".dol_print_date($paymentdatebefore,'day').".\n";
}
@ -130,7 +139,25 @@ foreach ($argv as $key => $value)
print 'Rebuild PDF for invoices with no payment done yet.'."\n";
}
if ($value == 'filter=nodeposit')
if ($value == 'filter=bank')
{
$found=true;
$option.=(empty($option)?'':'_').'bank_'.$argv[$key+1];
$filter[]='bank';
$paymentonbankref=$argv[$key+1];
$bankaccount=new Account($db);
$result=$bankaccount->fetch(0,$paymentonbankref);
if ($result <= 0)
{
print 'Error: Bank account with ref "'.$paymentonbankref.'" not found'."\n";
exit;
}
$paymentonbankid=$bankaccount->id;
print 'Rebuild PDF for invoices with at least one payment on financial account '.$bankaccount->ref."\n";
}
if ($value == 'filter=nodeposit')
{
$found=true;
$option.=(empty($option)?'':'_').'nodeposit';
@ -169,16 +196,21 @@ if (empty($option) && count($filter) <= 0)
exit;
}
// Check if there is no uncompatible choice
if (in_array('payments',$filter) && in_array('nopayment',$filter))
{
usage();
exit;
}
if (in_array('payments',$filter) && in_array('nopayment',$filter))
{
usage();
exit;
}
if (in_array('bank',$filter) && in_array('nopayment',$filter))
{
usage();
exit;
}
// Define SQL and SQL request to select invoices
// Use $filter, $dateafterdate, datebeforedate, $paymentdateafter, $paymentdatebefore
$result=rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, 1, $regenerate, $option);
$result=rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, 1, $regenerate, $option, $paymentonbankid);
@ -213,9 +245,11 @@ function usage()
print "Rebuild PDF files for some invoices and merge PDF files into one.\n";
print "\n";
print "To build/merge PDF for invoices in a date range:\n";
print "Usage: ".$script_file." filter=date dateafter datebefore [lang=langcode]\n";
print "Usage: ".$script_file." filter=date dateafter datebefore\n";
print "To build/merge PDF for invoices with at least one payment in a date range:\n";
print "Usage: ".$script_file." filter=payments dateafter datebefore [lang=langcode]\n";
print "Usage: ".$script_file." filter=payments dateafter datebefore\n";
print "To build/merge PDF for invoices with at least one payment onto a bank account:\n";
print "Usage: ".$script_file." filter=bank bankref\n";
print "To build/merge PDF for all invoices, use filter=all\n";
print "Usage: ".$script_file." filter=all\n";
print "To build/merge PDF for invoices with no payments, use filter=nopayment\n";
@ -224,9 +258,10 @@ function usage()
print "To exclude replacement invoices, use filter=noreplacement\n";
print "To exclude deposit invoices, use filter=nodeposit\n";
print "To regenerate existing PDF, use regenerate=crabe\n";
print "To generate invoices in a language, use lang=xx_XX\n";
print "\n";
print "Example: ".$script_file." filter=payments 20080101 20081231 lang=fr_FR regenerate=crabe\n";
print "Example: ".$script_file." filter=all lang=it_IT\n";
print "Example: ".$script_file." filter=all lang=en_US\n";
print "\n";
print "Note that some filters can be cumulated.\n";
}

View File

@ -34,21 +34,24 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
exit;
}
// Main
$version='1.11';
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
@set_time_limit(0);
$error=0;
require_once($path."../../htdocs/master.inc.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/ldap.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php");
$langs->load("main");
// Global variables
$version=DOL_VERSION;
$error=0;
print "***** $script_file ($version) *****\n";
/*
* Main
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") *****\n";
if (! isset($argv[1]) || ! $argv[1]) {
print "Usage: $script_file now\n";

View File

@ -34,22 +34,29 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
exit;
}
// Main
$version='1.14';
@set_time_limit(0);
$error=0;
$forcecommit=0;
require_once($path."../../htdocs/master.inc.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."/adherents/class/adherent.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/cotisation.class.php");
$langs->load("main");
$langs->load("errors");
$langs->load("errors");
// Global variables
$version=DOL_VERSION;
$error=0;
$forcecommit=0;
/*
* Main
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") *****\n";
// List of fields to get from LDAP
$required_fields = array(

View File

@ -40,17 +40,21 @@ if (! isset($argv[1]) || ! $argv[1]) {
}
$now=$argv[1];
// Recupere env dolibarr
$version='1.10';
require_once($path."../../htdocs/master.inc.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/ldap.class.php");
require_once(DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php");
// Global variables
$version=DOL_VERSION;
$error=0;
print "***** $script_file ($version) *****\n";
/*
* Main
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") *****\n";
/*
if (! $conf->global->LDAP_SYNCHRO_ACTIVE)

View File

@ -35,24 +35,29 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
exit;
}
require_once($path."../../htdocs/master.inc.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."/user/class/user.class.php");
require_once(DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php");
$langs->load("main");
$langs->load("errors");
// Global variables
$version=DOL_VERSION;
$error=0;
$forcecommit=0;
/*
* Main
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") *****\n";
// Main
$version='1.14';
@set_time_limit(0);
$error=0;
$forcecommit=0;
require_once($path."../../htdocs/master.inc.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."/user/class/user.class.php");
require_once(DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php");
$langs->load("main");
$langs->load("errors");
// List of fields to get from LDAP
$required_fields = array(
@ -136,11 +141,11 @@ if ($result >= 0)
$group->entity = $conf->entity;
//print_r($ldapgroup);
if($group->id > 0) { // Group update
print $langs->transnoentities("GroupUpdate").' # '.$key.': name='.$group->nom;
$res=$group->update();
if ($res > 0)
{
print ' --> Updated group id='.$group->id.' name='.$group->nom;
@ -154,7 +159,7 @@ if ($result >= 0)
} else { // Group creation
print $langs->transnoentities("GroupCreate").' # '.$key.': name='.$group->nom;
$res=$group->create();
if ($res > 0)
{
print ' --> Created group id='.$group->id.' name='.$group->nom;
@ -168,7 +173,7 @@ if ($result >= 0)
}
//print_r($group);
// Gestion des utilisateurs associés au groupe
// 1 - Association des utilisateurs du groupe LDAP au groupe Dolibarr
$userList = array();
@ -179,29 +184,29 @@ if ($result >= 0)
$userFilter = explode(',', $userdn);
$userKey = $ldap->getAttributeValues('('.$userFilter[0].')', $conf->global->LDAP_KEY_USERS);
if(!is_array($userKey)) continue;
$fuser = new User($db);
if($conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_SID) {
$fuser->fetch('','',$userKey[0]); // Chargement du user concerné par le SID
} else if($conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_LOGIN) {
$fuser->fetch('',$userKey[0]); // Chargement du user concerné par le login
}
$userList[$userdn] = $fuser;
} else {
$fuser = &$userList[$userdn];
}
$userIdList[$userdn] = $fuser->id;
// Ajout de l'utilisateur dans le groupe
if(!in_array($fuser->id, array_keys($group->members))) {
$fuser->SetInGroup($group->id, $group->entity);
echo $fuser->login.' added'."\n";
}
}
// 2 - Suppression des utilisateurs du groupe Dolibarr qui ne sont plus dans le groupe LDAP
foreach ($group->members as $guser) {
if(!in_array($guser->id, $userIdList)) {

View File

@ -40,17 +40,21 @@ if (! isset($argv[1]) || ! $argv[1]) {
}
$now=$argv[1];
// Recupere env dolibarr
$version='1.13';
require_once($path."../../htdocs/master.inc.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/ldap.class.php");
require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php");
// Global variables
$version=DOL_VERSION;
$error=0;
print "***** $script_file ($version) *****\n";
/*
* Main
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") *****\n";
/*
if (! $conf->global->LDAP_SYNCHRO_ACTIVE)

View File

@ -34,23 +34,27 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
exit;
}
require_once($path."../../htdocs/master.inc.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."/user/class/user.class.php");
$langs->load("main");
$langs->load("errors");
// Main
$version='1.14';
@set_time_limit(0);
// Global variables
$version=DOL_VERSION;
$error=0;
$forcecommit=0;
require_once($path."../../htdocs/master.inc.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."/user/class/user.class.php");
$langs->load("main");
$langs->load("errors");
/*
* Main
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") *****\n";
// List of fields to get from LDAP
$required_fields = array(
@ -178,7 +182,7 @@ if ($result >= 0)
foreach ($ldaprecords as $key => $ldapuser)
{
$fuser = new User($db);
if($conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_SID) {
$fuser->fetch('','',$ldapuser[$conf->global->LDAP_KEY_USERS]); // Chargement du user concerné par le SID
} else if($conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_LOGIN) {
@ -226,11 +230,11 @@ if ($result >= 0)
//if ($fuser->statut > 1) $fuser->statut=1;
//print_r($ldapuser);
if($fuser->id > 0) { // User update
print $langs->transnoentities("UserUpdate").' # '.$key.': login='.$fuser->login.', fullname='.$fuser->getFullName($langs);
$res=$fuser->update($user);
if ($res < 0)
{
$error++;
@ -243,7 +247,7 @@ if ($result >= 0)
} else { // User creation
print $langs->transnoentities("UserCreate").' # '.$key.': login='.$fuser->login.', fullname='.$fuser->getFullName($langs);
$res=$fuser->create($user);
if ($res > 0)
{
print ' --> Created user id='.$fuser->id.' login='.$fuser->login;
@ -256,7 +260,7 @@ if ($result >= 0)
}
print "\n";
//print_r($fuser);
// Gestion des groupes
// TODO : revoir la gestion des groupes (ou script de sync groupes)
/*if(!$error) {

View File

@ -34,16 +34,23 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
exit;
}
// Recupere env dolibarr
$version='1.6';
require_once($path."../../htdocs/master.inc.php");
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/class/bonprelevement.class.php");
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
require_once(DOL_DOCUMENT_ROOT."/compta/paiement/class/paiement.class.php");
$error = 0;
// Global variables
$version=DOL_VERSION;
$error=0;
/*
* Main
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") *****\n";
$datetimeprev = time();