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

develop

Conflicts:
	htdocs/expensereport/card.php
	htdocs/projet/element.php
This commit is contained in:
Laurent Destailleur 2015-06-23 18:34:39 +02:00
commit 040a643ee9
308 changed files with 43116 additions and 34513 deletions

16
.dockerignore Normal file
View File

@ -0,0 +1,16 @@
build
build.xml
ChangeLog
composer.json
CONTRIBUTING.md
COPYING
COPYRIGHT
dev
doc
Dockerfile
INSTALL
README-FR.md
README.md
robots.txt
scripts
test

View File

@ -24,6 +24,7 @@ odtPHP 1.0.1 GPL-2+ b Yes
PHPExcel 1.8.0 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
php-iban 1.4.6 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
Restler 3.0 LGPL-3+ Yes Library to develop REST Web services
TCPDF 6.2.6 LGPL-3+ Yes PDF generation
JS libraries:
@ -47,6 +48,7 @@ jQuery TableDnD 0.6 GPL and MIT License Yes
jQuery Timepicker 1.1.0 GPL and MIT License Yes JS library Timepicker addon for Datepicker
jQuery Tiptip 1.3 GPL and MIT License Yes JS library for tooltips
jsGantt 1.2 BSD License Yes JS library (to build Gantt reports)
JsTimezoneDetect 1.0.4 MIT Licence Yes JS library to detect user timezone
For licenses compatibility informations:
http://www.fsf.org/licensing/licenses/index_html

View File

@ -25,6 +25,7 @@ For users:
- [ task #1793 ] Create new permission to restrict commercial agent margin to logged user.
- Add experimental module ask supplier price to request supplier quotation.
- Add experimental module batch management.
- Fix: Corrected user timezone detection
For translators:
- Update language files.
@ -43,6 +44,12 @@ Dolibarr better:
- All fields "fk_societe" were renamed into "fk_soc".
- Method select_PriceBaseType and load_PriceBaseType were merged into selectPriceBaseType
***** ChangeLog for 3.7.2 compared to 3.7.1 *****
FIX [ bug #2855 ] Wrong translation key in localtax report page
FIX [ bug #1852 ] JS error when editing a customer order line
FIX [ bug #2900 ] Courtesy title is not stored in create thirdparty form
***** ChangeLog for 3.7.1 compared to 3.7.* *****
FIX Bug in the new photo system
FIX Error management
@ -297,6 +304,7 @@ Dolibarr better:
- Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme
- Fix: [ bug #2542 ] Contracts store localtax preferences
- Fix: Bad permission assignments for stock movements actions
- Fix: [ bug #2891 ] Category hooks do not work
***** ChangeLog for 3.6.2 compared to 3.6.1 *****
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
@ -471,6 +479,11 @@ Fix: [ bug #2577 ] Incorrect invoice status in "Linked objects" page of a projec
Fix: [ bug #2576 ] Unable to edit a dictionary entry that has # in its ref
Fix: [ bug #2758 ] Product::update sets product note to "null" when $prod->note is null
Fix: [ bug #2757 ] Deleting product category photo gives "Forbidden access" error
Fix: [ bug #2976 ] "Report" tab is the current tab but it is not marked as selected by the UI
Fix: [ bug #2861 ] Undefined variable $res when migrating
Fix: [ bug #2837 ] Product list table column header does not match column body
Fix: [ bug #2835 ] Customer prices of a product shows incorrect history order
Fix: [ bug #2814 ] JPEG photos are not displayed in Product photos page
***** ChangeLog for 3.5.6 compared to 3.5.5 *****
Fix: Avoid missing class error for fetch_thirdparty method #1973

14
Dockerfile Normal file
View File

@ -0,0 +1,14 @@
FROM php:5.6-apache
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-install gd
RUN docker-php-ext-install mysqli
COPY htdocs/ /var/www/html/
RUN chown -hR www-data:www-data /var/www/html
EXPOSE 80

View File

@ -489,6 +489,7 @@ if ($nboftargetok) {
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/license.txt`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip`;

View File

@ -0,0 +1,12 @@
# This is an example of multitail setup file you can use to analyze dolibarr log files.
# Usage: multitail -cS dolibarr documents/dolibarr.log
colorscheme:dolibarr
bright:1
cs_re:yellow,red:.*EMERG.*
cs_re:white,red:.*ALERT.*
cs_re:green,red:.*CRIT.*
cs_re:red:.*ERR.*
cs_re:white,yellow:.*WARNING.*
cs_re:green,yellow:.*NOTICE.*
cs_re:green:.*INFO.*
cs_re:white:.*DEBUG.*

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2007-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
*
* This program is free software; you can redistribute it and/or modify
@ -72,6 +72,10 @@ if (($id > 0 || ! empty($ref)) && $action != 'add')
if ($result < 0) dol_print_error($db);
}
// Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('skeleton'));
$extrafields = new ExtraFields($db);
/*******************************************************************
@ -80,108 +84,114 @@ if (($id > 0 || ! empty($ref)) && $action != 'add')
* Put here all code to do according to value of "action" parameter
********************************************************************/
// Action to add record
if ($action == 'add')
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
if (GETPOST('cancel'))
// Action to add record
if ($action == 'add')
{
$urltogo=$backtopage?$backtopage:dol_buildpath('/buildingmanagement/list.php',1);
header("Location: ".$urltogo);
exit;
}
$error=0;
/* object_prop_getpost_prop */
$object->prop1=GETPOST("field1");
$object->prop2=GETPOST("field2");
if (empty($object->ref))
{
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),'errors');
}
if (! $error)
{
$result=$object->create($user);
if ($result > 0)
if (GETPOST('cancel'))
{
// Creation OK
$urltogo=$backtopage?$backtopage:dol_buildpath('/mymodule/list.php',1);
$urltogo=$backtopage?$backtopage:dol_buildpath('/buildingmanagement/list.php',1);
header("Location: ".$urltogo);
exit;
}
$error=0;
/* object_prop_getpost_prop */
$object->prop1=GETPOST("field1");
$object->prop2=GETPOST("field2");
if (empty($object->ref))
{
// Creation KO
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
else setEventMessages($object->error, null, 'errors');
$action='create';
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),'errors');
}
}
else
{
$action='create';
}
}
// Cancel
if ($action == 'update' && GETPOST('cancel')) $action='view';
// Action to update record
if ($action == 'update' && ! GETPOST('cancel'))
{
$error=0;
$object->prop1=GETPOST("field1");
$object->prop2=GETPOST("field2");
if (empty($object->ref))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),null,'errors');
}
if (! $error)
{
$result=$object->update($user);
if ($result > 0)
if (! $error)
{
$action='view';
$result=$object->create($user);
if ($result > 0)
{
// Creation OK
$urltogo=$backtopage?$backtopage:dol_buildpath('/mymodule/list.php',1);
header("Location: ".$urltogo);
exit;
}
{
// Creation KO
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
else setEventMessages($object->error, null, 'errors');
$action='create';
}
}
else
{
$action='create';
}
}
// Cancel
if ($action == 'update' && GETPOST('cancel')) $action='view';
// Action to update record
if ($action == 'update' && ! GETPOST('cancel'))
{
$error=0;
$object->prop1=GETPOST("field1");
$object->prop2=GETPOST("field2");
if (empty($object->ref))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),null,'errors');
}
if (! $error)
{
$result=$object->update($user);
if ($result > 0)
{
$action='view';
}
else
{
// Creation KO
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
else setEventMessages($object->error, null, 'errors');
$action='edit';
}
}
else
{
// Creation KO
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
else setEventMessages($object->error, null, 'errors');
$action='edit';
}
}
else
// Action to delete
if ($action == 'confirm_delete')
{
$action='edit';
$result=$object->delete($user);
if ($result > 0)
{
// Delete OK
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
header("Location: ".dol_buildpath('/buildingmanagement/list.php',1));
exit;
}
else
{
if (! empty($object->errors)) setEventMessages(null,$object->errors,'errors');
else setEventMessages($object->error,null,'errors');
}
}
}
// Action to delete
if ($action == 'confirm_delete')
{
$result=$object->delete($user);
if ($result > 0)
{
// Delete OK
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
header("Location: ".dol_buildpath('/buildingmanagement/list.php',1));
exit;
}
else
{
if (! empty($object->errors)) setEventMessages(null,$object->errors,'errors');
else setEventMessages($object->error,null,'errors');
}
}
@ -221,15 +231,56 @@ if ($action == 'list' || empty($id))
$sql.= " t.rowid,";
$sql.= " t.field1,";
$sql.= " t.field2";
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."mytable as t";
$sql.= " WHERE field3 = 'xxx'";
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " ORDER BY field1 ASC";
print '<table class="noborder">'."\n";
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if (! empty($moreforfilter))
{
print '<div class="liste_titre">';
print $moreforfilter;
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
print '<table class="noborder">'."\n";
// Fields title
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('field1'),$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
print '</tr>';
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</tr>'."\n";
// Fields title search
print '<tr class="liste_titre">';
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_field1" value="'.$search_field1.'" size="10">';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_field2" value="'.$search_field2.'" size="10">';
print '</td>';
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</tr>'."\n";
dol_syslog($script_file, LOG_DEBUG);
$resql=$db->query($sql);
@ -243,21 +294,34 @@ if ($action == 'list' || empty($id))
if ($obj)
{
// You can use here results
print '<tr><td>';
print '<tr>';
print '<td>';
print $obj->field1;
print '</td><td>';
print $obj->field2;
print '</td></tr>';
print '</td>';
$parameters=array('obj' => $obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</tr>';
}
$i++;
}
}
else
{
{
$error++;
dol_print_error($db);
}
print '</table>'."\n";
$db->free($resql);
$parameters=array('sql' => $sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>\n";
print "</form>\n";
}
@ -267,12 +331,12 @@ if ($action == 'create')
{
print_fiche_titre($langs->trans("NewResidence"));
dol_fiche_head();
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
dol_fiche_head();
print '<table class="border centpercent">'."\n";
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td>';
print '<input class="flat" type="text" size="36" name="label" value="'.$label.'">';
@ -280,13 +344,11 @@ if ($action == 'create')
print '</table>'."\n";
print '<br>';
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" name="add" value="'.$langs->trans("Create").'"> &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
print '</form>';
dol_fiche_end();
}
@ -294,21 +356,19 @@ if ($action == 'create')
// Part to edit record
if (($id || $ref) && $action == 'edit')
{
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
dol_fiche_head();
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<br>';
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" name="add" value="'.$langs->trans("Create").'"></div>';
print '</form>';
dol_fiche_end();
}

View File

@ -23,12 +23,14 @@
* \brief Card accounting account
*/
require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
$error=0;
// Langs
$langs->load("bills");
$langs->load("accountancy");
@ -41,7 +43,7 @@ $rowid = GETPOST('rowid', 'int');
// Security check
if (!$user->admin)
accessforbidden();
$accounting = new AccountingAccount($db);
// Action
@ -49,11 +51,11 @@ if ($action == 'add')
{
if (! GETPOST('cancel', 'alpha')) {
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
$result = $db->query($sql);
$obj = $db->fetch_object($result);
$accounting->fk_pcg_version = $obj->pcg_version;
$accounting->pcg_type = GETPOST('pcg_type');
$accounting->pcg_subtype = GETPOST('pcg_subtype');
@ -61,17 +63,17 @@ if ($action == 'add')
$accounting->account_parent = GETPOST('account_parent', 'int');
$accounting->label = GETPOST('label', 'alpha');
$accounting->active = 1;
$res = $accounting->create($user);
if ($res == 0) {
} else {
if ($res == - 3) {
$_error = 1;
$error = 1;
$action = "create";
}
if ($res == - 4) {
$_error = 2;
$error = 2;
$action = "create";
}
}
@ -82,22 +84,22 @@ else if ($action == 'edit')
{
if (! GETPOST('cancel', 'alpha')) {
$result = $accounting->fetch($id);
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
$result2 = $db->query($sql);
$obj = $db->fetch_object($result2);
$accounting->fk_pcg_version = $obj->pcg_version;
$accounting->pcg_type = GETPOST('pcg_type');
$accounting->pcg_subtype = GETPOST('pcg_subtype');
$accounting->account_number = GETPOST('account_number', 'int');
$accounting->account_parent = GETPOST('account_parent', 'int');
$accounting->label = GETPOST('label', 'alpha');
$result = $accounting->update($user);
if ($result > 0) {
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
exit();
@ -112,15 +114,15 @@ else if ($action == 'edit')
else if ($action == 'delete')
{
$result = $accounting->fetch($id);
if (! empty($accounting->id)) {
$result = $accounting->delete($user);
if ($result > 0) {
Header("Location: account.php");
}
}
if ($result < 0) {
setEventMessage($accounting->error, 'errors');
}
@ -137,7 +139,7 @@ $htmlacc = new FormVentilation($db);
if ($action == 'create')
{
print_fiche_titre($langs->trans('NewAccount'));
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="add">';
@ -145,7 +147,7 @@ if ($action == 'create')
dol_fiche_head();
print '<table class="border" width="100%">';
print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>';
print '<td><input name="account_number" size="30" value="' . $accounting->account_number . '"</td></tr>';
print '<tr><td>' . $langs->trans("Label") . '</td>';
@ -162,7 +164,7 @@ if ($action == 'create')
print '<td>';
print $htmlacc->select_pcgsubtype($accounting->pcg_subtype, 'pcg_subtype');
print '</td></tr>';
print '</table>';
dol_fiche_end();
@ -172,35 +174,35 @@ if ($action == 'create')
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
print '</div>';
print '</form>';
}
else if ($id)
{
$rowid = $id;
$account = $accounting->fetch($rowid);
if ($account > 0) {
dol_htmloutput_mesg($mesg);
$head = accounting_prepare_head($accounting);
if ($action == 'update')
{
$soc = new Societe($db);
if ($object->socid) {
$soc->fetch($object->socid);
}
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="edit">';
print '<input type="hidden" name="id" value="' . $id . '">';
print '<table class="border" width="100%">';
print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>';
print '<td><input name="account_number" size="30" value="' . $accounting->account_number . '"</td></tr>';
print '<tr><td>' . $langs->trans("Label") . '</td>';
@ -217,7 +219,7 @@ else if ($id)
print '<td>';
print $htmlacc->select_pcgsubtype($accounting->pcg_subtype, 'pcg_subtype');
print '</td></tr>';
print '</table>';
dol_fiche_end();
@ -227,71 +229,71 @@ else if ($id)
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" name="cancel" class="button" value="' . $langs->trans("Cancel") . '">';
print '</div>';
print '</form>';
}
else
{
$linkback = '<a href="../admin/account.php">' . $langs->trans("BackToChartofaccounts") . '</a>';
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
print '<table class="border" width="100%">';
// Account number
print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>';
print '<td>' . $accounting->account_number . '</td>';
print '<td align="right" width="25%">' . $linkback . '</td></tr>';
print '<tr><td>' . $langs->trans("Label") . '</td>';
print '<td colspan="2">' . $accounting->label . '</td></tr>';
$accp = new AccountingAccount($db);
if (! empty($accounting->account_parent)) {
$accp->fetch($accounting->account_parent, '');
}
print '<tr><td>' . $langs->trans("Accountparent") . '</td>';
print '<td colspan="2">' . $accp->account_number . ' - ' . $accp->label . '</td></tr>';
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
print '<td colspan="2">' . $accounting->pcg_type . '</td></tr>';
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
print '<td colspan="2">' . $accounting->pcg_subtype . '</td></tr>';
print '<tr><td>' . $langs->trans("Active") . '</td>';
print '<td colspan="2">';
if (empty($accounting->active)) {
print img_picto($langs->trans("Disabled"), 'switch_off');
} else {
print img_picto($langs->trans("Activated"), 'switch_on');
}
print '</td></tr>';
print '</table>';
dol_fiche_end();
/*
* Barre d'actions
*/
print '<div class="tabsAction">';
if ($user->admin) {
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $id . '">' . $langs->trans('Modify') . '</a>';
} else {
print '<a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('Modify') . '</a>';
}
if ($user->admin) {
print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $id . '">' . $langs->trans('Delete') . '</a>';
} else {
print '<a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('Delete') . '</a>';
}
print '</div>';
}
}

View File

@ -108,8 +108,7 @@ if (! empty($id)) {
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="ventil">';
$linkback='<a href="'.DOL_URL_ROOT.'/accountancy/customer/lines.php">'.$langs->trans("Back").'</a>';
print_fiche_titre($langs->trans('CustomersVentilation'),$linkback,'title_setup');
print_fiche_titre($langs->trans('CustomersVentilation'),'','title_setup');
dol_fiche_head();

View File

@ -45,6 +45,18 @@ $search_desc = GETPOST('search_desc','alpha');
$search_amount = GETPOST('search_amount','alpha');
$search_account = GETPOST('search_account','alpha');
$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;
$limit = $conf->liste_limit;
if (! $sortfield) $sortfield="f.facnumber";
if (! $sortorder) $sortorder="DESC";
// Security check
if ($user->societe_id > 0)
accessforbidden();
@ -94,20 +106,6 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched"));
$page = GETPOST("page");
if ($page < 0)
$page = 0;
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} elseif ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
$limit = $conf->liste_limit;
} else {
$limit = $conf->liste_limit;
}
$offset = $limit * $page;
$sql = "SELECT l.rowid , f.facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ht, l.qty, l.tva_tx, l.fk_code_ventilation, aa.label, aa.account_number,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
@ -117,7 +115,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product
$sql .= " WHERE f.rowid = l.fk_facture AND f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 ";
$sql .= " AND aa.rowid = l.fk_code_ventilation";
if (strlen(trim(GETPOST("search_facture")))) {
$sql .= " AND f.facnumber like '%" . GETPOST("search_facture") . "%'";
$sql .= " AND f.facnumber like '%" . $search_facture . "%'";
}
if (strlen(trim($search_ref))) {
$sql .= " AND p.ref like '%" . $search_ref . "%'";
@ -134,16 +132,11 @@ if (strlen(trim($search_amount))) {
if (strlen(trim($search_account))) {
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
}
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
}
$sql .= " ORDER BY l.rowid";
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
$sql .= " DESC ";
}
$sql .= $db->plimit($limit + 1, $offset);
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1,$offset);
dol_syslog("/accountancy/customer/lines.php sql=" . $sql, LOG_DEBUG);
$result = $db->query($sql);
@ -151,7 +144,6 @@ if ($result) {
$num_lines = $db->num_rows($result);
$i = 0;
// TODO : print_barre_liste always use $conf->liste_limit and do not care about custom limit in list...
print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print '<td align="left"><b>' . $langs->trans("DescVentilDoneCustomer") . '</b></td>';
@ -159,29 +151,30 @@ if ($result) {
print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
print '<table class="noborder" width="100%">';
print '<br><br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount");
print '<br><br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
print $formventilation->select_account($account_parent, 'account_parent', 1);
print '<input type="submit" class="butAction" value="' . $langs->trans("Validate") . '"/></div>';
print '<tr class="liste_titre"><td>' . $langs->trans("Invoice") . '</td>';
print '<td>' . $langs->trans("Ref") . '</td>';
print '<td>' . $langs->trans("Label") . '</td>';
print '<td>' . $langs->trans("Description") . '</td>';
print '<td align="left">' . $langs->trans("Amount") . '</td>';
print '<td colspan="2" align="left">' . $langs->trans("Account") . '</td>';
print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"],"f.facnumber","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"],"l.total_ht","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"],"aa.account_number","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('');
print_liste_field_titre('');
print_liste_field_titre('');
print "</tr>\n";
print '<tr class="liste_titre"><td><input name="search_facture" size="8" value="' . $search_facture . '"></td>';
print '<tr class="liste_titre"><td><input type="text" class="flat" name="search_facture" size="8" value="' . $search_facture . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="8" name="search_amount" value="' . $search_amount. '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>';
print '<td class="liste_titre" align="right"><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 '<td class="liste_titre" align="center"><input type="text" class="flat" size="8" name="search_amount" value="' . $search_amount. '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
print '<td class="liste_titre" colspan="2">&nbsp;</td>';
print '<td class="liste_titre" align="center"><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></tr>\n";
@ -214,7 +207,7 @@ if ($result) {
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
print '<td align="right">' . price($objp->total_ht) . '</td>';
print '<td align="left">' . $codecompta . '</td>';
print '<td align="center">' . $codecompta . '</td>';
print '<td>' . $objp->rowid . '</td>';
print '<td><a href="./card.php?id=' . $objp->rowid . '">';
print img_edit();

View File

@ -141,7 +141,7 @@ if ($result) {
// Situation invoices handling
$line = new FactureLigne($db);
$line->fetch($obj->id);
$line->fetch($obj->rowid);
$prev_progress = $line->get_prev_progress();
if ($obj->situation_percent == 0) { // Avoid divide by 0
$situation_ratio = 0;

View File

@ -107,12 +107,11 @@ if (! empty($id)) {
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="ventil">';
$linkback='<a href="'.DOL_URL_ROOT.'/accountancy/supplier/lines.php">'.$langs->trans("Back").'</a>';
print_fiche_titre($langs->trans('SuppliersVentilation'),$linkback,'title_setup');
print_fiche_titre($langs->trans('SuppliersVentilation'),'','title_setup');
dol_fiche_head();
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
print '<table class="border" width="100%">';
// ref invoice
print '<tr><td>' . $langs->trans("BillsSuppliers") . '</td>';
@ -121,7 +120,7 @@ if (! empty($id)) {
print '<td>' . $facturefournisseur_static->getNomUrl(1) . '</td>';
print '</tr>';
print '<tr><td width="20%">Ligne</td>';
print '<tr><td width="20%">' . $langs->trans("Line") . '</td>';
print '<td>' . stripslashes(nl2br($objp->description)) . '</td></tr>';
print '<tr><td width="20%">' . $langs->trans("ProductLabel") . '</td>';
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';

View File

@ -46,6 +46,18 @@ $search_desc = GETPOST('search_desc','alpha');
$search_amount = GETPOST('search_amount','alpha');
$search_account = GETPOST('search_account','alpha');
$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;
$limit = $conf->liste_limit;
if (! $sortfield) $sortfield="f.ref";
if (! $sortorder) $sortorder="DESC";
// Security check
if ($user->societe_id > 0)
accessforbidden();
@ -95,20 +107,6 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
llxHeader('', $langs->trans("SuppliersVentilation") . ' - ' . $langs->trans("Dispatched"));
$page = GETPOST("page");
if ($page < 0)
$page = 0;
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
$limit = $conf->liste_limit;
} else {
$limit = $conf->liste_limit;
}
$offset = $limit * $page;
$sql = "SELECT f.ref as facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ht , l.qty, l.rowid, l.tva_tx, aa.label, aa.account_number, ";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
@ -138,12 +136,8 @@ if (strlen(trim($search_account))) {
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")";
}
$sql .= " ORDER BY l.rowid";
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
$sql .= " DESC ";
}
$sql .= $db->plimit($limit + 1, $offset);
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1,$offset);
dol_syslog('accountancy/supplier/lines.php::list sql= ' . $sql1);
$result = $db->query($sql);
@ -152,7 +146,6 @@ if ($result) {
$num_lines = $db->num_rows($result);
$i = 0;
// TODO : print_barre_liste always use $conf->liste_limit and do not care about custom limit in list...
print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print '<td align="left"><b>' . $langs->trans("DescVentilDoneSupplier") . '</b></td>';
@ -160,29 +153,30 @@ if ($result) {
print '<form method="GET" action="' . $_SERVER["PHP_SELF"] . '">';
print '<table class="noborder" width="100%">';
print '<br><br><div class="inline-block divButAction">'. $langs->trans("ChangeAccount");
print '<br><br><div class="inline-block divButAction">'. $langs->trans("ChangeAccount") . '<br>';
print $formventilation->select_account(GETPOST('account_parent'), 'account_parent', 1);
print '<input type="submit" class="butAction" value="' . $langs->trans("Validate") . '" /></div>';
print '<tr class="liste_titre"><td>' . $langs->trans("Invoice") . '</td>';
print '<td>' . $langs->trans("Ref") . '</td>';
print '<td>' . $langs->trans("Label") . '</td>';
print '<td>' . $langs->trans("Description") . '</td>';
print '<td align="left">' . $langs->trans("Amount") . '</td>';
print '<td colspan="2" align="left">' . $langs->trans("Account") . '</td>';
print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"],"f.ref","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"],"l.total_ht","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"],"aa.account_number","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('');
print_liste_field_titre('');
print_liste_field_titre('');
print "</tr>\n";
print '<tr class="liste_titre"><td><input name="search_facture" size="8" value="' . $search_facture . '"></td>';
print '<tr class="liste_titre"><td><input type="text" class="flat" name="search_facture" size="8" value="' . $search_facture . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_amount" value="' . $search_amount . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>';
print '<td class="liste_titre" align="right"><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 '<td class="liste_titre" align="center"><input type="text" class="flat" size="8" name="search_amount" value="' . $search_amount . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
print '<td class="liste_titre" colspan="2">&nbsp;</td>';
print '<td class="liste_titre" align="center"><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></tr>\n";
@ -215,8 +209,8 @@ if ($result) {
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
print '<td align="left">' . price($objp->total_ht) . '</td>';
print '<td align="left">' . $codeCompta . '</td>';
print '<td align="right">' . price($objp->total_ht) . '</td>';
print '<td align="center">' . $codeCompta . '</td>';
print '<td>' . $objp->rowid . '</td>';
print '<td><a href="./card.php?id=' . $objp->rowid . '">';
print img_edit();

View File

@ -976,7 +976,6 @@ else
$head = member_prepare_head($object);
dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
if ($conf->use_javascript_ajax)
{
@ -1020,6 +1019,8 @@ else
print '<input type="hidden" name="statut" value="'.$object->statut.'" />';
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
print '<table class="border" width="100%">';
// Ref
@ -1179,7 +1180,9 @@ else
print '</table>';
print '<br><div class="center">';
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'" onclick="history.go(-1)" />';
@ -1187,7 +1190,6 @@ else
print '</form>';
print '</div>';
}
if ($rowid && $action != 'edit')
@ -1277,7 +1279,7 @@ else
$texttosend=$object->makeSubstitution($adht->getMailOnValid());
$tmp=$langs->trans("SendAnEMailToMember");
$tmp.=' ('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
$tmp.='<br>('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
$tmp.=$langs->trans("MailRecipient").': <b>'.$object->email.'</b>)';
$helpcontent='';
$helpcontent.='<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
@ -1298,7 +1300,7 @@ else
if (! empty($conf->mailman->enabled) && ! empty($conf->global->ADHERENT_USE_SPIP)) {
$formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"),'value'=>'');
}
print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1);
print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1,1);
}
// Confirm send card by mail
@ -1319,7 +1321,7 @@ else
$texttosend=$object->makeSubstitution($adht->getMailOnResiliate());
$tmp=$langs->trans("SendAnEMailToMember");
$tmp.=' ('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
$tmp.='<br>('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
$tmp.=$langs->trans("MailRecipient").': <b>'.$object->email.'</b>)';
$helpcontent='';
$helpcontent.='<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
@ -1335,7 +1337,7 @@ else
$formquestion=array();
if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?'true':'false'));
if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]));
print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion);
print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion,'no',1);
}
// Confirm remove member

View File

@ -73,6 +73,10 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$sall="";
}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('memberlist'));
$extrafields = new ExtraFields($db);
/*
* View
@ -91,6 +95,12 @@ $sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company,
$sql.= " d.datefin,";
$sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
$sql.= " t.libelle as type, t.cotisation";
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d";
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member"; // We need this table joined to the select in order to filter by categ
$sql.= ", ".MAIN_DB_PREFIX."adherent_type as t";
@ -100,52 +110,23 @@ if ($catid == -2) $sql.= " AND cm.fk_categorie IS NULL";
if ($search_categ > 0) $sql.= " AND cm.fk_categorie = ".$db->escape($search_categ);
if ($search_categ == -2) $sql.= " AND cm.fk_categorie IS NULL";
$sql.= " AND d.entity IN (".getEntity('adherent', 1).")";
if ($sall)
{
// For natural search
$scrit = explode(' ', $sall);
foreach ($scrit as $crit)
{
$sql.=" AND (";
if (is_numeric($sall)) $sql.= "d.rowid = ".$db->escape($sall)." OR ";
$sql.=" d.firstname LIKE '%".$db->escape($sall)."%' OR d.lastname LIKE '%".$db->escape($sall)."%' OR d.societe LIKE '%".$db->escape($sall)."%'";
$sql.=" OR d.email LIKE '%".$db->escape($sall)."%' OR d.login LIKE '%".$db->escape($sall)."%' OR d.address LIKE '%".$db->escape($sall)."%'";
$sql.=" OR d.town LIKE '%".$db->escape($sall)."%' OR d.note_public LIKE '%".$db->escape($sall)."%' OR d.note_private LIKE '%".$db->escape($sall)."%')";
}
}
if ($type > 0)
{
$sql.=" AND t.rowid=".$db->escape($type);
}
if (isset($_GET["statut"]) || isset($_POST["statut"]))
{
$sql.=" AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
}
if ($sall) $sql.=natural_search(array("d.rowid", "d.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall);
if ($type > 0) $sql.=" AND t.rowid=".$db->escape($type);
if (isset($_GET["statut"]) || isset($_POST["statut"])) $sql.=" AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
if ($search_ref)
{
if (is_numeric($search_ref)) $sql.= " AND (d.rowid = ".$db->escape($search_ref).")";
else $sql.=" AND 1 = 2"; // Always wrong
}
if ($search_lastname)
{
$sql.= " AND (d.firstname LIKE '%".$db->escape($search_lastname)."%' OR d.lastname LIKE '%".$db->escape($search_lastname)."%' OR d.societe LIKE '%".$db->escape($search_lastname)."%')";
}
if ($search_login)
{
$sql.= " AND d.login LIKE '%".$db->escape($search_login)."%'";
}
if ($search_email)
{
$sql.= " AND (d.email LIKE '%".$db->escape($search_email)."%')";
}
if ($filter == 'uptodate')
{
$sql.=" AND datefin >= '".$db->idate($now)."'";
}
if ($filter == 'outofdate')
{
$sql.=" AND (datefin IS NULL OR datefin < '".$db->idate($now)."')";
}
if ($search_lastname) $sql.= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname);
if ($search_login) $sql.= natural_search("d.login", $search_login);
if ($search_email) $sql.= natural_search("d.email", $search_email);
if ($filter == 'uptodate') $sql.=" AND datefin >= '".$db->idate($now)."'";
if ($filter == 'outofdate') $sql.=" AND (datefin IS NULL OR datefin < '".$db->idate($now)."')";
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
// Count total nb of records with no order and no limits
$nbtotalofrecords = 0;
@ -199,11 +180,12 @@ if ($resql)
if ($sall)
{
print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ";
print '<strong>'.$sall.'</strong>';
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].($param?'?'.$param:'').'">';
print "<table class=\"noborder\" width=\"100%\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
// Filter on categories
$moreforfilter='';
@ -214,14 +196,17 @@ if ($resql)
$moreforfilter.=$formother->select_categories(Categorie::TYPE_MEMBER,$search_categ,'search_categ',1);
$moreforfilter.=' &nbsp; &nbsp; &nbsp; ';
}
if ($moreforfilter)
if (! empty($moreforfilter))
{
print '<tr class="liste_titre">';
print '<td class="liste_titre" colspan="9">';
print '<div class="liste_titre">';
print $moreforfilter;
print '</td></tr>';
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
print "<table class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
@ -229,7 +214,12 @@ if ($resql)
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"t.libelle",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EndSubscription"),$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
print "</tr>\n";
@ -256,7 +246,12 @@ if ($resql)
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_email" value="'.$search_email.'" size="12"></td>';
print '<td class="liste_titre">&nbsp;</td>';
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Status
print '<td class="liste_titre">&nbsp;</td>';
print '<td align="right" colspan="2" class="liste_titre">';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
@ -316,7 +311,11 @@ if ($resql)
// EMail
print "<td>".dol_print_email($objp->email,0,0,1)."</td>\n";
// Statut
$parameters=array('obj' => $obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Statut
print '<td class="nowrap">';
print $memberstatic->LibStatut($objp->statut,$objp->cotisation,$datefin,2);
print "</td>";
@ -365,6 +364,12 @@ if ($resql)
$i++;
}
$db->free($resql);
$parameters=array('sql' => $sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>\n";
print '</form>';

View File

@ -70,7 +70,7 @@ $hookmanager->initHooks(array('admin'));
// Put here declaration of dictionaries properties
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,6,0,10,23,12,13,0,14,0,7,17,24,0,22,20,18,21,0,15,0,25,0,26);
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,6,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,0,25,0,26);
// Name of SQL tables of dictionaries
$tabname=array();
@ -101,6 +101,7 @@ $tabname[24]= MAIN_DB_PREFIX."c_type_resource";
$tabname[25]= MAIN_DB_PREFIX."c_email_templates";
$tabname[26]= MAIN_DB_PREFIX."c_units";
$tabname[27]= MAIN_DB_PREFIX."c_stcomm";
$tabname[28]= MAIN_DB_PREFIX."c_holiday_types";
// Dictionary labels
$tablib=array();
@ -131,22 +132,23 @@ $tablib[24]= "DictionaryResourceType";
$tablib[25]= "DictionaryEMailTemplates";
$tablib[26]= "DictionaryUnits";
$tablib[27]= "DictionaryProspectStatus";
$tablib[28]= "DictionaryHolidayTypes";
// Requests to extract data
$tabsql=array();
$tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c WHERE f.fk_pays=c.rowid";
$tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1";
$tabsql[3] = "SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1";
$tabsql[4] = "SELECT rowid as rowid, code, label, active, favorite FROM ".MAIN_DB_PREFIX."c_country";
$tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite FROM ".MAIN_DB_PREFIX."c_country AS c";
$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c";
$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, a.deductible, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1";
$tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_country=c.rowid";
$tabsql[9] = "SELECT code_iso as code, label, unicode, active FROM ".MAIN_DB_PREFIX."c_currencies";
$tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c";
$tabsql[10]= "SELECT t.rowid, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
$tabsql[11]= "SELECT t.rowid as rowid, element, source, code, libelle, active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
$tabsql[12]= "SELECT c.rowid as rowid, code, sortorder, c.libelle, c.libelle_facture, nbjour, fdm, decalage, active FROM ".MAIN_DB_PREFIX.'c_payment_term AS c';
$tabsql[13]= "SELECT id as rowid, code, c.libelle, type, active, accountancy_code FROM ".MAIN_DB_PREFIX."c_paiement AS c";
$tabsql[12]= "SELECT c.rowid as rowid, c.code, c.sortorder, c.libelle, c.libelle_facture, nbjour, fdm, decalage, active FROM ".MAIN_DB_PREFIX.'c_payment_term AS c';
$tabsql[13]= "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.accountancy_code FROM ".MAIN_DB_PREFIX."c_paiement AS c";
$tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1";
$tabsql[15]= "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format";
$tabsql[16]= "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectlevel";
@ -161,6 +163,7 @@ $tabsql[24]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX
$tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content, active FROM ".MAIN_DB_PREFIX."c_email_templates";
$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
$tabsql[27]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_stcomm";
$tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.delay, h.newByMonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
// Criteria to sort dictionaries
$tabsqlsort=array();
@ -191,6 +194,7 @@ $tabsqlsort[24]="code ASC,label ASC";
$tabsqlsort[25]="label ASC";
$tabsqlsort[26]="code ASC";
$tabsqlsort[27]="code ASC";
$tabsqlsort[28]="country ASC, code ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array();
@ -221,6 +225,7 @@ $tabfield[24]= "code,label";
$tabfield[25]= "label,type_template,private,position,topic,content";
$tabfield[26]= "code,label,short_label";
$tabfield[27]= "code,libelle";
$tabfield[28]= "code,label,delay,newByMonth,country_id,country";
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array();
@ -251,6 +256,7 @@ $tabfieldvalue[24]= "code,label";
$tabfieldvalue[25]= "label,type_template,private,position,topic,content";
$tabfieldvalue[26]= "code,label,short_label";
$tabfieldvalue[27]= "code,libelle";
$tabfieldvalue[28]= "code,label,delay,newByMonth,country";
// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array();
@ -281,6 +287,7 @@ $tabfieldinsert[24]= "code,label";
$tabfieldinsert[25]= "label,type_template,private,position,topic,content";
$tabfieldinsert[26]= "code,label,short_label";
$tabfieldinsert[27]= "code,libelle";
$tabfieldinsert[28]= "code,label,delay,newByMonth,fk_country";
// Nom du rowid si le champ n'est pas de type autoincrement
// Example: "" if id field is "rowid" and has autoincrement on
@ -313,6 +320,7 @@ $tabrowid[24]= "";
$tabrowid[25]= "";
$tabrowid[26]= "";
$tabrowid[27]= "id";
$tabrowid[28]= "";
// Condition to show dictionary in setup page
$tabcond=array();
@ -343,6 +351,7 @@ $tabcond[24]= ! empty($conf->resource->enabled);
$tabcond[25]= true; // && ! empty($conf->global->MAIN_EMAIL_EDIT_TEMPLATE_FROM_DIC);
$tabcond[26]= ! empty($conf->product->enabled);
$tabcond[27]= ! empty($conf->societe->enabled);
$tabcond[28]= ! empty($conf->holiday->enabled);
// List of help for fields
$tabhelp=array();
@ -373,6 +382,7 @@ $tabhelp[24] = array();
$tabhelp[25] = array();
$tabhelp[26] = array();
$tabhelp[27] = array();
$tabhelp[28] = array();
// List of check for fields (NOT USED YET)
$tabfieldcheck=array();
@ -403,6 +413,7 @@ $tabfieldcheck[24] = array();
$tabfieldcheck[25] = array();
$tabfieldcheck[26] = array();
$tabfieldcheck[27] = array();
$tabfieldcheck[28] = array();
// Complete all arrays with entries found into modules
complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck);
@ -475,7 +486,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$ok=1;
foreach ($listfield as $f => $value)
{
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes'))) continue; // For some pages, country is not mandatory
if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
@ -524,7 +535,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
}
if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))
{
if (in_array($tablib[$id],array('DictionaryCompanyType')))
if (in_array($tablib[$id],array('DictionaryCompanyType','DictionaryHolidayTypes'))) // Field country is no mandatory for such dictionaries
{
$_POST["country"]='';
}
@ -832,7 +843,7 @@ if ($id)
$fieldlist=explode(',',$tabfield[$id]);
// Line for title
print '<tr class="liste_titre nohover">';
print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value)
{
// Determine le nom du champ par rapport aux noms possibles
@ -906,7 +917,7 @@ if ($id)
print '</tr>';
// Line to enter new values
print "<tr ".$bc[$var].">";
print "<tr ".$bcnd[$var].">";
$obj = new stdClass();
// If data was already input, we define them in obj to populate input fields.

View File

@ -45,10 +45,10 @@ $action = GETPOST('action');
if (! defined("MAIN_MOTD")) define("MAIN_MOTD","");
// List of supported permanent search area
$searchform=array("MAIN_SEARCHFORM_SOCIETE", "MAIN_SEARCHFORM_CONTACT", "MAIN_SEARCHFORM_PRODUITSERVICE", "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER", "MAIN_SEARCHFORM_ADHERENT");
$searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER,$conf->global->MAIN_SEARCHFORM_ADHERENT);
$searchformtitle=array($langs->trans("Companies"),$langs->trans("Contacts"),$langs->trans("ProductsAndServices"),$langs->trans("ProductsAndServices").' ('.$langs->trans("SupplierRef").')',$langs->trans("Members"));
$searchformmodule=array('Module1Name','Module1Name','Module50Name','Module50Name','Module310Name');
$searchform=array("MAIN_SEARCHFORM_SOCIETE", "MAIN_SEARCHFORM_CONTACT", "MAIN_SEARCHFORM_PRODUITSERVICE", "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER", "MAIN_SEARCHFORM_ADHERENT", "MAIN_SEARCHFORM_PROJECT");
$searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER,$conf->global->MAIN_SEARCHFORM_ADHERENT,$conf->global->MAIN_SEARCHFORM_PROJECT);
$searchformtitle=array($langs->trans("Companies"), $langs->trans("Contacts"), $langs->trans("ProductsAndServices"), $langs->trans("ProductsAndServices").' ('.$langs->trans("SupplierRef").')', $langs->trans("Members"), $langs->trans("Projects"));
$searchformmodule=array('Module1Name','Module1Name','Module50Name','Module50Name','Module310Name','Module400Name');
if ($action == 'update')
@ -73,6 +73,7 @@ if ($action == 'update')
dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE", $_POST["MAIN_SEARCHFORM_PRODUITSERVICE"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER",$_POST["MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_ADHERENT", $_POST["MAIN_SEARCHFORM_ADHERENT"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_PROJECT", $_POST["MAIN_SEARCHFORM_PROJECT"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"],'chaine',0,'',0); // Param for all entities
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity);

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2005-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
@ -24,6 +24,7 @@
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$langs->load("admin");
@ -66,38 +67,55 @@ print '<br>';
// Modified or missing files
$file_list = array('missing' => array(), 'updated' => array());
$xmlfile = DOL_DOCUMENT_ROOT.'/core/filelist-'.DOL_VERSION.'.xml';
if (file_exists($xmlfile)) {
// File to analyze
//$xmlfile = DOL_DOCUMENT_ROOT.'/install/filelist-'.DOL_VERSION.'.xml';
$xmlfile = DOL_DOCUMENT_ROOT.'/install/filelist.xml';
if (file_exists($xmlfile))
{
$xml = simplexml_load_file($xmlfile);
if ($xml) {
$ret = getFilesUpdated($xml->dolibarr_root_dir[0]);
if ($xml)
{
$ret = getFilesUpdated($xml->dolibarr_root_dir[0]); // Fill array $file_list
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td>' . $langs->trans("FilesMissing") . '</td>';
print '</tr>'."\n";
$var = true;
foreach ($file_list['missing'] as $file) {
foreach ($file_list['missing'] as $file)
{
$var = !$var;
print '<tr ' . $bc[$var] . '>';
print '<td>'.$file.'</td>' . "\n";
print "</tr>\n";
}
print '</table>';
print '<br>';
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td>' . $langs->trans("FilesUpdated") . '</td>';
print '<td align="right">' . $langs->trans("Size") . '</td>';
print '<td align="center">' . $langs->trans("DateModification") . '</td>';
print '</tr>'."\n";
$var = true;
foreach ($file_list['updated'] as $file) {
foreach ($file_list['updated'] as $file)
{
$var = !$var;
print '<tr ' . $bc[$var] . '>';
print '<td>'.$file.'</td>' . "\n";
print '<td align="right">'.dol_print_size(dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file)).'</td>' . "\n";
print '<td align="center">'.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file),'dayhour').'</td>' . "\n";
print "</tr>\n";
}
print '</table>';
}
} else {
print $langs->trans('XmlNotFound') . ': ' . DOL_DOCUMENT_ROOT . '/core/filelist-' . DOL_VERSION . '.xml';
}
else
{
print $langs->trans('XmlNotFound') . ': ' . $xmlfile;
}
llxFooter();
@ -117,7 +135,8 @@ function getFilesUpdated(SimpleXMLElement $dir, $path = '')
global $file_list;
$exclude = 'install';
foreach ($dir->md5file as $file) {
foreach ($dir->md5file as $file)
{
$filename = $path.$file['name'];
if (preg_match('#'.$exclude.'#', $filename))
@ -134,5 +153,5 @@ function getFilesUpdated(SimpleXMLElement $dir, $path = '')
foreach ($dir->dir as $subdir)
getFilesUpdated($subdir, $path.$subdir['name'].'/');
return $file_list;
return $file_list;
}

View File

@ -148,11 +148,11 @@ print '> '.$langs->trans("PurgeDeleteAllFilesInDocumentsDir",$dolibarr_main_data
print '</td></tr></table>';
if ($choice != 'confirm_allfiles')
{
//if ($choice != 'confirm_allfiles')
//{
print '<br>';
print '<div class="center"><input class="button" type="submit" value="'.$langs->trans("PurgeRunNow").'"></div>';
}
//}
print '</form>';

View File

@ -3,7 +3,7 @@
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.org>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Regis Houssin <jfefe@aternatik.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
@ -33,27 +33,22 @@ $langs->load("admin");
if (! $user->admin)
accessforbidden();
$actionsave=GETPOST("save");
$action=GETPOST("action");
// Sauvegardes parametres
if ($actionsave)
//Activate ProfId
if ($action == 'setproductionmode')
{
$i=0;
$status = GETPOST('status','alpha');
$db->begin();
$i+=dolibarr_set_const($db,'API_KEY',trim(GETPOST("API_KEY")),'chaine',0,'',$conf->entity);
if ($i >= 1)
{
$db->commit();
setEventMessage($langs->trans("SetupSaved"));
}
else
{
$db->rollback();
setEventMessage($langs->trans("Error"), 'errors');
}
if (dolibarr_set_const($db, 'API_PRODUCTION_MODE', $status, 'chaine', 0, '', $conf->entity) > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
}
@ -69,7 +64,7 @@ print_fiche_titre($langs->trans("ApiSetup"),$linkback,'title_setup');
print $langs->trans("ApiDesc")."<br>\n";
print "<br>\n";
print '<form name="apisetupform" action="'.$_SERVER["PHP_SELF"].'" method="post">';
//print '<form name="apisetupform" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder" width="100%">';
@ -80,22 +75,24 @@ print "<td>&nbsp;</td>";
print "</tr>";
print '<tr class="impair">';
print '<td class="fieldrequired">'.$langs->trans("KeyForApiAccess").'</td>';
print '<td><input type="text" class="flat" id="API_KEY" name="API_KEY" value="'. (GETPOST('API_KEY')?GETPOST('API_KEY'):(! empty($conf->global->API_KEY)?$conf->global->API_KEY:'')) . '" size="40">';
if (! empty($conf->use_javascript_ajax))
print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
print '</td>';
print '<td>'.$langs->trans("ApiProductionMode").'</td>';
$production_mode=(empty($conf->global->API_PRODUCTION_MODE)?false:true);
if ($production_mode)
{
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setproductionmode&value='.($i+1).'&status=0">';
print img_picto($langs->trans("Activated"),'switch_on');
print '</a></td>';
}
else
{
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setproductionmode&value='.($i+1).'&status=1">';
print img_picto($langs->trans("Disabled"),'switch_off');
print '</a></td>';
}
print '<td>&nbsp;</td>';
print '</tr>';
print '</table>';
print '<br><div class="center">';
print '<input type="submit" name="save" class="button" value="'.$langs->trans("Save").'">';
print '</div>';
print '</form>';
print '<br><br>';
// API endpoint
@ -111,27 +108,9 @@ $url=DOL_MAIN_URL_ROOT.'/public/api/explorer/index.html';
print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
print '<br>';
print '<br>';
print $langs->trans("OnlyActiveElementsAreExposed", DOL_URL_ROOT.'/admin/modules.php');
if (! empty($conf->use_javascript_ajax))
{
print "\n".'<script type="text/javascript">';
print '$(document).ready(function () {
$("#generate_token").click(function() {
$.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
action: \'getrandompassword\',
generic: true
},
function(token) {
$("#API_KEY").val(token);
});
});
});';
print '</script>';
}
llxFooter();

View File

@ -43,8 +43,10 @@ class DolibarrApi
* @param DoliDb $db Database handler
*/
function __construct($db) {
global $conf;
$this->db = $db;
$this->r = new Restler();
$production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true );
$this->r = new Restler($production_mode);
}
/**

View File

@ -52,7 +52,7 @@ class DolibarrApiAccess implements iAuthenticate
* @return bool
* @throws RestException
*/
public function _isAllowed()
public function __isAllowed()
{
global $db;
@ -114,7 +114,7 @@ class DolibarrApiAccess implements iAuthenticate
* @example Digest
* @example OAuth
*/
public function _getWWWAuthenticateString()
public function __getWWWAuthenticateString()
{
return '';
}

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2014-2015 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
@ -211,7 +211,7 @@ if ($conf->societe->enabled)
{
$nbno=$nbtotal=0;
print_fiche_titre($langs->trans("BarcodeInitForThirdparties"),'','');
print_fiche_titre($langs->trans("BarcodeInitForThirdparties"),'','object_company');
print '<br>'."\n";
$sql="SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."societe where barcode IS NULL or barcode = ''";
$resql=$db->query($sql);
@ -236,7 +236,7 @@ if ($conf->societe->enabled)
print '<br><input class="button" type="submit" id="submitformbarcodethirdpartygen" '.((GETPOST("selectorforbarcode") && GETPOST("selectorforbarcode"))?'':'disabled ').'value="'.$langs->trans("InitEmptyBarCode",$nbno).'"';
print ' title="'.dol_escape_htmltag($langs->trans("FeatureNotYetAvailable")).'" disabled';
print '>';
print '<br><br><br>';
print '<br><br><br><br>';
}
@ -252,7 +252,7 @@ if ($conf->product->enabled || $conf->product->service)
$nbno=$nbtotal=0;
print_fiche_titre($langs->trans("BarcodeInitForProductsOrServices"),'','');
print_fiche_titre($langs->trans("BarcodeInitForProductsOrServices"),'','object_product');
print '<br>'."\n";
$sql ="SELECT count(rowid) as nb, fk_product_type, datec";
@ -312,7 +312,7 @@ if ($conf->product->enabled || $conf->product->service)
$moretags2=(($nbno == $nbtotal)?' disabled':'');
print ' &nbsp; ';
print '<input class="button" type="submit" name="eraseallbarcode" id="eraseallbarcode" value="'.$langs->trans("EraseAllCurrentBarCode").'"'.$moretags2.' onClick="return confirm_erase();">';
print '<br><br><br>';
print '<br><br><br><br>';
}

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2009 Laurent Destailleur <eldy@uers.sourceforge.net>
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2009 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2015 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
@ -41,8 +42,10 @@ require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php';
//header("Content-type: text/html; charset=UTF-8");
header("Content-type: text/html; charset=".$conf->file->character_set_client);
$search = GETPOST("code", "alpha");
// Search from criteria
if (dol_strlen($_GET["code"]) >= 0) // If search criteria is on char length at least
if (dol_strlen($search) >= 0) // If search criteria is on char length at least
{
$sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx";
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
@ -54,11 +57,15 @@ if (dol_strlen($_GET["code"]) >= 0) // If search criteria is on char length at l
// Add criteria on ref/label
if (! empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE))
{
$sql.= " AND (p.ref LIKE '".$_GET['code']."%' OR p.label LIKE '".$_GET['code']."%')";
$sql.= " AND (p.ref LIKE '".$db->escape($search)."%' OR p.label LIKE '".$db->escape($search)."%'";
if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '".$db->escape($search)."%'";
$sql.= ")";
}
else
{
$sql.= " AND (p.ref LIKE '%".$_GET['code']."%' OR p.label LIKE '%".$_GET['code']."%')";
$sql.= " AND (p.ref LIKE '%".$db->escape($search)."%' OR p.label LIKE '%".$db->escape($search)."%'";
if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '%".$db->escape($search)."%'";
$sql.= ")";
}
$sql.= " ORDER BY label";

View File

@ -1,5 +1,6 @@
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2015 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
@ -59,8 +60,8 @@ function afficheDonnees(aId, aTexte) {
// aCible : id du bloc de destination; aCode : argument a passer a la page php chargee du traitement et de l'affichage
function verifResultat(aCible, aCode) {
if (aCode != '') {
function verifResultat(aCible, aCode, iLimit = 1) {
if (aCode != '' && aCode.length >= iLimit) {
if (texte = file ('facturation_dhtml.php?code='+escape(aCode))) {

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 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
@ -43,8 +44,8 @@ $langs->load("cashdesk");
<!-- Affichage de la reference et de la designation -->
<td><input class="texte_ref" type="text" id ="txtRef" name="txtRef" value="<?php echo $obj_facturation->ref() ?>"
onchange="javascript: setSource('REF');"
onkeyup="javascript: verifResultat('resultats_dhtml', this.value);"
onfocus="javascript: this.select(); verifResultat('resultats_dhtml', this.value);"
onkeyup="javascript: verifResultat('resultats_dhtml', this.value, <?php echo (isset($conf->global->BARCODE_USE_SEARCH_TO_SELECT) ? (int) $conf->global->BARCODE_USE_SEARCH_TO_SELECT : 1) ?>);"
onfocus="javascript: this.select(); verifResultat('resultats_dhtml', this.value, <?php echo (isset($conf->global->BARCODE_USE_SEARCH_TO_SELECT) ? (int) $conf->global->BARCODE_USE_SEARCH_TO_SELECT : 1) ?>);"
onBlur="javascript: document.getElementById('resultats_dhtml').innerHTML = '';"/>
</td>
<td class="select_design">

View File

@ -65,6 +65,10 @@ $object = new Categorie($db);
$extrafields = new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('categorycard'));
/*
* Actions
*/

View File

@ -7,6 +7,7 @@
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
@ -251,6 +252,11 @@ if ($socid)
print $form->showrefnav($soc,'socid','',($user->societe_id?0:1),'rowid','nom','','&type='.$type);
print '</td></tr>';
// Alias names (commercial, trademark or alias names)
print '<tr><td valign="top">'.$langs->trans('AliasNames').'</td><td colspan="3">';
print $soc->name_alias;
print "</td></tr>";
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$soc->prefix_comm.'</td></tr>';

View File

@ -56,6 +56,9 @@ $object = new Categorie($db);
$extrafields = new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('categorycard'));
/*
* Actions
*/

View File

@ -160,7 +160,7 @@ foreach($fulltree as $key => $val)
}
print '<table class="liste" width="100%">';
print '<table class="liste nohover" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Categories").'</td><td></td><td align="right">';
if (! empty($conf->use_javascript_ajax))
{

View File

@ -64,6 +64,9 @@ $type=$object->type;
$extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('categorycard'));
/*
* Actions
*/

View File

@ -37,6 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
if (! empty($conf->projet->enabled))
{
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
@ -57,6 +58,7 @@ $backtopage=GETPOST('backtopage','alpha');
$contactid=GETPOST('contactid','int');
$origin=GETPOST('origin','alpha');
$originid=GETPOST('originid','int');
$confirm = GETPOST('confirm', 'alpha');
$fulldayevent=GETPOST('fullday');
$datep=dol_mktime($fulldayevent?'00':GETPOST("aphour"), $fulldayevent?'00':GETPOST("apmin"), 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear"));
@ -78,6 +80,10 @@ $contact = new Contact($db);
$extrafields = new ExtraFields($db);
$formfile = new FormFile($db);
$form = new Form($db);
$formfile = new FormFile($db);
$formactions = new FormActions($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
@ -129,6 +135,29 @@ if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser'))
if ($action == 'update') $action = 'edit';
}
// Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes')
{
if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
{
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
}
else
{
if ($id > 0) {
$object->fetch($id);
$result = $object->createFromClone(GETPOST('fk_userowner'), GETPOST('socid'));
if ($result > 0) {
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
exit();
} else {
setEventMessage($object->error, 'errors');
$action = '';
}
}
}
}
// Add event
if ($action == 'add')
{
@ -542,10 +571,6 @@ if ($action == 'mupdate')
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
llxHeader('',$langs->trans("Agenda"),$help_url);
$form = new Form($db);
$formfile = new FormFile($db);
$formactions = new FormActions($db);
if ($action == 'create')
{
$contact = new Contact($db);
@ -1035,6 +1060,15 @@ if ($id > 0)
{
dol_fiche_head($head, 'card', $langs->trans("Action"),0,'action');
// Clone event
if($action == 'clone')
{
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . GETPOST('id'), $langs->trans('CloneAction'), $langs->trans('ConfirmCloneAction', $object->label), 'confirm_clone', $formquestion, 'yes', 1);
print $formconfirm;
}
// Affichage fiche action en mode visu
print '<table class="border" width="100%">';
@ -1241,7 +1275,17 @@ if ($id > 0)
{
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Modify").'</a></div>';
}
if ($user->rights->agenda->allactions->create ||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create))
{
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=clone&object='.$object->element.'&id='.$object->id.'">'.$langs->trans("ToClone").'</a></div>';
}
else
{
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("ToClone").'</a></div>';
}
if ($user->rights->agenda->allactions->delete ||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->delete))
{

View File

@ -391,6 +391,68 @@ class ActionComm extends CommonObject
}
/**
* Load an object from its id and create a new one in database
*
* @param user $fuser Object user making action
* @param int $socid Id of thirdparty
* @return int New id of clone
*/
function createFromClone($fuser, $socid)
{
global $db, $user, $langs, $conf, $hookmanager;
$this->context['createfromclone']='createfromclone';
$error=0;
$now=dol_now();
$this->db->begin();
// Load source object
$objFrom = dol_clone($this);
$this->fetch_optionals();
$this->fetch_userassigned();
$this->id=0;
// Create clone
$result=$this->add($fuser);
if ($result < 0) $error++;
if (! $error)
{
// Hook of thirdparty module
if (is_object($hookmanager))
{
$parameters=array('objFrom'=>$objFrom);
$action='';
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}
// Call trigger
$result=$this->call_trigger('ACTION_CLONE', $fuser);
if ($result < 0) { $error++; }
// End call triggers
}
unset($this->context['createfromclone']);
// End
if (! $error)
{
$this->db->commit();
return $this->id;
}
else
{
$this->db->rollback();
return -1;
}
}
/**
* Load object from database
*

View File

@ -1738,7 +1738,7 @@ if ($action == 'create')
$ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/'));
$fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
// Define output language
@ -1764,7 +1764,7 @@ if ($action == 'create')
dol_print_error($db, $result);
exit();
}
$fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/'));
$fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
}

View File

@ -8,6 +8,7 @@
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
@ -35,6 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
@ -225,6 +227,11 @@ if ($id > 0)
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
print '</td></tr>';
// Alias names (commercial, trademark or alias names)
print '<tr><td>'.$langs->trans('AliasNames').'</td><td colspan="3">';
print $object->name_alias;
print "</td></tr>";
// Prospect/Customer
print '<tr><td width="30%">'.$langs->trans('ProspectCustomer').'</td><td width="70%" colspan="3">';
print $object->getLibCustProspStatut();
@ -258,7 +265,7 @@ if ($id > 0)
}
// Address
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3">';
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3">';
dol_print_address($object->address,'gmap','thirdparty',$object->id);
print "</td></tr>";
@ -469,10 +476,12 @@ if ($id > 0)
}
// Categories
print '<tr><td>' . $langs->trans( "Categories" ) . '</td>';
print '<td colspan="3">';
print $form->showCategories( $object->id, 'customer', 1 );
print "</td></tr>";
if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) {
print '<tr><td>' . $langs->trans( "Categories" ) . '</td>';
print '<td colspan="3">';
print $form->showCategories( $object->id, 'customer', 1 );
print "</td></tr>";
}
// Other attributes
$parameters=array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
@ -491,7 +500,7 @@ if ($id > 0)
{
$langs->load("members");
$langs->load("users");
print '<tr><td width="25%" valign="top">'.$langs->trans("LinkedToDolibarrMember").'</td>';
print '<tr><td width="25%">'.$langs->trans("LinkedToDolibarrMember").'</td>';
print '<td colspan="3">';
$adh=new Adherent($db);
$result=$adh->fetch('','',$object->id);

View File

@ -5,6 +5,7 @@
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
*
* This program is freei software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -65,6 +66,7 @@ if (!$user->rights->societe->client->voir && !$socid) $search_sale = $user->id;
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('customerlist'));
$extrafields = new ExtraFields($db);
/*
@ -91,6 +93,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
if ($search_status=='') $search_status=1; // always display activ customer first
/*
* view
*/
@ -102,9 +105,15 @@ $thirdpartystatic=new Societe($db);
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$langs->trans("ThirdParty"),$help_url);
$sql = "SELECT s.rowid, s.nom as name, s.client, s.zip, s.town, st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta, s.status as status,";
$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.client, s.zip, s.town, st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta, s.status as status,";
$sql.= " s.datec, s.canvas";
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
@ -114,27 +123,22 @@ $sql.= " AND s.client IN (1, 3)";
$sql.= ' AND s.entity IN ('.getEntity('societe', 1).')';
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc";
if ($socid) $sql.= " AND s.rowid = ".$socid;
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_company) {
$sql .= natural_search('s.nom', $search_company);
}
if ($search_zipcode) $sql.= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'";
if ($search_town) {
$sql .= natural_search('s.town', $search_town);
}
if ($search_code) $sql.= " AND s.code_client LIKE '%".$db->escape($search_code)."%'";
if ($search_compta) $sql.= " AND s.code_compta LIKE '%".$db->escape($search_compta)."%'";
if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status);
// Insert sale filter
if ($search_sale > 0)
{
$sql .= " AND sc.fk_user = ".$search_sale;
}
if ($search_company) $sql.= natural_search(array('s.nom', 's.name_alias'), $search_company);
if ($search_zipcode) $sql.= natural_search("s.zip", $search_zipcode);
if ($search_town) $sql.= natural_search('s.town', $search_town);
if ($search_code) $sql.= natural_search("s.code_client", $search_code);
if ($search_compta) $sql.= natural_search("s.code_compta", $search_compta);
if ($search_status!='') $sql.= " AND s.status = ".$db->escape($search_status);
if ($search_sale > 0) $sql.= " AND sc.fk_user = ".$search_sale;
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
// Count total nb of records
$nbtotalofrecords = 0;
@ -182,6 +186,9 @@ if ($result)
{
print '<div class="liste_titre">';
print $moreforfilter;
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
@ -194,12 +201,12 @@ if ($result)
print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER["PHP_SELF"],"s.code_compta","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
print '<td class="liste_titre">&nbsp;</td>';
$parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print "</tr>\n";
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('');
print "</tr>\n";
print '<tr class="liste_titre">';
@ -227,6 +234,10 @@ if ($result)
print '&nbsp;';
print '</td>';
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '<td class="liste_titre" align="center">';
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
print '</td>';
@ -235,10 +246,8 @@ if ($result)
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>';
$parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print '</tr>'."\n";
print "</tr>\n";
$var=True;
@ -256,6 +265,7 @@ if ($result)
$thirdpartystatic->code_client=$obj->code_client;
$thirdpartystatic->canvas=$obj->canvas;
$thirdpartystatic->status=$obj->status;
$thirdpartystatic->name_alias=$obj->name_alias;
print $thirdpartystatic->getNomUrl(1);
print '</td>';
print '<td>'.$obj->zip.'</td>';
@ -263,23 +273,27 @@ if ($result)
print '<td>'.$obj->code_client.'</td>';
print '<td>'.$obj->code_compta.'</td>';
print '<td align="right">'.dol_print_date($db->jdate($obj->datec),'day').'</td>';
print '<td align="center">'.$thirdpartystatic->getLibStatut(3);
print '</td>';
print '<td></td>';
$parameters=array('obj' => $obj);
$formconfirm=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '<td align="center">'.$thirdpartystatic->getLibStatut(3);
print '</td>';
print '<td></td>';
print "</tr>\n";
$i++;
}
//print_barre_liste($langs->trans("ListOfCustomers"), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num);
print "</table>\n";
print "</form>\n";
$db->free($result);
$parameters=array('sql' => $sql);
$formconfirm=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>\n";
print "</form>\n";
}
else
{

View File

@ -2340,7 +2340,7 @@ if ($action == 'create')
$ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/').'([^\-])+');
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
// Define output language
@ -2365,7 +2365,7 @@ if ($action == 'create')
dol_print_error($db, $result);
exit();
}
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/').'([^\-])+');
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
}

View File

@ -7,6 +7,7 @@
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
@ -155,6 +156,7 @@ $sts = array(-1,0,1,2,3);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('prospectlist'));
$extrafields = new ExtraFields($db);
// Do we click on purge search criteria ?
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
@ -208,11 +210,17 @@ $prospectstatic=new Client($db);
$prospectstatic->client=2;
$prospectstatic->loadCacheOfProspStatus();
$sql = "SELECT s.rowid as socid, s.nom as name, s.zip, s.town, s.datec, s.status as status, s.code_client, s.client,";
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias, s.zip, s.town, s.datec, s.status as status, s.code_client, s.client,";
$sql.= " s.prefix_comm, s.fk_prospectlevel, s.fk_stcomm as stcomm_id,";
$sql.= " st.libelle as stcomm_label,";
$sql.= " d.nom as departement";
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."c_stcomm as st";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d on (d.rowid = s.fk_departement)";
@ -228,7 +236,7 @@ if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_nom) $sql .= natural_search('s.nom', $search_nom);
if ($search_nom) $sql .= natural_search(array('s.nom','s.name_alias'), $search_nom);
if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape(strtolower($search_zipcode))."%'";
if ($search_town) $sql .= natural_search('s.town', $search_town);
if ($search_state) $sql .= natural_search('d.nom', $search_state);
@ -244,6 +252,10 @@ if ($socname)
$sortfield = "s.nom";
$sortorder = "ASC";
}
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
// Count total nb of records
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
@ -317,6 +329,9 @@ if ($resql)
{
print '<div class="liste_titre">';
print $moreforfilter;
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
@ -331,11 +346,13 @@ if ($resql)
print_liste_field_titre($langs->trans("ProspectLevelShort"),$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("StatusProsp"),$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('');
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('');
$parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('');
print "</tr>\n";
@ -395,6 +412,10 @@ if ($resql)
print '&nbsp;';
print '</td>';
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSearch',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '<td class="liste_titre" align="center">';
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
print '</td>';
@ -404,10 +425,6 @@ if ($resql)
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></tr>\n";
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSearch',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</tr>\n";
$i = 0;
@ -427,6 +444,7 @@ if ($resql)
$prospectstatic->code_client=$obj->code_client;
$prospectstatic->client=$obj->client;
$prospectstatic->fk_prospectlevel=$obj->fk_prospectlevel;
$prospectstatic->name_alias=$obj->name_alias;
print $prospectstatic->getNomUrl(1,'prospect');
print '</td>';
print "<td>".$obj->zip."</td>";
@ -452,13 +470,15 @@ if ($resql)
}
print '</td>';
print '<td align="center">';
$parameters=array('obj' => $obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '<td align="center">';
print $prospectstatic->LibStatut($prospectstatic->status,3);
print '</td>';
print '<td></td>';
$parameters=array('obj' => $obj);
$formconfirm=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print '<td></td>';
print "</tr>\n";
$i++;
@ -473,7 +493,8 @@ if ($resql)
$db->free($resql);
$parameters=array('sql' => $sql);
$formconfirm=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
}
else
{

View File

@ -2358,7 +2358,7 @@ if ($action == 'create' && $user->rights->commande->creer)
dol_print_error($db, $result);
exit();
}
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'([^\-])+');
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
}

View File

@ -39,6 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
@ -50,6 +51,7 @@ $langs->load("companies");
$langs->load("salaries");
$langs->load("loan");
$langs->load("donations");
$langs->load("trips");
$id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int'));
$ref = GETPOST('ref','alpha');
@ -188,6 +190,7 @@ $paymentsupplierstatic=new PaiementFourn($db);
$paymentvatstatic=new TVA($db);
$paymentsalstatic=new PaymentSalary($db);
$donstatic=new Don($db);
$expensereportstatic=new ExpenseReport($db);
$bankstatic=new Account($db);
$banklinestatic=new AccountLine($db);
@ -732,6 +735,12 @@ if ($id > 0 || ! empty($ref))
print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
print '</a>';
}
elseif ($links[$key]['type']=='payment_expensereport')
{
print '<a href="'.DOL_URL_ROOT.'/expensereport/payment/card.php?id='.$links[$key]['url_id'].'">';
print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
print '</a>';
}
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.

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
@ -177,7 +177,7 @@ $form->select_comptes($account_to,'account_to',0,'',1);
print "</td>\n";
print "<td>";
$form->select_date($dateo,'','','','','add');
$form->select_date((! empty($dateo)?$dateo:''),'','','','','add');
print "</td>\n";
print '<td><input name="label" class="flat" type="text" size="40" value="'.$label.'"></td>';
print '<td><input name="amount" class="flat" type="text" size="8" value="'.$amount.'"></td>';

View File

@ -3821,7 +3821,7 @@ if ($action == 'create')
$ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/').'([^\-])+');
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
// Define output language
@ -3846,7 +3846,7 @@ if ($action == 'create')
dol_print_error($db, $result);
exit();
}
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/').'([^\-])+');
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
}

View File

@ -3061,11 +3061,14 @@ class Facture extends CommonInvoice
/**
* Create a withdrawal request for a standing order
*
* @param User $user User asking standing order
* @param User $fuser User asking standing order
* @param float $amount Amount we request withdraw for
* @return int <0 if KO, >0 if OK
*/
function demande_prelevement($user)
function demande_prelevement($fuser, $amount=0)
{
global $langs;
$error=0;
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
@ -3099,27 +3102,36 @@ class Facture extends CommonInvoice
// For example print 239.2 - 229.3 - 9.9; does not return 0.
//$resteapayer=bcadd($this->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
$resteapayer = price2num($this->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT');
if (empty($amount)) $amount = price2num($this->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT');
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande';
$sql .= ' (fk_facture, amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib)';
$sql .= ' VALUES ('.$this->id;
$sql .= ",'".price2num($resteapayer)."'";
$sql .= ",'".$this->db->idate($now)."'";
$sql .= ",".$user->id;
$sql .= ",'".$bac->code_banque."'";
$sql .= ",'".$bac->code_guichet."'";
$sql .= ",'".$bac->number."'";
$sql .= ",'".$bac->cle_rib."')";
if (is_numeric($amount) && $amount != 0)
{
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande';
$sql .= ' (fk_facture, amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib)';
$sql .= ' VALUES ('.$this->id;
$sql .= ",'".price2num($amount)."'";
$sql .= ",'".$this->db->idate($now)."'";
$sql .= ",".$fuser->id;
$sql .= ",'".$bac->code_banque."'";
$sql .= ",'".$bac->code_guichet."'";
$sql .= ",'".$bac->number."'";
$sql .= ",'".$bac->cle_rib."')";
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql)
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this).'::demandeprelevement Erreur');
$error++;
}
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql)
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this).'::demandeprelevement Erreur');
$error++;
}
}
else
{
$this->error='WithdrawRequestErrorNilAmount';
dol_syslog(get_class($this).'::demandeprelevement WithdrawRequestErrorNilAmount');
$error++;
}
if (! $error)
{
@ -3159,11 +3171,11 @@ class Facture extends CommonInvoice
/**
* Supprime une demande de prelevement
*
* @param User $user utilisateur creant la demande
* @param User $fuser User making delete
* @param int $did id de la demande a supprimer
* @return int <0 if OK, >0 if KO
*/
function demande_prelevement_delete($user, $did)
function demande_prelevement_delete($fuser, $did)
{
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
$sql .= ' WHERE rowid = '.$did;
@ -3184,8 +3196,8 @@ class Facture extends CommonInvoice
/**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
* @param User $user Object user
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
* @param User $user Object user
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/
function load_board($user)
{

View File

@ -10,6 +10,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Ferran Marcet <fmarcet@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
@ -88,6 +89,9 @@ $search_sale = GETPOST('search_sale','int');
$day = GETPOST('day','int');
$month = GETPOST('month','int');
$year = GETPOST('year','int');
$day_lim = GETPOST('day_lim','int');
$month_lim = GETPOST('month_lim','int');
$year_lim = GETPOST('year_lim','int');
$filtre = GETPOST('filtre');
// Security check
@ -213,6 +217,19 @@ else if ($year > 0)
{
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
}
if ($month_lim > 0)
{
if ($year_lim > 0 && empty($day_lim))
$sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($year_lim,$month_lim,false))."' AND '".$db->idate(dol_get_last_day($year_lim,$month_lim,false))."'";
else if ($year_lim > 0 && ! empty($day_lim))
$sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month_lim, $day_lim, $year_lim))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month_lim, $day_lim, $year_lim))."'";
else
$sql.= " AND date_format(f.date_lim_reglement, '%m') = '".$month_lim."'";
}
else if ($year_lim > 0)
{
$sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($year_lim,1,false))."' AND '".$db->idate(dol_get_last_day($year_lim,12,false))."'";
}
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
if ($search_user > 0)
{
@ -322,7 +339,11 @@ if ($resql)
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
$formother->select_year($year?$year:-1,'year',1, 20, 5);
print '</td>';
print '<td class="liste_titre" align="left">&nbsp;</td>';
print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day_lim" value="'.$day_lim.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month_lim" value="'.$month_lim.'">';
$formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5);
print '</td>';
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="8" name="search_societe" value="'.$search_societe.'"></td>';
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_montant_ht" value="'.$search_montant_ht.'"></td>';
print '<td class="liste_titre" align="right">&nbsp;</td>';

View File

@ -275,7 +275,7 @@ if ($action == "builddoc" && $user->rights->facture->lire && ! GETPOST('button_s
{
$arrayofinclusion=array();
foreach($_POST['toGenerate'] as $tmppdf) $arrayofinclusion[]=preg_quote($tmppdf.'.pdf','/');
$factures = dol_dir_list($conf->facture->dir_output,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC);
$factures = dol_dir_list($conf->facture->dir_output,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true);
// liste les fichiers
$files = array();
@ -284,7 +284,7 @@ if ($action == "builddoc" && $user->rights->facture->lire && ! GETPOST('button_s
{
foreach($factures as $facture)
{
if(strstr($facture["name"],$basename))
if (strstr($facture["name"],$basename))
{
$files[] = $conf->facture->dir_output.'/'.$basename.'/'.$facture["name"];
}
@ -810,10 +810,8 @@ if ($resql)
{
// Checkbox to merge
print '<td align="center">';
if (! empty($formfile->numoffiles))
if (! empty($formfile->infofiles['extensions']['pdf']))
print '<input id="cb'.$objp->facid.'" class="flat checkformerge" type="checkbox" name="toGenerate[]" value="'.$objp->facnumber.'">';
else
print '&nbsp;';
print '</td>' ;
}
else

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
*
@ -68,14 +68,19 @@ if ($action == "new")
{
if ($object->id > 0)
{
$result = $object->demande_prelevement($user);
$db->begin();
$result = $object->demande_prelevement($user, GETPOST('withdraw_request_amount'));
if ($result > 0)
{
$db->commit();
setEventMessage($langs->trans("RecordSaved"));
}
else
{
setEventMessage($object->error, 'errors');
{
$db->rollback();
setEventMessage($object->error, $object->errors, 'errors');
}
}
$action='';
@ -309,7 +314,7 @@ if ($object->id > 0)
print '</td>';
print '</tr>';
// Conditions de reglement
// Payment condition
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentConditionsShort');
@ -370,11 +375,11 @@ if ($object->id > 0)
print '</td><td colspan="3">';
if ($action == 'editmode')
{
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id');
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id');
}
else
{
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none');
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none');
}
print '</td></tr>';
@ -478,7 +483,13 @@ if ($object->id > 0)
{
if ($user->rights->prelevement->bons->creer)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=new">'.$langs->trans("MakeWithdrawRequest").'</a>';
print '<form method="POST" action="">';
print '<input type="hidden" name="id" value="' . $object->id . '" />';
print '<input type="hidden" name="action" value="new" />';
print '<label for="withdraw_request_amount">' . $langs->trans('WithdrawRequestAmount') . ' </label>';
print '<input type="text" id="withdraw_request_amount" name="withdraw_request_amount" value="' . $resteapayer . '" size="10" />';
print '<input type="submit" class="butAction" value="'.$langs->trans("MakeWithdrawRequest").'" />';
print '</form>';
}
else
{
@ -508,10 +519,12 @@ if ($object->id > 0)
print '<tr class="liste_titre">';
print '<td align="left">'.$langs->trans("DateRequest").'</td>';
print '<td align="center">'.$langs->trans("DateProcess").'</td>';
print '<td align="center">'.$langs->trans("User").'</td>';
print '<td align="center">'.$langs->trans("Amount").'</td>';
print '<td align="center">'.$langs->trans("WithdrawalReceipt").'</td>';
print '<td align="center">'.$langs->trans("User").'</td><td>&nbsp;</td><td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td align="center">'.$langs->trans("DateProcess").'</td>';
print '<td>&nbsp;</td>';
print '</tr>';
$var=true;
@ -526,15 +539,18 @@ if ($object->id > 0)
print "<tr ".$bc[$var].">";
print '<td align="left">'.dol_print_date($db->jdate($obj->date_demande),'day')."</td>\n";
print '<td align="center">'.$langs->trans("OrderWaiting").'</td>';
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
print '<td align="center">'.price($obj->amount).'</td>';
print '<td align="center">-</td>';
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
print '<td>&nbsp;</td>';
print '<td>';
print '<td align="center">'.$langs->trans("OrderWaiting").'</td>';
print '<td align="right">';
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=delete&amp;did='.$obj->rowid.'">';
print img_delete();
print '</a></td>';
print "</tr>\n";
$i++;
}
@ -574,7 +590,7 @@ if ($object->id > 0)
print '<td align="left">'.dol_print_date($db->jdate($obj->date_demande),'day')."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->date_traite),'day')."</td>\n";
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
print '<td align="center">'.price($obj->amount).'</td>';
@ -585,9 +601,10 @@ if ($object->id > 0)
print $withdrawreceipt->getNomUrl(1);
print "</td>\n";
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
print '<td>&nbsp;</td>';
print '<td align="center">'.dol_print_date($db->jdate($obj->date_traite),'day')."</td>\n";
print '<td>&nbsp;</td>';
print "</tr>\n";

View File

@ -67,7 +67,7 @@ $childids[]=$user->id;
llxHeader(array(),$langs->trans('HRMArea'));
print_fiche_titre($langs->trans("HRMArea"));
print_fiche_titre($langs->trans("HRMArea"),'', 'title_hrm.png');
print '<div class="fichecenter"><div class="fichethirdleft">';

View File

@ -109,7 +109,7 @@ $calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local;
if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services
{
$nom=$langs->transcountry($local==1?"LT1ReportByCustomersInInputOutputMode":"LT2ReportByCustomersInInputOutputMode",$mysoc->country_code);
$calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT'.$local.'Rec");
$calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT".$local."Rec");
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");

View File

@ -129,7 +129,7 @@ $calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local;
if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services
{
$nom=$langs->trans($local==1?"LT1ReportByQuartersInDueDebtMode":"LT2ReportByQuartersInDueDebtMode");
$calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT'.$local.'Rec");
$calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT".$local."Rec");
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
$prevyear=$year_start; $prevquarter=$q;
@ -161,7 +161,7 @@ if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice
if ($conf->global->$calc==2) // Invoice for goods, payment for services
{
$nom=$langs->trans($local==1?"LT1ReportByQuartersInInputOutputMode":"LT2ReportByQuartersInInputOutputMode");
$calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT'.$local.'Rec");
$calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT".$local."Rec");
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
$prevyear=$year_start; $prevquarter=$q;

View File

@ -55,7 +55,7 @@ $pagenext = $page + 1;
/*
* Mode Liste
* Mode List
*
*/
$sql = "SELECT p.rowid, p.ref, p.amount, p.statut";
@ -81,7 +81,7 @@ if ($result)
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"');
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"p.datec","","",'class="liste_titre" align="center"');
print '<td class="liste_titre" align="right">'.$langs->trans("Amount").'</td>';
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"","","",'align="center"');
print '</tr>';
print '<tr class="liste_titre">';
@ -121,7 +121,7 @@ else
dol_print_error($db);
}
$db->close();
llxFooter();
$db->close();

View File

@ -25,6 +25,7 @@
require('../../main.inc.php');
require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
@ -45,6 +46,11 @@ if ($user->societe_id > 0) accessforbidden();
$action = GETPOST('action','alpha');
$id = GETPOST('id','int');
$socid = GETPOST('socid','int');
$page = GETPOST('page','int');
$sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha');
$sortfield = ((GETPOST('sortfield','alpha')=="")) ? "pl.fk_soc" : GETPOST('sortfield','alpha');
/*
* Actions
@ -207,10 +213,10 @@ if ($id > 0)
print '<table class="border" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("NotifyTransmision").'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("TransData").'</td><td>';
print '<tr '.$bc[false].'><td width="20%">'.$langs->trans("TransData").'</td><td>';
print $form->select_date('','','','','',"userfile",1,1);
print '</td></tr>';
print '<tr><td width="20%">'.$langs->trans("TransMetod").'</td><td>';
print '<tr '.$bc[false].'><td width="20%">'.$langs->trans("TransMetod").'</td><td>';
print $form->selectarray("methode",$bon->methodes_trans);
print '</td></tr>';
/* print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
@ -230,7 +236,7 @@ if ($id > 0)
print '<table class="border" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("NotifyCredit").'</td></tr>';
print '<tr><td width="20%">'.$langs->trans('CreditDate').'</td><td>';
print '<tr '.$bc[false].'><td width="20%">'.$langs->trans('CreditDate').'</td><td>';
print $form->select_date('','','','','',"infocredit",1,1);
print '</td></tr>';
print '</table>';
@ -259,6 +265,122 @@ if ($id > 0)
print "</div>";
}
$ligne=new LignePrelevement($db,$user);
if ($page == -1) { $page = 0 ; }
$offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
/*
* Lines into withdraw request
*/
$sql = "SELECT pl.rowid, pl.statut, pl.amount";
$sql.= ", s.rowid as socid, s.nom as name";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql.= ", ".MAIN_DB_PREFIX."prelevement_bons as pb";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE pl.fk_prelevement_bons = ".$id;
$sql.= " AND pl.fk_prelevement_bons = pb.rowid";
$sql.= " AND pb.entity = ".$conf->entity;
$sql.= " AND pl.fk_soc = s.rowid";
if ($socid) $sql.= " AND s.rowid = ".$socid;
$sql.= $db->order($sortfield, $sortorder);
$sql.= $db->plimit($conf->liste_limit+1, $offset);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i = 0;
$urladd = "&amp;id=".$prev_id;
print_barre_liste("", $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
print"\n<!-- debut table -->\n";
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Lines"),$_SERVER["PHP_SELF"],"pl.rowid",'',$urladd);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",'',$urladd);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"pl.amount","",$urladd,'align="center"');
print_liste_field_titre('');
print '</tr>';
$var=false;
$total = 0;
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object($result);
print "<tr ".$bc[$var].">";
print "<td>";
print $ligne->LibStatut($obj->statut,2);
print "&nbsp;";
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
print substr('000000'.$obj->rowid, -6);
print '</a></td>';
$thirdparty=new Societe($db);
$thirdparty->fetch($obj->socid);
print '<td>';
print $thirdparty->getNomUrl(1);
print "</td>\n";
print '<td align="center">'.price($obj->amount)."</td>\n";
print '<td>';
if ($obj->statut == 3)
{
print '<b>'.$langs->trans("StatusRefused").'</b>';
}
else
{
print "&nbsp;";
}
print '</td></tr>';
$total += $obj->total_ttc;
$var=!$var;
$i++;
}
if($socid)
{
print "<tr ".$bc[$var].">";
print '<td>'.$langs->trans("Total").'</td>';
print '<td align="center">'.price($total)."</td>\n";
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print "</tr>\n";
}
print "</table>";
$db->free($result);
}
else
{
dol_print_error($db);
}
}

View File

@ -446,8 +446,17 @@ class BonPrelevement extends CommonObject
$fac = new Facture($this->db);
$fac->fetch($facs[$i][0]);
$amounts[$fac->id] = $facs[$i][1];
$result = $fac->set_paid($user);
$totalpaye = $fac->getSommePaiement();
$totalcreditnotes = $fac->getSumCreditNotesUsed();
$totaldeposits = $fac->getSumDepositsUsed();
$alreadypayed = $totalpaye + $totalcreditnotes + $totaldeposits;
if ($alreadypayed + $facs[$i][1] >= $fac->total_ttc) {
$result = $fac->set_paid($user);
}
}
$paiement = new Paiement($this->db);
$paiement->datepaye = $date ;
$paiement->amounts = $amounts;
@ -651,7 +660,7 @@ class BonPrelevement extends CommonObject
{
global $conf;
$sql = "SELECT sum(f.total_ttc) as nb";
$sql = "SELECT sum(pfd.amount) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,";
$sql.= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
//$sql.= " ,".MAIN_DB_PREFIX."c_paiement as cp";
@ -837,7 +846,7 @@ class BonPrelevement extends CommonObject
else
{
dol_syslog(__METHOD__."::Check RIB Error on default bank number RIB/IBAN for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_ERR);
$this->invoice_in_error[$fac[0]]="Error on default bank number RIB/IBAN for invoice ".$fact->getNomUrl(0)." for thirdparty (reported by function verif) ".$soc->name;
$this->invoice_in_error[$fac[0]]="Error on default bank number RIB/IBAN for invoice ".$fact->getNomUrl(0)." for thirdparty (reported by function verif) ".$soc->getNomUrl(0);
}
}
else
@ -924,6 +933,7 @@ class BonPrelevement extends CommonObject
if ($resql)
{
$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
$this->id = $prev_id;
$dir=$conf->prelevement->dir_output.'/receipts';
$file=$filebonprev;
@ -981,6 +991,7 @@ class BonPrelevement extends CommonObject
dol_syslog(__METHOD__."::Update Orders::Sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql)
{
$error++;
@ -1210,7 +1221,7 @@ class BonPrelevement extends CommonObject
/**
* Generate a withdrawal file.
* Generation Formats:
* - Europe: SEPA (France: CFONB no more supported, Spain: AEB19 if external module EsAEB is enabled)
* - Europe: SEPA (France: CFONB no more supported, Spain: AEB19 if external module EsAEB is enabled)
* - Others countries: Warning message
* File is generated with name this->filename
*
@ -1226,6 +1237,11 @@ class BonPrelevement extends CommonObject
dol_syslog(get_class($this)."::generate build file ".$this->filename);
$this->file = fopen($this->filename,"w");
if (empty($this->file))
{
$this->error=$langs->trans('ErrorFailedToOpenFile', $this->filename);
return -1;
}
$found=0;
@ -1287,7 +1303,8 @@ class BonPrelevement extends CommonObject
//echo $sql;
$resql=$this->db->query($sql);
if ($resql)
{ $num = $this->db->num_rows($resql);
{
$num = $this->db->num_rows($resql);
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
@ -1297,7 +1314,8 @@ class BonPrelevement extends CommonObject
}
}
else
{ fputs($this->file, 'ERREUR DEBITEUR '.$sql.$CrLf);
{
fputs($this->file, 'ERREUR DEBITEUR '.$sql.$CrLf);
$result = -2;
}
@ -1305,10 +1323,12 @@ class BonPrelevement extends CommonObject
* section Emetteur(sepa Emetteur bloc lines)
*/
if ($result != -2)
{ $fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $i, $this->total, $CrLf);
{
$fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $i, $this->total, $CrLf);
}
else
{ fputs($this->file, 'ERREUR EMETTEUR'.$CrLf);
{
fputs($this->file, 'ERREUR EMETTEUR'.$CrLf);
}
/**
@ -1503,7 +1523,7 @@ class BonPrelevement extends CommonObject
*/
static function buildRumNumber($row_code_client, $row_datec, $row_drum)
{
$pre = ($row_datec > 1359673200) ? 'Rum' : '++R';
$pre = ($row_datec > 1359673200) ? 'RUM-' : '++R';
return $pre.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec);
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2015 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>
*
@ -96,13 +96,19 @@ if (prelevement_check_config() < 0)
print '</div>';
}
$h=0;
/*$h=0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/create.php';
$head[$h][1] = $langs->trans("NewStandingOrder");
$head[$h][2] = 'payment';
$hselected = 'payment';
$h++;
dol_fiche_head($head, $hselected, $langs->trans("StandingOrders"), 0, 'payment');
*/
print_fiche_titre($langs->trans("NewStandingOrder"));
dol_fiche_head();
$nb=$bprev->NbFactureAPrelever();
$nb1=$bprev->NbFactureAPrelever(1);
@ -161,7 +167,7 @@ print '<br>';
*/
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, s.nom as name, s.rowid as socid,";
$sql.= " pfd.date_demande";
$sql.= " pfd.date_demande, pfd.amount";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,";
$sql.= " ".MAIN_DB_PREFIX."societe as s,";
$sql.= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
@ -184,6 +190,7 @@ if ($resql)
print '<td>'.$langs->trans("Invoice").'</td>';
print '<td>'.$langs->trans("ThirdParty").'</td>';
print '<td>'.$langs->trans("RIB").'</td>';
print '<td>'.$langs->trans("RUM").'</td>';
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
print '<td align="right">'.$langs->trans("DateRequest").'</td>';
print '</tr>';
@ -210,9 +217,13 @@ if ($resql)
print '<td>';
print $thirdpartystatic->display_rib();
print '</td>';
// RUM
print '<td>';
print $thirdpartystatic->display_rib('rum');
print '</td>';
// Amount
print '<td align="right">';
print price($obj->total_ttc,0,$langs,0,0,-1,$conf->currency);
print price($obj->amount,0,$langs,0,0,-1,$conf->currency);
print '</td>';
// Date
print '<td align="right">';
@ -265,11 +276,14 @@ if ($result)
$obj = $db->fetch_object($result);
$var=!$var;
print "<tr ".$bc[$var]."><td>";
print "<tr ".$bc[$var].">";
print "<td>";
$bprev->id=$obj->rowid;
$bprev->ref=$obj->ref;
print $bprev->getNomUrl(1);
print "</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->datec),'day')."</td>\n";
print '<td align="right">'.price($obj->amount,0,$langs,0,0,-1,$conf->currency)."</td>\n";

View File

@ -96,7 +96,7 @@ print '</td></tr></table><br>';
* Invoices waiting for withdraw
*/
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,";
$sql.= " pfd.date_demande,";
$sql.= " pfd.date_demande, pfd.amount,";
$sql.= " s.nom as name, s.rowid as socid";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,";
$sql.= " ".MAIN_DB_PREFIX."societe as s";
@ -143,7 +143,7 @@ if ($resql)
print '</td>';
print '<td align="right">';
print price($obj->total_ttc);
print price($obj->amount);
print '</td>';
print '<td align="right">';

View File

@ -1,225 +0,0 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 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>
*
* 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/compta/prelevement/lignes.php
* \ingroup prelevement
* \brief Prelevement lines
*/
require('../../main.inc.php');
require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("banks");
$langs->load("categories");
// Security check
if ($user->societe_id > 0) accessforbidden();
$langs->load('withdrawals');
$langs->load('bills');
// Get supervariables
$prev_id = GETPOST('id','int');
$socid = GETPOST('socid','int');
$page = GETPOST('page','int');
$sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha');
$sortfield = ((GETPOST('sortfield','alpha')=="")) ? "pl.fk_soc" : GETPOST('sortfield','alpha');
/*
* View
*/
llxHeader('',$langs->trans("WithdrawalsReceipts"));
if ($prev_id)
{
$bon = new BonPrelevement($db,"");
if ($bon->fetch($prev_id) == 0)
{
$head = prelevement_prepare_head($bon);
dol_fiche_head($head, 'lines', $langs->trans("WithdrawalsReceipts"), '', 'payment');
print '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
// Status
print '<tr><td width="20%">'.$langs->trans('Status').'</td>';
print '<td>'.$bon->getLibStatut(1).'</td>';
print '</tr>';
if($bon->date_trans <> 0)
{
$muser = new User($db);
$muser->fetch($bon->user_trans);
print '<tr><td width="20%">'.$langs->trans("TransData").'</td><td>';
print dol_print_date($bon->date_trans,'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("TransMetod").'</td><td>';
print $bon->methodes_trans[$bon->method_trans];
print '</td></tr>';
}
if($bon->date_credit <> 0)
{
print '<tr><td width="20%">'.$langs->trans('CreditDate').'</td><td>';
print dol_print_date($bon->date_credit,'day');
print '</td></tr>';
}
print '</table>';
print '<br>';
print '<table class="border" width="100%"><tr><td width="20%">';
print $langs->trans("WithdrawalFile").'</td><td>';
$relativepath = 'receipts/'.$bon->ref;
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr></table>';
dol_fiche_end();
}
else
{
dol_print_error($db);
}
}
$ligne=new LignePrelevement($db,$user);
if ($page == -1) { $page = 0 ; }
$offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
/*
* Liste des lignes de prelevement
*/
$sql = "SELECT pl.rowid, pl.statut, pl.amount";
$sql.= ", s.rowid as socid, s.nom as name";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql.= ", ".MAIN_DB_PREFIX."prelevement_bons as pb";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE pl.fk_prelevement_bons = ".$prev_id;
$sql.= " AND pl.fk_prelevement_bons = pb.rowid";
$sql.= " AND pb.entity = ".$conf->entity;
$sql.= " AND pl.fk_soc = s.rowid";
if ($socid) $sql.= " AND s.rowid = ".$socid;
$sql.= " ORDER BY $sortfield $sortorder ";
$sql.= $db->plimit($conf->liste_limit+1, $offset);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i = 0;
$urladd = "&amp;id=".$prev_id;
print_barre_liste("", $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
print"\n<!-- debut table -->\n";
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Lines"),$_SERVER["PHP_SELF"],"pl.rowid",'',$urladd);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",'',$urladd);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"pl.amount","",$urladd,'align="center"');
print '<td colspan="2">&nbsp;</td></tr>';
$var=false;
$total = 0;
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object($result);
print "<tr ".$bc[$var]."><td>";
print $ligne->LibStatut($obj->statut,2);
print "&nbsp;";
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
print substr('000000'.$obj->rowid, -6);
print '</a></td>';
$thirdparty=new Societe($db);
$thirdparty->fetch($obj->socid);
print '<td>';
print $thirdparty->getNomUrl(1);
print "</td>\n";
print '<td align="center">'.price($obj->amount)."</td>\n";
print '<td>';
if ($obj->statut == 3)
{
print '<b>'.$langs->trans("StatusRefused").'</b>';
}
else
{
print "&nbsp;";
}
print '</td></tr>';
$total += $obj->total_ttc;
$var=!$var;
$i++;
}
if($socid)
{
print "<tr ".$bc[$var]."><td>";
print '<td>Total</td>';
print '<td align="center">'.price($total)."</td>\n";
print '<td>&nbsp;</td>';
print "</tr>\n";
}
print "</table>";
$db->free($result);
}
else
{
dol_print_error($db);
}
$db->close();
llxFooter();

View File

@ -115,7 +115,7 @@ if ($socid > 0)
if (! $num > 0)
{
print '<tr><td colspan="7">'.$langs->trans("NoInvoice").'</td></tr>';
print '<tr '.$bc[false].'><td colspan="7">'.$langs->trans("NoInvoice").'</td></tr>';
}
$solde = 0;

View File

@ -40,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT. '/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$langs->load("companies");
$langs->load("users");
$langs->load("other");
@ -220,7 +221,17 @@ if (empty($reshook))
{
$error++; $errors=array_merge($errors,($object->error?array($object->error):$object->errors));
$action = 'create';
}
} else {
// Categories association
$contcats = GETPOST( 'contcats', 'array' );
if (!empty( $contcats )) {
$cat = new Categorie( $db );
foreach ($contcats as $id_category) {
$cat->fetch( $id_category );
$cat->add_type( $object, 'contact' );
}
}
}
}
if (! $error && $id > 0)
@ -313,8 +324,22 @@ if (empty($reshook))
$result = $object->update($contactid, $user);
if ($result > 0)
{
if ($result > 0) {
// Categories association
// First we delete all categories association
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'categorie_contact';
$sql .= ' WHERE fk_socpeople = ' . $object->id;
$db->query( $sql );
// Then we add the associated categories
$categories = GETPOST( 'contcats', 'array' );
if (!empty( $categories )) {
$cat = new Categorie( $db );
foreach ($categories as $id_category) {
$cat->fetch( $id_category );
$cat->add_type( $object, 'contact' );
}
}
$object->old_lastname='';
$object->old_firstname='';
$action = 'view';
@ -580,6 +605,15 @@ else
print $form->selectarray('priv',$selectarray,(GETPOST("priv",'alpha')?GETPOST("priv",'alpha'):$object->priv),0);
print '</td></tr>';
// Categories
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) {
print '<tr><td>' . fieldLabel( 'Categories', 'contcats' ) . '</td><td colspan="3">';
$cate_arbo = $form->select_all_categories( Categorie::TYPE_CONTACT, null, 'parent', null, null, 1 );
print $form->multiselectarray( 'contcats', $cate_arbo, GETPOST( 'contcats', 'array' ), null, null, null,
null, '90%' );
print "</td></tr>";
}
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
@ -819,6 +853,20 @@ else
print $object->getLibStatut(4);
print '</td></tr>';
// Categories
if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) {
print '<tr><td>' . fieldLabel( 'Categories', 'contcats' ) . '</td>';
print '<td colspan="3">';
$cate_arbo = $form->select_all_categories( Categorie::TYPE_CONTACT, null, null, null, null, 1 );
$c = new Categorie( $db );
$cats = $c->containing( $object->id, Categorie::TYPE_CONTACT );
foreach ($cats as $cat) {
$arrayselected[] = $cat->id;
}
print $form->multiselectarray( 'contcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%' );
print "</td></tr>";
}
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
@ -1043,6 +1091,15 @@ else
print $object->getLibStatut(4);
print '</td>';
print '</tr>'."\n";
// Categories
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) {
print '<tr><td>' . $langs->trans( "Categories" ) . '</td>';
print '<td colspan="3">';
print $form->showCategories( $object->id, 'contact', 1 );
print '</td></tr>';
}
// Other attributes
$parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook

View File

@ -918,6 +918,11 @@ class Contact extends CommonObject
$result='';
$label = '<u>' . $langs->trans("ShowContact") . '</u>';
$label.= '<br><b>' . $langs->trans("Name") . ':</b> '.$this->getFullName($langs);
//if ($this->civility_id) $label.= '<br><b>' . $langs->trans("Civility") . ':</b> '.$this->civility_id; // TODO Translate cibilty_id code
$label.= '<br><b>' . $langs->trans("Poste") . ':</b> '.$this->poste;
$label.= '<br><b>' . $langs->trans("EMail") . ':</b> '.$this->email;
$label.= '<br><b>' . $langs->trans("Phone") . ':</b> '.join(', ',array($this->phone_pro,$this->phone_mobile,$this->phone_perso));
$label.= '<br><b>' . $langs->trans("Address") . ':</b> '.dol_format_address($this, 1, ' ', $langs);
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';

View File

@ -273,7 +273,6 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
$tdparam='';
if (isset($contents[$i][$j]['td'])) $tdparam.=' '.$contents[$i][$j]['td'];
if (empty($contents[$i][$j]['text'])) $contents[$i][$j]['text']="";
$text=isset($contents[$i][$j]['text'])?$contents[$i][$j]['text']:'';
$textwithnotags=preg_replace('/<([^>]+)>/i','',$text);
$text2=isset($contents[$i][$j]['text2'])?$contents[$i][$j]['text2']:'';

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
@ -148,6 +149,7 @@ abstract class CommonDocGenerator
$array_thirdparty = array(
'company_name'=>$object->name,
'company_name_alias' => $object->name_alias,
'company_email'=>$object->email,
'company_phone'=>$object->phone,
'company_fax'=>$object->fax,

View File

@ -404,7 +404,7 @@ class Form
else $paramfortooltiptd =($extracss?' class="'.$extracss.'"':'').($extrastyle?' style="'.$extrastyle.'"':''); // Attribut to put on td text tag
$s="";
if (empty($notabs)) $s.='<table class="nobordernopadding" summary=""><tr style="height: auto;">';
elseif ($notabs == 2) $s.='<div class="inline-block nowrap">';
elseif ($notabs == 2) $s.='<div class="inline-block">';
// Define value if value is before
if ($direction < 0) {
$s.='<'.$tag.$paramfortooltipimg;
@ -818,15 +818,16 @@ class Form
*
* @param string $selected Preselected type
* @param string $htmlname Name of field in form
* @param string $filter optional filters criteras (example: 's.rowid <> x')
* @param string $filter optional filters criteras (example: 's.rowid <> x', 's.client IN (1,3)')
* @param int $showempty Add an empty field
* @param int $showtype Show third party type in combolist (customer, prospect or supplier)
* @param int $forcecombo Force to use combo box
* @param array $events Ajax event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @param int $limit Maximum number of elements
* @param string $morecss Add more css styles to the SELECT component
* @return string HTML string with select box for thirdparty.
*/
function select_company($selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array(), $limit=0)
function select_company($selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100')
{
$out='';
@ -860,7 +861,7 @@ class Form
}
else
{*/
$out.=$this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit);
$out.=$this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss);
//}
return $out;
@ -879,9 +880,10 @@ class Form
* @param string $filterkey Filter on key value
* @param int $outputmode 0=HTML select string, 1=Array
* @param int $limit Limit number of answers
* @param string $morecss Add more css styles to the SELECT component
* @return string HTML string with
*/
function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0)
function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0, $morecss='minwidth100')
{
global $conf,$user,$langs;
@ -935,7 +937,7 @@ class Form
}
// Construct $out and $outarray
$out.= '<select id="'.$htmlname.'" class="flat minwidth100" name="'.$htmlname.'"'.$nodatarole.'>'."\n";
$out.= '<select id="'.$htmlname.'" class="flat'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'"'.$nodatarole.'>'."\n";
$textifempty='';
// Do not use textempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@ -2322,7 +2324,7 @@ class Form
/**
* Charge dans cache la liste des conditions de paiements possibles
* Load into cache list of payment terms
*
* @return int Nb of lines loaded, <0 if KO
*/
@ -2356,7 +2358,7 @@ class Form
$i++;
}
//$this->cache_conditions_paiements=dol_sort_array($this->cache_conditions_paiements, 'label'); // We use the sortorder
//$this->cache_conditions_paiements=dol_sort_array($this->cache_conditions_paiements, 'label', 'asc', 0, 0, 1); // We use the field sortorder of table
return $num;
}
@ -2401,7 +2403,7 @@ class Form
$i++;
}
$this->cache_availability = dol_sort_array($this->cache_availability, 'label');
$this->cache_availability = dol_sort_array($this->cache_availability, 'label', 'asc', 0, 0, 1);
return $num;
}
@ -2482,7 +2484,7 @@ class Form
$i++;
}
$this->cache_demand_reason=dol_sort_array($tmparray, 'label', 'asc');
$this->cache_demand_reason=dol_sort_array($tmparray, 'label', 'asc', 0, 0, 1);
unset($tmparray);
return $num;
@ -2545,7 +2547,9 @@ class Form
dol_syslog(__METHOD__, LOG_DEBUG);
$sql = "SELECT id, code, libelle, type";
$this->cache_types_paiements = array();
$sql = "SELECT id, code, libelle as label, type";
$sql.= " FROM ".MAIN_DB_PREFIX."c_paiement";
$sql.= " WHERE active > 0";
@ -2559,14 +2563,15 @@ class Form
$obj = $this->db->fetch_object($resql);
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label=($langs->trans("PaymentTypeShort".$obj->code)!=("PaymentTypeShort".$obj->code)?$langs->trans("PaymentTypeShort".$obj->code):($obj->libelle!='-'?$obj->libelle:''));
$label=($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code)!=("PaymentTypeShort".$obj->code)?$langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code):($obj->label!='-'?$obj->label:''));
$this->cache_types_paiements[$obj->id]['id'] =$obj->id;
$this->cache_types_paiements[$obj->id]['code'] =$obj->code;
$this->cache_types_paiements[$obj->id]['label']=$label;
$this->cache_types_paiements[$obj->id]['type'] =$obj->type;
$i++;
}
$this->cache_types_paiements = dol_sort_array($this->cache_types_paiements, 'label');
$this->cache_types_paiements = dol_sort_array($this->cache_types_paiements, 'label', 'asc', 0, 0, 1);
return $num;
}
@ -3207,22 +3212,23 @@ class Form
// Show JQuery confirm box. Note that global var $useglobalvars is used inside this template
$formconfirm.= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">';
if (! empty($more)) {
$formconfirm.= '<div>'.$more.'</div>';
$formconfirm.= '<div class="confirmquestions">'.$more.'</div>';
}
$formconfirm.= ($question ? img_help('','').' '.$question : '');
$formconfirm.= ($question ? '<div class="confirmmessage"'.img_help('','').' '.$question . '</div>': '');
$formconfirm.= '</div>'."\n";
$formconfirm.= "\n<!-- begin ajax form_confirm page=".$page." -->\n";
$formconfirm.= '<script type="text/javascript">'."\n";
$formconfirm.='
$formconfirm.= 'jQuery(document).ready(function() {
$(function() {
$( "#'.$dialogconfirm.'" ).dialog({
$( "#'.$dialogconfirm.'" ).dialog(
{
autoOpen: '.($autoOpen ? "true" : "false").',';
if ($newselectedchoice == 'no')
{
$formconfirm.='
open: function() {
$(this).parent().find("button.ui-button:eq(1)").focus();
$(this).parent().find("button.ui-button:eq(2)").focus();
},';
}
$formconfirm.='
@ -3270,7 +3276,8 @@ class Form
$(this).dialog("close");
}
}
});
}
);
var button = "'.$button.'";
if (button.length > 0) {
@ -3279,6 +3286,7 @@ class Form
});
}
});
});
</script>';
$formconfirm.= "<!-- end ajax form_confirm -->\n";
}
@ -3574,7 +3582,7 @@ class Form
/**
* Affiche formulaire de selection des modes de reglement
* Show form with payment mode
*
* @param string $page Page
* @param int $selected Id mode pre-selectionne
@ -3602,6 +3610,7 @@ class Form
if ($selected)
{
$this->load_cache_types_paiements();
print $this->cache_types_paiements[$selected]['label'];
} else {
print "&nbsp;";
@ -4599,7 +4608,7 @@ class Form
*
* @param int $id Id of object
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact'). Old mode (0, 1, 2, ...) is deprecated.
* @param int $rendermode 0=Default, use multiselect. 1=Use text with link
* @param int $rendermode 0=Default, use multiselect. 1=Emulate multiselect
* @return mixed Array of category objects or < 0 if KO
*/
function showCategories($id, $type, $rendermode=0)
@ -4617,10 +4626,10 @@ class Form
$ways = $c->print_all_ways();
foreach($ways as $way)
{
$toprint[] = img_object('','category').' '.$way;
$toprint[] = '<li class="select2-search-choice-dolibarr">'.img_object('','category').' '.$way.'</li>';
}
}
return implode('<br>', $toprint);
return '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
}
if ($rendermode == 0)

View File

@ -718,10 +718,11 @@ class FormCompany
* @param string $htmlname HTML select name
* @param string $fields Fields
* @param int $fieldsize Field size
* @param int $disableautocomplete 1 To disable autocomplete features
* @param int $disableautocomplete 1 To disable ajax autocomplete features (browser autocomplete may still occurs)
* @param string $moreattrib Add more attribute on HTML input field
* @return string
*/
function select_ziptown($selected='', $htmlname='zipcode', $fields='', $fieldsize=0, $disableautocomplete=0)
function select_ziptown($selected='', $htmlname='zipcode', $fields='', $fieldsize=0, $disableautocomplete=0, $moreattrib='')
{
global $conf;
@ -730,8 +731,12 @@ class FormCompany
$size='';
if (!empty($fieldsize)) $size='size="'.$fieldsize.'"';
if ($conf->use_javascript_ajax && empty($disableautocomplete)) $out.= ajax_multiautocompleter($htmlname,$fields,DOL_URL_ROOT.'/core/ajax/ziptown.php')."\n";
$out.= '<input id="'.$htmlname.'" type="text" name="'.$htmlname.'" '.$size.' value="'.$selected.'">'."\n";
if ($conf->use_javascript_ajax && empty($disableautocomplete))
{
$out.= ajax_multiautocompleter($htmlname,$fields,DOL_URL_ROOT.'/core/ajax/ziptown.php')."\n";
$moreattrib.=' autocomplete="off"';
}
$out.= '<input id="'.$htmlname.'" type="text"'.($moreattrib?' '.$moreattrib:'').' name="'.$htmlname.'" '.$size.' value="'.$selected.'">'."\n";
return $out;
}

View File

@ -37,6 +37,7 @@ class FormFile
var $error;
var $numoffiles;
var $infofiles; // Used to return informations by function getDocumentsLink
/**
@ -680,16 +681,17 @@ class FormFile
* @param string $modulepart propal, facture, facture_fourn, ...
* @param string $modulesubdir Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module.
* @param string $filedir Directory to scan
* @return string Output string with HTML link of documents (might be empty string)
* @param string $filter Filter filenames on this regex string (Example: '\.pdf$')
* @return string Output string with HTML link of documents (might be empty string). This also fill the array ->infofiles
*/
function getDocumentsLink($modulepart, $modulesubdir, $filedir)
function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter='')
{
if (! function_exists('dol_dir_list')) include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$out='';
$this->numoffiles=0;
$this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array());
$file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir).'.pdf','/'), '\.meta$|\.png$');
$file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir),'/').'[^\-]+', '\.meta$|\.png$'); // Get list of files starting with name fo ref (but not followed by "-" to discard uploaded files)
// For ajax treatment
$out.= '<div id="gen_pdf_'.$modulesubdir.'" class="linkobject hideobject">'.img_picto('', 'refresh').'</div>'."\n";
@ -699,6 +701,8 @@ class FormFile
// Loop on each file found
foreach($file_list as $file)
{
if ($filter && ! preg_match('/'.$filter.'/i', $file["name"])) continue; // Discard this. It does not match provided filter.
// Define relative path for download link (depends on module)
$relativepath=$file["name"]; // Cas general
if ($modulesubdir) $relativepath=$modulesubdir."/".$file["name"]; // Cas propal, facture...
@ -718,10 +722,14 @@ class FormFile
$mime=dol_mimetype($relativepath,'',0);
if (preg_match('/text/',$mime)) $out.= ' target="_blank"';
$out.= '>';
$out.= img_pdf($file["name"],2);
$out.= img_mime($relativepath, $file["name"]);
$out.= '</a>'."\n";
$this->numoffiles++;
$this->infofiles['nboffiles']++;
$this->infofiles['files'][]=$file['fullname'];
$ext=pathinfo($file["name"], PATHINFO_EXTENSION);
if (empty($this->infofiles[$ext])) $this->infofiles['extensions'][$ext]=1;
else $this->infofiles['extensions'][$ext]++;
}
}
@ -840,7 +848,12 @@ class FormFile
$fileinfo = pathinfo($file['name']);
print '<td align="center">';
$minifile=$fileinfo['filename'].'_mini.'.strtolower($fileinfo['extension']); // Thumbs are created with filename in lower case
if (image_format_supported($file['name']) > 0) print '<img border="0" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.'thumbs/'.$minifile).'" title="">';
if (image_format_supported($file['name']) > 0)
{
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])).'" class="aphoto" target="_blank">';
print '<img border="0" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.'thumbs/'.$minifile).'" title="">';
print '</a>';
}
else print '&nbsp;';
print '</td>';
}
@ -848,6 +861,22 @@ class FormFile
// ($param must start with &)
print '<td align="right">';
if ($useinecm) print '<a href="'.DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($file['name']).$param.'" class="editfilelink" rel="'.urlencode($file['name']).'">'.img_view().'</a> &nbsp; ';
else
{
if (image_format_supported($file['name']) > 0)
{
$permtoedit=0;
if ($user->rights->produit->creer && $object->type == Product::TYPE_PRODUCT) $permtoedit=1;
if ($user->rights->service->creer && $object->type == Product::TYPE_SERVICE) $permtoedit=1;
if (empty($conf->global->MAIN_UPLOAD_DOC)) $permtoedit=0;
if ($permtoedit)
{
// Link to resize
print '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode('produit|service').'&id='.$object->id.'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','',1).'</a> &nbsp; ';
}
}
}
if ($permtodelete)
{
/*

View File

@ -600,7 +600,7 @@ class FormOther
}
/**
* Output a HTML code to select a color
* Output a HTML code to select a color. Field will return an hexa color like '334455'.
*
* @param string $set_color Pre-selected color
* @param string $prefix Name of HTML field

View File

@ -1,19 +1,20 @@
<?php
/* Copyright (c) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
* 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/>.
*/
* 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/core/class/html.formprojet.class.php
@ -52,11 +53,59 @@ class FormProjets
* @param int $option_only Return only html options lines without the select tag
* @param int $show_empty Add an empty line
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
* @param int $forcefocus Force focus on field (works with javascript only)
* @param int $disabled Disabled
* @param int $forcefocus Force focus on field (works with javascript only)
* @param int $disabled Disabled
* @param int $mode 0 for HTML mode and 1 for JSON mode
* @param string $filterkey Key to filter
* @return int Nber of project if OK, <0 if KO
*/
function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=24, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0)
function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=16, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode = 0, $filterkey = '')
{
global $langs,$conf;
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT))
{
$placeholder='';
if ($selected && empty($selected_input_value))
{
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$project = new Project($this->db);
$project->fetch($selected);
$selected_input_value=$project->ref;
}
$urloption='socid='.$socid.'&htmlname='.$htmlname;
print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array(
// 'update' => array(
// 'projectid' => 'id'
// )
));
print '<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' />';
}
else
{
print $this->select_projects_list($socid, $selected, $htmlname, $maxlength, $option_only, $show_empty, $discard_closed, $forcefocus, $disabled, 0, $filterkey);
}
}
/**
* Returns an array with projects qualified for a third party
*
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
* @param int $selected Id project preselected
* @param string $htmlname Nom de la zone html
* @param int $maxlength Maximum length of label
* @param int $option_only Return only html options lines without the select tag
* @param int $show_empty Add an empty line
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
* @param int $forcefocus Force focus on field (works with javascript only)
* @param int $disabled Disabled
* @param int $mode 0 for HTML mode and 1 for JSON mode
* @param string $filterkey Key to filter
* @return int Nber of project if OK, <0 if KO
*/
function select_projects_list($socid=-1, $selected='', $htmlname='projectid', $maxlength=24, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode = 0, $filterkey = '')
{
global $user,$conf,$langs;
@ -81,6 +130,10 @@ class FormProjets
if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")";
if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
if (!empty($filterkey)) {
$sql .= ' AND p.title LIKE "%'.$this->db->escape($filterkey).'%"';
$sql .= ' OR p.ref LIKE "%'.$this->db->escape($filterkey).'%"';
}
$sql.= " ORDER BY p.ref ASC";
dol_syslog(__METHOD__, LOG_DEBUG);
@ -126,7 +179,7 @@ class FormProjets
continue;
}
$labeltoshow=dol_trunc($obj->ref,18);
$labeltoshow=dol_trunc($obj->ref,18).' - '.$obj->title;
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')';
$labeltoshow.=' '.dol_trunc($obj->title,$maxlength);
@ -171,19 +224,30 @@ class FormProjets
$resultat.='</option>';
}
$out.= $resultat;
$outarray[] = array(
'key' => (int) $obj->rowid,
'value' => $obj->ref,
'ref' => $obj->ref,
'label' => $labeltoshow,
'disabled' => (bool) $disabled
);
}
}
$i++;
}
}
if (empty($option_only)) {
$out.= '</select>';
}
print $out;
$this->db->free($resql);
return $num;
if (!$mode) {
if (empty($option_only)) {
$out.= '</select>';
}
print $out;
} else {
return $outarray;
}
}
else
{
@ -290,7 +354,7 @@ class FormProjets
}
else if ($obj->fk_statut == 2)
{
if ($discard_close == 2) $disabled=1;
if ($discard_closed == 2) $disabled=1;
$labeltoshow.=' - '.$langs->trans("Closed");
}
else if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
@ -299,7 +363,7 @@ class FormProjets
$labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
}
// Label for task
$labeltoshow.=' - '.$obj->tref.' '.dol_trunc($obj->tlabel,$maxlenght);
$labeltoshow.=' - '.$obj->tref.' '.dol_trunc($obj->tlabel,$maxlength);
if (!empty($selected) && $selected == $obj->rowid)
{

View File

@ -1,5 +1,6 @@
// Copyright (C) 2011-2014 Laurent Destailleur <eldy@users.sourceforge.net>
// Copyright (C) 2011-2012 Regis Houssin <regis.houssin@capnetworks.com>
// Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
@ -23,7 +24,10 @@
//
$(document).ready(function () {
// Detect and save TZ and DST
var timezone = jstz.determine();
// Detect and save TZ and DST
var rightNow = new Date();
var jan1 = new Date(rightNow.getFullYear(), 0, 1, 0, 0, 0, 0);
var temp = jan1.toGMTString();
@ -40,16 +44,12 @@ $(document).ready(function () {
dst = "1"; // daylight savings time is observed
}
var now=new Date();
var tz=now.toTimeString().match(/\(.*\)/); // now.toTimeString may return "12:39:59 GMT+0200 (CEST)"
//alert('date=' + now + ' string=' + now.toTimeString());
var dst_first=DisplayDstSwitchDates('first');
var dst_second=DisplayDstSwitchDates('second');
//alert(dst);
$('#tz').val(std_time_offset); // returns TZ
// tz is null with IE
if (tz != null) {
$('#tz_string').val(tz[0].replace('(','').replace(')','')); // returns TZ string
}
$('#tz_string').val(timezone.name()); // returns TZ string
$('#dst_observed').val(dst); // returns if DST is observed on summer
$('#dst_first').val(dst_first); // returns DST first switch in year
$('#dst_second').val(dst_second); // returns DST second switch in year

View File

@ -854,7 +854,7 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
// remove invalid value, as it didnt match anything
$( this ).val( "" );
select.val( "" );
input.data( "autocomplete" ).term = "";
input.data("ui-autocomplete").term = "";
return false;
}
}
@ -862,8 +862,8 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
})
.addClass( "ui-widget ui-widget-content ui-corner-left dolibarrcombobox" );
input.data( "autocomplete" )._renderItem = function( ul, item ) {
return $( "<li></li>" )
input.data("ui-autocomplete")._renderItem = function( ul, item ) {
return $("<li></li>")
.data( "item.autocomplete", item )
.append( "<a>" + item.label + "</a>" )
.appendTo( ul );

View File

@ -40,11 +40,3 @@ function updateCoords(c)
jQuery('#w').val(Math.ceil(c.w * ratio));
jQuery('#h').val(Math.ceil(c.h * ratio));
};
/* checkCoords */
function checkCoords()
{
if (parseInt(jQuery('#w').val())) return true;
alert('Please select a crop region then press submit.');
return false;
};

View File

@ -174,8 +174,8 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
$("#search_'.$htmlname.'").trigger("change"); // To tell that input text field was modified
}
,delay: 500
}).data( "autocomplete" )._renderItem = function( ul, item ) {
return $( "<li></li>" )
}).data("ui-autocomplete")._renderItem = function( ul, item ) {
return $("<li></li>")
.data( "item.autocomplete", item )
.append( \'<a><span class="tag">\' + item.label + "</span></a>" )
.appendTo(ul);
@ -225,8 +225,8 @@ function ajax_multiautocompleter($htmlname, $fields, $url, $option='', $minLengt
}
for (i=0;i<nboffields;i++) {
if (item[fields[i]]) { // If defined
//alert(item[fields[i]]);
jQuery("#" + fields[i]).val(item[fields[i]]);
//alert(item[fields[i]]);
jQuery("#" + fields[i]).val(item[fields[i]]);
}
}
}
@ -235,13 +235,22 @@ function ajax_multiautocompleter($htmlname, $fields, $url, $option='', $minLengt
});
},
select: function( event, ui ) {
needtotrigger = "";
for (i=0;i<nboffields;i++) {
//alert(fields[i] + " = " + ui.item[fields[i]]);
if (fields[i]=="selectcountry_id")
{
if (ui.item[fields[i]] > 0) // Do not erase country if unknown
{
oldvalue=jQuery("#" + fields[i]).val();
newvalue=ui.item[fields[i]];
//alert(oldvalue+" "+newvalue);
jQuery("#" + fields[i]).val(ui.item[fields[i]]);
if (oldvalue != newvalue) // To force select2 to refresh visible content
{
needtotrigger="#" + fields[i];
}
// If we set new country and new state, we need to set a new list of state to allow change
if (ui.item.states && ui.item["state_id"] != jQuery("#state_id").value) {
jQuery("#state_id").html(ui.item.states);
@ -252,15 +261,35 @@ function ajax_multiautocompleter($htmlname, $fields, $url, $option='', $minLengt
{
if (ui.item[fields[i]] > 0) // Do not erase state if unknown
{
oldvalue=jQuery("#" + fields[i]).val();
newvalue=ui.item[fields[i]];
//alert(oldvalue+" "+newvalue);
jQuery("#" + fields[i]).val(ui.item[fields[i]]); // This may fails if not correct country
if (oldvalue != newvalue) // To force select2 to refresh visible content
{
needtotrigger="#" + fields[i];
}
}
}
else if (ui.item[fields[i]]) { // If defined
//alert(fields[i]);
//alert(ui.item[fields[i]]);
oldvalue=jQuery("#" + fields[i]).val();
newvalue=ui.item[fields[i]];
//alert(oldvalue+" "+newvalue);
jQuery("#" + fields[i]).val(ui.item[fields[i]]);
if (oldvalue != newvalue) // To force select2 to refresh visible content
{
needtotrigger="#" + fields[i];
}
}
}
if (needtotrigger != "") // To force select2 to refresh visible content
{
// We introduce a delay so hand is back to js and all other js change can be done before the trigger that may execute a submit is done
// This is required for example when changing zip with autocomplete that change the country
jQuery(needtotrigger).delay(500).queue(function() {
jQuery(needtotrigger).trigger("change");
});
}
}
});
});';

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
@ -134,29 +134,27 @@ function checkSwiftForAccount($account)
}
/**
* Check IBAN number informations for a bank account
* Check IBAN number informations for a bank account.
*
* @param Account $account A bank account
* @return boolean True if informations are valid, false otherwise
* @return boolean True if informations are valid, false otherwise
*/
function checkIbanForAccount($account)
{
require_once DOL_DOCUMENT_ROOT.'/includes/php-iban/oophp-iban.php';
$iban = new Iban($account->iban);
$check = $iban->Verify();
if ($check) {
return true;
} else {
return false;
}
$iban = new IBAN($account->iban);
$check = $iban->Verify();
if ($check) return true;
else return false;
}
/**
* Check account number informations for a bank account
*
* @param Account $account A bank account
* @return boolean True if informations are valid, false otherwise
* @return boolean True if informations are valid, false otherwise
*/
function checkBanForAccount($account)
{
@ -225,6 +223,8 @@ function checkBanForAccount($account)
return true;
}
/**
* Returns the key for Spanish Banks Accounts
*
@ -232,7 +232,8 @@ function checkBanForAccount($account)
* @param string $InumCta InumCta
* @return string Key
*/
function checkES($IentOfi, $InumCta) {
function checkES($IentOfi, $InumCta)
{
if (empty($IentOfi) || empty($InumCta) || strlen($IentOfi) != 8 || strlen($InumCta) != 10) {
$keycontrol = "";
return $keycontrol;

View File

@ -666,7 +666,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print "</tr>";
$sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays as country_id, p.poste, p.phone, p.phone_mobile, p.phone_perso, p.fax, p.email, p.skype, p.statut ";
$sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays as country_id, p.civility, p.poste, p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.email, p.skype, p.statut ";
$sql .= ", p.civility as civility_id, p.address, p.zip, p.town";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
$sql .= " WHERE p.fk_soc = ".$object->id;
@ -676,6 +676,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
dol_syslog('core/lib/company.lib.php :: show_contacts', LOG_DEBUG);
$result = $db->query($sql);
if (! $result) dol_print_error($db);
$num = $db->num_rows($result);
$var=true;
@ -695,6 +697,14 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$contactstatic->lastname = $obj->lastname;
$contactstatic->firstname = $obj->firstname;
$contactstatic->civility_id = $obj->civility_id;
$contactstatic->poste = $obj->poste;
$contactstatic->address = $obj->address;
$contactstatic->zip = $obj->zip;
$contactstatic->town = $obj->town;
$contactstatic->phone_pro = $obj->phone_pro;
$contactstatic->phone_mobile = $obj->phone_mobile;
$contactstatic->phone_perso = $obj->phone_perso;
$contactstatic->email = $obj->email;
print $contactstatic->getNomUrl(1,'',0,'&backtopage='.urlencode($backtopage));
print '</td><td>';
if ($obj->poste) print $obj->poste;
@ -719,11 +729,13 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print '</a> ';
}
if ($coords) { print dol_print_address($coords,'address_contact_'.$obj->rowid, 'contact', $obj->rowid); $outdone++; }
if ($obj->phone || $obj->phone_mobile || $obj->phone_perso) print ($outdone?'<br>':'');
if ($obj->phone) { print dol_print_phone($obj->phone,$country_code['code'],$obj->rowid,$object->id,'AC_TEL','&nbsp;','phone'); $outdone++; }
if ($obj->phone_pro || $obj->phone_mobile || $obj->phone_perso || $obj->fax) print ($outdone?'<br>':'');
if ($obj->phone_pro) { print dol_print_phone($obj->phone_pro,$country_code['code'],$obj->rowid,$object->id,'AC_TEL','&nbsp;','phone'); $outdone++; }
if ($obj->phone_mobile) { print dol_print_phone($obj->phone_mobile,$country_code['code'],$obj->rowid,$object->id,'AC_TEL','&nbsp;','phone'); $outdone++; }
if ($obj->phone_perso) { print dol_print_phone($obj->phone_perso,$country_code['code'],$obj->rowid,$object->id,'AC_TEL','&nbsp;','phone'); $outdone++; }
if ($obj->fax) { print dol_print_phone($obj->fax,$country_code['code'],$obj->rowid,$object->id,'AC_FAX','&nbsp;','fax'); $outdone++; }
print '<div style="clear: both;"></div>';
$outdone=0;
if ($obj->email) print dol_print_email($obj->email,$obj->rowid,$object->id,'AC_EMAIL',0,0,1);

View File

@ -82,16 +82,6 @@ function contact_prepare_head(Contact $object)
$head[$tab][2] = 'documents';
$tab++;
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
{
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$type = Categorie::TYPE_CONTACT;
$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[$tab][0] = DOL_URL_ROOT.'/contact/info.php?id='.$object->id;
$head[$tab][1] = $langs->trans("Info");

View File

@ -152,7 +152,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
// if we're in a directory and we want recursive behavior, call this function again
if ($recursive)
{
$file_list = array_merge($file_list,dol_dir_list($path."/".$file, $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder, $mode));
$file_list = array_merge($file_list,dol_dir_list($path."/".$file, $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder, $mode, $nohook));
}
}
else if (! $isdir && (($types == "files") || ($types == "all")))

View File

@ -153,7 +153,7 @@ function ordersupplier_prepare_head($object)
$head[$h][1] = $langs->trans("OrderFollow");
$head[$h][2] = 'info';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'supplier_order', 'remove');
return $head;
}

View File

@ -218,7 +218,7 @@ function dol_shutdown()
global $conf,$user,$langs,$db;
$disconnectdone=false; $depth=0;
if (is_object($db) && ! empty($db->connected)) { $depth=$db->transaction_opened; $disconnectdone=$db->close(); }
dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth)?' (Warn: db disconnection forced, transaction depth was '.$depth.')':''), (($disconnectdone && $depth)?LOG_WARNING:LOG_DEBUG));
dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth)?' (Warn: db disconnection forced, transaction depth was '.$depth.')':''), (($disconnectdone && $depth)?LOG_WARNING:LOG_INFO));
}
@ -877,6 +877,7 @@ function dol_bc($var,$moreclass='')
* @param string $sep Separator to use to build string
* @param Translate $outputlangs Object lang that contains language for text translation.
* @return string Formated string
* @see dol_print_address
*/
function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='')
{
@ -1604,6 +1605,7 @@ function dol_user_country()
* @param int $mode thirdparty|contact|member|other
* @param int $id Id of object
* @return void
* @see dol_format_address
*/
function dol_print_address($address, $htmlid, $mode, $id)
{
@ -4555,12 +4557,13 @@ function dol_htmloutput_errors($mesgstring='', $mesgarray='', $keepembedded=0)
*
* @param array $array Array to sort (array of array('key','otherkey1','otherkey2'...))
* @param string $index Key in array to use for sorting criteria
* @param int $order Sort order
* @param int $order Sort order ('asc' or 'desc')
* @param int $natsort 1=use "natural" sort (natsort), 0=use "standard" sort (asort)
* @param int $case_sensitive 1=sort is case sensitive, 0=not case sensitive
* @param int $keepindex If 0 and index key of array to sort is a numeric, than index will be rewrote. If 1 or index key is not numeric, key for index is kept after sorting.
* @return array Sorted array
*/
function dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0)
function dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
{
// Clean parameters
$order=strtolower($order);
@ -4569,13 +4572,21 @@ function dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensiti
if (is_array($array) && $sizearray>0)
{
foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index];
if (!$natsort) ($order=='asc') ? asort($temp) : arsort($temp);
else
{
($case_sensitive) ? natsort($temp) : natcasesort($temp);
if($order!='asc') $temp=array_reverse($temp,TRUE);
}
foreach(array_keys($temp) as $key) (is_numeric($key))? $sorted[]=$array[$key] : $sorted[$key]=$array[$key];
$sorted = array();
foreach(array_keys($temp) as $key)
{
(is_numeric($key) && empty($keepindex)) ? $sorted[]=$array[$key] : $sorted[$key]=$array[$key];
}
return $sorted;
}
return $array;
@ -5020,14 +5031,16 @@ function dol_getmypid()
*
* @param string|string[] $fields String or array of strings, filled with the name of all fields in the SQL query we must check (combined with a OR)
* @param string $value The value to look for.
* If param $mode is 0, can contains several keywords separated with a space, like "keyword1 keyword2" = We want record field like keyword1 and field like keyword2
* If param $mode is 0, can contains several keywords separated with a space or |
* like "keyword1 keyword2" = We want record field like keyword1 AND field like keyword2
* or like "keyword1|keyword2" = We want record field like keyword1 OR field like keyword2
* If param $mode is 1, can contains an operator <, > or = like "<10" or ">=100.5 < 1000"
* If param $mode is 2, can contains a list of id separated by comma like "1,3,4"
* @param integer $mode 0=value is list of keywords, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of id separated with comma (Example '1,3,4')
* @param integer $nofinaland 1=Do now output the final 'AND'
* @param integer $nofirstand 1=Do now output the first 'AND'
* @return string $res The statement to append to the SQL query
*/
function natural_search($fields, $value, $mode=0, $nofinaland=0)
function natural_search($fields, $value, $mode=0, $nofirstand=0)
{
global $db,$langs;
@ -5079,15 +5092,22 @@ function natural_search($fields, $value, $mode=0, $nofinaland=0)
}
else
{
$newres .= ($i2 > 0 ? ' OR ' : '') . $field . " LIKE '%" . $db->escape(trim($crit)) . "%'";
$i2++; // a criteria was added to string
$textcrit = '';
$tmpcrits = explode('|',$crit);
$i3 = 0;
foreach($tmpcrits as $tmpcrit)
{
$newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : '') . $field . " LIKE '%" . $db->escape(trim($tmpcrit)) . "%'";
$i3++;
}
$i2++; // a criteria was added to string
}
$i++;
}
if ($newres) $res = $res . ($res ? ' AND ' : '') . ($i2 > 1 ? '(' : '') .$newres . ($i2 > 1 ? ')' : '');
$j++;
}
$res = ($nofinaland?"":" AND ")."(" . $res . ")";
$res = ($nofirstand?"":" AND ")."(" . $res . ")";
//print 'xx'.$res.'yy';
return $res;
}

View File

@ -1918,22 +1918,24 @@ function fetchObjectByElement($element_id,$element_type) {
* Convert an array with RGB value into hex RGB value
*
* @param array $arraycolor Array
* @param string $colorifnotfound Color code to return if entry not defined
* @param string $colorifnotfound Color code to return if entry not defined or not a RGB format
* @return string RGB hex value (without # before). For example: FF00FF
* @see Make the opposite of colorStringToArray
*/
function colorArrayToHex($arraycolor,$colorifnotfound='888888')
{
if (! is_array($arraycolor)) return $colorifnotfound;
if (empty($arraycolor)) return $colorifnotfound;
return dechex($arraycolor[0]).dechex($arraycolor[1]).dechex($arraycolor[2]);
}
/**
* Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,255)
* Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,255).
* If entry is already an array, return it.
*
* @param string $stringcolor String with hex (FFFFFF) or comma RGB ('255,255,255')
* @param string $colorifnotfound Color code to return if entry not defined
* @param array $colorifnotfound Color code array to return if entry not defined
* @return string RGB hex value (without # before). For example: FF00FF
* @see Make the opposite of colorArrayToHex
*/

View File

@ -547,161 +547,3 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
return $imgThumbName;
}
/**
* This function returns the html for the moneymeter.
*
* @param int $actualValue amount of actual money
* @param int $pendingValue amount of money of pending memberships
* @param int $intentValue amount of intended money (that's without the amount of actual money)
* @return string thermometer htmlLegenda
*/
function moneyMeter($actualValue=0, $pendingValue=0, $intentValue=0)
{
global $langs;
// variables
$height="200";
$maximumValue=125000;
$imageDir = "http://eucd.info/images/therm/";
$imageTop = $imageDir . "therm_top.png";
$imageMiddleActual = $imageDir . "therm_actual.png";
$imageMiddlePending = $imageDir . "therm_pending.png";
$imageMiddleIntent = $imageDir . "therm_intent.png";
$imageMiddleGoal = $imageDir . "therm_goal.png";
$imageIndex = $imageDir . "therm_index.png";
$imageBottom = $imageDir . "therm_bottom.png";
$imageColorActual = $imageDir . "therm_color_actual.png";
$imageColorPending = $imageDir . "therm_color_pending.png";
$imageColorIntent = $imageDir . "therm_color_intent.png";
$formThermTop = '
<!-- Thermometer Begin -->
<table cellpadding="0" cellspacing="4" border="0">
<tr><td>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="2"><img src="' . $imageTop . '" width="58" height="6" border="0"></td>
</tr>
<tr>
<td>
<table cellpadding="0" cellspacing="0" border="0">';
$formSection = '
<tr><td><img src="{image}" width="26" height="{height}" border="0"></td></tr>';
$formThermbottom = '
</table>
</td>
<td><img src="' . $imageIndex . '" width="32" height="200" border="0"></td>
</tr>
<tr>
<td colspan="2"><img src="' . $imageBottom . '" width="58" height="32" border="0"></td>
</tr>
</table>
</td>
</tr></table>';
// legenda
$legendaActual = "&euro; " . round($actualValue);
$legendaPending = "&euro; " . round($pendingValue);
$legendaIntent = "&euro; " . round($intentValue);
$legendaTotal = "&euro; " . round($actualValue + $pendingValue + $intentValue);
$formLegenda = '
<table cellpadding="0" cellspacing="0" border="0">
<tr><td><img src="' . $imageColorActual . '" width="9" height="9">&nbsp;</td><td><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>'.$langs->trans("Paid").':<br>' . $legendaActual . '</b></font></td></tr>
<tr><td><img src="' . $imageColorPending . '" width="9" height="9">&nbsp;</td><td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">'.$langs->trans("Waiting").':<br>' . $legendaPending . '</font></td></tr>
<tr><td><img src="' . $imageColorIntent . '" width="9" height="9">&nbsp;</td><td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">'.$langs->trans("Promesses").':<br>' . $legendaIntent . '</font></td></tr>
<tr><td>&nbsp;</td><td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Total:<br>' . $legendaTotal . '</font></td></tr>
</table>
<!-- Thermometer End -->';
// check and edit some values
$error = 0;
if ( $maximumValue <= 0 || $height <= 0 || $actualValue < 0 || $pendingValue < 0 || $intentValue < 0)
{
return "The money meter could not be processed<br>\n";
}
if ( $actualValue > $maximumValue )
{
$actualValue = $maximumValue;
$pendingValue = 0;
$intentValue = 0;
}
else
{
if ( ($actualValue + $pendingValue) > $maximumValue )
{
$pendingValue = $maximumValue - $actualValue;
$intentValue = 0;
}
else
{
if ( ($actualValue + $pendingValue + $intentValue) > $maximumValue )
{
$intentValue = $maximumValue - $actualValue - $pendingValue;
}
}
}
// start writing the html (from bottom to top)
// bottom
$thermometer = $formThermbottom;
// actual
$sectionHeight = round(($actualValue / $maximumValue) * $height);
$totalHeight = $sectionHeight;
if ( $sectionHeight > 0 )
{
$section = $formSection;
$section = str_replace("{image}", $imageMiddleActual, $section);
$section = str_replace("{height}", $sectionHeight, $section);
$thermometer = $section . $thermometer;
}
// pending
$sectionHeight = round(($pendingValue / $maximumValue) * $height);
$totalHeight += $sectionHeight;
if ( $sectionHeight > 0 )
{
$section = $formSection;
$section = str_replace("{image}", $imageMiddlePending, $section);
$section = str_replace("{height}", $sectionHeight, $section);
$thermometer = $section . $thermometer;
}
// intent
$sectionHeight = round(($intentValue / $maximumValue) * $height);
$totalHeight += $sectionHeight;
if ( $sectionHeight > 0 )
{
$section = $formSection;
$section = str_replace("{image}", $imageMiddleIntent, $section);
$section = str_replace("{height}", $sectionHeight, $section);
$thermometer = $section . $thermometer;
}
// goal
$sectionHeight = $height- $totalHeight;
if ( $sectionHeight > 0 )
{
$section = $formSection;
$section = str_replace("{image}", $imageMiddleGoal, $section);
$section = str_replace("{height}", $sectionHeight, $section);
$thermometer = $section . $thermometer;
}
// top
$thermometer = $formThermTop . $thermometer;
return $thermometer . $formLegenda;
}

View File

@ -9,6 +9,7 @@
* Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
@ -289,6 +290,33 @@ function pdf_getHeightForLogo($logo, $url = false)
return $height;
}
/**
* Returns the name of the thirdparty
*
* @param Societe|Contact $thirdparty Contact or thirdparty
* @param Translate $outputlangs Output language
* @return string
*/
function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs)
{
//Recipient name
$socname = '';
// On peut utiliser le nom de la societe du contact
if ($thirdparty instanceof Societe) {
if (!empty($thirdparty->name_alias)) {
$socname = $thirdparty->name_alias."\n";
}
$socname .= $thirdparty->name;
} elseif ($thirdparty instanceof Contact) {
$socname = $thirdparty->socname;
} else {
throw new InvalidArgumentException();
}
return $outputlangs->convToOutputCharset($socname);
}
/**
* Return a string with full address formated

View File

@ -44,11 +44,6 @@ function prelevement_prepare_head(BonPrelevement $object)
$head[$h][2] = 'prelevement';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$object->id;
$head[$h][1] = $langs->trans("Lines");
$head[$h][2] = 'lines';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$object->id;
$head[$h][1] = $langs->trans("Bills");
$head[$h][2] = 'invoices';

View File

@ -114,10 +114,12 @@ function product_prepare_head($object)
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'product');
/* Merged into the Join files tab
$head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$object->id;
$head[$h][1] = $langs->trans("Photos");
$head[$h][2] = 'photos';
$h++;
*/
// Attachments
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';

View File

@ -53,7 +53,7 @@ function project_prepare_head($object)
|| ! empty($conf->ficheinter->enabled) || ! empty($conf->agenda->enabled) || ! empty($conf->deplacement->enabled))
{
$head[$h][0] = DOL_URL_ROOT.'/projet/element.php?id='.$object->id;
$head[$h][1] = $langs->trans("ProjectReferers");
$head[$h][1] = $langs->trans("Overview");
$head[$h][2] = 'element';
$h++;
}

View File

@ -39,7 +39,7 @@
*/
function report_header($nom,$variante,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='')
{
global $langs, $hselected;
global $langs;
if (empty($hselected)) $hselected='report';
@ -50,7 +50,7 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat
$head[$h][1] = $langs->trans("Report");
$head[$h][2] = 'report';
dol_fiche_head($head, $hselected);
dol_fiche_head($head, 'report');
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
foreach($moreparam as $key => $value)

View File

@ -1133,6 +1133,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
/*
* Menu SUPPLIERS
*/
/*
if ($mainmenu == 'suppliers')
{
$langs->load("suppliers");
@ -1173,6 +1174,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
}
}
*/
/*
* Menu PROJECTS

View File

@ -5,6 +5,7 @@
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
@ -1293,19 +1294,16 @@ class pdf_einstein extends ModelePDFCommandes
$result=$object->fetch_contact($arrayidcontact[0]);
}
// Recipient name
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
else $socname = $object->client->name;
$carac_client_name=$outputlangs->convToOutputCharset($socname);
}
else
{
$carac_client_name=$outputlangs->convToOutputCharset($object->client->name);
//Recipient name
// On peut utiliser le nom de la societe du contact
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$thirdparty = $object->contact;
} else {
$thirdparty = $object->client;
}
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target');
// Show recipient

View File

@ -4,6 +4,7 @@
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
@ -1185,19 +1186,16 @@ class pdf_proforma extends ModelePDFCommandes
$result=$object->fetch_contact($arrayidcontact[0]);
}
// Recipient name
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
else $socname = $object->client->name;
$carac_client_name=$outputlangs->convToOutputCharset($socname);
}
else
{
$carac_client_name=$outputlangs->convToOutputCharset($object->client->name);
//Recipient name
// On peut utiliser le nom de la societe du contact
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$thirdparty = $object->contact;
} else {
$thirdparty = $object->client;
}
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target');
// Show recipient

View File

@ -5,6 +5,7 @@
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011 Fabrice CHERRIER
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
@ -598,17 +599,16 @@ class pdf_strato extends ModelePDFContract
$this->recipient = $object->client;
// Recipient name
if (! empty($usecontact)) {
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
else $socname = $object->client->name;
$this->recipient->name = $outputlangs->convToOutputCharset($socname);
}
else {
$this->recipient->name = $outputlangs->convToOutputCharset($object->client->name);
//Recipient name
// On peut utiliser le nom de la societe du contact
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$thirdparty = $object->contact;
} else {
$thirdparty = $object->client;
}
$this->recipient->name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target');
// Show recipient

View File

@ -2,7 +2,8 @@
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
@ -622,19 +623,16 @@ class pdf_merou extends ModelePdfExpedition
$result=$object->fetch_contact($arrayidcontact[0]);
}
// Recipient name
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
else $socname = $object->client->name;
$carac_client_name=$outputlangs->convToOutputCharset($socname);
}
else
{
$carac_client_name=$outputlangs->convToOutputCharset($object->client->name);
//Recipient name
// On peut utiliser le nom de la societe du contact
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$thirdparty = $object->contact;
} else {
$thirdparty = $object->client;
}
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,((!empty($object->contact))?$object->contact:null),$usecontact,'targetwithdetails');
$blDestX=$blExpX+55;

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-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.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
@ -662,19 +662,16 @@ class pdf_rouget extends ModelePdfExpedition
$result=$object->fetch_contact($arrayidcontact[0]);
}
// Recipient name
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
else $socname = $object->client->name;
$carac_client_name=$outputlangs->convToOutputCharset($socname);
}
else
{
$carac_client_name=$outputlangs->convToOutputCharset($object->client->name);
//Recipient name
// On peut utiliser le nom de la societe du contact
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$thirdparty = $object->contact;
} else {
$thirdparty = $object->client;
}
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,(!empty($object->contact)?$object->contact:null),$usecontact,'targetwithdetails');
// Show recipient

View File

@ -341,10 +341,13 @@ class pdf_standard extends ModeleExpenseReport
$pdf->MultiCell($this->posxtva-$this->posxprojet-1, 3,$object->lines[$i]->projet_ref, 0, 'C');
// VAT Rate
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3,$vat_rate, 0, 'R');
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3,$vat_rate, 0, 'R');
}
// Unit price
$pdf->SetFont('','', $default_font_size - 1);
@ -441,12 +444,15 @@ class pdf_standard extends ModeleExpenseReport
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - 160, 5, price($object->total_ht), 1, 'R');
$pdf->SetFillColor(248,248,248);
$posy+=5;
$pdf->SetXY(100, $posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(60, 5, $outputlangs->transnoentities("TotalVAT"), 1,'L');
$pdf->SetXY(160, $posy);
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - 160, 5, price($object->total_tva),1, 'R');
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$posy+=5;
$pdf->SetXY(100, $posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(60, 5, $outputlangs->transnoentities("TotalVAT"), 1,'L');
$pdf->SetXY(160, $posy);
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - 160, 5, price($object->total_tva),1, 'R');
}
$posy+=5;
$pdf->SetXY(100, $posy);
@ -768,9 +774,12 @@ class pdf_standard extends ModeleExpenseReport
$pdf->MultiCell($this->posxtva-$this->posxprojet-1,2, $outputlangs->transnoentities("Project"),'','C');
// VAT
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxtva-1, $tab_top+1);
$pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C');
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxtva-1, $tab_top+1);
$pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C');
}
// Unit price
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);

View File

@ -6,6 +6,7 @@
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
@ -1579,19 +1580,16 @@ class pdf_crabe extends ModelePDFFactures
$result=$object->fetch_contact($arrayidcontact[0]);
}
// Recipient name
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
else $socname = $object->client->name;
$carac_client_name=$outputlangs->convToOutputCharset($socname);
}
else
{
$carac_client_name=$outputlangs->convToOutputCharset($object->client->name);
//Recipient name
// On peut utiliser le nom de la societe du contact
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$thirdparty = $object->contact;
} else {
$thirdparty = $object->client;
}
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target');
// Show recipient

View File

@ -5,6 +5,7 @@
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011 Fabrice CHERRIER
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
@ -241,7 +242,7 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->SetXY($this->marge_gauche, $tab_top + 5);
$text=$object->description;
if ($object->duree > 0)
if ($object->duration > 0)
{
$totaltime=convertSecondToTime($object->duration,'all',$conf->global->MAIN_DURATION_OF_WORKDAY);
$text.=($text?' - ':'').$langs->trans("Total").": ".$totaltime;
@ -436,9 +437,9 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetXY($this->marge_gauche, $tab_top + 8);
$text=$object->description;
if ($object->duree > 0)
if ($object->duration > 0)
{
$totaltime=convertSecondToTime($object->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY);
$totaltime=convertSecondToTime($object->duration,'all',$conf->global->MAIN_DURATION_OF_WORKDAY);
$text.=($text?' - ':'').$langs->trans("Total").": ".$totaltime;
}
$desc=dol_htmlentitiesbr($text,1);
@ -609,19 +610,16 @@ class pdf_soleil extends ModelePDFFicheinter
$result=$object->fetch_contact($arrayidcontact[0]);
}
// Recipient name
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
else $socname = $object->client->name;
$carac_client_name=$outputlangs->convToOutputCharset($socname);
}
else
{
$carac_client_name=$outputlangs->convToOutputCharset($object->client->name);
//Recipient name
// On peut utiliser le nom de la societe du contact
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$thirdparty = $object->contact;
} else {
$thirdparty = $object->client;
}
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target');
// Show recipient

View File

@ -4,6 +4,7 @@
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2008 Chiptronik
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
@ -843,19 +844,16 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$result=$object->fetch_contact($arrayidcontact[0]);
}
// Recipient name
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
else $socname = $object->client->name;
$carac_client_name=$outputlangs->convToOutputCharset($socname);
}
else
{
$carac_client_name=$outputlangs->convToOutputCharset($object->client->name);
//Recipient name
// On peut utiliser le nom de la societe du contact
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$thirdparty = $object->contact;
} else {
$thirdparty = $object->client;
}
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target');
// Show recipient

View File

@ -203,8 +203,8 @@ class modExpenseReport extends DolibarrModules
$this->export_label[$r]='ListTripsAndExpenses';
$this->export_icon[$r]='trip';
$this->export_permission[$r]=array(array("expensereport","export"));
$this->export_fields_array[$r]=array('d.rowid'=>"TripId",'d.ref'=>'Ref','d.date_debut'=>'DateStart','d.date_fin'=>'DateEnd','d.date_create'=>'DateCreation','d.date_approve'=>'DateApprove','d.total_ht'=>"TotalHT",'d.total_tva'=>'TotalVAT','d.total_ttc'=>'TotalTTC','d.note_private'=>'NotePrivate','d.note_public'=>'NotePublic','u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>"Login",'ed.rowid'=>'LineId','tf.code'=>'Type','ed.date'=>'Date','ed.fk_c_tva'=>'VATRate','ed.total_ht'=>'TotalHT','ed.total_tva'=>'TotalVAT','ed.total_ttc'=>'TotalTTC','ed.comments'=>'Comment','p.rowid'=>'ProjectId','p.ref'=>'Ref');
$this->export_entities_array[$r]=array('u.lastname'=>'user','u.firstname'=>'user','u.login'=>'user','ed.rowid'=>'expensereport_line','ed.date'=>'expensereport_line','ed.fk_c_tva'=>'expensereport_line','ed.total_ht'=>'expensereport_line','ed.total_tva'=>'expensereport_line','ed.total_ttc'=>'expensereport_line','ed.comments'=>'expensereport_line','tf.code'=>'expensereport_line','p.project_ref'=>'expensereport_line','p.rowid'=>'project','p.ref'=>'project');
$this->export_fields_array[$r]=array('d.rowid'=>"TripId",'d.ref'=>'Ref','d.date_debut'=>'DateStart','d.date_fin'=>'DateEnd','d.date_create'=>'DateCreation','d.date_approve'=>'DateApprove','d.total_ht'=>"TotalHT",'d.total_tva'=>'TotalVAT','d.total_ttc'=>'TotalTTC','d.note_private'=>'NotePrivate','d.note_public'=>'NotePublic','u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>"Login",'ed.rowid'=>'LineId','tf.code'=>'Type','ed.date'=>'Date','ed.tva_tx'=>'VATRate','ed.total_ht'=>'TotalHT','ed.total_tva'=>'TotalVAT','ed.total_ttc'=>'TotalTTC','ed.comments'=>'Comment','p.rowid'=>'ProjectId','p.ref'=>'Ref');
$this->export_entities_array[$r]=array('u.lastname'=>'user','u.firstname'=>'user','u.login'=>'user','ed.rowid'=>'expensereport_line','ed.date'=>'expensereport_line','ed.tva_tx'=>'expensereport_line','ed.total_ht'=>'expensereport_line','ed.total_tva'=>'expensereport_line','ed.total_ttc'=>'expensereport_line','ed.comments'=>'expensereport_line','tf.code'=>'expensereport_line','p.project_ref'=>'expensereport_line','p.rowid'=>'project','p.ref'=>'project');
$this->export_alias_array[$r]=array('d.rowid'=>"idtrip",'d.type'=>"type",'d.note_private'=>'note_private','d.note_public'=>'note_public','u.lastname'=>'name','u.firstname'=>'firstname','u.login'=>'login');
$this->export_dependencies_array[$r]=array('expensereport_line'=>'ed.rowid','type_fees'=>'tf.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them

View File

@ -130,35 +130,35 @@ class modProjet extends DolibarrModules
$r++;
$this->rights[$r][0] = 41; // id de la permission
$this->rights[$r][1] = "Lire les projets et tâches (partagés ou dont je suis contact)"; // libelle de la permission
$this->rights[$r][1] = "Read projects and tasks (shared projects or projects I am contact for). Can also enter time consumed on assigned tasks (timesheet)"; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'lire';
$r++;
$this->rights[$r][0] = 42; // id de la permission
$this->rights[$r][1] = "Creer/modifier les projets et tâches (partagés ou dont je suis contact)"; // libelle de la permission
$this->rights[$r][1] = "Create/modify projects and tasks (shared projects or projects I am contact for)"; // libelle de la permission
$this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'creer';
$r++;
$this->rights[$r][0] = 44; // id de la permission
$this->rights[$r][1] = "Supprimer les projets et tâches (partagés ou dont je suis contact)"; // libelle de la permission
$this->rights[$r][1] = "Delete project and tasks (shared projects or projects I am contact for)"; // libelle de la permission
$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'supprimer';
$r++;
$this->rights[$r][0] = 45; // id de la permission
$this->rights[$r][1] = "Exporter les projets"; // libelle de la permission
$this->rights[$r][1] = "Export projects"; // libelle de la permission
$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'export';
$r++;
$this->rights[$r][0] = 141; // id de la permission
$this->rights[$r][1] = "Lire tous les projets et tâches (y compris prives qui ne me sont pas affectes)"; // libelle de la permission
$this->rights[$r][1] = "Read all projects and tasks (also private projects I am not contact for)"; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'all';
@ -166,7 +166,7 @@ class modProjet extends DolibarrModules
$r++;
$this->rights[$r][0] = 142; // id de la permission
$this->rights[$r][1] = "Creer/modifier tous les projets et tâches (y compris prives qui ne me sont pas affectes)"; // libelle de la permission
$this->rights[$r][1] = "Create/modify all projects and tasks (also private projects I am not contact for)"; // libelle de la permission
$this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'all';
@ -174,7 +174,7 @@ class modProjet extends DolibarrModules
$r++;
$this->rights[$r][0] = 144; // id de la permission
$this->rights[$r][1] = "Supprimer tous les projets et tâches (y compris prives qui ne me sont pas affectes)"; // libelle de la permission
$this->rights[$r][1] = "Delete all projects and tasks (also private projects I am not contact for)"; // libelle de la permission
$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'all';

View File

@ -5,6 +5,7 @@
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
@ -1485,19 +1486,16 @@ class pdf_azur extends ModelePDFPropales
$result=$object->fetch_contact($arrayidcontact[0]);
}
// Recipient name
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
else $socname = $object->client->name;
$carac_client_name=$outputlangs->convToOutputCharset($socname);
}
else
{
$carac_client_name=$outputlangs->convToOutputCharset($object->client->name);
//Recipient name
// On peut utiliser le nom de la societe du contact
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$thirdparty = $object->contact;
} else {
$thirdparty = $object->client;
}
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target');
// Show recipient

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
@ -1100,19 +1101,16 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$result=$object->fetch_contact($arrayidcontact[0]);
}
// Recipient name
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
else $socname = $mysoc->name;
$carac_client_name=$outputlangs->convToOutputCharset($socname);
}
else
{
$carac_client_name=$outputlangs->convToOutputCharset($mysoc->name);
//Recipient name
// On peut utiliser le nom de la societe du contact
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$thirdparty = $object->contact;
} else {
$thirdparty = $mysoc;
}
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$mysoc,((!empty($object->contact))?$object->contact:null),$usecontact,'target');
// Show recipient

View File

@ -3,6 +3,7 @@
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
@ -1152,19 +1153,16 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$result=$object->fetch_contact($arrayidcontact[0]);
}
// Recipient name
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
else $socname = $object->client->name;
$carac_client_name=$outputlangs->convToOutputCharset($socname);
}
else
{
$carac_client_name=$outputlangs->convToOutputCharset($object->client->name);
//Recipient name
// On peut utiliser le nom de la societe du contact
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$thirdparty = $object->contact;
} else {
$thirdparty = $object->client;
}
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target');
// Show recipient

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2010-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009 Meos
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
*
@ -46,6 +46,8 @@ $id=GETPOST('id','int');
$action=GETPOST('action','alpha');
$modulepart=GETPOST('modulepart','alpha')?GETPOST('modulepart','alpha'):'produit|service';
$original_file = isset($_REQUEST["file"])?urldecode($_REQUEST["file"]):'';
$backtourl=GETPOST('backtourl');
$cancel=GETPOST("cancel");
// Security check
if (empty($modulepart)) accessforbidden('Bad value for modulepart');
@ -78,6 +80,20 @@ if ($id > 0)
* Actions
*/
if ($cancel)
{
if ($backtourl)
{
header("Location: ".$backtourl);
exit;
}
else
{
header("Location: ".DOL_URL_ROOT."/product/document.php?id=".$id.'&file='.urldecode($_POST["file"]));
exit;
}
}
if ($action == 'confirm_resize' && (isset($_POST["file"]) != "") && (isset($_POST["sizex"]) != "") && (isset($_POST["sizey"]) != ""))
{
$fullpath=$dir."/".$original_file;
@ -85,13 +101,24 @@ if ($action == 'confirm_resize' && (isset($_POST["file"]) != "") && (isset($_POS
if ($result == $fullpath)
{
header("Location: ".DOL_URL_ROOT."/product/photos.php?id=".$id.'&action=addthumb&file='.urldecode($_POST["file"]));
exit;
$object->add_thumb($fullpath);
if ($backtourl)
{
header("Location: ".$backtourl);
exit;
}
else
{
header("Location: ".DOL_URL_ROOT."/product/document.php?id=".$id.'&file='.urldecode($_POST["file"]));
exit;
}
}
else
{
$mesg=$result;
setEventMessage($result, 'errors');
$_GET['file']=$_POST["file"];
$action='';
}
}
@ -103,13 +130,24 @@ if ($action == 'confirm_crop')
if ($result == $fullpath)
{
header("Location: ".DOL_URL_ROOT."/product/photos.php?id=".$id.'&action=addthumb&file='.urldecode($_POST["file"]));
exit;
$object->add_thumb($fullpath);
if ($backtourl)
{
header("Location: ".$backtourl);
exit;
}
else
{
header("Location: ".DOL_URL_ROOT."/product/document.php?id=".$id.'&file='.urldecode($_POST["file"]));
exit;
}
}
else
{
$mesg=$result;
setEventMessage($result, 'errors');
$_GET['file']=$_POST["file"];
$action='';
}
}
@ -123,8 +161,6 @@ llxHeader($head, $langs->trans("Image"), '', '', 0, 0, array('/includes/jquery/p
print_fiche_titre($langs->trans("ImageEditor"));
if ($mesg) print '<div class="error">'.$mesg.'</div>';
$infoarray=dol_getImageSize($dir."/".urldecode($_GET["file"]));
$height=$infoarray['height'];
$width=$infoarray['width'];
@ -133,6 +169,11 @@ print $langs->trans("Width").': <strong>'.$width.'</strong> x '.$langs->trans("H
print '<br>'."\n";
/*
* Resize image
*/
print '<!-- Form to resize -->'."\n";
print '<form name="redim_file" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="POST">';
@ -145,11 +186,15 @@ print '<input type="hidden" name="file" value="'.$_GET['file'].'" />';
print '<input type="hidden" name="action" value="confirm_resize" />';
print '<input type="hidden" name="product" value="'.$id.'" />';
print '<input type="hidden" name="id" value="'.$id.'" />';
print '<br><input class="button" name="sendit" value="'.dol_escape_htmltag($langs->trans("Resize")).'" type="submit" />';
print '<br>';
print '<input class="button" id="submitresize" name="sendit" value="'.dol_escape_htmltag($langs->trans("Resize")).'" type="submit" />';
print '&nbsp;';
print '<input type="submit" id="cancelresize" name="cancel" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" />';
print '</fieldset>'."\n";
print '</form>';
print '<br>'."\n";
/*
* Crop image
*/
@ -168,7 +213,7 @@ if (! empty($conf->use_javascript_ajax))
$refsizeforcrop='screenwidth';
$ratioforcrop=2;
}
print '<!-- Form to crop -->'."\n";
print '<fieldset id="redim_file">';
print '<legend>'.$langs->trans("Recenter").'</legend>';
@ -178,7 +223,7 @@ if (! empty($conf->use_javascript_ajax))
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$object->entity.'&file='.$original_file.'" alt="" id="cropbox" width="'.$widthforcrop.'px"/>';
print '</div>';
print '</div><br>';
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post" onsubmit="return checkCoords();">
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">
<div class="jc_coords">
'.$langs->trans("NewSizeAfterCropping").':
<label>X1 <input type="text" size="4" id="x" name="x" /></label>
@ -188,19 +233,33 @@ if (! empty($conf->use_javascript_ajax))
<label>W <input type="text" size="4" id="w" name="w" /></label>
<label>H <input type="text" size="4" id="h" name="h" /></label>
</div>
<input type="hidden" id="file" name="file" value="'.urlencode($original_file).'" />
<input type="hidden" id="action" name="action" value="confirm_crop" />
<input type="hidden" id="product" name="product" value="'.$id.'" />
<input type="hidden" id="refsizeforcrop" name="refsizeforcrop" value="'.$refsizeforcrop.'" />
<input type="hidden" id="ratioforcrop" name="ratioforcrop" value="'.$ratioforcrop.'" />
<input type="hidden" name="id" value="'.$id.'" />
<br><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Recenter")).'" />
<br>
<input type="submit" id="submitcrop" name="submitcrop" class="button" value="'.dol_escape_htmltag($langs->trans("Recenter")).'" />
&nbsp;
<input type="submit" id="cancelcrop" name="cancel" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" />
</form>'."\n";
print '</fieldset>'."\n";
print '<br>';
}
/* Check that mandatory fields are filled */
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
$("#submitcrop").click(function(e) {
var idClicked = e.target.id;
if (parseInt(jQuery(\'#w\').val())) return true;
alert(\''.dol_escape_js($langs->trans("ErrorFieldRequired", $langs->trans("Dimension"))).'\');
return false;
});
});
</script>';
llxFooter();
$db->close();

View File

@ -70,7 +70,7 @@ $searchform = '';
if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && ! empty($conf->global->MAIN_SEARCHFORM_SOCIETE) && $user->rights->societe->lire)
{
$langs->load("companies");
$searchform.=printSearchForm(DOL_URL_ROOT.'/societe/societe.php', DOL_URL_ROOT.'/societe/societe.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'socname');
$searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'socname');
$nbofsearch++;
}

View File

@ -28,7 +28,11 @@ if (GETPOST('dol_use_jmobile')) $conf->dol_use_jmobile=1;
// If we force to use jmobile, then we reenable javascript
if (! empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax=1;
$arrayofjs=array('/core/js/dst.js'.(empty($conf->dol_use_jmobile)?'':'?version='.urlencode(DOL_VERSION))); // Javascript code on logon page only to detect user tz, dst_observed, dst_first, dst_second
// Javascript code on logon page only to detect user tz, dst_observed, dst_first, dst_second
$arrayofjs=array(
'/includes/jstz/jstz.min.js'.(empty($conf->dol_use_jmobile)?'':'?version='.urlencode(DOL_VERSION)),
'/core/js/dst.js'.(empty($conf->dol_use_jmobile)?'':'?version='.urlencode(DOL_VERSION))
);
$titleofloginpage=$langs->trans('Login').' @ '.$title; // title is defined by dol_loginfunction in security2.lib.php. We must keep the @, some tools use it to know it is login page.
print top_htmlhead('',$titleofloginpage,0,0,$arrayofjs);

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