Merge branch 'develop' of git://github.com/Dolibarr/dolibarr.git into webservices
This commit is contained in:
commit
28cbe7d0b3
72
ChangeLog
72
ChangeLog
@ -4,6 +4,7 @@ English Dolibarr ChangeLog
|
||||
|
||||
***** ChangeLog for 3.4 compared to 3.3.2 *****
|
||||
For users:
|
||||
- New: Can use ODS templates as document templates.
|
||||
- New: Add link to autofill/reset with quantity to ship when creating a
|
||||
delivery receipt.
|
||||
- New: Event into calendar use different colors for different users.
|
||||
@ -11,44 +12,48 @@ For users:
|
||||
- New: Add a tab "consumption" on thirdparties to list products bought/sells.
|
||||
- New: Some performance enhancements.
|
||||
- New: Can attach files onto trip and expenses modules.
|
||||
- New: Add option MAIN_PDF_TITLE_BACKGROUND_COLOR.
|
||||
- New: Add hidden option MAIN_PDF_TITLE_BACKGROUND_COLOR.
|
||||
- New: Merge tab customer and prospect.
|
||||
- New: Add ES formated address country rule.
|
||||
- New: Can define a hierarchical responsible on user.
|
||||
- New: Add a hierarchical view for users.
|
||||
- New: Can define a hierarchical responsible on user and add a tree view to
|
||||
see hierarchy of users.
|
||||
- New: Can expand/collapse menus, categories and users list.
|
||||
- New: extra parameters are supported into ODT templates.
|
||||
- New: total per vat rate are available as tags for ODT templates.
|
||||
- New: Add more types for extra parameters (lists, phone, emails, checkbox, prices).
|
||||
- New: extra parameters are supported into ODT/ODS templates.
|
||||
- New: total per vat rate are available as tags for ODT/ODS templates.
|
||||
- New: Some part of interface use more CSS3 (ie: agenda)
|
||||
- New: [ task #707 ] Create option ProfIdx are mandatory to validate a invoice.
|
||||
- New: [ task #707 ] Create option "ProfIdx is mandatory to validate a invoice".
|
||||
- New: Can define if we want to use VAT or not for subscriptions (foundation module).
|
||||
- New: Can define a default choice for choice "More action when recording
|
||||
a subscription" (foundation module).
|
||||
- New: Add link to check professional id for india.
|
||||
- New: Can define a default choice for "More action when recording a
|
||||
subscription" (foundation module).
|
||||
- New: Add link to check professional id for India.
|
||||
- New: [ task #731 ] Uniformize ref generation
|
||||
- New: [ task #748 ] Add a link "Dolibarr" into left menu
|
||||
- New: Script email_unpaid_invoices_to_representative accepts now a parameter test
|
||||
and a delay.
|
||||
- New: Can define a different clicktodial setup per user.
|
||||
- New: Add option INVOICE_CAN_NEVER_BE_REMOVED.
|
||||
- New: Enhance agenda module to reach RFC2445 (add busy information).
|
||||
- New: Script email_unpaid_invoices_to_representative accepts now a parameter "test"
|
||||
and a "late delay".
|
||||
- New: Can define different clicktodial setups for each user.
|
||||
- New: Add hidden option INVOICE_CAN_NEVER_BE_REMOVED.
|
||||
- New: Enhance agenda module to reach RFC2445 ("type" not enabled by default and add
|
||||
"busy" information).
|
||||
- New: Add module Opensurvey.
|
||||
- New: Default aprrover for holidays i sby default hierchical parent.
|
||||
- New: Default approver for holidays is set by default to hierchical parent.
|
||||
- First change to prepare feature "click to print" (IPP) for PDF.
|
||||
- New: [ task #350 ] Merge tab customer and prospect
|
||||
- New: [ task #710 ] Add substitution into mailing send (and HTML is now valid)
|
||||
- New: [ task #711 ] Add combobox for contact as done for product/thirdparty
|
||||
- New: [ task #714 ] In Emailing module admin autogenerate security key of READRECIEPT
|
||||
- New: [ task #743 ] GED : Add aministration option to disabled autotree to display
|
||||
- New: [ task #767 ] Customer Address fallback when a contact doesn't have an address
|
||||
- New: [ task #768 ] WYSIWYG for all mail
|
||||
- New: [ task #773 ] Add Project document in GED(ECM) modules
|
||||
- New: [ task #783 ] Add checkbox and radio into extrafield feature
|
||||
- New: [ task #798 ] Add range limit date on product/services as it is done on order and invoice
|
||||
- New: [ task #814 ] Add extrafield feature into Project/project tasks module
|
||||
- New: [ task #770 ] Add ODT document generation for Projects module
|
||||
- New: [ task #741 ] Add intervention box
|
||||
- New: [ task #350 ] Merge tab customer and prospect.
|
||||
- New: [ task #710 ] Add substitution into mailing send (and HTML is now valid).
|
||||
- New: [ task #711 ] Add combobox for contact, as done for product/thirdparty.
|
||||
- New: [ task #714 ] In Emailing module admin autogenerate security key of READRECEIPT.
|
||||
- New: [ task #743 ] GED : Add aministration option to disable autotree display.
|
||||
- New: [ task #767 ] Customer Address fallback when a contact doesn't have an address.
|
||||
- New: [ task #768 ] WYSIWYG for all mails.
|
||||
- New: [ task #773 ] Add Project document in GED(ECM) modules.
|
||||
- New: [ task #783 ] Add more types for extra parameters (lists, phone, emails, checkbox,
|
||||
prices, radio).
|
||||
- New: [ task #798 ] Add range limit date on product/services as it is done on order
|
||||
and invoice.
|
||||
- New: [ task #814 ] Add extrafield feature for projects ands tasks.
|
||||
- New: [ task #770 ] Add ODT document generation for Projects module.
|
||||
- New: [ task #741 ] Add intervention box.
|
||||
- New: [ task #826 ] Optionnal increase stock when deleting an invoice already validated.
|
||||
- New: [ task #823 ] Shipping_validate email notification.
|
||||
|
||||
For translators:
|
||||
- Update language files.
|
||||
@ -58,8 +63,8 @@ For developers:
|
||||
- An external module can force its theme.
|
||||
- Add function dol_set_focus('#xxx').
|
||||
- A mymodule can bring its own core/modules/mymodule/modules_mymodule.php file.
|
||||
- Removed not used libraries.
|
||||
- More web services.
|
||||
- Removed some not used libraries.
|
||||
- More web services.
|
||||
- Renamed some database fields, code variables and parameters from french to english.
|
||||
- First change to manage margins on contracts.
|
||||
- Add hook getFormMail.
|
||||
@ -86,7 +91,7 @@ WARNING: If you used external modules, some of them may need to be upgraded due
|
||||
|
||||
***** ChangeLog for 3.3.2 compared to 3.3.1 *****
|
||||
|
||||
- Fix: Ducth (nl_NL) translation
|
||||
- Fix: Dutch (nl_NL) translation
|
||||
- Fix: [ bug #790 ] Spanish localtax RE not being correctly calculated
|
||||
- Generalize fix: file with a specific mask not found, again
|
||||
- Fix: translations and BILL_SUPPLIER_BUILDDOC trigger
|
||||
@ -99,11 +104,12 @@ WARNING: If you used external modules, some of them may need to be upgraded due
|
||||
- Fix: [ bug #806 ] Margins module with orders2invoice does not respect cost price
|
||||
- Fix: Orderstoinvoice didn't act as expected when no order was checked
|
||||
- Fix: Bad link to all proposals into Third party card if customer is prospect
|
||||
- Fix: [ bug #774 ] Bug on creating event with box "all day" crossed
|
||||
- Fix: [ bug #789 ] VAT not being calculated in POS
|
||||
- Fix: [ bug #794 ] Lost filter on zipcode in prospect list
|
||||
- Fix: [ bug #774 ] Bug on creating event with box "all day" crossed
|
||||
- Fix: [ bug #810 ] Cannot update ODT template path
|
||||
- Fix: [ bug #824 ] MAIN_DB_PREFIX not use into dictionnary
|
||||
- Fix: [ bug #828 ] Error when code_region is not a number in llx_c_regions (with postgres)
|
||||
|
||||
|
||||
***** ChangeLog for 3.3.1 compared to 3.3 *****
|
||||
|
||||
@ -133,7 +133,11 @@ class modMyModule extends DolibarrModules
|
||||
$this->tabs = array();
|
||||
|
||||
// Dictionnaries
|
||||
if (! isset($conf->mymodule->enabled)) $conf->mymodule->enabled=0;
|
||||
if (! isset($conf->mymodule->enabled))
|
||||
{
|
||||
$conf->mymodule=new stdClass();
|
||||
$conf->mymodule->enabled=0;
|
||||
}
|
||||
$this->dictionnaries=array();
|
||||
/* Example:
|
||||
if (! isset($conf->mymodule->enabled)) $conf->mymodule->enabled=0; // This is to avoid warnings
|
||||
|
||||
@ -1520,7 +1520,12 @@ class Adherent extends CommonObject
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$this->id.'">';
|
||||
$lienfin='</a>';
|
||||
}
|
||||
|
||||
if ($option == 'category')
|
||||
{
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/categories/categorie.php?id='.$this->id.'&type=3">';
|
||||
$lienfin='</a>';
|
||||
}
|
||||
|
||||
$picto='user';
|
||||
$label=$langs->trans("ShowMember");
|
||||
|
||||
|
||||
@ -65,8 +65,8 @@ else
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
* Actions
|
||||
*/
|
||||
if ($action == "save" && empty($cancel))
|
||||
{
|
||||
$i=0;
|
||||
@ -125,7 +125,7 @@ if (preg_match('/del_(.*)/',$action,$reg))
|
||||
|
||||
|
||||
/**
|
||||
* Affichage du formulaire de saisie
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
@ -184,48 +184,7 @@ print "</center>";
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
* Other options
|
||||
*/
|
||||
|
||||
print_titre($langs->trans("OtherOptions"));
|
||||
|
||||
$var=true;
|
||||
|
||||
print '<table class="noborder allwidth">'."\n";
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
|
||||
print '<td align="center" width="20"> </td>'."\n";
|
||||
print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
// Manual or automatic
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>'."\n";
|
||||
print '<td>'.$langs->trans("AGENDA_USE_EVENT_TYPE").'</td>'."\n";
|
||||
print '<td align="center" width="20"> </td>'."\n";
|
||||
|
||||
print '<td align="center" width="100">'."\n";
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print ajax_constantonoff('AGENDA_USE_EVENT_TYPE');
|
||||
}
|
||||
else
|
||||
{
|
||||
if($conf->global->AGENDA_USE_EVENT_TYPE == 0)
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_USE_EVENT_TYPE">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
else if($conf->global->BUSINESS_VISIBLE_TO_ALL_BY_DEFAULT == 1)
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_USE_EVENT_TYPE">'.img_picto($langs->trans("Enabled"),'on').'</a>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '</table>';
|
||||
dol_fiche_end();
|
||||
|
||||
print "<br>";
|
||||
|
||||
|
||||
135
htdocs/admin/agenda_other.php
Normal file
135
htdocs/admin/agenda_other.php
Normal file
@ -0,0 +1,135 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-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/admin/agenda.php
|
||||
* \ingroup agenda
|
||||
* \brief Autocreate actions for agenda module setup page
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("other");
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (preg_match('/set_(.*)/',$action,$reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
$value=(GETPOST($code) ? GETPOST($code) : 1);
|
||||
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('/del_(.*)/',$action,$reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("AgendaSetup"),$linkback,'setup');
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
$head=agenda_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'other', $langs->trans("Agenda"));
|
||||
|
||||
print_titre($langs->trans("OtherOptions"));
|
||||
|
||||
$var=true;
|
||||
|
||||
print '<table class="noborder allwidth">'."\n";
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
|
||||
print '<td align="center" width="20"> </td>'."\n";
|
||||
print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
// Manual or automatic
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>'."\n";
|
||||
print '<td>'.$langs->trans("AGENDA_USE_EVENT_TYPE").'</td>'."\n";
|
||||
print '<td align="center" width="20"> </td>'."\n";
|
||||
|
||||
print '<td align="center" width="100">'."\n";
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print ajax_constantonoff('AGENDA_USE_EVENT_TYPE');
|
||||
}
|
||||
else
|
||||
{
|
||||
if($conf->global->AGENDA_USE_EVENT_TYPE == 0)
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_USE_EVENT_TYPE">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
else if($conf->global->BUSINESS_VISIBLE_TO_ALL_BY_DEFAULT == 1)
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_USE_EVENT_TYPE">'.img_picto($langs->trans("Enabled"),'on').'</a>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print "<br>";
|
||||
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
@ -1,222 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/carrier.php
|
||||
* \ingroup expedition
|
||||
* \brief Page to setup carriers. TODO Delete this page. We mut use dictionnary instead.
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("sendings");
|
||||
$langs->load("deliveries");
|
||||
$langs->load('other');
|
||||
|
||||
if (! $user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$carrier=GETPOST('carrier','int');
|
||||
|
||||
$object = new Expedition($db);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
//if ($action==setvalue AND $carrier)
|
||||
if ($action=='setvalue')
|
||||
{
|
||||
// need to add check on values
|
||||
$object->update['code']=GETPOST('code','alpha');
|
||||
$object->update['libelle']=GETPOST('libelle','alpha');
|
||||
$object->update['description']=GETPOST('description','alpha');
|
||||
$object->update['tracking']=GETPOST('tracking','alpha');
|
||||
$object->update_delivery_method($carrier);
|
||||
header("Location: carrier.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action=='activate_carrier' && $carrier!='')
|
||||
{
|
||||
$object->activ_delivery_method($carrier);
|
||||
}
|
||||
|
||||
if ($action=='disable_carrier' && $carrier!='')
|
||||
{
|
||||
$object->disable_delivery_method($carrier);
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
llxHeader("","");
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("SendingsSetup"),$linkback,'setup');
|
||||
print '<br>';
|
||||
|
||||
|
||||
//if ($mesg) print $mesg.'<br>';
|
||||
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/confexped.php";
|
||||
$head[$h][1] = $langs->trans("Setup");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/carrier.php";
|
||||
$head[$h][1] = $langs->trans("Carriers");
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
if (! empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
|
||||
$head[$h][1] = $langs->trans("Sending");
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_SUBMODULE_LIVRAISON))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/livraison.php";
|
||||
$head[$h][1] = $langs->trans("Receivings");
|
||||
$h++;
|
||||
}
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
|
||||
|
||||
/*
|
||||
* Carrier List
|
||||
*/
|
||||
if ($action=='edit_carrier' || $action=='setvalue')
|
||||
{
|
||||
// Carrier Edit
|
||||
if ($carrier!='') $object->list_delivery_methods($carrier);
|
||||
print_titre($langs->trans("CarrierEdit"));
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?carrier='.$carrier.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setvalue">';
|
||||
|
||||
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
|
||||
$var=true;
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="150">'.$langs->trans("CarrierParameter").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td class="fieldrequired">';
|
||||
print $langs->trans("Code").'</td><td>';
|
||||
print '<input size="32" type="text" name="code" value="'.$object->listmeths[0]['code'].'">';
|
||||
print ' '.$langs->trans("Example").': CODE';
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td class="fieldrequired">';
|
||||
print $langs->trans("Name").'</td><td>';
|
||||
print '<input size="32" type="text" name="libelle" value="'.$object->listmeths[0]['libelle'].'">';
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td class="fieldrequired">';
|
||||
print $langs->trans("Description").'</td><td>';
|
||||
print '<input size="64" type="text" name="description" value="'.$object->listmeths[0]['description'].'">';
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td class="fieldrequired">';
|
||||
print $langs->trans("Tracking").'</td><td>';
|
||||
print '<input size="80" type="text" name="tracking" value="'.$object->listmeths[0]['tracking'].'">';
|
||||
print ' '.$langs->trans("Example").': http://www.website.com/dir/{TRACKID}';
|
||||
print '</td></tr>';
|
||||
|
||||
if ($carrier)
|
||||
{
|
||||
print '<tr><td colspan="2" align="center"><br><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan="2" align="center"><br><input type="submit" class="button" value="'.$langs->trans("Add").'"></td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Display List
|
||||
$object->list_delivery_methods();
|
||||
$var=true;
|
||||
print_titre($langs->trans("CarrierList"));
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="80">'.$langs->trans("Code").'</td>';
|
||||
print '<td width="150">'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$langs->trans("TrackingUrl").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
|
||||
print '<td align="center" width="30">'.$langs->trans("Edit").'</td>';
|
||||
print "</tr>\n";
|
||||
$numlistmeths=count($object->listmeths);
|
||||
for ($i=0; $i<$numlistmeths; $i++)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>'.$object->listmeths[$i]['code'].'</td>';
|
||||
print '<td>'.$object->listmeths[$i]['libelle'].'</td>';
|
||||
print '<td>'.$object->listmeths[$i]['description'].'</td>';
|
||||
print '<td>'.dol_trunc($object->listmeths[$i]['tracking'],92,'middle').'</td>';
|
||||
print '<td align="center">';
|
||||
if($object->listmeths[$i]['active'] == 0)
|
||||
{
|
||||
print '<a href="carrier.php?action=activate_carrier&carrier='.$object->listmeths[$i]['rowid'].'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="carrier.php?action=disable_carrier&carrier='.$object->listmeths[$i]['rowid'].'">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
|
||||
}
|
||||
print '</td><td align="center">';
|
||||
print '<a href="carrier.php?action=edit_carrier&carrier='.$object->listmeths[$i]['rowid'].'">'.img_picto($langs->trans("Edit"),'edit').'</a>';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '<tr><td align="center"><a href="carrier.php?action=edit_carrier"><br>'.$langs->trans("Add").'</a></td><tr>';
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
@ -107,7 +107,7 @@ print '<br>';
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/compta.php";
|
||||
$head[$h][1] = $langs->trans("Compta");
|
||||
$head[$h][1] = $langs->trans("Accountancy");
|
||||
$head[$h][2] = 'Compta';
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
@ -84,10 +84,6 @@ $head[$h][1] = $langs->trans("Setup");
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/carrier.php";
|
||||
$head[$h][1] = $langs->trans("Carriers");
|
||||
$h++;
|
||||
|
||||
if (! empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
|
||||
|
||||
@ -6,9 +6,9 @@
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012-2013 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
|
||||
* Copyright (C) 2011-2012 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2011-2012 Alexandre Spangaro <alexandre.spangaro@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
|
||||
@ -147,7 +147,7 @@ $tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.org
|
||||
$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, active FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
||||
$tabsql[17]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_type_fees";
|
||||
$tabsql[18]= "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_shipment_mode";
|
||||
$tabsql[18]= "SELECT rowid as rowid, code, libelle, tracking, active FROM ".MAIN_DB_PREFIX."c_shipment_mode";
|
||||
$tabsql[19]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_effectif";
|
||||
$tabsql[20]= "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_input_method";
|
||||
$tabsql[21]= "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_availability AS c";
|
||||
@ -203,7 +203,7 @@ $tabfield[14]= "code,libelle,price,organization,country_id,country";
|
||||
$tabfield[15]= "code,libelle,width,height,unit";
|
||||
$tabfield[16]= "code,libelle";
|
||||
$tabfield[17]= "code,libelle";
|
||||
$tabfield[18]= "code,libelle";
|
||||
$tabfield[18]= "code,libelle,tracking";
|
||||
$tabfield[19]= "code,libelle";
|
||||
$tabfield[20]= "code,libelle";
|
||||
$tabfield[21]= "code,label";
|
||||
@ -231,7 +231,7 @@ $tabfieldvalue[14]= "code,libelle,price,organization,country";
|
||||
$tabfieldvalue[15]= "code,libelle,width,height,unit";
|
||||
$tabfieldvalue[16]= "code,libelle";
|
||||
$tabfieldvalue[17]= "code,libelle";
|
||||
$tabfieldvalue[18]= "code,libelle";
|
||||
$tabfieldvalue[18]= "code,libelle,tracking";
|
||||
$tabfieldvalue[19]= "code,libelle";
|
||||
$tabfieldvalue[20]= "code,libelle";
|
||||
$tabfieldvalue[21]= "code,label";
|
||||
@ -259,7 +259,7 @@ $tabfieldinsert[14]= "code,libelle,price,organization,fk_pays";
|
||||
$tabfieldinsert[15]= "code,label,width,height,unit";
|
||||
$tabfieldinsert[16]= "code,label";
|
||||
$tabfieldinsert[17]= "code,libelle";
|
||||
$tabfieldinsert[18]= "code,libelle";
|
||||
$tabfieldinsert[18]= "code,libelle,tracking";
|
||||
$tabfieldinsert[19]= "code,libelle";
|
||||
$tabfieldinsert[20]= "code,libelle";
|
||||
$tabfieldinsert[21]= "code,label";
|
||||
@ -391,7 +391,7 @@ if ($id == 11)
|
||||
|
||||
// Define localtax_typeList (used for dictionnary "c_tva")
|
||||
$localtax_typeList = array();
|
||||
if (GETPOST("id") == 10)
|
||||
if ($id == 10)
|
||||
{
|
||||
$localtax_typeList = array(
|
||||
"0" => $langs->trans("No"),
|
||||
@ -441,22 +441,32 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
if ($fieldnamekey == 'position') $fieldnamekey = 'Position';
|
||||
if ($fieldnamekey == 'unicode') $fieldnamekey = 'Unicode';
|
||||
|
||||
$msg.=$langs->trans("ErrorFieldRequired",$langs->transnoentities($fieldnamekey)).'<br>';
|
||||
$msg.=$langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)).'<br>';
|
||||
}
|
||||
}
|
||||
// Other checks
|
||||
if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"],array('system','systemauto'))) {
|
||||
$ok=0;
|
||||
$msg.="Value 'system' and 'systemauto' for type is reserved. You can use 'user' as value to add your own record.<br>";
|
||||
$msg.= $langs->transnoentities('ErrorReservedTypeSystemSystemAuto').'<br>';
|
||||
}
|
||||
if (isset($_POST["code"]) && $_POST["code"]=='0') {
|
||||
$ok=0;
|
||||
$msg.="Code can't contains value 0<br>";
|
||||
if (isset($_POST["code"]))
|
||||
{
|
||||
if ($_POST["code"]=='0')
|
||||
{
|
||||
$ok=0;
|
||||
$msg.= $langs->transnoentities('ErrorCodeCantContainZero').'<br>';
|
||||
}
|
||||
if (!is_numeric($_POST['code']))
|
||||
{
|
||||
$ok = 0;
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
||||
}
|
||||
}
|
||||
if (isset($_POST["country"]) && $_POST["country"]=='0') {
|
||||
$ok=0;
|
||||
$msg.=$langs->trans("ErrorFieldRequired",$langs->trans("Country")).'<br>';
|
||||
$msg.=$langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")).'<br>';
|
||||
}
|
||||
|
||||
// Clean some parameters
|
||||
if (isset($_POST["localtax1"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0
|
||||
if (isset($_POST["localtax2"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0
|
||||
@ -518,7 +528,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
else
|
||||
{
|
||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
$msg=$langs->trans("ErrorRecordAlreadyExists").'<br>';
|
||||
$msg=$langs->transnoentities("ErrorRecordAlreadyExists").'<br>';
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
@ -588,7 +598,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||
{
|
||||
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
||||
{
|
||||
$msg='<div class="error">'.$langs->trans("ErrorRecordIsUsedByChild").'</div>';
|
||||
$msg='<div class="error">'.$langs->transnoentities("ErrorRecordIsUsedByChild").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -994,6 +1004,7 @@ if ($id)
|
||||
$valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_type_contact') {
|
||||
$langs->load('agenda');
|
||||
$key=$langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
@ -1084,15 +1095,23 @@ if ($id)
|
||||
}
|
||||
|
||||
// Est-ce une entree du dictionnaire qui peut etre desactivee ?
|
||||
$iserasable=1; // Oui par defaut
|
||||
if (isset($obj->code) && ($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) $iserasable=0;
|
||||
if (isset($obj->code) && $obj->code == 'RECEP') $iserasable=0;
|
||||
if (isset($obj->code) && $obj->code == 'EF0') $iserasable=0;
|
||||
// True by default
|
||||
$iserasable=1;
|
||||
|
||||
if (isset($obj->code))
|
||||
{
|
||||
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) $iserasable = 0;
|
||||
else if ($obj->code == 'RECEP') $iserasable = 0;
|
||||
else if ($obj->code == 'EF0') $iserasable = 0;
|
||||
}
|
||||
|
||||
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) $iserasable=0;
|
||||
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?$obj->code:'').'&id='.$id.'&';
|
||||
|
||||
// Active
|
||||
print '<td align="center" nowrap="nowrap">';
|
||||
if ($iserasable) print '<a href="'.$_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?$obj->code:'').'&id='.$id.'&action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
||||
if ($iserasable) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
||||
else
|
||||
{
|
||||
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto')) && empty($obj->active)) print $langs->trans("Deprecated");
|
||||
@ -1101,11 +1120,11 @@ if ($id)
|
||||
print "</td>";
|
||||
|
||||
// Modify link
|
||||
if ($iserasable) print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?$obj->code:'').'&id='.$id.'&action=edit#'.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'">'.img_edit().'</a></td>';
|
||||
if ($iserasable) print '<td align="center"><a href="'.$url.'action=edit#'.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'">'.img_edit().'</a></td>';
|
||||
else print '<td> </td>';
|
||||
|
||||
// Delete link
|
||||
if ($iserasable) print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?$obj->code:'').'&id='.$id.'&action=delete">'.img_delete().'</a></td>';
|
||||
if ($iserasable) print '<td align="center"><a href="'.$url.'action=delete">'.img_delete().'</a></td>';
|
||||
else print '<td> </td>';
|
||||
|
||||
print "</tr>\n";
|
||||
@ -1153,7 +1172,7 @@ else
|
||||
|
||||
$var=!$var;
|
||||
$value=$tabname[$i];
|
||||
print '<tr '.$bc[$var].'><td width="30%">';
|
||||
print '<tr '.$bc[$var].'><td width="50%">';
|
||||
if (! empty($tabcond[$i]))
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$i.'">'.$langs->trans($tablib[$i]).'</a>';
|
||||
@ -1299,6 +1318,7 @@ function fieldList($fieldlist,$obj='',$tabname='')
|
||||
print '<td>';
|
||||
$size='';
|
||||
if ($fieldlist[$field]=='libelle') $size='size="32" ';
|
||||
if ($fieldlist[$field]=='tracking') $size='size="92" ';
|
||||
if ($fieldlist[$field]=='accountancy_code') $size='size="15" ';
|
||||
if ($fieldlist[$field]=='accountancy_code_sell') $size='size="15" ';
|
||||
if ($fieldlist[$field]=='accountancy_code_buy') $size='size="15" ';
|
||||
|
||||
@ -201,10 +201,6 @@ $head[$h][0] = DOL_URL_ROOT."/admin/confexped.php";
|
||||
$head[$h][1] = $langs->trans("Setup");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/carrier.php";
|
||||
$head[$h][1] = $langs->trans("Carriers");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
|
||||
$head[$h][1] = $langs->trans("Sending");
|
||||
$hselected=$h;
|
||||
|
||||
@ -189,10 +189,6 @@ $head[$h][0] = DOL_URL_ROOT."/admin/confexped.php";
|
||||
$head[$h][1] = $langs->trans("Setup");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/carrier.php";
|
||||
$head[$h][1] = $langs->trans("Carriers");
|
||||
$h++;
|
||||
|
||||
if (! empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
|
||||
|
||||
@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
|
||||
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load('other');
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
|
||||
@ -194,7 +194,7 @@ asort($orders);
|
||||
|
||||
$nbofactivatedmodules=count($conf->modules);
|
||||
$moreinfo=$langs->trans("TotalNumberOfActivatedModules",($nbofactivatedmodules-1));
|
||||
|
||||
if ($nbofactivatedmodules <= 1) $moreinfo .= ' '.img_warning($langs->trans("YouMustEnableOneModule"));
|
||||
print load_fiche_titre($langs->trans("ModulesSetup"),$moreinfo,'setup');
|
||||
|
||||
// Start to show page
|
||||
@ -206,7 +206,7 @@ if ($mode==='functional') print $langs->trans("ModulesJobDesc")."<br>\n";
|
||||
if ($mode==='marketplace') print $langs->trans("ModulesMarketPlaceDesc")."<br>\n";
|
||||
if ($mode==='expdev') print $langs->trans("ModuleFamilyExperimental")."<br>\n";
|
||||
|
||||
if ($nbofactivatedmodules <= 1) print ' '.img_warning($langs->trans("YouMustEnableOneModule"));
|
||||
|
||||
//print '<br>'."\n";
|
||||
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* 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
|
||||
@ -67,6 +68,7 @@ if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL'
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", '','chaine',0,'',$conf->entity);
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", '','chaine',0,'',$conf->entity);
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", '','chaine',0,'',$conf->entity);
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_DELETE_INVOICE", '','chaine',0,'',$conf->entity);
|
||||
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_BILL','alpha'),'chaine',0,'',$conf->entity);
|
||||
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity);
|
||||
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER','alpha'),'chaine',0,'',$conf->entity);
|
||||
@ -239,6 +241,19 @@ if (! empty($conf->fournisseur->enabled))
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</form>\n</td>\n</tr>\n";
|
||||
}
|
||||
if (! empty($conf->facture->enabled))
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="60%">'.$langs->trans("ReStockOnDeleteInvoice").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_DELETE_INVOICE\">";
|
||||
print $form->selectyesno("STOCK_CALCULATE_ON_DELETE_INVOICE",$conf->global->STOCK_CALCULATE_ON_DELETE_INVOICE,1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</form>\n</td>\n</tr>\n";
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
@ -99,7 +99,7 @@ $error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->e
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
//Suppression d'un objet d'une categorie
|
||||
// Remove element from category
|
||||
if ($removecat > 0)
|
||||
{
|
||||
if ($type==0 && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||
@ -113,17 +113,20 @@ if (empty($reshook))
|
||||
{
|
||||
$object = new Societe($db);
|
||||
$result = $object->fetch($objectid);
|
||||
$elementtype = 'fournisseur';
|
||||
}
|
||||
if ($type==2 && $user->rights->societe->creer)
|
||||
{
|
||||
$object = new Societe($db);
|
||||
$result = $object->fetch($objectid);
|
||||
$elementtype = 'societe';
|
||||
}
|
||||
if ($type == 3 && $user->rights->adherent->creer)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
$object = new Adherent($db);
|
||||
$result = $object->fetch($objectid);
|
||||
$elementtype = 'member';
|
||||
}
|
||||
$cat = new Categorie($db);
|
||||
$result=$cat->fetch($removecat);
|
||||
@ -507,7 +510,7 @@ function formCategory($db,$object,$typeid,$socid=0)
|
||||
//print $c->getNomUrl(1);
|
||||
print img_object('','category').' '.$way."</td>";
|
||||
|
||||
// Lien supprimer
|
||||
// Link to delete from category
|
||||
print '<td align="right">';
|
||||
$permission=0;
|
||||
if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer);
|
||||
|
||||
@ -420,6 +420,7 @@ class Categorie
|
||||
$sql .= " WHERE fk_categorie = ".$this->id;
|
||||
$sql .= " AND fk_".($type=='fournisseur'?'societe':$type)." = ".$obj->id;
|
||||
|
||||
dol_syslog(get_class($this).'::del_type sql='.$sql);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
return 1;
|
||||
|
||||
@ -36,6 +36,7 @@ $ref=GETPOST('ref');
|
||||
$type=GETPOST('type');
|
||||
$action=GETPOST('action');
|
||||
$confirm=GETPOST('confirm');
|
||||
$removeelem = GETPOST('removeelem','int');
|
||||
|
||||
if ($id == "")
|
||||
{
|
||||
@ -61,6 +62,40 @@ $type=$object->type;
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Remove element from category
|
||||
if ($id > 0 && $removeelem > 0)
|
||||
{
|
||||
if ($type==0 && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
$tmpobject = new Product($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'product';
|
||||
}
|
||||
if ($type==1 && $user->rights->societe->creer)
|
||||
{
|
||||
$tmpobject = new Societe($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'fournisseur';
|
||||
}
|
||||
if ($type==2 && $user->rights->societe->creer)
|
||||
{
|
||||
$tmpobject = new Societe($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'societe';
|
||||
}
|
||||
if ($type == 3 && $user->rights->adherent->creer)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
$tmpobject = new Adherent($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'member';
|
||||
}
|
||||
|
||||
$result=$object->del_type($tmpobject,$elementtype);
|
||||
if ($result < 0) dol_print_error('',$object->error);
|
||||
}
|
||||
|
||||
if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->delete($user) >= 0)
|
||||
@ -214,7 +249,7 @@ if ($object->type == 0)
|
||||
{
|
||||
print "<br>";
|
||||
print "<table class='noborder' width='100%'>\n";
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("ProductsAndServices")."</td></tr>\n";
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("ProductsAndServices")."</td></tr>\n";
|
||||
|
||||
if (count($prods) > 0)
|
||||
{
|
||||
@ -224,10 +259,24 @@ if ($object->type == 0)
|
||||
$var=!$var;
|
||||
print "\t<tr ".$bc[$var].">\n";
|
||||
print '<td nowrap="nowrap" valign="top">';
|
||||
if ($prod->type == 1) print img_object($langs->trans("ShowService"),"service");
|
||||
else print img_object($langs->trans("ShowProduct"),"product");
|
||||
print " <a href='".DOL_URL_ROOT."/product/fiche.php?id=".$prod->id."'>".$prod->ref."</a></td>\n";
|
||||
print $prod->getNomUrl(1,'category');
|
||||
print "</td>\n";
|
||||
print '<td valign="top">'.$prod->libelle."</td>\n";
|
||||
// Link to delete from category
|
||||
print '<td align="right">';
|
||||
$typeid=$object->type;
|
||||
$permission=0;
|
||||
if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer);
|
||||
if ($typeid == 1) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == 2) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == 3) $permission=$user->rights->adherent->creer;
|
||||
if ($permission)
|
||||
{
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&type=".$typeid."&removeelem=".$prod->id."'>";
|
||||
print img_delete($langs->trans("DeleteFromCat")).' ';
|
||||
print $langs->trans("DeleteFromCat")."</a>";
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
@ -249,8 +298,8 @@ if ($object->type == 1)
|
||||
else
|
||||
{
|
||||
print "<br>";
|
||||
print "<table class='noborder' width='100%'>\n";
|
||||
print "<tr class='liste_titre'><td>".$langs->trans("Suppliers")."</td></tr>\n";
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Suppliers")."</td></tr>\n";
|
||||
|
||||
if (count($socs) > 0)
|
||||
{
|
||||
@ -261,9 +310,24 @@ if ($object->type == 1)
|
||||
print "\t<tr ".$bc[$var].">\n";
|
||||
|
||||
print '<td nowrap="nowrap" valign="top">';
|
||||
print $soc->getNomUrl(1);
|
||||
print $soc->getNomUrl(1,'category_supplier');
|
||||
print "</td>\n";
|
||||
|
||||
// Link to delete from category
|
||||
print '<td align="right">';
|
||||
$typeid=$object->type;
|
||||
$permission=0;
|
||||
if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer);
|
||||
if ($typeid == 1) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == 2) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == 3) $permission=$user->rights->adherent->creer;
|
||||
if ($permission)
|
||||
{
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&type=".$typeid."&removeelem=".$soc->id."'>";
|
||||
print img_delete($langs->trans("DeleteFromCat")).' ';
|
||||
print $langs->trans("DeleteFromCat")."</a>";
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
@ -285,8 +349,8 @@ if($object->type == 2)
|
||||
else
|
||||
{
|
||||
print "<br>";
|
||||
print "<table class='noborder' width='100%'>\n";
|
||||
print "<tr class='liste_titre'><td>".$langs->trans("Customers")."</td></tr>\n";
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Customers")."</td></tr>\n";
|
||||
|
||||
if (count($socs) > 0)
|
||||
{
|
||||
@ -298,9 +362,23 @@ if($object->type == 2)
|
||||
$var=!$var;
|
||||
print "\t<tr ".$bc[$var].">\n";
|
||||
print '<td nowrap="nowrap" valign="top">';
|
||||
print $soc->getNomUrl(1);
|
||||
print $soc->getNomUrl(1,'category');
|
||||
print "</td>\n";
|
||||
|
||||
// Link to delete from category
|
||||
print '<td align="right">';
|
||||
$typeid=$object->type;
|
||||
$permission=0;
|
||||
if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer);
|
||||
if ($typeid == 1) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == 2) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == 3) $permission=$user->rights->adherent->creer;
|
||||
if ($permission)
|
||||
{
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&type=".$typeid."&removeelem=".$soc->id."'>";
|
||||
print img_delete($langs->trans("DeleteFromCat")).' ';
|
||||
print $langs->trans("DeleteFromCat")."</a>";
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
@ -326,7 +404,7 @@ if ($object->type == 3)
|
||||
{
|
||||
print "<br>";
|
||||
print "<table class='noborder' width='100%'>\n";
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Member")."</td></tr>\n";
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Member")."</td></tr>\n";
|
||||
|
||||
if (count($prods) > 0)
|
||||
{
|
||||
@ -336,10 +414,25 @@ if ($object->type == 3)
|
||||
$var=!$var;
|
||||
print "\t<tr ".$bc[$var].">\n";
|
||||
print '<td nowrap="nowrap" valign="top">';
|
||||
print $member->getNomUrl(1);
|
||||
$member->ref=$member->login;
|
||||
print $member->getNomUrl(1,0,'category');
|
||||
print "</td>\n";
|
||||
print '<td valign="top">'.$member->lastname."</td>\n";
|
||||
print '<td valign="top">'.$member->firstname."</td>\n";
|
||||
// Link to delete from category
|
||||
print '<td align="right">';
|
||||
$typeid=$object->type;
|
||||
$permission=0;
|
||||
if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer);
|
||||
if ($typeid == 1) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == 2) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == 3) $permission=$user->rights->adherent->creer;
|
||||
if ($permission)
|
||||
{
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&type=".$typeid."&removeelem=".$member->id."'>";
|
||||
print img_delete($langs->trans("DeleteFromCat")).' ';
|
||||
print $langs->trans("DeleteFromCat")."</a>";
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ class CActionComm
|
||||
$qualified=1;
|
||||
|
||||
// $obj->type can be system, systemauto, module, moduleauto, xxx, xxxauto
|
||||
if ($qualified && $onlyautoornot && preg_match('/^system/',$obj->type) && ! preg_match('/^AC_OTH/',$obj->code)) $qualified=0; // We discard detailed system events. We keep only the 2 generic lines (AC_OTH and AC_OTHER)
|
||||
if ($qualified && $onlyautoornot && preg_match('/^system/',$obj->type) && ! preg_match('/^AC_OTH/',$obj->code)) $qualified=0; // We discard detailed system events. We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO)
|
||||
|
||||
if ($qualified && $obj->module)
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -592,7 +592,7 @@ if ($action == 'create')
|
||||
// Description
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('note',(GETPOST('note')?GETPOST('note'):$actioncomm->note),'',280,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_7,90);
|
||||
$doleditor=new DolEditor('note',(GETPOST('note')?GETPOST('note'):$actioncomm->note),'',240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_7,90);
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
@ -663,7 +663,6 @@ if ($id > 0)
|
||||
*/
|
||||
|
||||
$head=actions_prepare_head($act);
|
||||
dol_fiche_head($head, 'card', $langs->trans("Action"),0,'action');
|
||||
|
||||
$now=dol_now();
|
||||
$delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
|
||||
@ -711,6 +710,8 @@ if ($id > 0)
|
||||
print '<input type="hidden" name="ref_ext" value="'.$act->ref_ext.'">';
|
||||
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1'? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("Action"),0,'action');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
@ -836,7 +837,9 @@ if ($id > 0)
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<center><br><input type="submit" class="button" name="edit" value="'.$langs->trans("Save").'">';
|
||||
dol_fiche_end();
|
||||
|
||||
print '<center><input type="submit" class="button" name="edit" value="'.$langs->trans("Save").'">';
|
||||
print ' <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</center>';
|
||||
|
||||
@ -844,6 +847,8 @@ if ($id > 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_fiche_head($head, 'card', $langs->trans("Action"),0,'action');
|
||||
|
||||
// Affichage fiche action en mode visu
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -1021,14 +1026,13 @@ if ($id > 0)
|
||||
}
|
||||
print '</table><br><br>';
|
||||
}
|
||||
}
|
||||
|
||||
print "</div>\n";
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Barre d'actions
|
||||
*
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
@ -72,11 +72,11 @@ $year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
|
||||
$month=GETPOST("month","int")?GETPOST("month","int"):date("m");
|
||||
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
||||
$day=GETPOST("day","int")?GETPOST("day","int"):0;
|
||||
$actioncode=GETPOST("actioncode","alpha",3);
|
||||
$pid=GETPOST("projectid","int",3);
|
||||
$status=GETPOST("status");
|
||||
$type=GETPOST("type");
|
||||
$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
|
||||
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=="0"?'':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':''));
|
||||
|
||||
if (GETPOST('viewcal')) {
|
||||
$action='show_month'; $day='';
|
||||
@ -271,7 +271,7 @@ $param.='&year='.$year.'&month='.$month.($day?'&day='.$day:'');
|
||||
$head = calendars_prepare_head('');
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans('Events'), 0, $picto);
|
||||
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$listofextcals);
|
||||
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$listofextcals,$actioncode);
|
||||
dol_fiche_end();
|
||||
|
||||
$link='';
|
||||
|
||||
@ -238,7 +238,7 @@ if ($resql)
|
||||
$i = 0;
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"acode",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
|
||||
//print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
|
||||
|
||||
@ -132,7 +132,7 @@ if ($resql)
|
||||
|
||||
if (file_exists($file))
|
||||
{
|
||||
print '<td align="center"><a href="'.DOL_URL_ROOT.'/document.php?page='.$page.'&file='.urlencode($relativepath).'&modulepart=actionsreport">'.img_pdf().'</a></td>';
|
||||
print '<td align="center"><a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?page='.$page.'&file='.urlencode($relativepath).'&modulepart=actionsreport">'.img_pdf().'</a></td>';
|
||||
print '<td align="center">'.dol_print_date(dol_filemtime($file),'dayhour').'</td>';
|
||||
print '<td align="center">'.dol_print_size(dol_filesize($file)).'</td>';
|
||||
}
|
||||
|
||||
@ -1534,7 +1534,7 @@ else
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php';
|
||||
$notify=new Notify($db);
|
||||
$text.='<br>';
|
||||
$text.=$notify->confirmMessage('NOTIFY_VAL_PROPAL',$object->socid);
|
||||
$text.=$notify->confirmMessage('PROPAL_VALIDATE',$object->socid);
|
||||
}
|
||||
|
||||
if (! $error) $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate','',0,1);
|
||||
@ -2171,7 +2171,7 @@ else
|
||||
|
||||
|
||||
//print '</td></tr></table>';
|
||||
print '</div></div></div>';
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -142,7 +142,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print "<tr $bc[$var]><td>".$langs->trans("Propal")." PDF</td>";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=propal&file='.urlencode($relativepath).'">'.$object->ref.'.pdf</a></td>';
|
||||
print '<td><a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart=propal&file='.urlencode($relativepath).'">'.$object->ref.'.pdf</a></td>';
|
||||
|
||||
print '<td align="right">'.dol_print_size(dol_filesize($file)).'</td>';
|
||||
print '<td align="right">'.dol_print_date(dol_filemtime($file),'dayhour').'</td>';
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
@ -165,7 +165,7 @@ if ($search_societe)
|
||||
}
|
||||
if ($search_montant_ht)
|
||||
{
|
||||
$sql.= " AND p.total_ht='".$db->escape(trim($search_montant_ht))."'";
|
||||
$sql.= " AND p.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'";
|
||||
}
|
||||
if ($sall) $sql.= " AND (s.nom LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%' OR pd.description LIKE '%".$db->escape($sall)."%')";
|
||||
if ($socid) $sql.= ' AND s.rowid = '.$socid;
|
||||
|
||||
@ -128,7 +128,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print "<tr $bc[$var]><td>".$langs->trans("Order")." PDF</td>";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=commande&file='.urlencode($relativepath).'">'.$object->ref.'.pdf</a></td>';
|
||||
print '<td><a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart=commande&file='.urlencode($relativepath).'">'.$object->ref.'.pdf</a></td>';
|
||||
print '<td align="right">'.dol_print_size(dol_filesize($file)).'</td>';
|
||||
print '<td align="right">'.dol_print_date(dol_filemtime($file),'dayhour').'</td>';
|
||||
print '</tr>';
|
||||
@ -139,7 +139,7 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
print "<tr $bc[$var]><td>Commande detaillee</td>";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=commande&file='.urlencode($relativepathdetail).'">'.$object->ref.'-detail.pdf</a></td>';
|
||||
print '<td><a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart=commande&file='.urlencode($relativepathdetail).'">'.$object->ref.'-detail.pdf</a></td>';
|
||||
print '<td align="right">'.dol_print_size(dol_filesize($filedetail)).'</td>';
|
||||
print '<td align="right">'.dol_print_date(dol_filemtime($filedetail),'dayhour').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -1,34 +1,34 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* 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/commande/fiche.php
|
||||
* \ingroup commande
|
||||
* \brief Page to show customer order
|
||||
*/
|
||||
* \ingroup commande
|
||||
* \brief Page to show customer order
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
@ -541,7 +541,7 @@ else if ($action == 'setnote_public' && $user->rights->commande->creer)
|
||||
|
||||
else if ($action == 'setnote_private' && $user->rights->commande->creer)
|
||||
{
|
||||
$result=$object->update_note_rivate(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES), '_private');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
@ -1121,7 +1121,7 @@ else if ($action == 'print_file' AND $user->rights->printipp->use)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolprintipp.class.php';
|
||||
$printer = new dolPrintIPP($db,$conf->global->PRINTIPP_HOST,$conf->global->PRINTIPP_PORT,$user->login,$conf->global->PRINTIPP_USER,$conf->global->PRINTIPP_PASSWORD);
|
||||
$printer->print_file(GETPOST('file','alpha'),GETPOST('printer','alpha'));
|
||||
$printer->print_file(GETPOST('file','alpha'),GETPOST('printer','alpha'));
|
||||
}
|
||||
|
||||
else if ($action == 'update_extras')
|
||||
@ -1784,7 +1784,7 @@ else
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php';
|
||||
$notify=new Notify($db);
|
||||
$text.='<br>';
|
||||
$text.=$notify->confirmMessage('NOTIFY_VAL_ORDER',$object->socid);
|
||||
$text.=$notify->confirmMessage('ORDER_VALIDATE',$object->socid);
|
||||
}
|
||||
$formquestion=array();
|
||||
if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $object->hasProductsOrServices(1))
|
||||
@ -1935,15 +1935,15 @@ else
|
||||
print '<td colspan="3">'.$soc->getNomUrl(1).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
||||
{
|
||||
$filterabsolutediscount="fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
||||
$filtercreditnote="fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
||||
}
|
||||
else
|
||||
{
|
||||
$filterabsolutediscount="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')";
|
||||
$filtercreditnote="fk_facture_source IS NOT NULL AND description <> '(DEPOSIT)'";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
||||
{
|
||||
$filterabsolutediscount="fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
||||
$filtercreditnote="fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
||||
}
|
||||
else
|
||||
{
|
||||
$filterabsolutediscount="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')";
|
||||
$filtercreditnote="fk_facture_source IS NOT NULL AND description <> '(DEPOSIT)'";
|
||||
}
|
||||
|
||||
// Relative and absolute discounts
|
||||
@ -2135,49 +2135,24 @@ else
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||
{
|
||||
|
||||
if ($action == 'edit_extras')
|
||||
{
|
||||
print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post" name="formsoc">';
|
||||
print '<input type="hidden" name="action" value="update_extras">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
}
|
||||
|
||||
// TODO : use showOptionals($extrafields) function
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
||||
if ($extrafields->attribute_type[$key] == 'separate')
|
||||
{
|
||||
print $extrafields->showSeparator($key);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td';
|
||||
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
|
||||
print '>'.$label.'</td><td colspan="3">';
|
||||
|
||||
// Convert date into timestamp format
|
||||
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
|
||||
{
|
||||
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key];
|
||||
}
|
||||
|
||||
if ($action == 'edit_extras' && $user->rights->propal->creer)
|
||||
{
|
||||
print $extrafields->showInputField($key,$value);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $extrafields->showOutputField($key,$value);
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
if(count($extrafields->attribute_label) > 0) {
|
||||
|
||||
if ($action == 'edit_extras')
|
||||
{
|
||||
print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post" name="formsoc">';
|
||||
print '<input type="hidden" name="action" value="update_extras">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'edit_extras' && $user->rights->propal->creer) {
|
||||
print $object->showOptionals($extrafields,'edit');
|
||||
}
|
||||
else {
|
||||
print $object->showOptionals($extrafields);
|
||||
}
|
||||
|
||||
if ($action == 'edit_extras' && $user->rights->propal->creer)
|
||||
{
|
||||
print '<tr><td></td><td>';
|
||||
@ -2195,9 +2170,9 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
$rowspan=4;
|
||||
if ($mysoc->localtax1_assuj=="1") $rowspan++;
|
||||
if ($mysoc->localtax2_assuj=="1") $rowspan++;
|
||||
$rowspan=4;
|
||||
if ($mysoc->localtax1_assuj=="1") $rowspan++;
|
||||
if ($mysoc->localtax2_assuj=="1") $rowspan++;
|
||||
|
||||
// Total HT
|
||||
print '<tr><td>'.$langs->trans('AmountHT').'</td>';
|
||||
@ -2307,7 +2282,7 @@ else
|
||||
|
||||
/*
|
||||
* Boutons actions
|
||||
*/
|
||||
*/
|
||||
if ($action != 'presend')
|
||||
{
|
||||
if ($user->societe_id == 0 && $action <> 'editline')
|
||||
@ -2436,7 +2411,7 @@ else
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
if ($action != 'presend')
|
||||
@ -2447,7 +2422,7 @@ else
|
||||
|
||||
/*
|
||||
* Documents generes
|
||||
*/
|
||||
*/
|
||||
$comref = dol_sanitizeFileName($object->ref);
|
||||
$file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf';
|
||||
$relativepath = $comref.'/'.$comref.'.pdf';
|
||||
@ -2461,7 +2436,7 @@ else
|
||||
|
||||
/*
|
||||
* Linked object block
|
||||
*/
|
||||
*/
|
||||
$somethingshown=$object->showLinkedObjectBlock();
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
@ -2473,7 +2448,7 @@ else
|
||||
$somethingshown=$formactions->showactions($object,'order',$socid);
|
||||
|
||||
//print '</td></tr></table>';
|
||||
print '</div></div></div>';
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -318,7 +318,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print "<tr $bc[$var]><td>".$langs->trans("Bill")." PDF</td>";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture&file='.urlencode($relativepath).'">'.$object->ref.'.pdf</a></td>';
|
||||
print '<td><a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart=facture&file='.urlencode($relativepath).'">'.$object->ref.'.pdf</a></td>';
|
||||
print '<td align="right">'.dol_print_size(dol_filesize($file)). '</td>';
|
||||
print '<td align="right">'.dol_print_date(dol_filemtime($file),'dayhour').'</td>';
|
||||
print '</tr>';
|
||||
@ -328,7 +328,7 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
print "<tr $bc[$var]><td>Facture detaillee</td>";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture&file='.urlencode($relativepathdetail).'">'.$object->ref.'-detail.pdf</a></td>';
|
||||
print '<td><a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart=facture&file='.urlencode($relativepathdetail).'">'.$object->ref.'-detail.pdf</a></td>';
|
||||
print '<td align="right">'.dol_print_size(dol_filesize($filedetail)).'</td>';
|
||||
print '<td align="right">'.dol_print_date(dol_filemtime($filedetail),'dayhour').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
@ -183,11 +183,11 @@ if ($search_societe)
|
||||
}
|
||||
if ($search_montant_ht)
|
||||
{
|
||||
$sql.= ' AND f.total = \''.$db->escape(trim($search_montant_ht)).'\'';
|
||||
$sql.= ' AND f.total = \''.$db->escape(price2num(trim($search_montant_ht))).'\'';
|
||||
}
|
||||
if ($search_montant_ttc)
|
||||
{
|
||||
$sql.= ' AND f.total_ttc = \''.$db->escape(trim($search_montant_ttc)).'\'';
|
||||
$sql.= ' AND f.total_ttc = \''.$db->escape(price2num(trim($search_montant_ttc))).'\'';
|
||||
}
|
||||
if ($month > 0)
|
||||
{
|
||||
|
||||
@ -3,7 +3,8 @@
|
||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2012 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2011-2012 Alexandre spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013 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
|
||||
@ -99,12 +100,9 @@ $sql = "SELECT f.rowid, f.ref_supplier, f.type, f.datef, f.libelle,";
|
||||
$sql.= " fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type, fd.localtax1_tx, fd.localtax2_tx, fd.total_localtax1, fd.total_localtax2,";
|
||||
$sql.= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur,";
|
||||
$sql.= " p.rowid as pid, p.ref as ref, p.accountancy_code_buy,";
|
||||
$sql.= " ct.accountancy_code_buy as account_tva, ct.recuperableonly,";
|
||||
$sql.= " ctl1.accountancy_code_buy as account_localtax1, ctl2.accountancy_code_buy as account_localtax2";
|
||||
$sql.= " ct.accountancy_code_buy as account_tva, ct.recuperableonly";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det fd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ctl1 ON fd.localtax1_tx = ctl1.localtax1 AND ctl1.fk_pays = '".$idpays."'";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ctl2 ON fd.localtax2_tx = ctl2.localtax2 AND ctl2.fk_pays = '".$idpays."'";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."facture_fourn f ON f.rowid = fd.fk_facture_fourn";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc" ;
|
||||
@ -145,6 +143,11 @@ if ($result)
|
||||
$compta_localtax1 = (! empty($obj->account_localtax1)?$obj->account_localtax1:$langs->trans("CodeNotDef"));
|
||||
$compta_localtax2 = (! empty($obj->account_localtax2)?$obj->account_localtax2:$langs->trans("CodeNotDef"));
|
||||
|
||||
$account_localtax1=getLocalTaxesFromRate($obj->tva_tx, 1, $mysoc);
|
||||
$compta_localtax1= (! empty($account_localtax1[2])?$account_localtax1[2]:$langs->trans("CodeNotDef"));
|
||||
$account_localtax2=getLocalTaxesFromRate($obj->tva_tx, 2, $mysoc);
|
||||
$compta_localtax2= (! empty($account_localtax2[2])?$account_localtax2[2]:$langs->trans("CodeNotDef"));
|
||||
|
||||
$tabfac[$obj->rowid]["date"] = $obj->datef;
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier;
|
||||
$tabfac[$obj->rowid]["type"] = $obj->type;
|
||||
@ -166,7 +169,6 @@ else {
|
||||
/*
|
||||
* Show result array
|
||||
*/
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
///print "<td>".$langs->trans("JournalNum")."</td>";
|
||||
@ -177,96 +179,71 @@ print "<td>".$langs->trans("Type")."</td><td align='right'>".$langs->trans("Debi
|
||||
print "</tr>\n";
|
||||
|
||||
$var=true;
|
||||
$r='';
|
||||
|
||||
$invoicestatic=new FactureFournisseur($db);
|
||||
$companystatic=new Fournisseur($db);
|
||||
|
||||
foreach ($tabfac as $key => $val)
|
||||
{
|
||||
$invoicestatic->id=$key;
|
||||
$invoicestatic->ref=$val["ref"];
|
||||
$invoicestatic->type=$val["type"];
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
|
||||
// product
|
||||
foreach ($tabht[$key] as $k => $mt)
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
|
||||
$lines = array(
|
||||
array(
|
||||
'var' => $tabht[$key],
|
||||
'label' => $langs->trans('Products'),
|
||||
),
|
||||
array(
|
||||
'var' => $tabtva[$key],
|
||||
'label' => $langs->trans('VAT')
|
||||
),
|
||||
array(
|
||||
'var' => $tablocaltax1[$key],
|
||||
'label' => $langs->transcountry('LT1', $mysoc->country_code)
|
||||
),
|
||||
array(
|
||||
'var' => $tablocaltax2[$key],
|
||||
'label' => $langs->transcountry('LT2', $mysoc->country_code)
|
||||
),
|
||||
array(
|
||||
'var' => $tabttc[$key],
|
||||
'label' => $langs->trans('ThirdParty').' ('.$companystatic->getNomUrl(0, 'supplier', 16).')',
|
||||
'nomtcheck' => true,
|
||||
'inv' => true
|
||||
)
|
||||
);
|
||||
|
||||
foreach ($lines as $line)
|
||||
{
|
||||
if ($mt)
|
||||
foreach ($line['var'] as $k => $mt)
|
||||
{
|
||||
print "<tr ".$bc[$var]." >";
|
||||
//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
|
||||
print "<td>".$val["date"]."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
print "<td>".$k."</td><td>".$langs->trans("Products")."</td>";
|
||||
print '<td align="right">'.($mt>=0?price($mt):'')."</td>";
|
||||
print '<td align="right">'.($mt<0?price(-$mt):'')."</td>";
|
||||
print "</tr>";
|
||||
if (isset($line['nomtcheck']) || $mt)
|
||||
{
|
||||
print "<tr ".$bc[$var]." >";
|
||||
//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
|
||||
print "<td>".$val["date"]."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
print "<td>".$k."</td><td>".$line['label']."</td>";
|
||||
|
||||
if (isset($line['inv']))
|
||||
{
|
||||
print '<td align="right">'.($mt<0?price(-$mt):'')."</td>";
|
||||
print '<td align="right">'.($mt>=0?price($mt):'')."</td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="right">'.($mt>=0?price($mt):'')."</td>";
|
||||
print '<td align="right">'.($mt<0?price(-$mt):'')."</td>";
|
||||
}
|
||||
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
// vat
|
||||
foreach ($tabtva[$key] as $k => $mt)
|
||||
{
|
||||
if ($mt)
|
||||
{
|
||||
print "<tr ".$bc[$var]." >";
|
||||
//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
|
||||
print "<td>".$val["date"]."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
print "<td>".$k."</td><td>".$langs->trans("VAT")."</td>";
|
||||
print '<td align="right">'.($mt>=0?price($mt):'')."</td>";
|
||||
print '<td align="right">'.($mt<0?price(-$mt):'')."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
// localtax1
|
||||
foreach ($tablocaltax1[$key] as $k => $mt)
|
||||
{
|
||||
if ($mt)
|
||||
{
|
||||
print "<tr ".$bc[$var].">";
|
||||
//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
|
||||
print "<td>".$val["date"]."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
print "<td>".$k."</td><td>".$langs->transcountrynoentities("LT1",$mysoc->country_code)."</td>";
|
||||
print "<td align='right'>".($mt>=0?price($mt):'')."</td>";
|
||||
print "<td align='right'>".($mt<0?price(-$mt):'')."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
// localtax2
|
||||
foreach ($tablocaltax2[$key] as $k => $mt)
|
||||
{
|
||||
if ($mt)
|
||||
{
|
||||
print "<tr ".$bc[$var].">";
|
||||
//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
|
||||
print "<td>".$val["date"]."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
print "<td>".$k."</td><td>".$langs->transcountrynoentities("LT2",$mysoc->country_code)."</td>";
|
||||
print "<td align='right'>".($mt>=0?price($mt):'')."</td>";
|
||||
print "<td align='right'>".($mt<0?price(-$mt):'')."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
print "<tr ".$bc[$var].">";
|
||||
// third party
|
||||
//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
|
||||
print "<td>".$val["date"]."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
|
||||
foreach ($tabttc[$key] as $k => $mt)
|
||||
{
|
||||
$companystatic->id=$tabcompany[$key]['id'];
|
||||
$companystatic->name=$tabcompany[$key]['name'];
|
||||
|
||||
print "<td>".$k;
|
||||
print "</td><td>".$langs->trans("ThirdParty");
|
||||
print ' ('.$companystatic->getNomUrl(0,'supplier',16).')';
|
||||
print "</td>";
|
||||
print '<td align="right">'.($mt<0?price(-$mt):'')."</td>";
|
||||
print '<td align="right">'.($mt>=0?price($mt):'')."</td>";
|
||||
}
|
||||
print "</tr>";
|
||||
|
||||
$var = !$var;
|
||||
}
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2012 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2011-2012 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013 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
|
||||
@ -102,15 +102,12 @@ $sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,";
|
||||
$sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, fd.localtax1_tx, fd.localtax2_tx, fd.total_localtax1, fd.total_localtax2,";
|
||||
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,";
|
||||
$sql.= " ct.accountancy_code_sell as account_tva, ct.recuperableonly,";
|
||||
$sql.= " ctl1.accountancy_code_sell as account_localtax1, ctl2.accountancy_code_sell as account_localtax2";
|
||||
$sql.= " ct.accountancy_code_sell as account_tva, ct.recuperableonly";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet fd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."facture f ON f.rowid = fd.fk_facture";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ctl1 ON fd.localtax1_tx = ctl1.localtax1 AND ctl1.fk_pays = '".$idpays."'";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ctl2 ON fd.localtax2_tx = ctl2.localtax2 AND ctl2.fk_pays = '".$idpays."'";
|
||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||
$sql.= " AND f.fk_statut > 0";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
|
||||
@ -129,6 +126,8 @@ if ($result)
|
||||
$tablocaltax2 = array();
|
||||
$tabttc = array();
|
||||
$tabcompany = array();
|
||||
$account_localtax1=0;
|
||||
$account_localtax2=0;
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
$i=0;
|
||||
@ -147,9 +146,12 @@ if ($result)
|
||||
}
|
||||
$cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT)?$conf->global->COMPTA_VAT_ACCOUNT:$langs->trans("CodeNotDef"));
|
||||
$compta_tva = (! empty($obj->account_tva)?$obj->account_tva:$cpttva);
|
||||
$compta_localtax1 = (! empty($obj->account_localtax1)?$obj->account_localtax1:$langs->trans("CodeNotDef"));
|
||||
$compta_localtax2 = (! empty($obj->account_localtax2)?$obj->account_localtax2:$langs->trans("CodeNotDef"));
|
||||
|
||||
$account_localtax1=getLocalTaxesFromRate($obj->tva_tx, 1, $mysoc);
|
||||
$compta_localtax1= (! empty($account_localtax1[3])?$account_localtax1[3]:$langs->trans("CodeNotDef"));
|
||||
$account_localtax2=getLocalTaxesFromRate($obj->tva_tx, 2, $mysoc);
|
||||
$compta_localtax2= (! empty($account_localtax2[3])?$account_localtax2[3]:$langs->trans("CodeNotDef"));
|
||||
|
||||
//la ligne facture
|
||||
$tabfac[$obj->rowid]["date"] = $obj->datef;
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
||||
@ -178,17 +180,15 @@ else {
|
||||
*/
|
||||
|
||||
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
//print "<td>".$langs->trans("JournalNum")."</td>";
|
||||
print "<td>".$langs->trans("Date")."</td><td>".$langs->trans("Piece").' ('.$langs->trans("InvoiceRef").")</td>";
|
||||
print "<td>".$langs->trans("Account")."</td>";
|
||||
print "<td>".$langs->trans("Type")."</td><td align='right'>".$langs->trans("Debit")."</td><td align='right'>".$langs->trans("Credit")."</td>";
|
||||
print '<td>'.$langs->trans('Date').'</td><td>'.$langs->trans('Piece').' ('.$langs->trans('InvoiceRef').')</td>';
|
||||
print '<td>'.$langs->trans('Account').'</td>';
|
||||
print '<td>'.$langs->trans('Type').'</td><td align="right">'.$langs->trans('Debit').'</td><td align="right">'.$langs->trans('Credit').'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=true;
|
||||
$r='';
|
||||
|
||||
$invoicestatic=new Facture($db);
|
||||
$companystatic=new Client($db);
|
||||
@ -199,74 +199,62 @@ foreach ($tabfac as $key => $val)
|
||||
$invoicestatic->ref=$val["ref"];
|
||||
$invoicestatic->type=$val["type"];
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
// third party
|
||||
//print "<td>".$conf->global->COMPTA_JOURNAL_SELL."</td>";
|
||||
print "<td>".$val["date"]."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
foreach ($tabttc[$key] as $k => $mt)
|
||||
$companystatic->id=$tabcompany[$key]['id'];
|
||||
$companystatic->name=$tabcompany[$key]['name'];
|
||||
$companystatic->client=$tabcompany[$key]['client'];
|
||||
|
||||
$lines = array(
|
||||
array(
|
||||
'var' => $tabttc[$key],
|
||||
'label' => $langs->trans('ThirdParty').' ('.$companystatic->getNomUrl(0, 'customer', 16).')',
|
||||
'nomtcheck' => true,
|
||||
'inv' => true
|
||||
),
|
||||
array(
|
||||
'var' => $tabht[$key],
|
||||
'label' => $langs->trans('Products'),
|
||||
),
|
||||
array(
|
||||
'var' => $tabtva[$key],
|
||||
'label' => $langs->trans('VAT')
|
||||
),
|
||||
array(
|
||||
'var' => $tablocaltax1[$key],
|
||||
'label' => $langs->transcountry('LT1', $mysoc->country_code)
|
||||
),
|
||||
array(
|
||||
'var' => $tablocaltax2[$key],
|
||||
'label' => $langs->transcountry('LT2', $mysoc->country_code)
|
||||
)
|
||||
);
|
||||
|
||||
foreach ($lines as $line)
|
||||
{
|
||||
$companystatic->id=$tabcompany[$key]['id'];
|
||||
$companystatic->name=$tabcompany[$key]['name'];
|
||||
$companystatic->client=$tabcompany[$key]['client'];
|
||||
print "<td>".$k;
|
||||
print "</td><td>".$langs->trans("ThirdParty");
|
||||
print ' ('.$companystatic->getNomUrl(0,'customer',16).')';
|
||||
print "</td><td align='right'>".($mt>=0?price($mt):'')."</td><td align='right'>".($mt<0?price(-$mt):'')."</td>";
|
||||
}
|
||||
print "</tr>";
|
||||
// product
|
||||
foreach ($tabht[$key] as $k => $mt)
|
||||
{
|
||||
if ($mt)
|
||||
foreach ($line['var'] as $k => $mt)
|
||||
{
|
||||
print "<tr ".$bc[$var].">";
|
||||
//print "<td>".$conf->global->COMPTA_JOURNAL_SELL."</td>";
|
||||
print "<td>".$val["date"]."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
print "<td>".$k;
|
||||
print "</td><td>".$langs->trans("Products")."</td><td align='right'>".($mt<0?price(-$mt):'')."</td><td align='right'>".($mt>=0?price($mt):'')."</td></tr>";
|
||||
if (isset($line['nomtcheck']) || $mt)
|
||||
{
|
||||
print "<tr ".$bc[$var]." >";
|
||||
//print "<td>".$conf->global->COMPTA_JOURNAL_SELL."</td>";
|
||||
print "<td>".$val["date"]."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
print "<td>".$k."</td><td>".$line['label']."</td>";
|
||||
|
||||
if (isset($line['inv']))
|
||||
{
|
||||
print '<td align="right">'.($mt>=0?price($mt):'')."</td>";
|
||||
print '<td align="right">'.($mt<0?price(-$mt):'')."</td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="right">'.($mt<0?price(-$mt):'')."</td>";
|
||||
print '<td align="right">'.($mt>=0?price($mt):'')."</td>";
|
||||
}
|
||||
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
// vat
|
||||
foreach ($tabtva[$key] as $k => $mt)
|
||||
{
|
||||
if ($mt)
|
||||
{
|
||||
print "<tr ".$bc[$var].">";
|
||||
//print "<td>".$conf->global->COMPTA_JOURNAL_SELL."</td>";
|
||||
print "<td>".$val["date"]."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
print "<td>".$k;
|
||||
print "</td><td>".$langs->trans("VAT")."</td><td align='right'>".($mt<0?price(-$mt):'')."</td><td align='right'>".($mt>=0?price($mt):'')."</td></tr>";
|
||||
}
|
||||
}
|
||||
// localtax1
|
||||
foreach ($tablocaltax1[$key] as $k => $mt)
|
||||
{
|
||||
if ($mt)
|
||||
{
|
||||
print "<tr ".$bc[$var].">";
|
||||
//print "<td>".$conf->global->COMPTA_JOURNAL_SELL."</td>";
|
||||
print "<td>".$val["date"]."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
print "<td>".$k;
|
||||
print "</td><td>".$langs->transcountrynoentities("LT1",$mysoc->country_code)."</td><td align='right'>".($mt<0?price(-$mt):'')."</td><td align='right'>".($mt>=0?price($mt):'')."</td></tr>";
|
||||
}
|
||||
}
|
||||
// localtax2
|
||||
foreach ($tablocaltax2[$key] as $k => $mt)
|
||||
{
|
||||
if ($mt)
|
||||
{
|
||||
print "<tr ".$bc[$var].">";
|
||||
//print "<td>".$conf->global->COMPTA_JOURNAL_SELL."</td>";
|
||||
print "<td>".$val["date"]."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
print "<td>".$k;
|
||||
print "</td><td>".$langs->transcountrynoentities("LT2",$mysoc->country_code)."</td><td align='right'>".($mt<0?price(-$mt):'')."</td><td align='right'>".($mt>=0?price($mt):'')."</td></tr>";
|
||||
}
|
||||
}
|
||||
|
||||
$var = !$var;
|
||||
}
|
||||
|
||||
@ -286,7 +286,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
$(\'.fieldrequireddyn\').addClass(\'fieldrequired\');
|
||||
if ($(\'#fieldchqemetteur\').val() == \'\')
|
||||
{
|
||||
$(\'#fieldchqemetteur\').val(jQuery(\'#thirdpartylabel\').val());
|
||||
var emetteur = ('.$facture->type.' == 2) ? \''.dol_escape_htmltag(MAIN_INFO_SOCIETE_NOM).'\' : jQuery(\'#thirdpartylabel\').val();
|
||||
$(\'#fieldchqemetteur\').val(emetteur);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -154,7 +154,7 @@ if ($year)
|
||||
$var=!$var;
|
||||
$tfile = $dir . '/'.$year.'/'.$file;
|
||||
$relativepath = $year.'/'.$file;
|
||||
print "<tr $bc[$var]>".'<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture_paiement&file='.urlencode($relativepath).'">'.img_pdf().' '.$file.'</a></td>';
|
||||
print "<tr ".$bc[$var].">".'<td><a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart=facture_paiement&file='.urlencode($relativepath).'">'.img_pdf().' '.$file.'</a></td>';
|
||||
print '<td align="right">'.dol_print_size(dol_filesize($tfile)).'</td>';
|
||||
print '<td align="right">'.dol_print_date(dol_filemtime($tfile),"dayhour").'</td></tr>';
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
$relativepath = 'bon/'.$object->ref;
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$object->ref.'</a>';
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$object->ref.'</a>';
|
||||
|
||||
print '</td></tr>';
|
||||
print '</table><br>';
|
||||
|
||||
@ -94,7 +94,7 @@ if ($prev_id)
|
||||
print '<table class="border" width="100%"><tr><td width="20%">';
|
||||
print $langs->trans("WithdrawalFile").'</td><td>';
|
||||
$relativepath = 'receipts/'.$bon->ref;
|
||||
print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||
print '</td></tr></table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -93,7 +93,7 @@ if ($prev_id)
|
||||
print '<table class="border" width="100%"><tr><td width="20%">';
|
||||
print $langs->trans("WithdrawalFile").'</td><td>';
|
||||
$relativepath = 'receipts/'.$bon->ref;
|
||||
print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||
print '</td></tr></table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -92,7 +92,7 @@ if ($prev_id)
|
||||
print '<table class="border" width="100%"><tr><td width="20%">';
|
||||
print $langs->trans("WithdrawalFile").'</td><td>';
|
||||
$relativepath = 'receipts/'.$bon->ref;
|
||||
print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||
print '</td></tr></table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -191,7 +191,7 @@ if ($id > 0)
|
||||
print '<table class="border" width="100%"><tr><td width="20%">';
|
||||
print $langs->trans("WithdrawalFile").'</td><td>';
|
||||
$relativepath = 'receipts/'.$bon->ref;
|
||||
print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||
print '</td></tr></table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -101,7 +101,7 @@ if ($prev_id)
|
||||
print '<table class="border" width="100%"><tr><td width="20%">';
|
||||
print $langs->trans("WithdrawalFile").'</td><td>';
|
||||
$relativepath = 'receipts/'.$bon->ref;
|
||||
print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||
print '</td></tr></table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
390
htdocs/compta/stats/cabyprodserv.php
Normal file
390
htdocs/compta/stats/cabyprodserv.php
Normal file
@ -0,0 +1,390 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Antoine Iauch <aiauch@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/stats/cabyprodserv.php
|
||||
* \brief Page reporting TO by Products & Services
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
$langs->load("products");
|
||||
$langs->load("categories");
|
||||
$langs->load("errors");
|
||||
|
||||
// Security pack (data & check)
|
||||
$socid = GETPOST('socid','int');
|
||||
|
||||
if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||
if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat');
|
||||
if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport');
|
||||
|
||||
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
|
||||
$modecompta = $conf->global->COMPTA_MODE;
|
||||
if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta");
|
||||
|
||||
$sortorder=isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
||||
$sortfield=isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
||||
if (! $sortorder) $sortorder="asc";
|
||||
if (! $sortfield) $sortfield="name";
|
||||
|
||||
// Category
|
||||
$selected_cat = (int)GETPOST('search_categ', 'int');
|
||||
$subcat = false;
|
||||
if (GETPOST('subcat', 'alpha') === 'yes') {
|
||||
$subcat = true;
|
||||
}
|
||||
|
||||
// Date range
|
||||
$year=GETPOST("year");
|
||||
$month=GETPOST("month");
|
||||
$date_startyear = GETPOST("date_startyear");
|
||||
$date_startmonth = GETPOST("date_startmonth");
|
||||
$date_startday = GETPOST("date_startday");
|
||||
$date_endyear = GETPOST("date_endyear");
|
||||
$date_endmonth = GETPOST("date_endmonth");
|
||||
$date_endday = GETPOST("date_endday");
|
||||
if (empty($year))
|
||||
{
|
||||
$year_current = strftime("%Y",dol_now());
|
||||
$month_current = strftime("%m",dol_now());
|
||||
$year_start = $year_current;
|
||||
} else {
|
||||
$year_current = $year;
|
||||
$month_current = strftime("%m",dol_now());
|
||||
$year_start = $year;
|
||||
}
|
||||
$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]);
|
||||
$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
|
||||
// Quarter
|
||||
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
{
|
||||
$q=GETPOST("q")?GETPOST("q"):0;
|
||||
if ($q==0)
|
||||
{
|
||||
// We define date_start and date_end
|
||||
$month_start=GETPOST("month")?GETPOST("month"):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||
$year_end=$year_start;
|
||||
$month_end=$month_start;
|
||||
if (! GETPOST("month")) // If month not forced
|
||||
{
|
||||
if (! GETPOST('year') && $month_start > $month_current)
|
||||
{
|
||||
$year_start--;
|
||||
$year_end--;
|
||||
}
|
||||
$month_end=$month_start-1;
|
||||
if ($month_end < 1) $month_end=12;
|
||||
else $year_end++;
|
||||
}
|
||||
$date_start=dol_get_first_day($year_start,$month_start,false); $date_end=dol_get_last_day($year_end,$month_end,false);
|
||||
}
|
||||
if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); }
|
||||
if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); }
|
||||
if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); }
|
||||
if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
|
||||
} else {
|
||||
// TODO We define q
|
||||
}
|
||||
|
||||
$commonparams=array();
|
||||
$commonparams['modecompta']=$modecompta;
|
||||
$commonparams['sortorder'] = $sortorder;
|
||||
$commonparams['sortfield'] = $sortfield;
|
||||
|
||||
$headerparams = array();
|
||||
$headerparams['date_startyear'] = $date_startyear;
|
||||
$headerparams['date_startmonth'] = $date_startmonth;
|
||||
$headerparams['date_startday'] = $date_startday;
|
||||
$headerparams['date_endyear'] = $date_endyear;
|
||||
$headerparams['date_endmonth'] = $date_endmonth;
|
||||
$headerparams['date_endday'] = $date_endday;
|
||||
$headerparams['q'] = $q;
|
||||
|
||||
$tableparams = array();
|
||||
$tableparams['search_categ'] = $selected_cat;
|
||||
$tableparams['subcat'] = ($subcat === true)?'yes':'';
|
||||
|
||||
// Adding common parameters
|
||||
$allparams = array_merge($commonparams, $headerparams, $tableparams);
|
||||
$headerparams = array_merge($commonparams, $headerparams);
|
||||
$tableparams = array_merge($commonparams, $tableparams);
|
||||
|
||||
foreach($allparams as $key => $value) {
|
||||
$paramslink .= '&' . $key . '=' . $value;
|
||||
}
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
llxHeader();
|
||||
$form=new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
// Show report header
|
||||
$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByProductsAndServices");
|
||||
|
||||
if ($modecompta=="CREANCES-DETTES") {
|
||||
$nom.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
|
||||
$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);
|
||||
|
||||
$description=$langs->trans("RulesCADue");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$description.= $langs->trans("DepositsAreNotIncluded");
|
||||
} else {
|
||||
$description.= $langs->trans("DepositsAreIncluded");
|
||||
}
|
||||
|
||||
$builddate=time();
|
||||
} else {
|
||||
$nom.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
|
||||
$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);
|
||||
|
||||
$description=$langs->trans("RulesCAIn");
|
||||
$description.= $langs->trans("DepositsAreIncluded");
|
||||
|
||||
$builddate=time();
|
||||
}
|
||||
|
||||
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams);
|
||||
|
||||
|
||||
// SQL request
|
||||
$catotal=0;
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql = "SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label,";
|
||||
$sql.= " sum(DISTINCT l.total_ht) as amount, sum(DISTINCT l.total_ttc) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."facturedet as l";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON l.fk_facture = f.rowid";
|
||||
if ($selected_cat === -2) {
|
||||
$sql.=" LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product";
|
||||
}
|
||||
if ($selected_cat && $selected_cat !== -2) {
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON c.rowid = " . $selected_cat;
|
||||
if ($subcat) {
|
||||
$sql.=" OR c.fk_parent = " . $selected_cat;
|
||||
}
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_categorie = c.rowid";
|
||||
}
|
||||
$sql.= " WHERE l.fk_product = p.rowid";
|
||||
$sql.= " AND f.fk_statut in (1,2)";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql.= " AND f.type IN (0,1,2)";
|
||||
} else {
|
||||
$sql.= " AND f.type IN (0,1,2,3)";
|
||||
}
|
||||
if ($date_start && $date_end) {
|
||||
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
if ($selected_cat === -2) {
|
||||
$sql.=" AND cp.fk_product is null";
|
||||
}
|
||||
if ($selected_cat && $selected_cat !== -2) {
|
||||
$sql.= " AND cp.fk_product = p.rowid";
|
||||
}
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY p.rowid ";
|
||||
$sql.= "ORDER BY p.ref ";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i=0;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$amount_ht[$obj->rowid] = $obj->amount;
|
||||
$amount[$obj->rowid] = $obj->amount_ttc;
|
||||
$name[$obj->rowid] = $obj->ref . ' - ' . $obj->label;
|
||||
$catotal_ht+=$obj->amount;
|
||||
$catotal+=$obj->amount_ttc;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// Show Array
|
||||
$i=0;
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
// Extra parameters management
|
||||
foreach($headerparams as $key => $value)
|
||||
{
|
||||
print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
|
||||
}
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
// Category filter
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>';
|
||||
print $langs->trans("Category") . ': ' . $formother->select_categories(0, $selected_cat, 'search_categ', true);
|
||||
print ' ';
|
||||
print $langs->trans("SubCats") . '? ';
|
||||
print '<input type="checkbox" name="subcat" value="yes"';
|
||||
if ($subcat) {
|
||||
print ' checked';
|
||||
}
|
||||
print '></td>';
|
||||
print '<td colspan="3" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '</td></tr>';
|
||||
// Array header
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Product"),
|
||||
$_SERVER["PHP_SELF"],
|
||||
"name",
|
||||
"",
|
||||
$paramslink,
|
||||
"",
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print_liste_field_titre(
|
||||
$langs->trans('AmountHT'),
|
||||
$_SERVER["PHP_SELF"],
|
||||
"amount_ht",
|
||||
"",
|
||||
$paramslink,
|
||||
'align="right"',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print_liste_field_titre(
|
||||
$langs->trans("AmountTTC"),
|
||||
$_SERVER["PHP_SELF"],
|
||||
"amount_ttc",
|
||||
"",
|
||||
$paramslink,
|
||||
'align="right"',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Percentage"),
|
||||
$_SERVER["PHP_SELF"],
|
||||
"amount_ttc",
|
||||
"",
|
||||
$paramslink,
|
||||
'align="right"',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
// TODO: statistics?
|
||||
print "</tr>\n";
|
||||
|
||||
// Array Data
|
||||
$var=true;
|
||||
|
||||
if (count($amount)) {
|
||||
$arrayforsort=$name;
|
||||
// defining arrayforsort
|
||||
if ($sortfield == 'nom' && $sortorder == 'asc') {
|
||||
asort($name);
|
||||
$arrayforsort=$name;
|
||||
}
|
||||
if ($sortfield == 'nom' && $sortorder == 'desc') {
|
||||
arsort($name);
|
||||
$arrayforsort=$name;
|
||||
}
|
||||
if ($sortfield == 'amount_ht' && $sortorder == 'asc') {
|
||||
asort($amount_ht);
|
||||
$arrayforsort=$amount_ht;
|
||||
}
|
||||
if ($sortfield == 'amount_ht' && $sortorder == 'desc') {
|
||||
arsort($amount_ht);
|
||||
$arrayforsort=$amount_ht;
|
||||
}
|
||||
if ($sortfield == 'amount_ttc' && $sortorder == 'asc') {
|
||||
asort($amount);
|
||||
$arrayforsort=$amount;
|
||||
}
|
||||
if ($sortfield == 'amount_ttc' && $sortorder == 'desc') {
|
||||
arsort($amount);
|
||||
$arrayforsort=$amount;
|
||||
}
|
||||
foreach($arrayforsort as $key=>$value) {
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Third party
|
||||
$fullname=$name[$key];
|
||||
if ($key >= 0) {
|
||||
$linkname='<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$key.'">'.img_object($langs->trans("ShowProduct"),'product').' '.$fullname.'</a>';
|
||||
} else {
|
||||
$linkname=$langs->trans("PaymentsNotLinkedToProduct");
|
||||
}
|
||||
|
||||
print "<td>".$linkname."</td>\n";
|
||||
|
||||
// Amount w/o VAT
|
||||
print '<td align="right">';
|
||||
if ($key > 0) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?productid='.$key.'">';
|
||||
} else {
|
||||
print '<a href="#">';
|
||||
}
|
||||
print price($amount_ht[$key]);
|
||||
print '</td>';
|
||||
|
||||
// Amount with VAT
|
||||
print '<td align="right">';
|
||||
if ($key > 0) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?productid='.$key.'">';
|
||||
} else {
|
||||
print '<a href="#">';
|
||||
}
|
||||
print price($amount[$key]);
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
|
||||
// Percent;
|
||||
print '<td align="right">'.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : ' ').'</td>';
|
||||
|
||||
// TODO: statistics?
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Total
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($catotal_ht).'</td>';
|
||||
print '<td align="right">'.price($catotal).'</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
print "</table>";
|
||||
print '</form>';
|
||||
} else {
|
||||
// $modecompta != 'CREANCES-DETTES'
|
||||
// TODO: better message
|
||||
print '<div class="warning">' . $langs->trans("WarningNotRelevant") . '</div>';
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Antoine Iauch <aiauch@gpcsolutions.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
|
||||
@ -46,6 +47,12 @@ if (! $sortfield) $sortfield="name";
|
||||
// Date range
|
||||
$year=GETPOST("year");
|
||||
$month=GETPOST("month");
|
||||
$date_startyear = GETPOST("date_startyear");
|
||||
$date_startmonth = GETPOST("date_startmonth");
|
||||
$date_startday = GETPOST("date_startday");
|
||||
$date_endyear = GETPOST("date_endyear");
|
||||
$date_endmonth = GETPOST("date_endmonth");
|
||||
$date_endday = GETPOST("date_endday");
|
||||
if (empty($year))
|
||||
{
|
||||
$year_current = strftime("%Y",dol_now());
|
||||
@ -89,9 +96,34 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
else
|
||||
{
|
||||
// TODO We define q
|
||||
|
||||
}
|
||||
|
||||
$commonparams=array();
|
||||
$commonparams['modecompta']=$modecompta;
|
||||
$commonparams['sortorder'] = $sortorder;
|
||||
$commonparams['sortfield'] = $sortfield;
|
||||
|
||||
$headerparams = array();
|
||||
$headerparams['date_startyear'] = $date_startyear;
|
||||
$headerparams['date_startmonth'] = $date_startmonth;
|
||||
$headerparams['date_startday'] = $date_startday;
|
||||
$headerparams['date_endyear'] = $date_endyear;
|
||||
$headerparams['date_endmonth'] = $date_endmonth;
|
||||
$headerparams['date_endday'] = $date_endday;
|
||||
$headerparams['q'] = $q;
|
||||
|
||||
$tableparams = array();
|
||||
$tableparams['search_categ'] = $selected_cat;
|
||||
$tableparams['subcat'] = ($subcat === true)?'yes':'';
|
||||
|
||||
// Adding common parameters
|
||||
$allparams = array_merge($commonparams, $headerparams, $tableparams);
|
||||
$headerparams = array_merge($commonparams, $headerparams);
|
||||
$tableparams = array_merge($commonparams, $tableparams);
|
||||
|
||||
foreach($allparams as $key => $value) {
|
||||
$paramslink .= '&' . $key . '=' . $value;
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -102,9 +134,8 @@ llxHeader();
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
// Affiche en-tete du rapport
|
||||
if ($modecompta=="CREANCES-DETTES")
|
||||
{
|
||||
// Show report header
|
||||
if ($modecompta=="CREANCES-DETTES") {
|
||||
$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice");
|
||||
$nom.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
$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);
|
||||
@ -114,8 +145,7 @@ if ($modecompta=="CREANCES-DETTES")
|
||||
else $description.= $langs->trans("DepositsAreIncluded");
|
||||
$builddate=time();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice");
|
||||
$nom.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
$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);
|
||||
@ -131,20 +161,29 @@ if (! empty($modecompta)) $moreparam['modecompta']=$modecompta;
|
||||
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam);
|
||||
|
||||
|
||||
// Charge tableau
|
||||
$catotal=0;
|
||||
if ($modecompta == 'CREANCES-DETTES')
|
||||
// Show array
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
// Extra parameters management
|
||||
foreach($headerparams as $key => $value)
|
||||
{
|
||||
print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
|
||||
}
|
||||
|
||||
$catotal=0;
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql = "SELECT u.rowid as rowid, u.lastname as name, u.firstname as firstname, sum(f.total) as amount, sum(f.total_ttc) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON f.fk_user_author = u.rowid";
|
||||
$sql.= " WHERE f.fk_statut in (1,2)";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
|
||||
else $sql.= " AND f.type IN (0,1,2,3)";
|
||||
if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql.= " AND f.type IN (0,1,2)";
|
||||
} else {
|
||||
$sql.= " AND f.type IN (0,1,2,3)";
|
||||
}
|
||||
if ($date_start && $date_end) {
|
||||
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
|
||||
* vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
|
||||
@ -155,7 +194,9 @@ else
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON pf.fk_facture = f.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement as p ON p.rowid = pf.fk_paiement";
|
||||
$sql.= " WHERE 1=1";
|
||||
if ($date_start && $date_end) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||
if ($date_start && $date_end) {
|
||||
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
}
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||
@ -163,27 +204,25 @@ $sql .= " GROUP BY u.rowid, u.lastname, u.firstname";
|
||||
$sql .= " ORDER BY u.rowid";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$amount[$obj->rowid] = $obj->amount_ttc;
|
||||
$name[$obj->rowid] = $obj->lastname.' '.$obj->firstname;
|
||||
$catotal+=$obj->amount_ttc;
|
||||
$i++;
|
||||
$amount_ht[$obj->rowid] = $obj->amount;
|
||||
$amount[$obj->rowid] = $obj->amount_ttc;
|
||||
$name[$obj->rowid] = $obj->name.' '.$obj->firstname;
|
||||
$catotal_ht+=$obj->amount;
|
||||
$catotal+=$obj->amount_ttc;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// On ajoute les paiements ancienne version, non lies par paiement_facture donc sans user
|
||||
if ($modecompta != 'CREANCES-DETTES')
|
||||
{
|
||||
$sql = "SELECT -1 as rowidx, '' as lastname, '' as firstname, sum(p.amount) as amount_ttc";
|
||||
// Adding old-version payments, non-bound by "paiement_facture" then without User
|
||||
if ($modecompta != 'CREANCES-DETTES') {
|
||||
$sql = "SELECT -1 as rowidx, '' as name, '' as firstname, sum(DISTINCT p.amount) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."paiement as p";
|
||||
@ -192,42 +231,86 @@ if ($modecompta != 'CREANCES-DETTES')
|
||||
$sql.= " AND p.fk_bank = b.rowid";
|
||||
$sql.= " AND b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity = ".$conf->entity;
|
||||
if ($date_start && $date_end) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||
if ($date_start && $date_end) {
|
||||
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
$sql.= " GROUP BY rowidx, name, firstname";
|
||||
$sql.= " ORDER BY rowidx";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$amount[$obj->rowidx] = $obj->amount_ttc;
|
||||
$name[$obj->rowidx] = $obj->lastname.' '.$obj->firstname;
|
||||
$name[$obj->rowidx] = $obj->name.' '.$obj->firstname;
|
||||
$catotal+=$obj->amount_ttc;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"name","",'&year='.($year).'&modecompta='.$modecompta,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"amount_ttc","",'&year='.($year).'&modecompta='.$modecompta,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Percentage"),$_SERVER["PHP_SELF"],"amount_ttc","",'&year='.($year).'&modecompta='.$modecompta,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("OtherStatistics"),$_SERVER["PHP_SELF"],"","","",'align="center" width="20%"');
|
||||
print_liste_field_titre(
|
||||
$langs->trans("User"),
|
||||
$_SERVER["PHP_SELF"],
|
||||
"name",
|
||||
"",
|
||||
$paramslink,
|
||||
"",
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print_liste_field_titre(
|
||||
$langs->trans('AmountHT'),
|
||||
$_SERVER["PHP_SELF"],
|
||||
"amount_ht",
|
||||
"",
|
||||
$paramslink,
|
||||
'align="right"',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
} else {
|
||||
print '<td colspan="1"></td>';
|
||||
}
|
||||
print_liste_field_titre(
|
||||
$langs->trans("AmountTTC"),
|
||||
$_SERVER["PHP_SELF"],
|
||||
"amount_ttc",
|
||||
"",
|
||||
$paramslink,
|
||||
'align="right"',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Percentage"),
|
||||
$_SERVER["PHP_SELF"],"amount_ttc",
|
||||
"",
|
||||
$paramslink,
|
||||
'align="right"',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print_liste_field_titre(
|
||||
$langs->trans("OtherStatistics"),
|
||||
$_SERVER["PHP_SELF"],
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
'align="center" width="20%"'
|
||||
);
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
if (count($amount))
|
||||
{
|
||||
if (count($amount)) {
|
||||
$arrayforsort=$name;
|
||||
|
||||
// We define arrayforsort
|
||||
@ -239,6 +322,14 @@ if (count($amount))
|
||||
arsort($name);
|
||||
$arrayforsort=$name;
|
||||
}
|
||||
if ($sortfield == 'amount_ht' && $sortorder == 'asc') {
|
||||
asort($amount_ht);
|
||||
$arrayforsort=$amount_ht;
|
||||
}
|
||||
if ($sortfield == 'amount_ht' && $sortorder == 'desc') {
|
||||
arsort($amount_ht);
|
||||
$arrayforsort=$amount_ht;
|
||||
}
|
||||
if ($sortfield == 'amount_ttc' && $sortorder == 'asc') {
|
||||
asort($amount);
|
||||
$arrayforsort=$amount;
|
||||
@ -248,8 +339,7 @@ if (count($amount))
|
||||
$arrayforsort=$amount;
|
||||
}
|
||||
|
||||
foreach($arrayforsort as $key => $value)
|
||||
{
|
||||
foreach($arrayforsort as $key => $value) {
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
@ -257,23 +347,44 @@ if (count($amount))
|
||||
$fullname=$name[$key];
|
||||
if ($key >= 0) {
|
||||
$linkname='<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$key.'">'.img_object($langs->trans("ShowUser"),'user').' '.$fullname.'</a>';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$linkname=$langs->trans("PaymentsNotLinkedToUser");
|
||||
}
|
||||
print "<td>".$linkname."</td>\n";
|
||||
|
||||
// Amount
|
||||
// Amount w/o VAT
|
||||
print '<td align="right">';
|
||||
if ($modecompta != 'CREANCES-DETTES')
|
||||
{
|
||||
if ($key > 0) print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?userid='.$key.'">';
|
||||
else print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?userid=-1">';
|
||||
if ($key > 0) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?userid='.$key.'">';
|
||||
} else {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?userid=-1">';
|
||||
}
|
||||
} else {
|
||||
if ($key > 0) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?userid='.$key.'">';
|
||||
} else {
|
||||
print '<a href="#">';
|
||||
}
|
||||
print price($amount_ht[$key]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($key > 0) print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?userid='.$key.'">';
|
||||
else print '<a href="#">';
|
||||
print '</td>';
|
||||
|
||||
// Amount with VAT
|
||||
print '<td align="right">';
|
||||
if ($modecompta != 'CREANCES-DETTES') {
|
||||
if ($key > 0) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?userid='.$key.'">';
|
||||
} else {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?userid=-1">';
|
||||
}
|
||||
} else {
|
||||
if ($key > 0) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?userid='.$key.'">';
|
||||
} else {
|
||||
print '<a href="#">';
|
||||
}
|
||||
}
|
||||
print price($amount[$key]);
|
||||
print '</td>';
|
||||
@ -283,17 +394,30 @@ if (count($amount))
|
||||
|
||||
// Other stats
|
||||
print '<td align="center">';
|
||||
if (! empty($conf->propal->enabled) && $key>0) print ' <a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("ProposalStats"),"stats").'</a> ';
|
||||
if (! empty($conf->commande->enabled) && $key>0) print ' <a href="'.DOL_URL_ROOT.'/commande/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("OrderStats"),"stats").'</a> ';
|
||||
if (! empty($conf->facture->enabled) && $key>0) print ' <a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("InvoiceStats"),"stats").'</a> ';
|
||||
if (! empty($conf->propal->enabled) && $key>0) {
|
||||
print ' <a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("ProposalStats"),"stats").'</a> ';
|
||||
}
|
||||
if (! empty($conf->commande->enabled) && $key>0) {
|
||||
print ' <a href="'.DOL_URL_ROOT.'/commande/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("OrderStats"),"stats").'</a> ';
|
||||
}
|
||||
if (! empty($conf->facture->enabled) && $key>0) {
|
||||
print ' <a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("InvoiceStats"),"stats").'</a> ';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Total
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'.price($catotal).'</td><td> </td>';
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>'.$langs->trans("Total").'</td>';
|
||||
if ($modecompta != 'CREANCES-DETTES') {
|
||||
print '<td colspan="1"></td>';
|
||||
} else {
|
||||
print '<td align="right">'.price($catotal_ht).'</td>';
|
||||
}
|
||||
print '<td align="right">'.price($catotal).'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
* Copyright (C) 2013 Antoine Iauch <aiauch@gpcsolutions.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
|
||||
@ -27,8 +28,10 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("categories");
|
||||
|
||||
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
|
||||
$modecompta = $conf->global->COMPTA_MODE;
|
||||
@ -41,6 +44,13 @@ if (! $sortfield) $sortfield="nom";
|
||||
|
||||
$socid = GETPOST('socid','int');
|
||||
|
||||
// Category
|
||||
$selected_cat = (int)GETPOST('search_categ', 'int');
|
||||
$subcat = false;
|
||||
if (GETPOST('subcat', 'alpha') === 'yes') {
|
||||
$subcat = true;
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||
if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat');
|
||||
@ -49,6 +59,12 @@ if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accountin
|
||||
// Date range
|
||||
$year=GETPOST("year");
|
||||
$month=GETPOST("month");
|
||||
$date_startyear = GETPOST("date_startyear");
|
||||
$date_startmonth = GETPOST("date_startmonth");
|
||||
$date_startday = GETPOST("date_startday");
|
||||
$date_endyear = GETPOST("date_endyear");
|
||||
$date_endmonth = GETPOST("date_endmonth");
|
||||
$date_endday = GETPOST("date_endday");
|
||||
if (empty($year))
|
||||
{
|
||||
$year_current = strftime("%Y",dol_now());
|
||||
@ -92,10 +108,34 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
else
|
||||
{
|
||||
// TODO We define q
|
||||
|
||||
}
|
||||
|
||||
$commonparams=array();
|
||||
$commonparams['modecompta']=$modecompta;
|
||||
$commonparams['sortorder'] = $sortorder;
|
||||
$commonparams['sortfield'] = $sortfield;
|
||||
|
||||
$headerparams = array();
|
||||
$headerparams['date_startyear'] = $date_startyear;
|
||||
$headerparams['date_startmonth'] = $date_startmonth;
|
||||
$headerparams['date_startday'] = $date_startday;
|
||||
$headerparams['date_endyear'] = $date_endyear;
|
||||
$headerparams['date_endmonth'] = $date_endmonth;
|
||||
$headerparams['date_endday'] = $date_endday;
|
||||
$headerparams['q'] = $q;
|
||||
|
||||
$tableparams = array();
|
||||
$tableparams['search_categ'] = $selected_cat;
|
||||
$tableparams['subcat'] = ($subcat === true)?'yes':'';
|
||||
|
||||
// Adding common parameters
|
||||
$allparams = array_merge($commonparams, $headerparams, $tableparams);
|
||||
$headerparams = array_merge($commonparams, $headerparams);
|
||||
$tableparams = array_merge($commonparams, $tableparams);
|
||||
|
||||
foreach($allparams as $key => $value) {
|
||||
$paramslink .= '&' . $key . '=' . $value;
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -105,8 +145,9 @@ llxHeader();
|
||||
|
||||
$form=new Form($db);
|
||||
$thirdparty_static=new Societe($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
// Affiche en-tete de rapport
|
||||
// Show report header
|
||||
if ($modecompta=="CREANCES-DETTES")
|
||||
{
|
||||
$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties");
|
||||
@ -118,8 +159,7 @@ if ($modecompta=="CREANCES-DETTES")
|
||||
else $description.= $langs->trans("DepositsAreIncluded");
|
||||
$builddate=time();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties");
|
||||
$nom.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
$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);
|
||||
@ -129,26 +169,44 @@ else {
|
||||
$builddate=time();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
}
|
||||
$moreparam=array();
|
||||
if (! empty($modecompta)) $moreparam['modecompta']=$modecompta;
|
||||
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam);
|
||||
|
||||
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams);
|
||||
|
||||
|
||||
// Charge tableau
|
||||
// Show Array
|
||||
$catotal=0;
|
||||
if ($modecompta == 'CREANCES-DETTES')
|
||||
{
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name, sum(f.total) as amount, sum(f.total_ttc) as amount_ttc";
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql = "SELECT DISTINCT s.rowid as socid, s.nom as name,";
|
||||
$sql.= " sum(DISTINCT f.total) as amount, sum(DISTINCT f.total_ttc) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."facture as f";
|
||||
if ($selected_cat === -2) {
|
||||
$sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_societe";
|
||||
}
|
||||
if ($selected_cat && $selected_cat !== -2) {
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON c.rowid = ".$selected_cat;
|
||||
if (subcat) {
|
||||
$sql.=" OR c.fk_parent = " . $selected_cat;
|
||||
}
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON cs.fk_categorie = c.rowid";
|
||||
}
|
||||
$sql.= " WHERE f.fk_statut in (1,2)";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
|
||||
else $sql.= " AND f.type IN (0,1,2,3)";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql.= " AND f.type IN (0,1,2)";
|
||||
} else {
|
||||
$sql.= " AND f.type IN (0,1,2,3)";
|
||||
}
|
||||
$sql.= " AND f.fk_soc = s.rowid";
|
||||
if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($date_start && $date_end) {
|
||||
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
if ($selected_cat === -2) {
|
||||
$sql.=" AND cs.fk_societe is null";
|
||||
}
|
||||
if ($selected_cat && $selected_cat !== -2) {
|
||||
$sql.= " AND cs.fk_societe = s.rowid";
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
|
||||
* vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
|
||||
@ -161,7 +219,9 @@ else
|
||||
$sql .= " WHERE p.rowid = pf.fk_paiement";
|
||||
$sql.= " AND pf.fk_facture = f.rowid";
|
||||
$sql.= " AND f.fk_soc = s.rowid";
|
||||
if ($date_start && $date_end) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||
if ($date_start && $date_end) {
|
||||
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
}
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||
@ -169,27 +229,26 @@ $sql.= " GROUP BY s.rowid, s.nom";
|
||||
$sql.= " ORDER BY s.rowid";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$amount[$obj->socid] += $obj->amount_ttc;
|
||||
$name[$obj->socid] = $obj->name;
|
||||
$catotal+=$obj->amount_ttc;
|
||||
$i++;
|
||||
$amount_ht[$obj->socid] = $obj->amount;
|
||||
$amount[$obj->socid] = $obj->amount_ttc;
|
||||
$name[$obj->socid] = $obj->name.' '.$obj->firstname;
|
||||
$catotal_ht+=$obj->amount;
|
||||
$catotal+=$obj->amount_ttc;
|
||||
$i++;
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// On ajoute les paiements anciennes version, non lies par paiement_facture
|
||||
if ($modecompta != 'CREANCES-DETTES')
|
||||
{
|
||||
$sql = "SELECT '0' as socid, 'Autres' as name, sum(p.amount) as amount_ttc";
|
||||
if ($modecompta != 'CREANCES-DETTES') {
|
||||
$sql = "SELECT '0' as socid, 'Autres' as name, sum(DISTINCT p.amount) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."paiement as p";
|
||||
@ -203,20 +262,17 @@ if ($modecompta != 'CREANCES-DETTES')
|
||||
$sql.= " ORDER BY name";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$amount[$obj->rowid] += $obj->amount_ttc;
|
||||
$name[$obj->rowid] = $obj->name;
|
||||
$catotal+=$obj->amount_ttc;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
@ -224,20 +280,87 @@ if ($modecompta != 'CREANCES-DETTES')
|
||||
|
||||
// Show array
|
||||
$i = 0;
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
// Extra parameters management
|
||||
foreach($headerparams as $key => $value)
|
||||
{
|
||||
print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
|
||||
}
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"nom","",'&year='.($year).'&modecompta='.$modecompta,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"amount_ttc","",'&year='.($year).'&modecompta='.$modecompta,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Percentage"),$_SERVER["PHP_SELF"],"amount_ttc","",'&year='.($year).'&modecompta='.$modecompta,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("OtherStatistics"),$_SERVER["PHP_SELF"],"","","",'align="center" width="20%"');
|
||||
// Category filter
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>';
|
||||
print $langs->trans("Category") . ': ' . $formother->select_categories(2, $selected_cat, 'search_categ', true);
|
||||
print ' ';
|
||||
print $langs->trans("SubCats") . '? ';
|
||||
print '<input type="checkbox" name="subcat" value="yes"';
|
||||
if ($subcat) {
|
||||
print ' checked="checked"';
|
||||
}
|
||||
print'></td>';
|
||||
print '<td colspan="4" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
// Array titles
|
||||
print "<tr class='liste_titre'>";
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Company"),
|
||||
$_SERVER["PHP_SELF"],
|
||||
"nom",
|
||||
"",
|
||||
$paramslink,
|
||||
"",
|
||||
$sortfield,$sortorder
|
||||
);
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print_liste_field_titre(
|
||||
$langs->trans('AmountHT'),
|
||||
$_SERVER["PHP_SELF"],
|
||||
"amount_ht",
|
||||
"",
|
||||
$paramslink,
|
||||
'align="right"',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
} else {
|
||||
print '<td colspan="1"></td>';
|
||||
}
|
||||
print_liste_field_titre(
|
||||
$langs->trans("AmountTTC"),
|
||||
$_SERVER["PHP_SELF"],
|
||||
"amount_ttc",
|
||||
"",
|
||||
$paramslink,
|
||||
'align="right"',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Percentage"),
|
||||
$_SERVER["PHP_SELF"],
|
||||
"amount_ttc",
|
||||
"",
|
||||
$paramslink,
|
||||
'align="right"',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print_liste_field_titre(
|
||||
$langs->trans("OtherStatistics"),
|
||||
$_SERVER["PHP_SELF"],
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
'align="center" width="20%"'
|
||||
);
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
if (count($amount))
|
||||
{
|
||||
if (count($amount)) {
|
||||
$arrayforsort=$name;
|
||||
|
||||
// On definit tableau arrayforsort
|
||||
// Defining array arrayforsort
|
||||
if ($sortfield == 'nom' && $sortorder == 'asc') {
|
||||
asort($name);
|
||||
$arrayforsort=$name;
|
||||
@ -246,6 +369,14 @@ if (count($amount))
|
||||
arsort($name);
|
||||
$arrayforsort=$name;
|
||||
}
|
||||
if ($sortfield == 'amount_ht' && $sortorder == 'asc') {
|
||||
asort($amount_ht);
|
||||
$arrayforsort=$amount_ht;
|
||||
}
|
||||
if ($sortfield == 'amount_ht' && $sortorder == 'desc') {
|
||||
arsort($amount_ht);
|
||||
$arrayforsort=$amount_ht;
|
||||
}
|
||||
if ($sortfield == 'amount_ttc' && $sortorder == 'asc') {
|
||||
asort($amount);
|
||||
$arrayforsort=$amount;
|
||||
@ -255,8 +386,7 @@ if (count($amount))
|
||||
$arrayforsort=$amount;
|
||||
}
|
||||
|
||||
foreach($arrayforsort as $key=>$value)
|
||||
{
|
||||
foreach($arrayforsort as $key=>$value) {
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
@ -267,23 +397,43 @@ if (count($amount))
|
||||
$thirdparty_static->name=$fullname;
|
||||
$thirdparty_static->client=1;
|
||||
$linkname=$thirdparty_static->getNomUrl(1,'customer');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$linkname=$langs->trans("PaymentsNotLinkedToInvoice");
|
||||
}
|
||||
print "<td>".$linkname."</td>\n";
|
||||
|
||||
// Amount
|
||||
// Amount w/o VAT
|
||||
print '<td align="right">';
|
||||
if ($modecompta != 'CREANCES-DETTES')
|
||||
{
|
||||
if ($key > 0) print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?socid='.$key.'">';
|
||||
else print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?orphelins=1">';
|
||||
if ($modecompta != 'CREANCES-DETTES') {
|
||||
if ($key > 0) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?userid='.$key.'">';
|
||||
} else {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?userid=-1">';
|
||||
}
|
||||
} else {
|
||||
if ($key > 0) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?userid='.$key.'">';
|
||||
} else {
|
||||
print '<a href="#">';
|
||||
}
|
||||
print price($amount_ht[$key]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($key > 0) print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$key.'">';
|
||||
else print '<a href="#">';
|
||||
print '</td>';
|
||||
|
||||
// Amount with VAT
|
||||
print '<td align="right">';
|
||||
if ($modecompta != 'CREANCES-DETTES') {
|
||||
if ($key > 0) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?socid='.$key.'">';
|
||||
} else {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?orphelins=1">';
|
||||
}
|
||||
} else {
|
||||
if ($key > 0) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$key.'">';
|
||||
} else {
|
||||
print '<a href="#">';
|
||||
}
|
||||
}
|
||||
print price($amount[$key]);
|
||||
print '</a>';
|
||||
@ -294,17 +444,30 @@ if (count($amount))
|
||||
|
||||
// Other stats
|
||||
print '<td align="center">';
|
||||
if (! empty($conf->propal->enabled) && $key>0) print ' <a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$key.'">'.img_picto($langs->trans("ProposalStats"),"stats").'</a> ';
|
||||
if (! empty($conf->commande->enabled) && $key>0) print ' <a href="'.DOL_URL_ROOT.'/commande/stats/index.php?socid='.$key.'">'.img_picto($langs->trans("OrderStats"),"stats").'</a> ';
|
||||
if (! empty($conf->facture->enabled) && $key>0) print ' <a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?socid='.$key.'">'.img_picto($langs->trans("InvoiceStats"),"stats").'</a> ';
|
||||
if (! empty($conf->propal->enabled) && $key>0) {
|
||||
print ' <a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$key.'">'.img_picto($langs->trans("ProposalStats"),"stats").'</a> ';
|
||||
}
|
||||
if (! empty($conf->commande->enabled) && $key>0) {
|
||||
print ' <a href="'.DOL_URL_ROOT.'/commande/stats/index.php?socid='.$key.'">'.img_picto($langs->trans("OrderStats"),"stats").'</a> ';
|
||||
}
|
||||
if (! empty($conf->facture->enabled) && $key>0) {
|
||||
print ' <a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?socid='.$key.'">'.img_picto($langs->trans("InvoiceStats"),"stats").'</a> ';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Total
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'.price($catotal).'</td><td> </td>';
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>'.$langs->trans("Total").'</td>';
|
||||
if ($modecompta != 'CREANCES-DETTES') {
|
||||
print '<td colspan="1"></td>';
|
||||
} else {
|
||||
print '<td align="right">'.price($catotal_ht).'</td>';
|
||||
}
|
||||
print '<td align="right">'.price($catotal).'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -312,8 +475,7 @@ if (count($amount))
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '<br>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ $object->fetch($id,$ref);
|
||||
|
||||
if ($action == 'setnote_public' && $user->rights->contrat->creer)
|
||||
{
|
||||
$result=$object->update_note(dol_html_entity_decode(dol_htmlcleanlastbr(GETPOST('note_public')), ENT_QUOTES),'_pubic');
|
||||
$result=$object->update_note(dol_html_entity_decode(dol_htmlcleanlastbr(GETPOST('note_public')), ENT_QUOTES),'_public');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010 Pierre Morin <pierre.morin@auguria.net>
|
||||
* Copyright (C) 2013 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
|
||||
@ -139,8 +140,7 @@ if (! dol_is_dir($upload_dir))
|
||||
print '<!-- TYPE='.$type.' -->'."\n";
|
||||
print '<!-- Page called with mode='.(isset($mode)?$mode:'').' type='.$type.' module='.$module.' url='.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
|
||||
|
||||
$param='';
|
||||
$param.=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'');
|
||||
$param=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'');
|
||||
$url=DOL_URL_ROOT.'/ecm/index.php';
|
||||
|
||||
// Dir scan
|
||||
@ -149,126 +149,73 @@ if ($type == 'directory')
|
||||
$formfile=new FormFile($db);
|
||||
|
||||
$maxlengthname=40;
|
||||
$excludefiles = array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$');
|
||||
$sorting = (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC);
|
||||
|
||||
// Right area. If module is defined, we are in automatic ecm.
|
||||
if ($module == 'company') // Auto area for suppliers invoices
|
||||
{
|
||||
$upload_dir = $conf->societe->dir_output; // TODO change for multicompany sharing
|
||||
$filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
$automodules = array('company', 'invoice', 'invoice_supplier', 'propal', 'order', 'order_supplier', 'contract', 'product', 'tax', 'project');
|
||||
|
||||
$param.='&module='.$module;
|
||||
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
|
||||
|
||||
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
|
||||
}
|
||||
else if ($module == 'invoice') // Auto area for suppliers invoices
|
||||
{
|
||||
$upload_dir = $conf->facture->dir_output;
|
||||
$filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
|
||||
$param.='&module='.$module;
|
||||
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
|
||||
|
||||
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
|
||||
}
|
||||
else if ($module == 'invoice_supplier') // Auto area for suppliers invoices
|
||||
// TODO change for multicompany sharing
|
||||
// Auto area for suppliers invoices
|
||||
if ($module == 'company') $upload_dir = $conf->societe->dir_output;
|
||||
// Auto area for suppliers invoices
|
||||
else if ($module == 'invoice') $upload_dir = $conf->facture->dir_output;
|
||||
// Auto area for suppliers invoices
|
||||
else if ($module == 'invoice_supplier')
|
||||
{
|
||||
$relativepath='facture';
|
||||
$upload_dir = $conf->fournisseur->dir_output.'/'.$relativepath;
|
||||
$filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
$param.='&module='.$module;
|
||||
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
|
||||
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
|
||||
}
|
||||
else if ($module == 'propal') // Auto area for customers orders
|
||||
{
|
||||
$upload_dir = $conf->propal->dir_output;
|
||||
$filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
|
||||
$param.='&module='.$module;
|
||||
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
|
||||
|
||||
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
|
||||
}
|
||||
else if ($module == 'order') // Auto area for customers orders
|
||||
{
|
||||
$upload_dir = $conf->commande->dir_output;
|
||||
$filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
|
||||
$param.='&module='.$module;
|
||||
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
|
||||
|
||||
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
|
||||
}
|
||||
else if ($module == 'order_supplier') // Auto area for suppliers orders
|
||||
// Auto area for customers orders
|
||||
else if ($module == 'propal') $upload_dir = $conf->propal->dir_output;
|
||||
// Auto area for customers orders
|
||||
else if ($module == 'order') $upload_dir = $conf->commande->dir_output;
|
||||
// Auto area for suppliers orders
|
||||
else if ($module == 'order_supplier')
|
||||
{
|
||||
$relativepath='commande';
|
||||
$upload_dir = $conf->fournisseur->dir_output.'/'.$relativepath;
|
||||
$filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
}
|
||||
// Auto area for suppliers invoices
|
||||
else if ($module == 'contract') $upload_dir = $conf->contrat->dir_output;
|
||||
// Auto area for products
|
||||
else if ($module == 'product') $upload_dir = $conf->product->dir_output;
|
||||
// Auto area for suppliers invoices
|
||||
else if ($module == 'tax') $upload_dir = $conf->tax->dir_output;
|
||||
// Auto area for projects
|
||||
else if ($module == 'project') $upload_dir = $conf->projet->dir_output;
|
||||
|
||||
if (in_array($module, $automodules))
|
||||
{
|
||||
$param.='&module='.$module;
|
||||
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
|
||||
|
||||
$filearray=dol_dir_list($upload_dir,"files",1,'', $excludefiles, $sortfield, $sorting,1);
|
||||
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
|
||||
}
|
||||
else if ($module == 'contract') // Auto area for suppliers invoices
|
||||
{
|
||||
$upload_dir = $conf->contrat->dir_output;
|
||||
$filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
|
||||
$param.='&module='.$module;
|
||||
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
|
||||
|
||||
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
|
||||
}
|
||||
else if ($module == 'product') // Auto area for products
|
||||
{
|
||||
$upload_dir = $conf->product->dir_output;
|
||||
$filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
|
||||
$param.='&module='.$module;
|
||||
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
|
||||
|
||||
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
|
||||
}
|
||||
else if ($module == 'tax') // Auto area for suppliers invoices
|
||||
{
|
||||
$upload_dir = $conf->tax->dir_output;
|
||||
$filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
|
||||
$param.='&module='.$module;
|
||||
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
|
||||
|
||||
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
|
||||
}
|
||||
else if ($module == 'project') // Auto area for projects
|
||||
{
|
||||
$upload_dir = $conf->projet->dir_output;
|
||||
$filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
|
||||
$param.='&module='.$module;
|
||||
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
|
||||
|
||||
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
|
||||
}
|
||||
else // Manual area
|
||||
//Manual area
|
||||
else
|
||||
{
|
||||
$relativepath=$ecmdir->getRelativePath();
|
||||
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
|
||||
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'',array('^\.','\.meta$','^temp$','^CVS$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
|
||||
if ($section) $param.='§ion='.$section;
|
||||
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection")));
|
||||
// If $section defined with value 0
|
||||
if ($section === '0')
|
||||
{
|
||||
$filearray=array();
|
||||
$textifempty='<br><div align="center"><font class="warning">'.$langs->trans("DirNotSynchronizedSyncFirst").'</font></div><br>';
|
||||
$filearray=array();
|
||||
$textifempty='<br><div align="center"><font class="warning">'.$langs->trans("DirNotSynchronizedSyncFirst").'</font></div><br>';
|
||||
}
|
||||
else $filearray=dol_dir_list($upload_dir,"files",0,'',array('^\.','\.meta$','^temp$','^CVS$'),$sortfield, $sorting,1);
|
||||
|
||||
if ($section)
|
||||
{
|
||||
$param.='§ion='.$section;
|
||||
$textifempty = $langs->trans('NoFileFound');
|
||||
}
|
||||
else $textifempty=($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection"));
|
||||
|
||||
$formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath,$user->rights->ecm->upload,1,$textifempty,$maxlengthname,'',$url);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))
|
||||
|
||||
@ -117,7 +117,7 @@ if (file_exists($fullpathselecteddir))
|
||||
// Loop on all database entries (sqltree) to find the one matching the subdir found into dir to scan
|
||||
foreach($sqltree as $key => $tmpval)
|
||||
{
|
||||
//print "-- key=".$key." - ".$val['fullrelativename']." vs ".(($selecteddir != '/'?$selecteddir.'/':'').$file).'<br>';
|
||||
//print "-- key=".$key." - ".$tmpval['fullrelativename']." vs ".(($selecteddir != '/'?$selecteddir.'/':'').$file)."<br>\n";
|
||||
if ($tmpval['fullrelativename'] == (($selecteddir != '/'?$selecteddir.'/':'').$file)) // We found equivalent record into database
|
||||
{
|
||||
$val=$tmpval;
|
||||
|
||||
@ -64,20 +64,23 @@ class box_produits_alerte_stock extends ModeleBoxes
|
||||
|
||||
if ($user->rights->produit->lire || $user->rights->service->lire)
|
||||
{
|
||||
$sql = "SELECT p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte, s.reel";
|
||||
$sql = "SELECT p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte,";
|
||||
$sql.= " SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") as total_stock";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as s on p.rowid = s.fk_product";
|
||||
$sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')';
|
||||
$sql.= " AND p.tosell = 1";
|
||||
$sql.= " AND p.tosell = 1 AND p.seuil_stock_alerte > 0";
|
||||
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
|
||||
if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1';
|
||||
$sql.= " HAVING s.reel < p.seuil_stock_alerte";
|
||||
$sql.= $db->order('s.reel', 'DESC');
|
||||
$sql.= " GROUP BY p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte";
|
||||
$sql.= " HAVING SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") < p.seuil_stock_alerte";
|
||||
$sql.= $db->order('p.seuil_stock_alerte', 'DESC');
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$langs->load("stocks");
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
@ -128,7 +131,8 @@ class box_produits_alerte_stock extends ModeleBoxes
|
||||
'text' => $price_base_type);
|
||||
|
||||
$this->info_box_contents[$i][4] = array('td' => 'align="center"',
|
||||
'text' => $objp->reel . ' / '.$objp->seuil_stock_alerte);
|
||||
'text' => $objp->total_stock . ' / '.$objp->seuil_stock_alerte,
|
||||
'text2'=>img_warning($langs->transnoentitiesnoconv("StockLowerThanLimit")));
|
||||
|
||||
$this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"',
|
||||
'text' => $productstatic->LibStatut($objp->tosell,3,0));
|
||||
@ -138,7 +142,7 @@ class box_produits_alerte_stock extends ModeleBoxes
|
||||
|
||||
$i++;
|
||||
}
|
||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedProducts"));
|
||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoTooLowStockProducts"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -165,7 +165,8 @@ class ModeleBoxes // Can't be abtract as it is instanciated to build "empty"
|
||||
print '</td><td class="nocellnopadd boxclose" nowrap="nowrap">';
|
||||
// The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object
|
||||
print img_picto($langs->trans("MoveBox",$this->box_id),'grip','class="boxhandle hideonsmartphone" style="cursor:move;"');
|
||||
print img_picto($langs->trans("Close",$this->box_id),'close','class="boxclose" style="cursor:pointer;" id="imgclose'.$this->box_id.'"');
|
||||
print img_picto($langs->trans("Close",$this->box_id),'close','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"');
|
||||
print '<input type="hidden" id="boxlabelentry'.$this->box_id.'" value="'.dol_escape_htmltag($head['text']).'">';
|
||||
print '</td></tr></table>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -2310,7 +2310,7 @@ abstract class CommonObject
|
||||
/**
|
||||
* Function to say how many lines object contains
|
||||
*
|
||||
* @param int $predefined -1=All, 0=Count free product/service only, 1=Count predefined product/service only
|
||||
* @param int $predefined -1=All, 0=Count free product/service only, 1=Count predefined product/service only, 2=Count predefined product, 3=Count predefined service
|
||||
* @return int <0 if KO, 0 if no predefined products, nb of lines with predefined products if found
|
||||
*/
|
||||
function hasProductsOrServices($predefined=-1)
|
||||
@ -2323,6 +2323,8 @@ abstract class CommonObject
|
||||
if ($predefined == -1) $qualified=1;
|
||||
if ($predefined == 1 && $val->fk_product > 0) $qualified=1;
|
||||
if ($predefined == 0 && $val->fk_product <= 0) $qualified=1;
|
||||
if ($predefined == 2 && $val->fk_product > 0 && $val->product_type==0) $qualified=1;
|
||||
if ($predefined == 3 && $val->fk_product > 0 && $val->product_type==1) $qualified=1;
|
||||
if ($qualified) $nb++;
|
||||
}
|
||||
dol_syslog(get_class($this).'::hasProductsOrServices we found '.$nb.' qualified lines of products/servcies');
|
||||
@ -2946,11 +2948,11 @@ abstract class CommonObject
|
||||
global $conf,$langs,$bc;
|
||||
|
||||
//var_dump($line);
|
||||
if (!empty($line->date_start))
|
||||
{
|
||||
if (!empty($line->date_start))
|
||||
{
|
||||
$date_start=$line->date_start;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$date_start=$line->date_debut_prevue;
|
||||
if ($line->date_debut_reel) $date_start=$line->date_debut_reel;
|
||||
@ -2959,7 +2961,7 @@ abstract class CommonObject
|
||||
{
|
||||
$date_end=$line->date_end;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$date_end=$line->date_fin_prevue;
|
||||
if ($line->date_fin_reel) $date_end=$line->date_fin_reel;
|
||||
@ -2995,7 +2997,7 @@ abstract class CommonObject
|
||||
$this->tpl['label'].=$line->desc;
|
||||
}else {
|
||||
$this->tpl['label'].= ($line->label ? ' '.$line->label : '');
|
||||
}
|
||||
}
|
||||
// Dates
|
||||
if ($line->product_type == 1 && ($date_start || $date_end))
|
||||
{
|
||||
@ -3048,149 +3050,160 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $force_price
|
||||
* @return multitype:number string NULL
|
||||
*/
|
||||
function getMarginInfos($force_price=false) {
|
||||
global $conf;
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
|
||||
function getMarginInfos($force_price=false) {
|
||||
global $conf;
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$marginInfos = array(
|
||||
'pa_products' => 0,
|
||||
'pv_products' => 0,
|
||||
'margin_on_products' => 0,
|
||||
'margin_rate_products' => '',
|
||||
'mark_rate_products' => '',
|
||||
'pa_services' => 0,
|
||||
'pv_services' => 0,
|
||||
'margin_on_services' => 0,
|
||||
'margin_rate_services' => '',
|
||||
'mark_rate_services' => '',
|
||||
'pa_total' => 0,
|
||||
'pv_total' => 0,
|
||||
'total_margin' => 0,
|
||||
'total_margin_rate' => '',
|
||||
'total_mark_rate' => ''
|
||||
);
|
||||
foreach($this->lines as $line) {
|
||||
if (isset($line->fk_fournprice) && !$force_price) {
|
||||
$product = new ProductFournisseur($this->db);
|
||||
if ($product->fetch_product_fournisseur_price($line->fk_fournprice))
|
||||
$line->pa_ht = $product->fourn_unitprice;
|
||||
if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == "2" && $product->fourn_unitcharges > 0)
|
||||
$line->pa_ht += $product->fourn_unitcharges;
|
||||
}
|
||||
// si prix d'achat non renseigné et devrait l'être, alors prix achat = prix vente
|
||||
if ((!isset($line->pa_ht) || $line->pa_ht == 0) && $line->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) {
|
||||
$line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100));
|
||||
}
|
||||
$marginInfos = array(
|
||||
'pa_products' => 0,
|
||||
'pv_products' => 0,
|
||||
'margin_on_products' => 0,
|
||||
'margin_rate_products' => '',
|
||||
'mark_rate_products' => '',
|
||||
'pa_services' => 0,
|
||||
'pv_services' => 0,
|
||||
'margin_on_services' => 0,
|
||||
'margin_rate_services' => '',
|
||||
'mark_rate_services' => '',
|
||||
'pa_total' => 0,
|
||||
'pv_total' => 0,
|
||||
'total_margin' => 0,
|
||||
'total_margin_rate' => '',
|
||||
'total_mark_rate' => ''
|
||||
);
|
||||
|
||||
// calcul des marges
|
||||
if (isset($line->fk_remise_except) && isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT)) { // remise
|
||||
if ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1') { // remise globale considérée comme produit
|
||||
$marginInfos['pa_products'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
|
||||
$marginInfos['pv_products'] += $line->subprice * (1 - $line->remise_percent / 100);
|
||||
$marginInfos['pa_total'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
|
||||
$marginInfos['pv_total'] += $line->subprice * (1 - $line->remise_percent / 100);
|
||||
foreach($this->lines as $line) {
|
||||
if (empty($line->pa_ht) && isset($line->fk_fournprice) && !$force_price) {
|
||||
$product = new ProductFournisseur($this->db);
|
||||
if ($product->fetch_product_fournisseur_price($line->fk_fournprice))
|
||||
$line->pa_ht = $product->fourn_unitprice;
|
||||
if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == "2" && $product->fourn_unitcharges > 0)
|
||||
$line->pa_ht += $product->fourn_unitcharges;
|
||||
}
|
||||
// si prix d'achat non renseigné et devrait l'être, alors prix achat = prix vente
|
||||
if ((!isset($line->pa_ht) || $line->pa_ht == 0) && $line->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) {
|
||||
$line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100));
|
||||
}
|
||||
|
||||
// calcul des marges
|
||||
if (isset($line->fk_remise_except) && isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT)) { // remise
|
||||
if ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1') { // remise globale considérée comme produit
|
||||
$marginInfos['pa_products'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
|
||||
$marginInfos['pv_products'] += $line->subprice * (1 - $line->remise_percent / 100);
|
||||
$marginInfos['pa_total'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
|
||||
$marginInfos['pv_total'] += $line->subprice * (1 - $line->remise_percent / 100);
|
||||
}
|
||||
elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '2') { // remise globale considérée comme service
|
||||
$marginInfos['pa_services'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
|
||||
$marginInfos['pv_services'] += $line->subprice * (1 - ($line->remise_percent / 100));
|
||||
$marginInfos['pa_total'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
|
||||
$marginInfos['pv_total'] += $line->subprice * (1 - $line->remise_percent / 100);
|
||||
elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '2') { // remise globale considérée comme service
|
||||
$marginInfos['pa_services'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
|
||||
$marginInfos['pv_services'] += $line->subprice * (1 - ($line->remise_percent / 100));
|
||||
$marginInfos['pa_total'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
|
||||
$marginInfos['pv_total'] += $line->subprice * (1 - $line->remise_percent / 100);
|
||||
}
|
||||
elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '3') { // remise globale prise en compte uniqt sur total
|
||||
$marginInfos['pa_total'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
|
||||
$marginInfos['pv_total'] += $line->subprice * (1 - ($line->remise_percent / 100));
|
||||
elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '3') { // remise globale prise en compte uniqt sur total
|
||||
$marginInfos['pa_total'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
|
||||
$marginInfos['pv_total'] += $line->subprice * (1 - ($line->remise_percent / 100));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$type=$line->product_type?$line->product_type:$line->fk_product_type;
|
||||
if ($type == 0) { // product
|
||||
$marginInfos['pa_products'] += $line->qty * $line->pa_ht;
|
||||
$marginInfos['pv_products'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
|
||||
$marginInfos['pa_total'] += $line->qty * $line->pa_ht;
|
||||
$marginInfos['pv_total'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
|
||||
}
|
||||
elseif ($type == 1) { // service
|
||||
$marginInfos['pa_services'] += $line->qty * $line->pa_ht;
|
||||
$marginInfos['pv_services'] += $line->qty * $line->subprice * (1 - ($line->remise_percent / 100));
|
||||
$marginInfos['pa_total'] += $line->qty * $line->pa_ht;
|
||||
$marginInfos['pv_total'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$type=$line->product_type?$line->product_type:$line->fk_product_type;
|
||||
if ($type == 0) { // product
|
||||
$marginInfos['pa_products'] += $line->qty * $line->pa_ht;
|
||||
$marginInfos['pv_products'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
|
||||
$marginInfos['pa_total'] += $line->qty * $line->pa_ht;
|
||||
$marginInfos['pv_total'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
|
||||
}
|
||||
elseif ($type == 1) { // service
|
||||
$marginInfos['pa_services'] += $line->qty * $line->pa_ht;
|
||||
$marginInfos['pv_services'] += $line->qty * $line->subprice * (1 - ($line->remise_percent / 100));
|
||||
$marginInfos['pa_total'] += $line->qty * $line->pa_ht;
|
||||
$marginInfos['pv_total'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$marginInfos['margin_on_products'] = $marginInfos['pv_products'] - $marginInfos['pa_products'];
|
||||
if ($marginInfos['pa_products'] > 0)
|
||||
$marginInfos['margin_rate_products'] = 100 * round($marginInfos['margin_on_products'] / $marginInfos['pa_products'],5);
|
||||
if ($marginInfos['pv_products'] > 0)
|
||||
$marginInfos['mark_rate_products'] = 100 * round($marginInfos['margin_on_products'] / $marginInfos['pv_products'],5);
|
||||
$marginInfos['margin_on_products'] = $marginInfos['pv_products'] - $marginInfos['pa_products'];
|
||||
if ($marginInfos['pa_products'] > 0)
|
||||
$marginInfos['margin_rate_products'] = 100 * round($marginInfos['margin_on_products'] / $marginInfos['pa_products'],5);
|
||||
if ($marginInfos['pv_products'] > 0)
|
||||
$marginInfos['mark_rate_products'] = 100 * round($marginInfos['margin_on_products'] / $marginInfos['pv_products'],5);
|
||||
|
||||
$marginInfos['margin_on_services'] = $marginInfos['pv_services'] - $marginInfos['pa_services'];
|
||||
if ($marginInfos['pa_services'] > 0)
|
||||
$marginInfos['margin_rate_services'] = 100 * round($marginInfos['margin_on_services'] / $marginInfos['pa_services'],5);
|
||||
if ($marginInfos['pv_services'] > 0)
|
||||
$marginInfos['mark_rate_services'] = 100 * round($marginInfos['margin_on_services'] / $marginInfos['pv_services'],5);
|
||||
$marginInfos['margin_on_services'] = $marginInfos['pv_services'] - $marginInfos['pa_services'];
|
||||
if ($marginInfos['pa_services'] > 0)
|
||||
$marginInfos['margin_rate_services'] = 100 * round($marginInfos['margin_on_services'] / $marginInfos['pa_services'],5);
|
||||
if ($marginInfos['pv_services'] > 0)
|
||||
$marginInfos['mark_rate_services'] = 100 * round($marginInfos['margin_on_services'] / $marginInfos['pv_services'],5);
|
||||
|
||||
$marginInfos['total_margin'] = $marginInfos['pv_total'] - $marginInfos['pa_total'];
|
||||
if ($marginInfos['pa_total'] > 0)
|
||||
$marginInfos['total_margin_rate'] = 100 * round($marginInfos['total_margin'] / $marginInfos['pa_total'],5);
|
||||
if ($marginInfos['pv_total'] > 0)
|
||||
$marginInfos['total_mark_rate'] = 100 * round($marginInfos['total_margin'] / $marginInfos['pv_total'],5);
|
||||
|
||||
$marginInfos['total_margin'] = $marginInfos['pv_total'] - $marginInfos['pa_total'];
|
||||
if ($marginInfos['pa_total'] > 0)
|
||||
$marginInfos['total_margin_rate'] = 100 * round($marginInfos['total_margin'] / $marginInfos['pa_total'],5);
|
||||
if ($marginInfos['pv_total'] > 0)
|
||||
$marginInfos['total_mark_rate'] = 100 * round($marginInfos['total_margin'] / $marginInfos['pv_total'],5);
|
||||
return $marginInfos;
|
||||
}
|
||||
|
||||
return $marginInfos;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param string $force_price
|
||||
*/
|
||||
function displayMarginInfos($force_price=false) {
|
||||
global $langs, $conf;
|
||||
|
||||
$marginInfo = $this->getMarginInfos($force_price);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="30%">'.$langs->trans('Margins').'</td>';
|
||||
print '<td width="20%" align="right">'.$langs->trans('SellingPrice').'</td>';
|
||||
if ($conf->global->MARGIN_TYPE == "1")
|
||||
print '<td width="20%" align="right">'.$langs->trans('BuyingPrice').'</td>';
|
||||
else
|
||||
print '<td width="20%" align="right">'.$langs->trans('CostPrice').'</td>';
|
||||
print '<td width="20%" align="right">'.$langs->trans('Margin').'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print '<td align="right">'.$langs->trans('MarginRate').'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print '<td align="right">'.$langs->trans('MarkRate').'</td>';
|
||||
print '</tr>';
|
||||
//if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) {
|
||||
print '<tr class="impair">';
|
||||
print '<td>'.$langs->trans('MarginOnProducts').'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pv_products']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pa_products']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['margin_on_products']).'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print '<td align="right">'.(($marginInfo['margin_rate_products'] == '')?'n/a':price($marginInfo['margin_rate_products']).'%').'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print '<td align="right">'.(($marginInfo['mark_rate_products'] == '')?'n/a':price($marginInfo['mark_rate_products']).'%').'</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="pair">';
|
||||
print '<td>'.$langs->trans('MarginOnServices').'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pv_services']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pa_services']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['margin_on_services']).'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print '<td align="right">'.(($marginInfo['margin_rate_services'] == '')?'n/a':price($marginInfo['margin_rate_services']).'%').'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print '<td align="right">'.(($marginInfo['mark_rate_services'] == '')?'n/a':price($marginInfo['mark_rate_services']).'%').'</td>';
|
||||
print '</tr>';
|
||||
//}
|
||||
print '<tr class="impair">';
|
||||
print '<td>'.$langs->trans('TotalMargin').'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pv_total']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pa_total']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['total_margin']).'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print '<td align="right">'.(($marginInfo['total_margin_rate'] == '')?'n/a':price($marginInfo['total_margin_rate']).'%').'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print '<td align="right">'.(($marginInfo['total_mark_rate'] == '')?'n/a':price($marginInfo['total_mark_rate']).'%').'</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
function displayMarginInfos($force_price=false) {
|
||||
global $langs, $conf;
|
||||
$marginInfo = $this->getMarginInfos($force_price);
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="30%">'.$langs->trans('Margins').'</td>';
|
||||
print '<td width="20%" align="right">'.$langs->trans('SellingPrice').'</td>';
|
||||
if ($conf->global->MARGIN_TYPE == "1")
|
||||
print '<td width="20%" align="right">'.$langs->trans('BuyingPrice').'</td>';
|
||||
else
|
||||
print '<td width="20%" align="right">'.$langs->trans('CostPrice').'</td>';
|
||||
print '<td width="20%" align="right">'.$langs->trans('Margin').'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print '<td align="right">'.$langs->trans('MarginRate').'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print '<td align="right">'.$langs->trans('MarkRate').'</td>';
|
||||
print '</tr>';
|
||||
//if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) {
|
||||
print '<tr class="impair">';
|
||||
print '<td>'.$langs->trans('MarginOnProducts').'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pv_products']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pa_products']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['margin_on_products']).'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print '<td align="right">'.(($marginInfo['margin_rate_products'] == '')?'n/a':price($marginInfo['margin_rate_products']).'%').'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print '<td align="right">'.(($marginInfo['mark_rate_products'] == '')?'n/a':price($marginInfo['mark_rate_products']).'%').'</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="pair">';
|
||||
print '<td>'.$langs->trans('MarginOnServices').'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pv_services']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pa_services']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['margin_on_services']).'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print '<td align="right">'.(($marginInfo['margin_rate_services'] == '')?'n/a':price($marginInfo['margin_rate_services']).'%').'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print '<td align="right">'.(($marginInfo['mark_rate_services'] == '')?'n/a':price($marginInfo['mark_rate_services']).'%').'</td>';
|
||||
print '</tr>';
|
||||
//}
|
||||
print '<tr class="impair">';
|
||||
print '<td>'.$langs->trans('TotalMargin').'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pv_total']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pa_total']).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['total_margin']).'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print '<td align="right">'.(($marginInfo['total_margin_rate'] == '')?'n/a':price($marginInfo['total_margin_rate']).'%').'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print '<td align="right">'.(($marginInfo['total_mark_rate'] == '')?'n/a':price($marginInfo['total_mark_rate']).'%').'</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -144,7 +144,6 @@ class HookManager
|
||||
foreach($modules as $module => $actionclassinstance)
|
||||
{
|
||||
//print 'class='.get_class($actionclassinstance).' method='.$method.' action='.$action;
|
||||
|
||||
// jump to next class if method does not exists
|
||||
if (! method_exists($actionclassinstance,$method)) continue;
|
||||
// test to avoid to run twice a hook, when a module implements several active contexts
|
||||
@ -178,7 +177,7 @@ class HookManager
|
||||
|
||||
$result = $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
|
||||
|
||||
if (is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
|
||||
if (! empty($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
|
||||
if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints;
|
||||
|
||||
// TODO. remove this. array result must be set into $actionclassinstance->results
|
||||
|
||||
@ -344,7 +344,7 @@ class Form
|
||||
* Show a text and picto with tooltip on text or picto
|
||||
*
|
||||
* @param string $text Text to show
|
||||
* @param string $htmltext Content html of tooltip. Must be HTML/UTF8 encoded.
|
||||
* @param string $htmltext HTML content of tooltip. Must be HTML/UTF8 encoded.
|
||||
* @param int $tooltipon 1=tooltip sur texte, 2=tooltip sur picto, 3=tooltip sur les 2
|
||||
* @param int $direction -1=Le picto est avant, 0=pas de picto, 1=le picto est apres
|
||||
* @param string $img Code img du picto (use img_xxx() function to get it)
|
||||
@ -383,7 +383,7 @@ class Form
|
||||
//if ($text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.(($direction < 0)?' ':'').$text.(($direction > 0)?' ':'').'</'.$tag.'>';
|
||||
$paramfortooltiptd.= (($direction < 0)?' style="padding-left: 3px !important;"':'');
|
||||
$paramfortooltiptd.= (($direction > 0)?' style="padding-right: 3px !important;"':'');
|
||||
if ($text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>';
|
||||
if ((string) $text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>';
|
||||
if ($direction > 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14">'.$img.'</'.$tag.'>';
|
||||
if (empty($notabs)) $s.='</tr></table>';
|
||||
|
||||
@ -3333,7 +3333,7 @@ class Form
|
||||
if (strval($set_time) != '' && $set_time != -1)
|
||||
{
|
||||
//$formated_date=dol_print_date($set_time,$conf->format_date_short);
|
||||
$formated_date=dol_print_date($set_time,$langs->trans("FormatDateShort")); // FormatDateShort for dol_print_date/FormatDateShortJava that is same for javascript
|
||||
$formated_date=dol_print_date($set_time,$langs->trans("FormatDateShortInput")); // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
|
||||
}
|
||||
|
||||
// Calendrier popup version eldy
|
||||
@ -3342,7 +3342,7 @@ class Form
|
||||
// Zone de saisie manuelle de la date
|
||||
$retstring.='<input id="'.$prefix.'" name="'.$prefix.'" type="text" size="9" maxlength="11" value="'.$formated_date.'"';
|
||||
$retstring.=($disabled?' disabled="disabled"':'');
|
||||
$retstring.=' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJava").'\'); "'; // FormatDateShort for dol_print_date/FormatDateShortJava that is same for javascript
|
||||
$retstring.=' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
|
||||
$retstring.='>';
|
||||
|
||||
// Icone calendrier
|
||||
@ -3350,7 +3350,7 @@ class Form
|
||||
{
|
||||
$retstring.='<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';
|
||||
$base=DOL_URL_ROOT.'/core/';
|
||||
$retstring.=' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJava").'\',\''.$langs->defaultlang.'\');">'.img_object($langs->trans("SelectDate"),'calendarday','class="datecallink"').'</button>';
|
||||
$retstring.=' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');">'.img_object($langs->trans("SelectDate"),'calendarday','class="datecallink"').'</button>';
|
||||
}
|
||||
else $retstring.='<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"),'calendarday','class="datecallink"').'</button>';
|
||||
|
||||
@ -3359,7 +3359,7 @@ class Form
|
||||
$retstring.='<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
print "Bad value of MAIN_POPUP_CALENDAR";
|
||||
}
|
||||
}
|
||||
@ -3453,7 +3453,7 @@ class Form
|
||||
if ($usecalendar == "eldy")
|
||||
{
|
||||
$base=DOL_URL_ROOT.'/core/';
|
||||
$reset_scripts .= 'resetDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJava").'\',\''.$langs->defaultlang.'\');';
|
||||
$reset_scripts .= 'resetDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -209,10 +209,10 @@ class FormActions
|
||||
/**
|
||||
* Output list of type of event
|
||||
*
|
||||
* @param string $selected Type pre-selectionne
|
||||
* @param string $selected Type pre-selected (can be 'manual', 'auto' or 'AC_xxx'
|
||||
* @param string $htmlname Nom champ formulaire
|
||||
* @param string $excludetype Type to exclude
|
||||
* @param string $onlyautoornot Group list by auto events or not
|
||||
* @param string $onlyautoornot Group list by auto events or not: We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO)
|
||||
* @return void
|
||||
*/
|
||||
function select_type_actions($selected='',$htmlname='actioncode',$excludetype='',$onlyautoornot=0)
|
||||
@ -224,11 +224,14 @@ class FormActions
|
||||
$caction=new CActionComm($this->db);
|
||||
$form=new Form($this->db);
|
||||
|
||||
// Suggest a list with manual event or all auto events
|
||||
// Suggest a list with manual events or all auto events
|
||||
$arraylist=$caction->liste_array(1, 'code', $excludetype, $onlyautoornot);
|
||||
array_unshift($arraylist,' '); // Add empty line at start
|
||||
//asort($arraylist);
|
||||
|
||||
if ($selected == 'manual') $selected='AC_OTH';
|
||||
if ($selected == 'auto') $selected='AC_OTH_AUTO';
|
||||
|
||||
print $form->selectarray($htmlname, $arraylist, $selected);
|
||||
if ($user->admin && empty($onlyautoornot)) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||
}
|
||||
|
||||
@ -480,10 +480,10 @@ class FormFile
|
||||
|
||||
// Show file name with link to download
|
||||
$out.= '<td nowrap="nowrap">';
|
||||
$out.= '<a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'"';
|
||||
$out.= '<a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'"';
|
||||
$mime=dol_mimetype($relativepath,'',0);
|
||||
if (preg_match('/text/',$mime)) $out.= ' target="_blank"';
|
||||
$out.= '>';
|
||||
$out.= ' target="_blank">';
|
||||
$out.= img_mime($file["name"],$langs->trans("File").': '.$file["name"]).' '.dol_trunc($file["name"],$maxfilenamelength);
|
||||
$out.= '</a>'."\n";
|
||||
$out.= '</td>';
|
||||
@ -575,7 +575,7 @@ class FormFile
|
||||
}
|
||||
|
||||
// Show file name with link to download
|
||||
$out.= '<a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'"';
|
||||
$out.= '<a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'"';
|
||||
$mime=dol_mimetype($relativepath,'',0);
|
||||
if (preg_match('/text/',$mime)) $out.= ' target="_blank"';
|
||||
$out.= '>';
|
||||
@ -669,7 +669,7 @@ class FormFile
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
//print "XX".$file['name']; //$file['name'] must be utf8
|
||||
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
|
||||
if ($forcedownload) print '&attachment=1';
|
||||
if (! empty($object->entity)) print '&entity='.$object->entity;
|
||||
print '&file='.urlencode($relativepath.$file['name']).'">';
|
||||
@ -855,7 +855,7 @@ class FormFile
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
//print "XX".$file['name']; //$file['name'] must be utf8
|
||||
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
|
||||
if ($forcedownload) print '&attachment=1';
|
||||
print '&file='.urlencode($relativefile).'">';
|
||||
print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' ';
|
||||
@ -865,7 +865,7 @@ class FormFile
|
||||
print '<td align="right">'.dol_print_size($file['size'],1,1).'</td>';
|
||||
print '<td align="center">'.dol_print_date($file['date'],"dayhour").'</td>';
|
||||
print '<td align="right">';
|
||||
if (! empty($useinecm)) print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
|
||||
if (! empty($useinecm)) print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
|
||||
if ($forcedownload) print '&attachment=1';
|
||||
print '&file='.urlencode($relativefile).'">';
|
||||
print img_view().'</a> ';
|
||||
|
||||
@ -893,9 +893,34 @@ class FormOther
|
||||
$selectboxlist=$form->selectarray('boxcombo', $arrayboxtoactivatelabel,'',1);
|
||||
}
|
||||
|
||||
// Javascript code for dynamic actions
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
|
||||
// To update list of activated boxes
|
||||
function updateBoxOrder(closing) {
|
||||
var left_list = cleanSerialize(jQuery("#left").sortable("serialize"));
|
||||
var right_list = cleanSerialize(jQuery("#right").sortable("serialize"));
|
||||
var boxorder = \'A:\' + left_list + \'-B:\' + right_list;
|
||||
if (boxorder==\'A:A-B:B\' && closing == 1) // There is no more boxes on screen, and we are after a delete of a box so we must hide title
|
||||
{
|
||||
jQuery.ajax({
|
||||
url: \''.DOL_URL_ROOT.'/core/ajax/box.php?boxorder=\'+boxorder+\'&zone='.$areacode.'&userid=\'+'.$user->id.',
|
||||
async: false
|
||||
});
|
||||
// We force reload to be sure to get all boxes into list
|
||||
window.location.search=\'mainmenu='.GETPOST("mainmenu").'&leftmenu='.GETPOST('leftmenu').'&action=delbox\';
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery.ajax({
|
||||
url: \''.DOL_URL_ROOT.'/core/ajax/box.php?boxorder=\'+boxorder+\'&zone='.$areacode.'&userid=\'+'.$user->id.',
|
||||
async: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#boxcombo").change(function() {
|
||||
var boxid=jQuery("#boxcombo").val();
|
||||
@ -910,10 +935,33 @@ class FormOther
|
||||
window.location.search=\'mainmenu='.GETPOST("mainmenu").'&leftmenu='.GETPOST('leftmenu').'&action=addbox&boxid=\'+boxid;
|
||||
}
|
||||
});';
|
||||
if (! count($arrayboxtoactivatelabel)) print 'jQuery("#boxcombo").hide();';
|
||||
print '
|
||||
});
|
||||
</script>';
|
||||
if (! count($arrayboxtoactivatelabel)) print 'jQuery("#boxcombo").hide();';
|
||||
print '
|
||||
|
||||
jQuery("#left, #right").sortable({
|
||||
/* placeholder: \'ui-state-highlight\', */
|
||||
handle: \'.boxhandle\',
|
||||
revert: \'invalid\',
|
||||
items: \'.box\',
|
||||
containment: \'.fiche\',
|
||||
connectWith: \'.connectedSortable\',
|
||||
stop: function(event, ui) {
|
||||
updateBoxOrder(0);
|
||||
}
|
||||
});
|
||||
|
||||
jQuery(".boxclose").click(function() {
|
||||
var self = this; // because JQuery can modify this
|
||||
var boxid=self.id.substring(8);
|
||||
var label=jQuery(\'#boxlabelentry\'+boxid).val();
|
||||
jQuery(\'#boxto_\'+boxid).remove();
|
||||
// TODO Add id, label into combo list
|
||||
updateBoxOrder(1);
|
||||
});
|
||||
|
||||
});'."\n";
|
||||
|
||||
print '</script>'."\n";
|
||||
}
|
||||
|
||||
$nbboxactivated=count($boxidactivatedforuser);
|
||||
@ -996,59 +1044,6 @@ class FormOther
|
||||
|
||||
print "</td></tr>";
|
||||
print "</table>";
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print "\n";
|
||||
print '<script type="text/javascript" language="javascript">';
|
||||
// For moving
|
||||
print 'jQuery(function() {
|
||||
jQuery("#left, #right").sortable({
|
||||
/* placeholder: \'ui-state-highlight\', */
|
||||
handle: \'.boxhandle\',
|
||||
revert: \'invalid\',
|
||||
items: \'.box\',
|
||||
containment: \'.fiche\',
|
||||
connectWith: \'.connectedSortable\',
|
||||
stop: function(event, ui) {
|
||||
updateBoxOrder(0);
|
||||
}
|
||||
});
|
||||
});
|
||||
'."\n";
|
||||
// To update list of activated boxes
|
||||
print 'function updateBoxOrder(closing) {
|
||||
var left_list = cleanSerialize(jQuery("#left").sortable("serialize"));
|
||||
var right_list = cleanSerialize(jQuery("#right").sortable("serialize"));
|
||||
var boxorder = \'A:\' + left_list + \'-B:\' + right_list;
|
||||
if (boxorder==\'A:A-B:B\' && closing == 1) // There is no more boxes on screen, and we are after a delete of a box so we must hide title
|
||||
{
|
||||
jQuery.ajax({
|
||||
url: \''.DOL_URL_ROOT.'/core/ajax/box.php?boxorder=\'+boxorder+\'&zone='.$areacode.'&userid=\'+'.$user->id.',
|
||||
async: false
|
||||
});
|
||||
// We force reload to be sure to get all boxes into list
|
||||
window.location.search=\'mainmenu='.GETPOST("mainmenu").'&leftmenu='.GETPOST('leftmenu').'&action=delbox\';
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery.ajax({
|
||||
url: \''.DOL_URL_ROOT.'/core/ajax/box.php?boxorder=\'+boxorder+\'&zone='.$areacode.'&userid=\'+'.$user->id.',
|
||||
async: true
|
||||
});
|
||||
}
|
||||
}'."\n";
|
||||
// For closing
|
||||
print 'jQuery(document).ready(function() {
|
||||
jQuery(".boxclose").click(function() {
|
||||
var self = this; // because JQuery can modify this
|
||||
var boxid=self.id.substring(8);
|
||||
jQuery(\'#boxto_\'+boxid).remove();
|
||||
updateBoxOrder(1);
|
||||
});
|
||||
});'."\n";
|
||||
print '</script>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
return count($boxactivated);
|
||||
|
||||
@ -224,16 +224,16 @@ function displayBox($selectedDate,$month,$year)
|
||||
if($thedate==$selDate) $dayclass="dpSelected";
|
||||
elseif($thedate==$today) $dayclass="dpToday";
|
||||
|
||||
if ($langs->trans("FormatDateShortJava")=="FormatDateShortJava")
|
||||
if ($langs->trans("FormatDateShortJavaInput")=="FormatDateShortJavaInput")
|
||||
{
|
||||
print "ERROR FormatDateShortJava not defined for language ".$langs->defaultlang;
|
||||
print "ERROR FormatDateShortJavaInput not defined for language ".$langs->defaultlang;
|
||||
exit;
|
||||
}
|
||||
|
||||
// Sur click dans calendrier, appelle fonction dpClickDay
|
||||
echo "<TD class=\"".$dayclass."\"";
|
||||
echo " onMouseOver=\"dpHighlightDay(".$mydate["year"].",parseInt('".dol_print_date($thedate,"%m")."',10),".$mydate["mday"].",tradMonths)\"";
|
||||
echo " onClick=\"dpClickDay(".$mydate["year"].",parseInt('".dol_print_date($thedate,"%m")."',10),".$mydate["mday"].",'".$langs->trans("FormatDateShortJava")."')\"";
|
||||
echo " onClick=\"dpClickDay(".$mydate["year"].",parseInt('".dol_print_date($thedate,"%m")."',10),".$mydate["mday"].",'".$langs->trans("FormatDateShortJavaInput")."')\"";
|
||||
echo ">".sprintf("%02s",$mydate["mday"])."</TD>";
|
||||
$cols++;
|
||||
|
||||
|
||||
@ -40,11 +40,6 @@ $langs->load("main");
|
||||
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
|
||||
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
|
||||
|
||||
//var_dump($langs->defaultlang);
|
||||
//var_dump($conf->format_date_short_java);
|
||||
//var_dump($langs->trans("FormatDateShortJava"));
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
|
||||
@ -40,9 +40,10 @@
|
||||
* @param int $pid Product id
|
||||
* @param int $socid Third party id
|
||||
* @param array $showextcals Array with list of external calendars, or -1 to show no legend
|
||||
* @param string $actioncode Preselected value of actioncode for filter on type
|
||||
* @return void
|
||||
*/
|
||||
function print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$showextcals=array())
|
||||
function print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$showextcals=array(),$actioncode='')
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
|
||||
@ -94,8 +95,7 @@ function print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirt
|
||||
print $langs->trans("Type");
|
||||
print ' </td><td nowrap="nowrap">';
|
||||
|
||||
// print $formactions->select_type_actions(GETPOST('actioncode'), "actioncode");
|
||||
print $formactions->select_type_actions(GETPOST('actioncode')?GETPOST('actioncode'):'manual', "actioncode", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0));
|
||||
print $formactions->select_type_actions($actioncode, "actioncode", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0));
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -384,6 +384,11 @@ function agenda_prepare_head()
|
||||
$head[$h][2] = 'extsites';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/agenda_other.php";
|
||||
$head[$h][1] = $langs->trans("Other");
|
||||
$head[$h][2] = 'other';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'agenda_admin');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php";
|
||||
|
||||
@ -47,7 +47,7 @@ function societe_prepare_head($object)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$object->id;
|
||||
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && ($object->client==2 || $object->client==3)) $head[$h][1] = $langs->trans("Prospect");
|
||||
if ($object->client==3) $head[$h][1] .= '/';
|
||||
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && $object->client==3) $head[$h][1] .= '/';
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && ($object->client==1 || $object->client==3)) $head[$h][1] .= $langs->trans("Customer");
|
||||
$head[$h][2] = 'customer';
|
||||
$h++;
|
||||
|
||||
@ -814,13 +814,14 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
}
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
if (! $format) $format='daytextshort';
|
||||
|
||||
$reduceformat=(! empty($conf->dol_optimize_smallscreen) && in_array($format,array('day','hour')))?1:0;
|
||||
|
||||
// Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default.
|
||||
if ($format == 'day') $format=($outputlangs->trans("FormatDateShort")!="FormatDateShort"?$outputlangs->trans("FormatDateShort"):$conf->format_date_short);
|
||||
else if ($format == 'hour') $format=($outputlangs->trans("FormatHourShort")!="FormatHourShort"?$outputlangs->trans("FormatHourShort"):$conf->format_hour_short);
|
||||
else if ($format == 'hourduration') $format=($outputlangs->trans("FormatHourShortDuration")!="FormatHourShortDuration"?$outputlangs->trans("FormatHourShortDuration"):$conf->format_hour_short_duration);
|
||||
if ($format == 'day') $format=($outputlangs->trans("FormatDateShort")!="FormatDateShort"?$outputlangs->trans("FormatDateShort"):$conf->format_date_short);
|
||||
else if ($format == 'hour') $format=($outputlangs->trans("FormatHourShort")!="FormatHourShort"?$outputlangs->trans("FormatHourShort"):$conf->format_hour_short);
|
||||
else if ($format == 'hourduration') $format=($outputlangs->trans("FormatHourShortDuration")!="FormatHourShortDuration"?$outputlangs->trans("FormatHourShortDuration"):$conf->format_hour_short_duration);
|
||||
else if ($format == 'daytext') $format=($outputlangs->trans("FormatDateText")!="FormatDateText"?$outputlangs->trans("FormatDateText"):$conf->format_date_text);
|
||||
else if ($format == 'daytextshort') $format=($outputlangs->trans("FormatDateTextShort")!="FormatDateTextShort"?$outputlangs->trans("FormatDateTextShort"):$conf->format_date_text_short);
|
||||
else if ($format == 'daytextshort') $format=($outputlangs->trans("FormatDateTextShort")!="FormatDateTextShort"?$outputlangs->trans("FormatDateTextShort"):$conf->format_date_text_short);
|
||||
else if ($format == 'dayhour') $format=($outputlangs->trans("FormatDateHourShort")!="FormatDateHourShort"?$outputlangs->trans("FormatDateHourShort"):$conf->format_date_hour_short);
|
||||
else if ($format == 'dayhoursec') $format=($outputlangs->trans("FormatDateHourSecShort")!="FormatDateHourSecShort"?$outputlangs->trans("FormatDateHourSecShort"):$conf->format_date_hour_sec_short);
|
||||
else if ($format == 'dayhourtext') $format=($outputlangs->trans("FormatDateHourText")!="FormatDateHourText"?$outputlangs->trans("FormatDateHourText"):$conf->format_date_hour_text);
|
||||
@ -828,12 +829,18 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
// Format not sensitive to language
|
||||
else if ($format == 'dayhourlog') $format='%Y%m%d%H%M%S';
|
||||
else if ($format == 'dayhourldap') $format='%Y%m%d%H%M%SZ';
|
||||
else if ($format == 'dayhourxcard') $format='%Y%m%dT%H%M%SZ';
|
||||
else if ($format == 'dayxcard') $format='%Y%m%d';
|
||||
else if ($format == 'dayhourxcard') $format='%Y%m%dT%H%M%SZ';
|
||||
else if ($format == 'dayxcard') $format='%Y%m%d';
|
||||
else if ($format == 'dayrfc') $format='%Y-%m-%d'; // DATE_RFC3339
|
||||
else if ($format == 'dayhourrfc') $format='%Y-%m-%dT%H:%M:%SZ'; // DATETIME RFC3339
|
||||
else if ($format == 'standard') $format='%Y-%m-%d %H:%M:%S';
|
||||
else if ($format == 'standard') $format='%Y-%m-%d %H:%M:%S';
|
||||
|
||||
if ($reduceformat)
|
||||
{
|
||||
$format=str_replace('%Y','%y',$format);
|
||||
$format=str_replace('yyyy','yy',$format);
|
||||
}
|
||||
|
||||
// If date undefined or "", we return ""
|
||||
if (dol_strlen($time) == 0) return ''; // $time=0 allowed (it means 01/01/1970 00:00:00)
|
||||
|
||||
@ -1072,9 +1079,11 @@ function dol_now($mode='gmt')
|
||||
*/
|
||||
function dol_print_size($size,$shortvalue=0,$shortunit=0)
|
||||
{
|
||||
global $langs;
|
||||
global $conf,$langs;
|
||||
$level=1024;
|
||||
|
||||
|
||||
if (! empty($conf->dol_optimize_smallscreen)) $shortunit=1;
|
||||
|
||||
// Set value text
|
||||
if (empty($shortvalue) || $size < ($level*10))
|
||||
{
|
||||
@ -2846,7 +2855,7 @@ function getLocalTaxesFromRate($vatrate, $local, $thirdparty)
|
||||
dol_syslog("getLocalTaxesFromRate vatrate=".$vatrate." local=".$local." thirdparty id=".(is_object($thirdparty)?$thirdparty->id:''));
|
||||
|
||||
// Search local taxes
|
||||
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type";
|
||||
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type,t.accountancy_code_sell,t.accountancy_code_buy";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
|
||||
$sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty->country_code."'";
|
||||
$sql .= " AND t.taux = ".$vatrate." AND t.active = 1";
|
||||
@ -2855,9 +2864,9 @@ function getLocalTaxesFromRate($vatrate, $local, $thirdparty)
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($local == 1) return array($obj->localtax1_type, $obj->localtax1);
|
||||
elseif ($local == 2) return array($obj->localtax2_type, $obj->localtax2);
|
||||
else return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2);
|
||||
if ($local == 1) return array($obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
||||
elseif ($local == 2) return array($obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
||||
else return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -3105,12 +3114,16 @@ function get_default_npr($thirdparty_seller, $thirdparty_buyer, $idprod=0, $idpr
|
||||
|
||||
if ($idprodfournprice > 0)
|
||||
{
|
||||
if (! class_exists('ProductFournisseur'))
|
||||
require DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';
|
||||
$prodprice = new ProductFournisseur($db);
|
||||
$prodprice->fetch_product_fournisseur_price($idprodfournprice);
|
||||
return $prodprice->fourn_tva_npr;
|
||||
}
|
||||
elseif ($idprod > 0)
|
||||
{
|
||||
if (! class_exists('Product'))
|
||||
require DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
$prod = new Product($db);
|
||||
$prod->fetch($idprod);
|
||||
return $prod->tva_npr;
|
||||
|
||||
@ -1283,7 +1283,7 @@ function getListOfModels($db,$type,$maxfilenamelength=0)
|
||||
if (! $tmpdir) { unset($listofdir[$key]); continue; }
|
||||
if (is_dir($tmpdir))
|
||||
{
|
||||
$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt','','name',SORT_ASC,0,true); // Disable hook for the moment
|
||||
$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.od(s|t)$','','name',SORT_ASC,0,true); // Disable hook for the moment
|
||||
if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,14 +78,15 @@ function user_prepare_head($object)
|
||||
$head[$h][2] = 'clicktodial';
|
||||
$h++;
|
||||
}
|
||||
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'user');
|
||||
|
||||
if (! empty($user->societe_id))
|
||||
|
||||
//Info on users is visible only by internal user
|
||||
if (empty($user->societe_id))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
|
||||
@ -852,6 +852,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
*/
|
||||
if (empty($leftmenu) || $leftmenu=="ca") $newmenu->add("/compta/stats/casoc.php?leftmenu=ca",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="ca") $newmenu->add("/compta/stats/cabyuser.php?leftmenu=ca",$langs->trans("ByUsers"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="ca") $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=ca", $langs->trans("ByProductsAndServices"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
|
||||
|
||||
|
||||
// Journaux
|
||||
//if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journaux"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
|
||||
|
||||
@ -519,8 +519,12 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Write new file
|
||||
//$result=$odfHandler->exportAsAttachedFile('toto');
|
||||
$odfHandler->saveToDisk($file);
|
||||
if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
|
||||
$odfHandler->exportAsAttachedPDF($file);
|
||||
}
|
||||
else {
|
||||
$odfHandler->saveToDisk($file);
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
@ -1,68 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/expedition/methode_expedition.modules.php
|
||||
* \ingroup expedition
|
||||
* \brief Fichier contenant la classe mere de generation de bon de livraison en PDF
|
||||
* et la classe mere de numerotation des bons de livraisons
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
* Parent class for shipping method classes
|
||||
*/
|
||||
class ModeleShippingMethod
|
||||
{
|
||||
/**
|
||||
* Constructo
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->name = "NOT DEFINED";
|
||||
$this->description = "ERROR IN MODULE DESCRIPTION";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return list of active generation modules
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $maxfilenamelength Max length of value to show
|
||||
* @return array List of templates
|
||||
*/
|
||||
static function liste_modeles($db,$maxfilenamelength=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$type='???';
|
||||
$liste=array();
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$liste=getListOfModels($db,$type,$maxfilenamelength);
|
||||
|
||||
return $liste;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,56 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2008 Bearstech - http://bearstech.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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/expedition/methode_expedition_colsui.modules.php
|
||||
* \ingroup expedition
|
||||
*/
|
||||
include_once 'methode_expedition.modules.php';
|
||||
|
||||
/**
|
||||
* Class to manage shipment Colsui
|
||||
*/
|
||||
class methode_expedition_colsui extends ModeleShippingMethod
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db=0)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->id = 3; // Do not change this value
|
||||
$this->code = "COLSUI"; // Do not change this value
|
||||
$this->name = "Colissimo Suivi";
|
||||
$this->description = "Colissimo Suivi";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return URL of provider
|
||||
*
|
||||
* @param string $tracking_number Tracking number
|
||||
* @return string URL for tracking
|
||||
*/
|
||||
function provider_url_status($tracking_number)
|
||||
{
|
||||
return sprintf("http://www.coliposte.net/particulier/suivi_particulier.jsp?colispart=%s",$tracking_number);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,57 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2008 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* 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/modules/expedition/methode_expedition_enl.modules.php
|
||||
* \ingroup expedition
|
||||
*/
|
||||
include_once 'methode_expedition.modules.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage shipment Enl
|
||||
*/
|
||||
class methode_expedition_enl extends ModeleShippingMethod
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db=0)
|
||||
{
|
||||
global $langs;
|
||||
$this->db = $db;
|
||||
$this->id = 1; // Do not change this value
|
||||
$this->name = "Enlevement";
|
||||
$this->code = "ENL";
|
||||
$this->description = $langs->trans("Enlevement");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return URL of provider
|
||||
*
|
||||
* @param string $tracking_number Tracking number
|
||||
* @return string URL for tracking
|
||||
*/
|
||||
function provider_url_status($tracking_number)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,57 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 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
|
||||
* 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/modules/expedition/methode_expedition_lettremax.modules.php
|
||||
* \ingroup expedition
|
||||
*/
|
||||
|
||||
include_once 'methode_expedition.modules.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage shipment lettremax
|
||||
*/
|
||||
class methode_expedition_lettremax extends ModeleShippingMethod
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db=0)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->id = 4; // Do not change this value
|
||||
$this->code = "LETTREMAX"; // Do not change this value
|
||||
$this->name = "Lettre max";
|
||||
$this->description = "Courrier suivi et lettre max";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return URL of provider
|
||||
*
|
||||
* @param string $tracking_number Tracking number
|
||||
* @return string URL for tracking
|
||||
*/
|
||||
function provider_url_status($tracking_number)
|
||||
{
|
||||
return sprintf("http://www.csuivi.courrier.laposte.fr/default.asp?EZ_ACTION=rechercheRapide&numObjet=%s",$tracking_number);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,59 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2008 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* 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/modules/expedition/methode_expedition_trans.modules.php
|
||||
* \ingroup expedition
|
||||
*/
|
||||
include_once 'methode_expedition.modules.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage shipment Trans
|
||||
*/
|
||||
class methode_expedition_trans extends ModeleShippingMethod
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$this->db = $db;
|
||||
$this->id = 2; // Ne pas changer cette valeur
|
||||
$this->code = "TRANS";
|
||||
$this->name = "Transporteur";
|
||||
$this->description = $langs->trans("GenericTransport");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return URL of provider
|
||||
*
|
||||
* @param string $tracking_number Tracking number
|
||||
* @return string URL for tracking
|
||||
*/
|
||||
function provider_url_status($tracking_number)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -497,8 +497,12 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Write new file
|
||||
//$result=$odfHandler->exportAsAttachedFile('toto');
|
||||
$odfHandler->saveToDisk($file);
|
||||
if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
|
||||
$odfHandler->exportAsAttachedPDF($file);
|
||||
}
|
||||
else {
|
||||
$odfHandler->saveToDisk($file);
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
@ -38,6 +38,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
*/
|
||||
class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
{
|
||||
var $db;
|
||||
var $name;
|
||||
var $description;
|
||||
var $type;
|
||||
|
||||
var $phpmin = array(4,3,0); // Minimum version of PHP required by module
|
||||
var $version = 'dolibarr';
|
||||
|
||||
var $page_largeur;
|
||||
var $page_hauteur;
|
||||
var $format;
|
||||
var $marge_gauche;
|
||||
var $marge_droite;
|
||||
var $marge_haute;
|
||||
var $marge_basse;
|
||||
|
||||
var $emetteur; // Objet societe qui emet
|
||||
|
||||
/**
|
||||
@ -75,26 +91,26 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
$this->franchise=!$mysoc->tva_assuj;
|
||||
|
||||
// Recupere emmetteur
|
||||
// Get source company
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined
|
||||
if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined
|
||||
|
||||
// Defini position des colonnes
|
||||
// Define position of columns
|
||||
$this->posxdesc=$this->marge_gauche+1;
|
||||
$this->posxcomm=120;
|
||||
$this->posxcomm=111;
|
||||
//$this->posxtva=111;
|
||||
$this->posxup=132;
|
||||
$this->posxqty=168;
|
||||
$this->posxdiscount=162;
|
||||
$this->postotalht=177;
|
||||
//$this->posxup=126;
|
||||
$this->posxqty=174;
|
||||
//$this->posxdiscount=162;
|
||||
//$this->postotalht=174;
|
||||
if ($this->page_largeur < 210) // To work with US executive format
|
||||
{
|
||||
$this->posxcomm-=20;
|
||||
//$this->posxtva-=20;
|
||||
$this->posxup-=20;
|
||||
//$this->posxup-=20;
|
||||
$this->posxqty-=20;
|
||||
$this->posxdiscount-=20;
|
||||
$this->postotalht-=20;
|
||||
//$this->posxdiscount-=20;
|
||||
//$this->postotalht-=20;
|
||||
}
|
||||
|
||||
$this->tva=array();
|
||||
@ -104,15 +120,19 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
|
||||
/**
|
||||
* Fonction generant le bon de livraison sur le disque
|
||||
*
|
||||
* @param Object $object Object livraison a generer
|
||||
* @param Translate $outputlangs Lang output object
|
||||
* @return int 1 if OK, <=0 if KO
|
||||
* Function to build pdf onto disk
|
||||
*
|
||||
* @param Object $object Object to generate
|
||||
* @param Translate $outputlangs Lang output object
|
||||
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
* @return int 1=OK, 0=KO
|
||||
*/
|
||||
function write_file($object,$outputlangs)
|
||||
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
global $user,$langs,$conf,$mysoc,$hookmanager;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
|
||||
@ -126,17 +146,23 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$outputlangs->load("deliveries");
|
||||
$outputlangs->load("sendings");
|
||||
|
||||
if ($conf->expedition->dir_output."/receipt")
|
||||
if ($conf->expedition->dir_output)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$nblines = count($object->lines);
|
||||
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$dir = $conf->expedition->dir_output."/receipt";
|
||||
if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
|
||||
$file = $dir . "/" . $objectref . ".pdf";
|
||||
|
||||
// Definition of $dir and $file
|
||||
if ($object->specimen)
|
||||
{
|
||||
$dir = $conf->expedition->dir_output."/receipt";
|
||||
$file = $dir . "/SPECIMEN.pdf";
|
||||
}
|
||||
else
|
||||
{
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$dir = $conf->expedition->dir_output."/receipt/" . $objectref;
|
||||
$file = $dir . "/" . $objectref . ".pdf";
|
||||
}
|
||||
|
||||
if (! file_exists($dir))
|
||||
{
|
||||
if (dol_mkdir($dir) < 0)
|
||||
@ -148,9 +174,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
if (file_exists($dir))
|
||||
{
|
||||
$pdf=pdf_getInstance($this->format);
|
||||
$nblines = count($object->lines);
|
||||
|
||||
// Create pdf instance
|
||||
$pdf=pdf_getInstance($this->format);
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
|
||||
$heightforinfotot = 50; // Height reserved to output the info and total part
|
||||
$heightforinfotot = 30; // Height reserved to output the info and total part
|
||||
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
|
||||
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
|
||||
$pdf->SetAutoPageBreak(1,0);
|
||||
@ -195,7 +224,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
/*
|
||||
// Positionne $this->atleastonediscount si on a au moins une remise
|
||||
for ($i = 0 ; $i < $nblignes ; $i++)
|
||||
for ($i = 0 ; $i < $nblines ; $i++)
|
||||
{
|
||||
if ($object->lines[$i]->remise_percent)
|
||||
{
|
||||
@ -214,7 +243,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
$tab_top = 90;
|
||||
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?22:10);
|
||||
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
|
||||
$tab_height = 130;
|
||||
$tab_height_newpage = 150;
|
||||
|
||||
@ -223,7 +252,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
{
|
||||
$tab_top = 88;
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1);
|
||||
$nexY = $pdf->GetY();
|
||||
$height_note=$nexY-$tab_top;
|
||||
@ -252,13 +281,46 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
$pdf->setTopMargin($tab_top_newpage);
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext); // The only function to edit the bottom margin of current page to set it.
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
|
||||
$pageposbefore=$pdf->getPage();
|
||||
|
||||
// Description of product line
|
||||
$curX = $this->posxdesc-1;
|
||||
pdf_writelinedesc($pdf,$object,$i,$outputlangs,108,3,$curX,$curY);
|
||||
|
||||
$showpricebeforepagebreak=1;
|
||||
|
||||
$pdf->startTransaction();
|
||||
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxcomm-$curX,3,$curX,$curY,$hideref,$hidedesc);
|
||||
$pageposafter=$pdf->getPage();
|
||||
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
||||
{
|
||||
$pdf->rollbackTransaction(true);
|
||||
$pageposafter=$pageposbefore;
|
||||
//print $pageposafter.'-'.$pageposbefore;exit;
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxcomm-$curX,4,$curX,$curY,$hideref,$hidedesc);
|
||||
$posyafter=$pdf->GetY();
|
||||
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
|
||||
{
|
||||
if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page
|
||||
{
|
||||
$pdf->AddPage('','',true);
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$pdf->setPage($pagenb+1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// We found a page break
|
||||
$showpricebeforepagebreak=0;
|
||||
}
|
||||
}
|
||||
else // No pagebreak
|
||||
{
|
||||
$pdf->commitTransaction();
|
||||
}
|
||||
|
||||
$nexY = $pdf->GetY();
|
||||
$pageposafter=$pdf->getPage();
|
||||
$pdf->setPage($pageposbefore);
|
||||
@ -266,17 +328,15 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
|
||||
// We suppose that a too long description is moved completely on next page
|
||||
if ($pageposafter > $pageposbefore) {
|
||||
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
|
||||
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
|
||||
}
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
|
||||
|
||||
$nexY = $pdf->GetY()+4;
|
||||
|
||||
/*
|
||||
// TVA
|
||||
$pdf->SetXY($this->posxtva, $curY);
|
||||
$pdf->SetXY($this->posxcomm, $curY);
|
||||
$pdf->MultiCell(10, 4, ($object->lines[$i]->tva_tx < 0 ? '*':'').abs($object->lines[$i]->tva_tx), 0, 'R');
|
||||
|
||||
// Prix unitaire HT avant remise
|
||||
@ -284,8 +344,9 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->MultiCell(20, 4, price($object->lines[$i]->subprice), 0, 'R', 0);
|
||||
*/
|
||||
// Quantity
|
||||
//$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->posxqty, $curY);
|
||||
$pdf->MultiCell(30, 3, $object->lines[$i]->qty_shipped, 0, 'R');
|
||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxqty, 3, $object->lines[$i]->qty_shipped, 0, 'R');
|
||||
/*
|
||||
// Remise sur ligne
|
||||
$pdf->SetXY($this->posxdiscount, $curY);
|
||||
@ -307,7 +368,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
*/
|
||||
|
||||
// Add line
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
|
||||
{
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
@ -333,6 +394,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pagenb++;
|
||||
$pdf->setPage($pagenb);
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
}
|
||||
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
|
||||
{
|
||||
@ -349,34 +411,38 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->AddPage();
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
$pagenb++;
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
}
|
||||
}
|
||||
|
||||
// Show square
|
||||
if ($pagenb == 1)
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0);
|
||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1;
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
|
||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1);
|
||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1;
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
|
||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Pied de page
|
||||
*/
|
||||
// Affiche zone infos
|
||||
$posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
|
||||
|
||||
// Pied de page
|
||||
$this->_pagefoot($pdf,$object,$outputlangs);
|
||||
|
||||
$pdf->AliasNbPages();
|
||||
|
||||
// Check product remaining to be delivered
|
||||
// TODO doit etre modifie
|
||||
//$waitingDelivery = $object->getRemainingDelivered();
|
||||
/*
|
||||
$waitingDelivery='';
|
||||
|
||||
if (is_array($waitingDelivery) & !empty($waitingDelivery))
|
||||
{
|
||||
$pdf->AddPage('P', 'A4');
|
||||
$pdf->AddPage();
|
||||
|
||||
$this->_pagehead($pdf, $object, 1, $outputlangs);
|
||||
$pdf-> SetY(90);
|
||||
@ -426,17 +492,28 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
$this->_pagefoot($pdf,$object,$outputlangs);
|
||||
|
||||
}
|
||||
|
||||
$pdf->AliasNbPages();
|
||||
$pdf->AliasNbPages();
|
||||
}*/
|
||||
|
||||
$pdf->Close();
|
||||
|
||||
$pdf->Output($file,'F');
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
return 1;
|
||||
// Add pdfgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('pdfgeneration'));
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
||||
global $action;
|
||||
$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
return 1; // pas d'erreur
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -449,66 +526,90 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show miscellaneous information (payment mode, payment term, ...)
|
||||
*
|
||||
* @param PDF &$pdf Object PDF
|
||||
* @param Object $object Object to show
|
||||
* @param int $posy Y
|
||||
* @param Translate $outputlangs Langs object
|
||||
* @return void
|
||||
*/
|
||||
function _tableau_info(&$pdf, $object, $posy, $outputlangs)
|
||||
{
|
||||
global $conf;
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
$pdf->SetFont('','', $default_font_size);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
$larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3;
|
||||
$pdf->Rect($this->marge_gauche, $posy + 1, $larg_sign, 25);
|
||||
$pdf->SetXY($this->marge_gauche + 2, $posy + 2);
|
||||
$pdf->MultiCell($larg_sign,2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":",'','L');
|
||||
|
||||
$pdf->Rect(2*$larg_sign+$this->marge_gauche, $posy + 1, $larg_sign, 25);
|
||||
$pdf->SetXY(2*$larg_sign+$this->marge_gauche + 2, $posy + 2);
|
||||
$pdf->MultiCell($larg_sign,2, $outputlangs->trans("ForCustomer").':','','L');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show table for lines
|
||||
*
|
||||
* @param PDF &$pdf Object PDF
|
||||
* @param string $tab_top Top position of table
|
||||
* @param string $tab_height Height of table (rectangle)
|
||||
* @param int $nexY Y
|
||||
* @param int $nexY Y (not used)
|
||||
* @param Translate $outputlangs Langs object
|
||||
* @param int $hidetop Hide top bar of array
|
||||
* @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
|
||||
* @param int $hidebottom Hide bottom bar of array
|
||||
* @return void
|
||||
*/
|
||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
|
||||
{
|
||||
global $conf,$mysoc;
|
||||
|
||||
// Force to disable hidetop and hidebottom
|
||||
$hidebottom=0;
|
||||
if ($hidetop) $hidetop=-1;
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
$pdf->SetDrawColor(128,128,128);
|
||||
|
||||
// Rect prend une longueur en 3eme param
|
||||
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
|
||||
// line prend une position y en 3eme param
|
||||
if (empty($hidetop))
|
||||
$pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6);
|
||||
|
||||
|
||||
// Amount in (at tab_top - 1)
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
|
||||
// Output Rec
|
||||
$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
|
||||
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6);
|
||||
}
|
||||
|
||||
$pdf->SetDrawColor(128,128,128);
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
|
||||
if (empty($hidetop)) {
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
|
||||
$pdf->MultiCell(80,2, $outputlangs->transnoentities("Designation"),'','L');
|
||||
$pdf->MultiCell($this->posxcomm - $this->posxdesc,2, $outputlangs->transnoentities("Designation"),'','L');
|
||||
}
|
||||
|
||||
// Modif SEB pour avoir une col en plus pour les commentaires clients
|
||||
$pdf->line($this->posxcomm, $tab_top, $this->posxcomm, $tab_top + $tab_height);
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->posxcomm, $tab_top+1);
|
||||
$pdf->MultiCell(80,2, $outputlangs->transnoentities("Comments"),'','L');
|
||||
$pdf->MultiCell($this->posxqty - $this->posxcomm,2, $outputlangs->transnoentities("Comments"),'','L');
|
||||
}
|
||||
|
||||
// Qty
|
||||
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->posxqty-1, $tab_top+1);
|
||||
$pdf->MultiCell(30, 2, $outputlangs->transnoentities("QtyShipped"),'','R');
|
||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxqty, 2, $outputlangs->transnoentities("QtyShipped"),'','R');
|
||||
}
|
||||
|
||||
if (empty($hidebottom)) {
|
||||
// Modif Seb cadres signatures
|
||||
$pdf->SetFont('','', $default_font_size);
|
||||
$larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3;
|
||||
$pdf->Rect($this->marge_gauche, ($tab_top + $tab_height + 3), $larg_sign, 25);
|
||||
$pdf->SetXY($this->marge_gauche + 2, $tab_top + $tab_height + 5);
|
||||
$pdf->MultiCell($larg_sign,2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":",'','L');
|
||||
|
||||
$pdf->Rect(2*$larg_sign+$this->marge_gauche, ($tab_top + $tab_height + 3), $larg_sign, 25);
|
||||
$pdf->SetXY(2*$larg_sign+$this->marge_gauche + 2, $tab_top + $tab_height + 5);
|
||||
$pdf->MultiCell($larg_sign,2, $outputlangs->trans("ForCustomer").':','','L');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -522,22 +623,29 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
*/
|
||||
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
|
||||
{
|
||||
global $langs,$conf,$mysoc;
|
||||
global $conf,$langs,$hookmanager;
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
|
||||
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->SetFont('','B', $default_font_size + 3);
|
||||
|
||||
$posx=$this->page_largeur-$this->marge_droite-100;
|
||||
$posy=$this->marge_haute;
|
||||
|
||||
$pdf->SetXY($this->marge_gauche,$posy);
|
||||
|
||||
// Show Draft Watermark
|
||||
if($object->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) )
|
||||
{
|
||||
pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->COMMANDE_DRAFT_WATERMARK);
|
||||
}
|
||||
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->SetFont('','B', $default_font_size + 3);
|
||||
|
||||
$posy=$this->marge_haute;
|
||||
$posx=$this->page_largeur-$this->marge_droite-100;
|
||||
|
||||
$pdf->SetXY($this->marge_gauche,$posy);
|
||||
|
||||
// Logo
|
||||
$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
|
||||
if ($mysoc->logo)
|
||||
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
{
|
||||
@ -548,8 +656,8 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
{
|
||||
$pdf->SetTextColor(200,0,0);
|
||||
$pdf->SetFont('','B', $default_font_size - 2);
|
||||
$pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
|
||||
$pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
|
||||
}
|
||||
}
|
||||
else $pdf->MultiCell(100, 4, $this->emetteur->name, 0, 'L');
|
||||
@ -557,7 +665,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->SetFont('','B', $default_font_size + 2);
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DeliveryOrder")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DeliveryOrder")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
|
||||
|
||||
$pdf->SetFont('','',$default_font_size + 2);
|
||||
|
||||
@ -585,69 +693,42 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
|
||||
// Add origin linked objects
|
||||
// TODO extend to other objects
|
||||
$object->fetchObjectLinked('','',$object->id,'delivery');
|
||||
|
||||
if (! empty($object->linkedObjects))
|
||||
{
|
||||
$outputlangs->load('orders');
|
||||
|
||||
foreach($object->linkedObjects as $elementtype => $objects)
|
||||
{
|
||||
$object->fetchObjectLinked('','',$objects[0]->id,$objects[0]->element);
|
||||
|
||||
foreach($object->linkedObjects as $elementtype => $objects)
|
||||
{
|
||||
$num=count($objects);
|
||||
for ($i=0;$i<$num;$i++)
|
||||
{
|
||||
$order=new Commande($this->db);
|
||||
$result=$order->fetch($objects[$i]->id);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$text=$order->ref;
|
||||
if ($order->ref_client) $text.=' ('.$order->ref_client.')';
|
||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), '', 'R');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$posy+=2;
|
||||
|
||||
// Show list of linked objects
|
||||
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
|
||||
|
||||
if ($showaddress)
|
||||
{
|
||||
// Emetteur
|
||||
// Sender properties
|
||||
$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur);
|
||||
|
||||
// Show sender
|
||||
$posy=42;
|
||||
$posx=$this->marge_gauche;
|
||||
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
|
||||
$hautcadre=40;
|
||||
|
||||
// Show sender frame
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
$pdf->SetXY($this->marge_gauche,$posy-5);
|
||||
$pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":");
|
||||
|
||||
|
||||
$pdf->SetXY($this->marge_gauche,$posy);
|
||||
$pdf->SetXY($posx,$posy-5);
|
||||
$pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":", 0, 'L');
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetFillColor(230,230,230);
|
||||
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
|
||||
|
||||
|
||||
$pdf->SetXY($this->marge_gauche+2,$posy+3);
|
||||
|
||||
// Nom emetteur
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
|
||||
// Show sender name
|
||||
$pdf->SetXY($posx+2,$posy+3);
|
||||
$pdf->SetFont('','B',$default_font_size);
|
||||
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
|
||||
|
||||
// Sender properties
|
||||
$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur);
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY($this->marge_gauche+2,$posy+9);
|
||||
$pdf->MultiCell(80, 3, $carac_emetteur, 0, 'L');
|
||||
|
||||
// Show sender information
|
||||
$pdf->SetXY($posx+2,$posy+8);
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
|
||||
|
||||
// Client destinataire
|
||||
$posy=42;
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
@ -655,7 +736,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->SetXY(102,$posy-5);
|
||||
$pdf->MultiCell(80,5, $outputlangs->transnoentities("DeliveryAddress").":", 0, 'L');
|
||||
|
||||
// If SHIPPING contact defined on invoice, we use it
|
||||
// If SHIPPING contact defined on order, we use it
|
||||
$usecontact=false;
|
||||
$arrayidcontact=$object->commande->getIdContact('external','SHIPPING');
|
||||
if (count($arrayidcontact) > 0)
|
||||
@ -677,7 +758,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$carac_client_name=$outputlangs->convToOutputCharset($object->client->nom);
|
||||
}
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target');
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target');
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
@ -700,7 +781,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
// Show recipient information
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY($posx+2,$posy+8);
|
||||
$pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4));
|
||||
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
|
||||
}
|
||||
|
||||
@ -713,7 +794,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
* @param Object $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
* @return void
|
||||
* @return int Return height of bottom margin including footer text
|
||||
*/
|
||||
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
|
||||
{
|
||||
|
||||
@ -111,12 +111,12 @@ class modBarcode extends DolibarrModules
|
||||
$this->remove($options);
|
||||
|
||||
$sql = array(
|
||||
array('sql'=>'INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ("EAN8", "EAN8", 0, "1234567", __ENTITY__)','ignoreerror'=>1),
|
||||
array('sql'=>'INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ("EAN13", "EAN13", 0, "123456789012", __ENTITY__)','ignoreerror'=>1),
|
||||
array('sql'=>'INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ("UPC", "UPC", 0, "123456789012", __ENTITY__)','ignoreerror'=>1),
|
||||
array('sql'=>'INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ("ISBN", "ISBN", 0, "123456789", __ENTITY__)','ignoreerror'=>1),
|
||||
array('sql'=>'INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ("C39", "Code 39", 0, "1234567890", __ENTITY__)','ignoreerror'=>1),
|
||||
array('sql'=>'INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ("C128", "Code 128", 0, "ABCD1234567890", __ENTITY__)','ignoreerror'=>1)
|
||||
array('sql'=>"INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ('EAN8', 'EAN8', 0, '1234567', __ENTITY__)",'ignoreerror'=>1),
|
||||
array('sql'=>"INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ('EAN13', 'EAN13', 0, '123456789012', __ENTITY__)",'ignoreerror'=>1),
|
||||
array('sql'=>"INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ('UPC', 'UPC', 0, '123456789012', __ENTITY__)",'ignoreerror'=>1),
|
||||
array('sql'=>"INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ('ISBN', 'ISBN', 0, '123456789', __ENTITY__)",'ignoreerror'=>1),
|
||||
array('sql'=>"INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ('C39', 'Code 39', 0, '1234567890', __ENTITY__)",'ignoreerror'=>1),
|
||||
array('sql'=>"INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ('C128', 'Code 128', 0, 'ABCD1234567890', __ENTITY__)",'ignoreerror'=>1)
|
||||
);
|
||||
|
||||
return $this->_init($sql, $options);
|
||||
|
||||
@ -198,10 +198,10 @@ class modFacture extends DolibarrModules
|
||||
$this->export_label[$r]='CustomersInvoicesAndPayments'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='bill';
|
||||
$this->export_permission[$r]=array(array("facture","facture","export"));
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"NotePrivate",'f.note_public'=>"NotePublic",'p.rowid'=>'PaymentId','pf.amount'=>'AmountPayment','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber');
|
||||
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"List:facture:facnumber",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Number",'f.total_ttc'=>"Number",'f.tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note'=>"Text",'f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"List:facture:facnumber",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Number",'f.total_ttc'=>"Number",'f.tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note'=>"Text",'f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'f.note_public'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment');
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'p.rowid'=>'PaymentId','pf.amount'=>'AmountPayment','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber');
|
||||
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"List:facture:facnumber",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Number",'f.total_ttc'=>"Number",'f.tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"List:facture:facnumber",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Number",'f.total_ttc'=>"Number",'f.tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment');
|
||||
$this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
|
||||
@ -1,7 +1,18 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* Licensed under the GNU GPL v3 or higher (See file gpl-3.0.html)
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -184,10 +195,11 @@ class modOpenSurvey extends DolibarrModules
|
||||
*/
|
||||
function init($options='')
|
||||
{
|
||||
// Permissions
|
||||
$this->remove($options);
|
||||
|
||||
$sql = array();
|
||||
|
||||
$result=$this->load_tables();
|
||||
|
||||
return $this->_init($sql,$options);
|
||||
}
|
||||
|
||||
@ -205,20 +217,6 @@ class modOpenSurvey extends DolibarrModules
|
||||
|
||||
return $this->_remove($sql,$options);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create tables and keys required by module
|
||||
* Files mymodule.sql and mymodule.key.sql with create table and create keys
|
||||
* commands must be stored in directory /mymodule/sql/
|
||||
* This function is called by this->init.
|
||||
*
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
function load_tables()
|
||||
{
|
||||
return $this->_load_tables('/opensurvey/sql/');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -650,7 +650,7 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
|
||||
//Time ressources
|
||||
$sql = "SELECT t.rowid, t.task_date, t.task_duration, t.fk_user, t.note";
|
||||
$sql.= ", u.name, u.firstname";
|
||||
$sql.= ", u.lastname, u.firstname";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE t.fk_task =".$task->id;
|
||||
@ -973,8 +973,12 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
|
||||
|
||||
// Write new file
|
||||
$odfHandler->saveToDisk($file);
|
||||
//$odfHandler->exportAsAttachedPDF($file);
|
||||
if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
|
||||
$odfHandler->exportAsAttachedPDF($file);
|
||||
}
|
||||
else {
|
||||
$odfHandler->saveToDisk($file);
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
@ -482,8 +482,12 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Write new file
|
||||
//$result=$odfHandler->exportAsAttachedFile('toto');
|
||||
$odfHandler->saveToDisk($file);
|
||||
if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
|
||||
$odfHandler->exportAsAttachedPDF($file);
|
||||
}
|
||||
else {
|
||||
$odfHandler->saveToDisk($file);
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
@ -109,7 +109,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
|
||||
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
|
||||
else
|
||||
{
|
||||
$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt','','name',SORT_ASC,0,true); // Disable hook for the moment
|
||||
$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.od(s|t)$','','name',SORT_ASC,0,true); // Disable hook for the moment
|
||||
if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
|
||||
}
|
||||
}
|
||||
@ -210,16 +210,27 @@ class doc_generic_odt extends ModeleThirdPartyDoc
|
||||
{
|
||||
//print "srctemplatepath=".$srctemplatepath; // Src filename
|
||||
$newfile=basename($srctemplatepath);
|
||||
$newfiletmp=preg_replace('/\.odt/i','',$newfile);
|
||||
$newfiletmp=preg_replace('/\.od(s|t)/i','',$newfile);
|
||||
$newfiletmp=preg_replace('/template_/i','',$newfiletmp);
|
||||
$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
|
||||
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
|
||||
// Get extension (ods or odt)
|
||||
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
|
||||
if ( ! empty($conf->global->MAIN_ODT_USE_TIMING))
|
||||
{
|
||||
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
|
||||
}
|
||||
else
|
||||
{
|
||||
$filename=$newfiletmp.'.'.$newfileformat;
|
||||
}
|
||||
$file=$dir.'/'.$filename;
|
||||
$object->builddoc_filename=$filename; // For triggers
|
||||
//print "newfileformat=".$newfileformat;
|
||||
//print "newdir=".$dir;
|
||||
//print "newfile=".$newfile;
|
||||
//print "file=".$file;
|
||||
//print "conf->societe->dir_temp=".$conf->societe->dir_temp;
|
||||
//exit;
|
||||
|
||||
dol_mkdir($conf->societe->multidir_temp[$object->entity]);
|
||||
|
||||
@ -313,8 +324,12 @@ class doc_generic_odt extends ModeleThirdPartyDoc
|
||||
$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Write new file
|
||||
//$result=$odfHandler->exportAsAttachedFile('toto');
|
||||
$odfHandler->saveToDisk($file);
|
||||
if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
|
||||
$odfHandler->exportAsAttachedPDF($file);
|
||||
}
|
||||
else {
|
||||
$odfHandler->saveToDisk($file);
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
@ -40,11 +40,6 @@ $langs->load("main");
|
||||
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
|
||||
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
|
||||
|
||||
//var_dump($langs->defaultlang);
|
||||
//var_dump($conf->format_date_short_java);
|
||||
//var_dump($langs->trans("FormatDateShortJava"));
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
var required = jQuery("#required");
|
||||
var default_value = jQuery("#default_value");
|
||||
<?php
|
||||
if(GETPOST('type') != "select")
|
||||
if((GETPOST('type') != "select") && (GETPOST('type') != "sellist"))
|
||||
{
|
||||
print 'jQuery("#value_choice").hide();';
|
||||
}
|
||||
@ -48,6 +48,7 @@
|
||||
else if (type == 'boolean') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").hide();}
|
||||
else if (type == 'price') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").hide();}
|
||||
else if (type == 'select') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();}
|
||||
else if (type == 'sellist') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();}
|
||||
else if (type == 'checkbox') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();}
|
||||
else if (type == 'radio') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();}
|
||||
else if (type == 'separate') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); required.val('').attr('disabled','disabled'); default_value.val('').attr('disabled','disabled'); jQuery("#value_choice").hide();}
|
||||
@ -63,6 +64,7 @@
|
||||
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||
<input type="hidden" name="action" value="add">
|
||||
<input type="hidden" name="rowid" value="<?php echo $rowid ?>">
|
||||
|
||||
<table summary="listofattributes" class="border centpercent">
|
||||
<!-- Type -->
|
||||
@ -85,7 +87,7 @@
|
||||
<table class="nobordernopadding">
|
||||
<tr><td width="30%">
|
||||
<textarea name="param" id="param"><?php echo GETPOST('param'); ?></textarea>
|
||||
</td><td><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelp"),1,0)?></td></tr>
|
||||
</td><td><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelp".$type),1,0)?></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||
<input type="hidden" name="attrname" value="<?php echo $attrname; ?>">
|
||||
<input type="hidden" name="action" value="update">
|
||||
<input type="hidden" name="rowid" value="<?php echo $rowid ?>">
|
||||
|
||||
<table summary="listofattributes" class="border centpercent">
|
||||
|
||||
@ -80,7 +81,7 @@ if((($type == 'select') || ($type == 'checkbox') ||(($type == 'radio'))) && is_a
|
||||
</td></tr>
|
||||
<!-- Value (for select list / radio) -->
|
||||
<?php
|
||||
if(($type == 'select') || ($type == 'checkbox') ||(($type == 'radio')))
|
||||
if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') ||(($type == 'radio')))
|
||||
{
|
||||
?>
|
||||
<tr id="value_choice">
|
||||
@ -88,7 +89,11 @@ if(($type == 'select') || ($type == 'checkbox') ||(($type == 'radio')))
|
||||
<?php echo $langs->trans("Value"); ?>
|
||||
</td>
|
||||
<td>
|
||||
<table class="nobordernopadding">
|
||||
<tr><td width="30%">
|
||||
<textarea name="param" id="param"><?php echo $param_chain; ?></textarea>
|
||||
</td><td><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelp".$type),1,0)?></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
@ -80,8 +80,8 @@ if (! empty($conf->margin->enabled)) {
|
||||
'origin_price_ht_cache' => 'price_ht',
|
||||
'origin_tva_tx_cache' => 'tva_tx',
|
||||
'origin_price_ttc_cache' => 'price_ttc',
|
||||
'qty' => 'qty'
|
||||
,'remise_percent' => 'discount'
|
||||
'qty' => 'qty',
|
||||
'remise_percent' => 'discount'
|
||||
),
|
||||
'update_textarea' => array(
|
||||
'product_desc' => 'desc'
|
||||
@ -160,7 +160,10 @@ if (! empty($conf->margin->enabled)) {
|
||||
<input type="hidden" id="origin_price_ttc_cache" name="origin_price_ttc_cache" value="" />
|
||||
</td>
|
||||
<td align="right"><input type="text" size="3" id="qty" name="qty" value="<?php echo (GETPOST('qty')?GETPOST('qty'):1); ?>"></td>
|
||||
<td align="right" nowrap="nowrap"><input type="text" size="1" value="<?php echo $buyer->remise_client; ?>" id="remise_percent" name="remise_percent">%</td>
|
||||
<td align="right" nowrap="nowrap">
|
||||
<input type="text" size="1" value="<?php echo $buyer->remise_client; ?>" id="remise_percent" name="remise_percent">%
|
||||
<input type="hidden" id="origin_remise_percent" name="origin_remise_percent" value="<?php echo $buyer->remise_client; ?>" />
|
||||
</td>
|
||||
<?php
|
||||
$colspan = 4;
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
@ -373,6 +376,11 @@ $(document).ready(function() {
|
||||
$('#price_ttc').attr('disabled','disabled');
|
||||
}
|
||||
|
||||
$('#remise_percent').bind('change', function() {
|
||||
if ($(this).val() < $('#origin_remise_percent').val())
|
||||
$('#remise_percent').val($('#origin_remise_percent').val());
|
||||
});
|
||||
|
||||
$('#tva_tx').change(function() {
|
||||
if ($(this).val() == 0) {
|
||||
if ($('#idprod').val() == 0) {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 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,7 +36,8 @@ class InterfaceNotification
|
||||
'PROPAL_VALIDATE',
|
||||
'FICHINTER_VALIDATE',
|
||||
'ORDER_SUPPLIER_APPROVE',
|
||||
'ORDER_SUPPLIER_REFUSE'
|
||||
'ORDER_SUPPLIER_REFUSE',
|
||||
'SHIPPING_VALIDATE'
|
||||
);
|
||||
|
||||
/**
|
||||
@ -196,6 +198,19 @@ class InterfaceNotification
|
||||
$notify = new Notify($this->db);
|
||||
$notify->send($action, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf);
|
||||
}
|
||||
elseif ($action == 'SHIPPING_VALIDATE')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
$ref = dol_sanitizeFileName($object->ref);
|
||||
$filepdf = $conf->expedition->dir_output . '/sending/' . $ref . '/' . $ref . '.pdf';
|
||||
if (! file_exists($filepdf)) $filepdf='';
|
||||
$mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated",$object->ref);
|
||||
|
||||
|
||||
$notify = new Notify($this->db);
|
||||
$notify->send($action, $object->socid, $mesg, 'expedition', $object->id, $filepdf);
|
||||
}
|
||||
|
||||
// If not found
|
||||
/*
|
||||
|
||||
@ -142,7 +142,8 @@ class EcmDirectory // extends CommonObject
|
||||
|
||||
$dir=$conf->ecm->dir_output.'/'.$this->getRelativePath();
|
||||
$result=dol_mkdir($dir);
|
||||
|
||||
if ($result < 0) { $error++; $this->error="ErrorFailedToCreateDir"; }
|
||||
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
|
||||
@ -118,6 +118,7 @@ if ($action == 'add' && $user->rights->ecm->setup)
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessage($langs->trans($ecmdir->error), 'errors');
|
||||
setEventMessage($ecmdir->errors, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1199,7 +1199,7 @@ class Expedition extends CommonObject
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$listmeths = array();
|
||||
$this->listmeths = array();
|
||||
$i=0;
|
||||
|
||||
$sql = "SELECT em.rowid, em.code, em.libelle, em.description, em.tracking, em.active";
|
||||
@ -1216,29 +1216,11 @@ class Expedition extends CommonObject
|
||||
$label=$langs->trans('SendingMethod'.$obj->code);
|
||||
$this->listmeths[$i]['libelle'] = ($label != 'SendingMethod'.$obj->code?$label:$obj->libelle);
|
||||
$this->listmeths[$i]['description'] = $obj->description;
|
||||
if ($obj->tracking)
|
||||
{
|
||||
$this->listmeths[$i]['tracking'] = $obj->tracking;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($obj->code)
|
||||
{
|
||||
$classname = "methode_expedition_".strtolower($obj->code);
|
||||
|
||||
if (file_exists(DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_".strtolower($obj->code).".modules.php") )
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_".strtolower($obj->code).'.modules.php';
|
||||
$shipmethod = new $classname();
|
||||
$this->listmeths[$i]['tracking'] = $shipmethod->provider_url_status('{TRACKID}');
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->listmeths[$i]['tracking'] = $obj->tracking;
|
||||
$this->listmeths[$i]['active'] = $obj->active;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else dol_print_error($this->db,'');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1309,8 +1291,6 @@ class Expedition extends CommonObject
|
||||
*/
|
||||
function GetUrlTrackingStatus($value='')
|
||||
{
|
||||
$code='';
|
||||
|
||||
if (! empty($this->shipping_method_id))
|
||||
{
|
||||
$sql = "SELECT em.code, em.tracking";
|
||||
@ -1322,46 +1302,21 @@ class Expedition extends CommonObject
|
||||
{
|
||||
if ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$code = $obj->code;
|
||||
$tracking = $obj->tracking;
|
||||
$tracking = $obj->tracking;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($tracking)
|
||||
{
|
||||
$url = str_replace('{TRACKID}', $value, $tracking);
|
||||
$this->tracking_url = sprintf('<a target="_blank" href="%s">'.($value?$value:'url').'</a>',$url,$url);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($code)
|
||||
{
|
||||
$classname = "methode_expedition_".strtolower($code);
|
||||
|
||||
$url='';
|
||||
if (file_exists(DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_".strtolower($code).".modules.php") && ! empty($this->tracking_number))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_".strtolower($code).'.modules.php';
|
||||
$shipmethod = new $classname();
|
||||
$url = $shipmethod->provider_url_status($this->tracking_number);
|
||||
}
|
||||
|
||||
if ($url)
|
||||
{
|
||||
$this->tracking_url = sprintf('<a target="_blank" href="%s">'.($value?$value:'url').'</a>',$url,$url);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tracking_url = $value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tracking_url = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($tracking) && !empty($value))
|
||||
{
|
||||
$url = str_replace('{TRACKID}', $value, $tracking);
|
||||
$this->tracking_url = sprintf('<a target="_blank" href="%s">'.($value?$value:'url').'</a>',$url,$url);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tracking_url = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Classify the shipping as invoiced
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 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
|
||||
@ -698,16 +699,16 @@ if ($action == 'create')
|
||||
//$lines = $object->fetch_lines(1);
|
||||
$numAsked = count($object->lines);
|
||||
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#autofill").click(function() {';
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#autofill").click(function() {';
|
||||
$i=0;
|
||||
while($i < $numAsked)
|
||||
{
|
||||
print 'jQuery("#qtyl'.$i.'").val(jQuery("#qtyasked'.$i.'").val() - jQuery("#qtydelivered'.$i.'").val());'."\n";
|
||||
$i++;
|
||||
}
|
||||
print '});
|
||||
}
|
||||
print '});
|
||||
jQuery("#autoreset").click(function() {';
|
||||
$i=0;
|
||||
while($i < $numAsked)
|
||||
@ -716,8 +717,8 @@ if ($action == 'create')
|
||||
$i++;
|
||||
}
|
||||
print '});
|
||||
});
|
||||
</script>';
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
@ -904,7 +905,7 @@ if ($action == 'create')
|
||||
|
||||
print '<br><center><input type="submit" class="button" value="'.$langs->trans("Create").'"></center>';
|
||||
|
||||
print '</form>';
|
||||
print '</form>';
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
@ -974,7 +975,18 @@ else
|
||||
{
|
||||
$numref = $object->ref;
|
||||
}
|
||||
$ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('ValidateSending'),$langs->trans("ConfirmValidateSending",$numref),'confirm_valid','',0,1);
|
||||
|
||||
$text = $langs->trans("ConfirmValidateSending",$numref);
|
||||
|
||||
if (! empty($conf->notification->enabled))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php';
|
||||
$notify=new Notify($db);
|
||||
$text.='<br>';
|
||||
$text.=$notify->confirmMessage('SHIPPING_VALIDATE',$object->socid);
|
||||
}
|
||||
|
||||
$ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('ValidateSending'),$text,'confirm_valid','',0,1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
/*
|
||||
|
||||
@ -25,12 +25,12 @@
|
||||
|
||||
require '../main.inc.php';
|
||||
|
||||
$langs->load("externalsite@externalsite");
|
||||
$langs->load("externalsite");
|
||||
|
||||
if (empty($conf->global->EXTERNALSITE_URL))
|
||||
{
|
||||
llxHeader();
|
||||
print '<div class="error">Module ExternalSite was not configured properly.</div>';
|
||||
print '<div class="error">'.$langs->trans('ExternalSiteModuleNotComplete').'</div>';
|
||||
llxFooter();
|
||||
}
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
require ("../main.inc.php");
|
||||
|
||||
$langs->load("@externalsite");
|
||||
$langs->load("externalsite");
|
||||
|
||||
top_htmlhead("","");
|
||||
top_menu("","","_top");
|
||||
|
||||
@ -100,7 +100,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print "<tr $bc[$var]><td>".$langs->trans("Intervention")." PDF</td>";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=ficheinter&file='.urlencode($relativepath).'">'.$object->ref.'.pdf</a></td>';
|
||||
print '<td><a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart=ficheinter&file='.urlencode($relativepath).'">'.$object->ref.'.pdf</a></td>';
|
||||
print '<td align="right">'.dol_print_size(dol_filesize($file)).'</td>';
|
||||
print '<td align="right">'.dol_print_date(dol_filemtime($file),'dayhour').'</td>';
|
||||
print '</tr>';
|
||||
@ -110,7 +110,7 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
print "<tr $bc[$var]><td>Fiche d'intervention detaillee</td>";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=ficheinter&file='.urlencode($relativepathdetail).'">'.$object->ref.'-detail.pdf</a></td>';
|
||||
print '<td><a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart=ficheinter&file='.urlencode($relativepathdetail).'">'.$object->ref.'-detail.pdf</a></td>';
|
||||
print '<td align="right">'.dol_print_size(dol_filesize($filedetail)).'</td>';
|
||||
print '<td align="right">'.dol_print_date(dol_filemtime($filedetail),'dayhour').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -386,7 +386,7 @@ else if ($action == 'setnote_public' && $user->rights->ficheinter->creer)
|
||||
else if ($action == 'setnote_private' && $user->rights->ficheinter->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES), '_private');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
@ -141,6 +141,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$sql.= ", fk_soc";
|
||||
$sql.= ", datec";
|
||||
$sql.= ", datef";
|
||||
$sql.= ", fk_projet";
|
||||
$sql.= ", note_private";
|
||||
$sql.= ", note_public";
|
||||
$sql.= ", fk_user_author";
|
||||
@ -154,6 +155,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$sql.= ", ".$this->socid;
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
$sql.= ", '".$this->db->idate($this->date)."'";
|
||||
$sql.= ", ".$this->fk_project;
|
||||
$sql.= ", '".$this->db->escape($this->note_private)."'";
|
||||
$sql.= ", '".$this->db->escape($this->note_public)."'";
|
||||
$sql.= ", ".$user->id.",";
|
||||
|
||||
@ -296,7 +296,7 @@ class ProductFournisseur extends Product
|
||||
function fetch_product_fournisseur_price($rowid)
|
||||
{
|
||||
$sql = "SELECT pfp.rowid, pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability,";
|
||||
$sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.fk_product, pfp.charges, pfp.unitcharges, pfp.recuperableonly as fourn_tva_npr";
|
||||
$sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.fk_product, pfp.charges, pfp.unitcharges"; // , pfp.recuperableonly as fourn_tva_npr"; FIXME this field not exist in llx_product_fournisseur_price
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql.= " WHERE pfp.rowid = ".$rowid;
|
||||
|
||||
@ -320,7 +320,7 @@ class ProductFournisseur extends Product
|
||||
$this->product_id = $obj->fk_product; // deprecated
|
||||
$this->fk_product = $obj->fk_product;
|
||||
$this->fk_availability = $obj->fk_availability;
|
||||
$this->fourn_tva_npr = $obj->fourn_tva_npr;
|
||||
//$this->fourn_tva_npr = $obj->fourn_tva_npr; // FIXME this field not exist in llx_product_fournisseur_price
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
|
||||
@ -1077,7 +1077,7 @@ elseif (! empty($object->id))
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php';
|
||||
$notify=new Notify($db);
|
||||
$text.='<br>';
|
||||
$text.=$notify->confirmMessage(3,$object->socid);
|
||||
$text.=$notify->confirmMessage('ORDER_SUPPLIER_APPROVE', $object->socid);
|
||||
}
|
||||
|
||||
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_valid', '', 0, 1);
|
||||
@ -1762,10 +1762,10 @@ elseif (! empty($object->id))
|
||||
|
||||
print "</div>";
|
||||
}
|
||||
print "<br>";
|
||||
print "<br>";
|
||||
|
||||
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
//print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||
//print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
|
||||
@ -54,9 +54,9 @@ if ($action == 'setnote_public' && $user->rights->fournisseur->commande->creer)
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
elseif ($action == 'setnote' && $user->rights->fournisseur->commande->creer)
|
||||
elseif ($action == 'setnote_private' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES), '_private');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
@ -41,6 +41,8 @@ if (!empty($conf->produit->enabled))
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
if (!empty($conf->projet->enabled))
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
if (! empty($conf->projet->enabled))
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
||||
|
||||
|
||||
$langs->load('bills');
|
||||
@ -271,6 +273,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
|
||||
// Creation facture
|
||||
$object->ref = $_POST['ref'];
|
||||
$object->ref_supplier = $_POST['ref_supplier'];
|
||||
$object->fk_project = GETPOST('projectid');
|
||||
$object->socid = $_POST['socid'];
|
||||
$object->libelle = $_POST['libelle'];
|
||||
$object->date = $datefacture;
|
||||
@ -1153,6 +1156,15 @@ if ($action == 'create')
|
||||
print '<tr><td>'.$langs->trans('DateMaxPayment').'</td><td>';
|
||||
$form->select_date($datedue,'ech','','','',"add",1,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load('projects');
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
|
||||
select_projects(-1, $projectid, 'projectid');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td>';
|
||||
@ -1330,12 +1342,12 @@ else
|
||||
}
|
||||
|
||||
$text=$langs->trans('ConfirmValidateBill',$numref);
|
||||
/*if (! empty($conf->notification->enabled))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php';
|
||||
$notify=new Notify($db);
|
||||
$text.='<br>';
|
||||
$text.=$notify->confirmMessage('NOTIFY_VAL_FAC_SUP',$object->socid);
|
||||
/*if (! empty($conf->notification->enabled))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php';
|
||||
$notify=new Notify($db);
|
||||
$text.='<br>';
|
||||
$text.=$notify->confirmMessage('BILL_SUPPLIER_VALIDATE',$object->socid);
|
||||
}*/
|
||||
$formquestion=array();
|
||||
|
||||
@ -2054,7 +2066,7 @@ else
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
if ($action != 'edit')
|
||||
{
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -156,12 +156,12 @@ if (GETPOST("search_societe"))
|
||||
|
||||
if (GETPOST("search_montant_ht"))
|
||||
{
|
||||
$sql .= " AND fac.total_ht = '".$db->escape(GETPOST("search_montant_ht"))."'";
|
||||
$sql .= " AND fac.total_ht = '".$db->escape(price2num(GETPOST("search_montant_ht")))."'";
|
||||
}
|
||||
|
||||
if (GETPOST("search_montant_ttc"))
|
||||
{
|
||||
$sql .= " AND fac.total_ttc = '".$db->escape(GETPOST("search_montant_ttc"))."'";
|
||||
$sql .= " AND fac.total_ttc = '".$db->escape(price2num(GETPOST("search_montant_ttc")))."'";
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
@ -85,8 +85,9 @@ if ($object->fetch($id))
|
||||
dol_fiche_head($head, 'supplier', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
|
||||
print '<table width="100%" class="notopnoleftnoright">';
|
||||
print '<tr><td valign="top" width="50%" class="notopnoleft">';
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
//print '<table width="100%" class="notopnoleftnoright">';
|
||||
//print '<tr><td valign="top" width="50%" class="notopnoleft">';
|
||||
|
||||
print '<table width="100%" class="border">';
|
||||
print '<tr><td width="20%">'.$langs->trans("ThirdPartyName").'</td><td width="80%" colspan="3">';
|
||||
@ -216,7 +217,11 @@ if ($object->fetch($id))
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</td><td valign="top" width="50%" class="notopnoleftnoright">';
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
//print '</td><td valign="top" width="50%" class="notopnoleftnoright">';
|
||||
|
||||
|
||||
$var=true;
|
||||
|
||||
$MAXLIST=5;
|
||||
@ -367,9 +372,12 @@ if ($object->fetch($id))
|
||||
}
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
print '</table>' . "\n";
|
||||
print '</div>';
|
||||
print '</div></div></div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
//print '</td></tr>';
|
||||
//print '</table>' . "\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -278,7 +278,7 @@ $var=true;
|
||||
|
||||
/*$var=!$var;
|
||||
print '<tr '.$bc[$var].'>'."\n";
|
||||
print '<td style="padding:5px; width: 40%;">'.$langs->trans('GroupToValidateCP').'</td>'."\n";
|
||||
print '<td style="padding:5px;">'.$langs->trans('GroupToValidateCP').'</td>'."\n";
|
||||
print '<td style="padding:5px;">'.$cp->selectUserGroup('userGroup').'</td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
*/
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||
* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -228,7 +228,6 @@ if ($id > 0)
|
||||
print "</tr>\n";
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -242,7 +241,15 @@ $nbaquis=$holiday->getCPforUser($user_id);
|
||||
$nbdeduced=$holiday->getConfCP('nbHolidayDeducted');
|
||||
$nb_holiday = $nbaquis / $nbdeduced;
|
||||
print $langs->trans('SoldeCPUser',round($nb_holiday,2)).($nbdeduced != 1 ? ' ('.$nbaquis.' / '.$nbdeduced.')' : '');
|
||||
print '</div>';
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
dol_fiche_end();
|
||||
print '</br>';
|
||||
}
|
||||
else {
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
print '<table class="noborder" width="100%;">';
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user