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

This commit is contained in:
Laurent Destailleur 2015-04-02 11:42:29 +02:00
commit 52523effc8
19 changed files with 269 additions and 86 deletions

View File

@ -20,7 +20,7 @@
*/
/**
* \file htdocs/dev/generate-commande.php
* \file dev/initdata/generate-commande.php
* \brief Script de generation de donnees aleatoires pour les commandes
*/

View File

@ -19,7 +19,7 @@
*/
/**
* \file htdocs/dev/generate-facture.php
* \file dev/intdata/generate-facture.php
* \brief Script de generation de donnees aleatoires pour les factures
*/

View File

@ -20,7 +20,7 @@
*/
/**
* \file htdocs/dev/generate-produit.php
* \file dev/initdata/generate-produit.php
* \brief Script de generation de donnees aleatoires pour les produits
*/

View File

@ -20,7 +20,7 @@
*/
/**
* \file htdocs/dev/generate-propale.php
* \file dev/initdata/generate-propale.php
* \brief Script de generation de donnees aleatoires pour les propales
*/

View File

@ -20,8 +20,8 @@
*/
/**
* \file htdocs/dev/generate-societe.php
* \brief Script de generation de donnees aleatoires pour les societes
* \file dev/initdata/generate-societe.php
* \brief Script de generation de donnees aleatoires pour les societes
*/
// Test si mode batch
@ -89,7 +89,7 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
{
print "Company $s\n";
$soc = new Societe($db);
$soc->nom = "Company num ".time()."$s";
$soc->name = "Company num ".time()."$s";
$soc->town = $listoftown[rand(0, count($listoftown)-1)];
$soc->client = rand(1,2); // Une societe sur 2 est prospect, l'autre client
$soc->fournisseur = rand(0,1); // Une societe sur 2 est fournisseur
@ -101,7 +101,7 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
// Un client sur 3 a une remise de 5%
$user_remise=rand(1,3); if ($user_remise==3) $soc->remise_percent=5;
print "> client=".$soc->client.", fournisseur=".$soc->fournisseur.", remise=".$soc->remise_percent."\n";
$soc->note='Company created by the script generate-societe.php';
$soc->note_private = 'Company created by the script generate-societe.php';
$socid = $soc->create();
if ($socid >= 0)
@ -120,7 +120,7 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
}
}
print "Company ".$s." created nom=".$soc->nom."\n";
print "Company ".$s." created nom=".$soc->name."\n";
}
else
{

View File

@ -7427,7 +7427,7 @@ CREATE TABLE `llx_user` (
LOCK TABLES `llx_user` WRITE;
/*!40000 ALTER TABLE `llx_user` DISABLE KEYS */;
INSERT INTO `llx_user` VALUES (1,'2010-07-08 13:20:11','2012-12-12 16:54:10',NULL,NULL,'admin',0,NULL,NULL,NULL,'admin','21232f297a57a5a743894a0e4a801fc3',NULL,'SuperAdminName','Firstname','',NULL,'','','','bidon@destailleur.fr','',1,'','','',1,1,NULL,NULL,NULL,'','2014-12-21 20:52:09','2014-12-21 13:51:38',NULL,'',1,'01.jpg',NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(2,'2010-07-08 13:54:48','2010-07-08 09:54:48',NULL,NULL,'demo',1,NULL,NULL,NULL,'demo','fe01ce2a7fbac8fafaed7c982a04e229',NULL,'John','Doe',NULL,NULL,'09123123','','','johndoe@mycompany.com',NULL,0,'','','',1,1,NULL,NULL,NULL,'','2013-03-24 16:30:29','2010-07-08 14:12:02',NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(3,'2010-07-11 16:18:59','2013-02-20 18:07:21',NULL,NULL,'adupont',1,NULL,NULL,NULL,'adupont','00856ab2bbb748aa29aa335a6e3a2407',NULL,'Dupont','Alain','',NULL,'','','','toto@aa.com','',0,'','','',1,1,NULL,NULL,2,'','2012-12-21 17:38:55',NULL,NULL,'',1,NULL,NULL,NULL,2,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(4,'2013-01-23 17:52:27','2013-02-20 18:48:01',NULL,NULL,'aaa',1,NULL,NULL,NULL,'aaa','47bce5c74f589f4867dbd57e9ca9f808',NULL,'aaa','','',NULL,'','','','','',0,'','','',1,1,17,6,NULL,'','2013-02-25 10:18:41','2013-01-23 17:53:20',NULL,'',1,NULL,NULL,NULL,5,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(5,'2013-01-23 17:52:37','2013-01-23 15:52:37',NULL,NULL,'bbb',0,NULL,NULL,NULL,'bbb','08f8e0260c64418510cefb2b06eee5cd',NULL,'bbb','','',NULL,'','','','','',1,'','','',1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(6,'2013-02-16 20:22:40','2013-02-16 18:22:40',NULL,NULL,'aaab',2,NULL,NULL,NULL,'aaab','4c189b020ceb022e0ecc42482802e2b8',NULL,'aaab','','',NULL,'','','','','',0,'','','',1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(7,'2013-02-16 20:48:15','2013-02-16 18:48:15',NULL,NULL,'zzz',2,NULL,NULL,NULL,'zzz','f3abb86bd34cf4d52698f14c0da1dc60',NULL,'zzz','','',NULL,'','','','','',0,'','','',1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(9,'2013-02-16 20:50:07','2013-03-24 15:10:14',NULL,NULL,'zzzg',2,NULL,NULL,NULL,'jc28fg4h','93d789524fd223cf05eecea3f59cbe86',NULL,'zzzg','','',NULL,'','','','','fsdkkfsdf<br />\r\nfsdfsd<br />\r\n<strong>fsdfs</strong>',0,'','','',1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,5,NULL,'','','',NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `llx_user` VALUES (1,'2010-07-08 13:20:11','2012-12-12 16:54:10',NULL,NULL,'admin',0,NULL,NULL,NULL,'admin','21232f297a57a5a743894a0e4a801fc3',NULL,'SuperAdminName','Firstname','',NULL,'','','','bidon@destailleur.fr','',1,'','','',1,1,NULL,NULL,NULL,'','2014-12-21 20:52:09','2014-12-21 13:51:38',NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(2,'2010-07-08 13:54:48','2010-07-08 09:54:48',NULL,NULL,'demo',1,NULL,NULL,NULL,'demo','fe01ce2a7fbac8fafaed7c982a04e229',NULL,'John','Doe',NULL,NULL,'09123123','','','johndoe@mycompany.com',NULL,0,'','','',1,1,NULL,NULL,NULL,'','2013-03-24 16:30:29','2010-07-08 14:12:02',NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(3,'2010-07-11 16:18:59','2013-02-20 18:07:21',NULL,NULL,'adupont',1,NULL,NULL,NULL,'adupont','00856ab2bbb748aa29aa335a6e3a2407',NULL,'Dupont','Alain','',NULL,'','','','toto@aa.com','',0,'','','',1,1,NULL,NULL,2,'','2012-12-21 17:38:55',NULL,NULL,'',1,NULL,NULL,NULL,2,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(4,'2013-01-23 17:52:27','2013-02-20 18:48:01',NULL,NULL,'aaa',1,NULL,NULL,NULL,'aaa','47bce5c74f589f4867dbd57e9ca9f808',NULL,'aaa','','',NULL,'','','','','',0,'','','',1,1,17,6,NULL,'','2013-02-25 10:18:41','2013-01-23 17:53:20',NULL,'',1,NULL,NULL,NULL,5,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(5,'2013-01-23 17:52:37','2013-01-23 15:52:37',NULL,NULL,'bbb',0,NULL,NULL,NULL,'bbb','08f8e0260c64418510cefb2b06eee5cd',NULL,'bbb','','',NULL,'','','','','',1,'','','',1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(6,'2013-02-16 20:22:40','2013-02-16 18:22:40',NULL,NULL,'aaab',2,NULL,NULL,NULL,'aaab','4c189b020ceb022e0ecc42482802e2b8',NULL,'aaab','','',NULL,'','','','','',0,'','','',1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(7,'2013-02-16 20:48:15','2013-02-16 18:48:15',NULL,NULL,'zzz',2,NULL,NULL,NULL,'zzz','f3abb86bd34cf4d52698f14c0da1dc60',NULL,'zzz','','',NULL,'','','','','',0,'','','',1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(9,'2013-02-16 20:50:07','2013-03-24 15:10:14',NULL,NULL,'zzzg',2,NULL,NULL,NULL,'jc28fg4h','93d789524fd223cf05eecea3f59cbe86',NULL,'zzzg','','',NULL,'','','','','fsdkkfsdf<br />\r\nfsdfsd<br />\r\n<strong>fsdfs</strong>',0,'','','',1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,5,NULL,'','','',NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL);
/*!40000 ALTER TABLE `llx_user` ENABLE KEYS */;
UNLOCK TABLES;

View File

@ -78,6 +78,16 @@ if ($negpage)
$object = new Account($db);
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$paiementtype="";
$req_nb="";
$thirdparty="";
$req_desc="";
$req_debit="";
$req_credit="";
}
/*
* Action
*/
@ -446,7 +456,10 @@ if ($id > 0 || ! empty($ref))
print '<td align="right"><input type="text" class="flat" name="req_debit" value="'.$req_debit.'" size="4"></td>';
print '<td align="right"><input type="text" class="flat" name="req_credit" value="'.$req_credit.'" size="4"></td>';
print '<td align="center">&nbsp;</td>';
print '<td align="center" width="40"><input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>';
print '<td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print "</tr>\n";

View File

@ -111,8 +111,12 @@ foreach ($accounts as $key=>$type)
if ($acc->rappro)
{
$result=$acc->load_board($user,$acc->id);
print $acc->nbtodo;
if ($acc->nbtodolate) print ' ('.$acc->nbtodolate.img_warning($langs->trans("Late")).')';
if ($result<0) {
setEventMessage($acc->error, 'errors');
} else {
print $result->nbtodo;
if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
}
}
else print $langs->trans("FeatureDisabled");
print '</td>';
@ -223,8 +227,12 @@ foreach ($accounts as $key=>$type)
if ($acc->rappro)
{
$result=$acc->load_board($user,$acc->id);
print $acc->nbtodo;
if ($acc->nbtodolate) print ' ('.$acc->nbtodolate.img_warning($langs->trans("Late")).')';
if ($result<0) {
setEventMessage($acc->error, 'errors');
} else {
print $result->nbtodo;
if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
}
}
else print $langs->trans("FeatureDisabled");
print '</td>';

View File

@ -1,5 +0,0 @@
<a href="index.php">Go back to index</a>
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
<br><br>
<?php phpinfo(); ?>

123
htdocs/contact/document.php Normal file
View File

@ -0,0 +1,123 @@
<?php
/* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.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
* 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 htdocs/contact/document.php
* \ingroup contact
* \brief Page with attached files on contact
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
$langs->load("other");
$langs->load("companies");
$langs->load("contact");
$id = GETPOST('id','int');
$action = GETPOST("action");
$confirm = GETPOST('confirm', 'alpha');
// Security check
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contact', $id, '','');
// Get parameters
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if ($page == -1) {
$page = 0;
}
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name";
$object = new Contact($db);
if ($id > 0) $object->fetch($id);
$upload_dir = $conf->societe->dir_output.'/contact/'.dol_sanitizeFileName($object->ref);
$modulepart='contact';
/*
* Actions
*/
include DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
/*
* View
*/
$form = new Form($db);
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader("",$langs->trans("Contact"), $helpurl);
if ($object->id)
{
$head = contact_prepare_head($object, $user);
dol_fiche_head($head, 'documents', $langs->trans("Contact"), 0, 'contact');
// Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$totalsize=0;
foreach($filearray as $key => $file)
{
$totalsize+=$file['size'];
}
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object, 'id', $linkback);
print '</td></tr>';
// Name
print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td width="30%">'.$object->lastname.'</td>';
print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="30%">'.$object->firstname.'</td></tr>';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>';
print '</div>';
$modulepart = 'contact';
$permission = $user->rights->societe->contact->creer;
$param = '&id=' . $object->id;
include DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
} else {
print $langs->trans("ErrorUnknown");
}
llxFooter();
$db->close();

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.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
@ -32,62 +33,75 @@ function contact_prepare_head(Contact $object)
{
global $langs, $conf, $user;
$h = 0;
$tab = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/contact/card.php?id='.$object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
$head[$tab][0] = DOL_URL_ROOT.'/contact/card.php?id='.$object->id;
$head[$tab][1] = $langs->trans("Card");
$head[$tab][2] = 'card';
$tab++;
if (! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_CONTACT_ACTIVE))
{
$langs->load("ldap");
$head[$h][0] = DOL_URL_ROOT.'/contact/ldap.php?id='.$object->id;
$head[$h][1] = $langs->trans("LDAPCard");
$head[$h][2] = 'ldap';
$h++;
$head[$tab][0] = DOL_URL_ROOT.'/contact/ldap.php?id='.$object->id;
$head[$tab][1] = $langs->trans("LDAPCard");
$head[$tab][2] = 'ldap';
$tab++;
}
$head[$h][0] = DOL_URL_ROOT.'/contact/perso.php?id='.$object->id;
$head[$h][1] = $langs->trans("PersonalInformations");
$head[$h][2] = 'perso';
$h++;
$head[$tab][0] = DOL_URL_ROOT.'/contact/perso.php?id='.$object->id;
$head[$tab][1] = $langs->trans("PersonalInformations");
$head[$tab][2] = 'perso';
$tab++;
$head[$h][0] = DOL_URL_ROOT.'/contact/exportimport.php?id='.$object->id;
$head[$h][1] = $langs->trans("ExportImport");
$head[$h][2] = 'exportimport';
$h++;
$head[$tab][0] = DOL_URL_ROOT.'/contact/exportimport.php?id='.$object->id;
$head[$tab][1] = $langs->trans("ExportImport");
$head[$tab][2] = 'exportimport';
$tab++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'contact');
complete_head_from_modules($conf,$langs,$object,$head,$tab,'contact');
// Notes
$head[$h][0] = DOL_URL_ROOT.'/contact/note.php?id='.$object->id;
$head[$h][1] = $langs->trans("Note");
$head[$h][2] = 'note';
$h++;
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
$nbNote = (empty($object->note_private)?0:1)+(empty($object->note_public)?0:1);
$head[$tab][0] = DOL_URL_ROOT.'/contact/note.php?id='.$object->id;
$head[$tab][1] = $langs->trans("Note");
if($nbNote > 0) $head[$tab][1].= ' <span class="badge">'.$nbNote.'</span>';
$head[$tab][2] = 'note';
$tab++;
}
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$upload_dir = $conf->societe->dir_output . "/contact/" . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
$head[$tab][0] = DOL_URL_ROOT.'/contact/document.php?id='.$object->id;
$head[$tab][1] = $langs->trans("Documents");
if($nbFiles > 0) $head[$tab][1].= ' <span class="badge">'.$nbFiles.'</span>';
$head[$tab][2] = 'documents';
$tab++;
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
{
$type = 4;
$head[$h][0] = DOL_URL_ROOT.'/categories/categorie.php?id='.$object->id."&type=".$type;
$head[$h][1] = $langs->trans('Categories');
$head[$h][2] = 'category';
$h++;
$head[$tab][0] = DOL_URL_ROOT.'/categories/categorie.php?id='.$object->id."&type=".$type;
$head[$tab][1] = $langs->trans('Categories');
$head[$tab][2] = 'category';
$tab++;
}
// Info
$head[$h][0] = DOL_URL_ROOT.'/contact/info.php?id='.$object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
$head[$tab][0] = DOL_URL_ROOT.'/contact/info.php?id='.$object->id;
$head[$tab][1] = $langs->trans("Info");
$head[$tab][2] = 'info';
$tab++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'contact','remove');
complete_head_from_modules($conf,$langs,$object,$head,$tab,'contact','remove');
return $head;
}

View File

@ -57,7 +57,7 @@ function tax_prepare_head(ChargeSociales $object)
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
$head[$h][0] = DOL_URL_ROOT.'/compta/sociales/document.php?id='.$object->id;
$head[$h][1] = $langs->trans("Documents");
if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')';
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
$head[$h][2] = 'documents';
$h++;

View File

@ -119,6 +119,7 @@ class InterfaceDemo extends DolibarrTriggers
case 'ORDER_CLONE':
case 'ORDER_VALIDATE':
case 'ORDER_DELETE':
case 'ORDER_CANCEL':
case 'ORDER_SENTBYMAIL':
case 'ORDER_CLASSIFY_BILLED':
case 'LINEORDER_INSERT':

View File

@ -106,7 +106,7 @@ if ($action == 'update')
$object->email = GETPOST("email");
$object->date = $donation_date;
$object->public = GETPOST("public");
$object->fk_project = GETPOST("fk_project");
$object->fk_projet = GETPOST("fk_projet");
$object->note_private= GETPOST("note_private");
$object->note_public = GETPOST("note_public");
@ -161,7 +161,7 @@ if ($action == 'add')
$object->note_private= GETPOST("note_private");
$object->note_public = GETPOST("note_public");
$object->public = GETPOST("public");
$object->fk_project = GETPOST("fk_project");
$object->fk_projet = GETPOST("fk_projet");
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
@ -343,7 +343,7 @@ if ($action == 'create')
$formproject=new FormProjets($db);
print "<tr><td>".$langs->trans("Project")."</td><td>";
$formproject->select_projects(-1, GETPOST("fk_project"),'fk_project', 0, 1, 0, 1);
$formproject->select_projects(-1, GETPOST("fk_projet"),'fk_projet', 0, 1, 0, 1);
print "</td></tr>\n";
}
@ -459,7 +459,7 @@ if (! empty($id) && $action == 'edit')
$langs->load('projects');
print '<tr><td>'.$langs->trans('Project').'</td><td>';
$formproject->select_projects(-1, $object->fk_project,'fk_project', 0, 1, 0, 1);
$formproject->select_projects(-1, $object->fk_projet,'fk_projet', 0, 1, 0, 1);
print '</td></tr>';
}

View File

@ -54,7 +54,7 @@ class Don extends CommonObject
var $country;
var $email;
var $public;
var $fk_project;
var $fk_projet;
var $modepaiement;
var $modepaiementid;
var $note_private;
@ -337,7 +337,7 @@ class Don extends CommonObject
// $sql.= ", country"; -- Deprecated
$sql.= ", fk_country";
$sql.= ", public";
$sql.= ", fk_project";
$sql.= ", fk_projet";
$sql.= ", note_private";
$sql.= ", note_public";
$sql.= ", fk_user_author";
@ -359,7 +359,7 @@ class Don extends CommonObject
$sql.= ", '".$this->db->escape($this->town)."'";
$sql.= ", ".$this->country_id;
$sql.= ", ".$this->public;
$sql.= ", ".($this->fk_project > 0?$this->fk_project:"null");
$sql.= ", ".($this->fk_projet > 0?$this->fk_projet:"null");
$sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
$sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
$sql.= ", ".$user->id;
@ -455,7 +455,7 @@ class Don extends CommonObject
$sql .= ",town='".$this->db->escape($this->town)."'";
$sql .= ",fk_country = ".$this->country_id;
$sql .= ",public=".$this->public;
$sql .= ",fk_project=".($this->fk_project>0?$this->fk_project:'null');
$sql .= ",fk_projet=".($this->fk_projet>0?$this->fk_projet:'null');
$sql .= ",note_private=".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
$sql .= ",note_public=".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
$sql .= ",datedon='".$this->db->idate($this->date)."'";
@ -601,11 +601,11 @@ class Don extends CommonObject
$sql = "SELECT d.rowid, d.datec, d.tms as datem, d.datedon,";
$sql.= " d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, ";
$sql.= " d.fk_country, d.country as country_olddata, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, cp.libelle, d.email, d.phone, ";
$sql.= " d.phone_mobile, d.fk_project,";
$sql.= " d.phone_mobile, d.fk_projet,";
$sql.= " p.title as project_label,";
$sql.= " c.code as country_code, c.label as country";
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = d.fk_project";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = d.fk_projet";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON cp.id = d.fk_payment";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.fk_country = c.rowid";
if (! empty($id))
@ -647,7 +647,7 @@ class Don extends CommonObject
$this->phone = $obj->phone;
$this->phone_mobile = $obj->phone_mobile;
$this->project = $obj->project_label;
$this->fk_project = $obj->fk_project;
$this->fk_projet = $obj->fk_projet;
$this->public = $obj->public;
$this->modepaymentid = $obj->fk_payment;
$this->modepayment = $obj->libelle;
@ -677,8 +677,8 @@ class Don extends CommonObject
/**
* Validate a promise of donation
*
* @param int $id id of donation
* @param int $userid User who validate the promise
* @param int $id id of donation
* @param int $userid User who validate the donation/promise
* @return int <0 if KO, >0 if OK
*/
function valid_promesse($id, $userid)
@ -706,10 +706,10 @@ class Don extends CommonObject
}
/**
* Classe le don comme paye, le don a ete recu
* Classify the donation as paid, the donation was received
*
* @param int $id id du don a modifier
* @param int $modepaiement mode de paiement
* @param int $id id of donation
* @param int $modepayment mode de payment
* @return int <0 if KO, >0 if OK
*/
function set_paid($id, $modepaiement='')
@ -741,7 +741,7 @@ class Don extends CommonObject
}
/**
* Set donation to status canceled
* Set donation to status cancelled
*
* @param int $id id of donation
* @return int <0 if KO, >0 if OK

View File

@ -73,7 +73,7 @@ $sql = "SELECT d.rowid, d.datedon, d.firstname, d.lastname, d.societe,";
$sql.= " d.amount, d.fk_statut as statut, ";
$sql.= " p.rowid as pid, p.ref, p.title, p.public";
$sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p";
$sql.= " ON p.rowid = d.fk_project WHERE 1 = 1";
$sql.= " ON p.rowid = d.fk_projet WHERE 1 = 1";
if ($statut >= 0)
{
$sql .= " AND d.fk_statut = ".$statut;
@ -125,7 +125,7 @@ if ($resql)
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
print_liste_field_titre($langs->trans("Project"),$_SERVER["PHP_SELF"],"fk_project","&page=$page&statut=$statut","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Project"),$_SERVER["PHP_SELF"],"fk_projet","&page=$page&statut=$statut","","",$sortfield,$sortorder);
}
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"d.amount","&page=$page&statut=$statut","",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.fk_statut","&page=$page&statut=$statut","",'align="right"',$sortfield,$sortorder);

View File

@ -425,7 +425,7 @@ ALTER TABLE llx_societe_extrafields ADD UNIQUE INDEX uk_societe_extrafields (fk_
ALTER TABLE llx_don ADD COLUMN fk_country integer NOT NULL after country;
ALTER TABLE llx_don CHANGE COLUMN fk_paiement fk_payment integer;
ALTER TABLE llx_don ADD COLUMN paid smallint default 0 NOT NULL after fk_payment;
ALTER TABLE llx_don CHANGE COLUMN fk_don_projet fk_project integer NULL;
ALTER TABLE llx_don CHANGE COLUMN fk_don_projet fk_projet integer NULL;
create table llx_don_extrafields
(

View File

@ -27,8 +27,8 @@ create table llx_don
entity integer DEFAULT 1 NOT NULL, -- multi company id
tms timestamp,
fk_statut smallint NOT NULL DEFAULT 0, -- Status of donation promise or validate
datec datetime, -- date de creation de l'enregistrement
datedon datetime, -- date du don/promesse
datec datetime, -- Create date
datedon datetime, -- Date of the donation/promise
amount real DEFAULT 0,
fk_payment integer,
paid smallint default 0 NOT NULL,
@ -44,7 +44,7 @@ create table llx_don
phone varchar(24),
phone_mobile varchar(24),
public smallint DEFAULT 1 NOT NULL, -- Donation is public ? (0,1)
fk_project integer NULL, -- Donation is given for a project ?
fk_projet integer NULL, -- Donation is given for a project ?
fk_user_author integer NOT NULL,
fk_user_valid integer NULL,
note_private text,

View File

@ -254,9 +254,10 @@ $listofreferent=array(
'name'=>"Donation",
'title'=>"ListDonationsAssociatedProject",
'class'=>'Don',
'margin'=>'add',
'table'=>'don',
'datefieldname'=>'date',
'disableamount'=>1,
'disableamount'=>0,
'test'=>$conf->don->enabled && $user->rights->don->lire),
);
@ -344,7 +345,7 @@ foreach ($listofreferent as $key => $value)
print '<td width="100" align="center">'.$langs->trans("Date").'</td>';
// Thirdparty or user
print '<td>';
if ($tablename == 'expensereport_det') print $langs->trans("User");
if ($tablename == 'expensereport_det' || 'don') print $langs->trans("User");
else print $langs->trans("ThirdParty");
print '</td>';
if (empty($value['disableamount'])) print '<td align="right" width="120">'.$langs->trans("AmountHT").'</td>';
@ -461,15 +462,26 @@ foreach ($listofreferent as $key => $value)
$tmpuser=new User($db);
$tmpuser->fetch($expensereport->fk_user_author);
print $tmpuser->getNomUrl(1,'',48);
}
else if ($tablename == 'don')
{
$tmpuser2=new User($db);
$tmpuser2->fetch($don->fk_user_author);
print $tmpuser2->getNomUrl(1,'',48);
}
print '</td>';
// Amount without tax
if (empty($value['disableamount']))
{
if ($tablename == 'don') $total_ht_by_line=$element->amount;
else
{
$total_ht_by_line=$element->total_ht;
}
print '<td align="right">';
if (! $qualifiedfortotal) print '<strike>';
print (isset($element->total_ht)?price($element->total_ht):'&nbsp;');
print (isset($total_ht_by_line)?price($total_ht_by_line):'&nbsp;');
if (! $qualifiedfortotal) print '</strike>';
print '</td>';
}
@ -478,9 +490,14 @@ foreach ($listofreferent as $key => $value)
// Amount inc tax
if (empty($value['disableamount']))
{
if ($tablename == 'don') $total_ttc_by_line=$element->amount;
else
{
$total_ttc_by_line=$element->total_ttc;
}
print '<td align="right">';
if (! $qualifiedfortotal) print '<strike>';
print (isset($element->total_ttc)?price($element->total_ttc):'&nbsp;');
print (isset($total_ttc_by_line)?price($total_ttc_by_line):'&nbsp;');
if (! $qualifiedfortotal) print '</strike>';
print '</td>';
}
@ -496,11 +513,11 @@ foreach ($listofreferent as $key => $value)
if ($qualifiedfortotal)
{
$total_ht = $total_ht + $element->total_ht;
$total_ttc = $total_ttc + $element->total_ttc;
$total_ht = $total_ht + $total_ht_by_line;
$total_ttc = $total_ttc + $total_ttc_by_line;
$total_ht_by_third += $element->total_ht;
$total_ttc_by_third += $element->total_ttc;
$total_ht_by_third += $total_ht_by_line;
$total_ttc_by_third += $total_ttc_by_line;
}
if (canApplySubtotalOn($tablename))
@ -619,9 +636,21 @@ foreach ($listofreferent as $key => $value)
{
$element->fetch($elementarray[$i]);
if ($tablename != 'expensereport_det') $element->fetch_thirdparty();
if ($tablename == 'don') $total_ht_by_line=$element->amount;
else
{
$total_ht_by_line=$element->total_ht;
}
$total_ht = $total_ht + $element->total_ht;
$total_ttc = $total_ttc + $element->total_ttc;
$total_ht = $total_ht + $total_ht_by_line;
if ($tablename == 'don') $total_ttc_by_line=$element->amount;
else
{
$total_ttc_by_line=$element->total_ttc;
}
$total_ttc = $total_ttc + $total_ttc_by_line;
}
// Calculate margin