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

This commit is contained in:
Laurent Destailleur 2014-01-08 00:05:59 +01:00
commit 77cfdfd59e
42 changed files with 669 additions and 391 deletions

View File

@ -153,56 +153,63 @@ parameter. All methods addline in this case were modified to remove this paramet
***** ChangeLog for 3.4.3 compared to 3.4.2 *****
Fix: Bad get of localtaxes into contracts add lines
***** ChangeLog for 3.4.2 compared to 3.4.1 ***** ***** ChangeLog for 3.4.2 compared to 3.4.1 *****
Fix: field's problem into company's page (RIB) Fix: field's problem into company's page (RIB).
Fix: Document cerfa doesn't contained firstname & lastname from donator Fix: Document cerfa doesn't contained firstname & lastname from donator.
Fix: Bad rounding on margin calculations and display. Fix: Bad rounding on margin calculations and display.
Fix: Option drop table into backup was broken. Fix: Option drop table into backup was broken.
Fix: [ bug #1105 ] Searching Boxes other search option Fix: [ bug #1105 ] Searching Boxes other search option.
Fix: wrong buy price update Fix: wrong buy price update.
Fix: [ bug #1142 ] Set paiement on invoice (PGSql) Fix: [ bug #1142 ] Set paiement on invoice (PGSql).
Fix: [ bug #1145 ] Agenda button list type do not display Fix: [ bug #1145 ] Agenda button list type do not display.
Fix: [ bug #1148 ] Product consomation : supplier order bad status Fix: [ bug #1148 ] Product consomation : supplier order bad status.
Fix: [ bug #1159 ] Commercial search "other" give p.note do not exists Fix: [ bug #1159 ] Commercial search "other" give p.note do not exists.
Fix: [ bug #1174 ] Product translated description not good into PDF Fix: [ bug #1174 ] Product translated description not good into PDF.
Fix: [ bug #1163 ] SQL Error when searching for supplier orders Fix: [ bug #1163 ] SQL Error when searching for supplier orders.
Fix: [ bug #1162 ] Translaction for morning and afternoon Fix: [ bug #1162 ] Translaction for morning and afternoon.
Fix: [ bug #1161 ] Search on product label Fix: [ bug #1161 ] Search on product label.
Fix: [ bug #1075 ] POS module doesn't decrement stock of products in delayed payment mode. Fix: [ bug #1075 ] POS module doesn't decrement stock of products in delayed payment mode.
Fix: [ bug #1171 ] Documents lost in interventions after validating Fix: [ bug #1171 ] Documents lost in interventions after validating.
Fix: fix unsubscribe URL into mailing when sending manually (not by script) Fix: fix unsubscribe URL into mailing when sending manually (not by script).
Fix: [ bug #1182 ] ODT company_country tag is htmlencoded Fix: [ bug #1182 ] ODT company_country tag is htmlencoded.
Fix: [ bug #1196 ] Product barcode search does not expect 13th digit on EAN13 type Fix: [ bug #1196 ] Product barcode search does not expect 13th digit on EAN13 type.
Fix: [ bug #1202 ] Wrong amount in deposit % invoice from proposal Fix: [ bug #1202 ] Wrong amount in deposit % invoice from proposal.
Fix: Removed analytics tags into doc page.
Fix: Call Image on this instead of pdf.
Fix: Missing parameter for photo.
Fix: Bad SQL request for turnover report.
***** ChangeLog for 3.4.1 compared to 3.4.0 ***** ***** ChangeLog for 3.4.1 compared to 3.4.0 *****
Fix: Display buying price on line edit when no supplier price is defined Fix: Display buying price on line edit when no supplier price is defined.
Fix: Retrieving of margin info when invoice created automatically from order Fix: Retrieving of margin info when invoice created automatically from order.
Fix: Reordering supplier products in list by supplier or supplier ref was crashing Fix: Reordering supplier products in list by supplier or supplier ref was crashing.
Fix: [ bug #1029 ] Tulip numbering mask Fix: [ bug #1029 ] Tulip numbering mask.
Fix: Supplier invoice and supplier order are not displayed into object link into agenda event card Fix: Supplier invoice and supplier order are not displayed into object link into agenda event card.
Fix: [ bug #1033 ] SUPPLIER REF disappeared Fix: [ bug #1033 ] SUPPLIER REF disappeared.
Fix: update extrafield do not display immediately after update Fix: update extrafield do not display immediatly after update.
Fix: Fix bug with canvas thirdparty Fix: Fix bug with canvas thirdparty.
Fix: [ bug #1037 ] Consumption> Supplier invoices related Fix: [ bug #1037 ] Consumption> Supplier invoices related.
Fix: User group name do not display in card (view or edit mode) Fix: User group name do not display in card (view or edit mode).
Fix: Link "Show all supplier invoice" on supplier card not working Fix: Link "Show all supplier invoice" on suplier card not working.
Fix: [ bug #1039 ] Pre-defined invoices conversion Fix: [ bug #1039 ] Pre-defined invoices conversion.
Fix: If only service module is activated, it's impossible to delete service Fix: If only service module is activated, it's impossible to delete service.
Fix: [ bug #1043 ] Bad interventions ref numbering Fix: [ bug #1043 ] Bad interventions ref numbering.
Fix: Mailing module : if an email is already in destinaires list all other email from selector was not inserted Fix: Mailing module : if an email is already in destinaires list all other email from selector was not inserted.
Fix: Localtaxes balance not showing Fix: Localtaxes balance not showing.
Fix: Intervention box links to contracts id Fix: Intervention box links to contracts id.
Fix: Compatibility with multicompany module Fix: Compatiblity with multicompany module.
Fix: Edit propal line was losing product supplier price id Fix: Edit propal line was losing product supplier price id.
Fix: Delete linked element to supplier invoice when deleted Fix: Delete linked element to supplier invoice when deleted.
Fix: [ bug #1061 ] Bad info shipped products Fix: [ bug #1061 ] Bad info shipped products.
Fix: [ bug #1062 ] Documents lost in propals and contracts validating Fix: [ bug #1062 ] Documents lost in propals and contracts validating.
Fix: Supplier price displayed on document lines and margin infos didnt take discount Fix: Supplier price displayed on document lines and margin infos didnt take discount.
Fix: sorting on qty did not work in supplier product list Fix: sorting on qty did not work in supplier product list.
Fix: there was no escaping on filter fields in supplier product list Fix: there was no escaping on filter fields in supplier product list.
Fix: bugs on margin reports and better margin calculation on credit notes Fix: bugs on margin reports and better margin calculation on credit notes.
Qual: Add travis-ci integration Qual: Add travis-ci integration.
***** ChangeLog for 3.4 compared to 3.3.* ***** ***** ChangeLog for 3.4 compared to 3.3.* *****
For users: For users:
@ -301,6 +308,7 @@ backport commit 384e3812eb73a15adafb472cacfb93397a54459b to fix W3C/edit contrac
***** ChangeLog for 3.3.5 compared to 3.3.4 ***** ***** ChangeLog for 3.3.5 compared to 3.3.4 *****
- Fix: Change to make debian package ok despite removal of ckeditor.
- Fix: jcrop file to match debian rules - Fix: jcrop file to match debian rules
- Fix: Add missing country UK. - Fix: Add missing country UK.
- Fix: Minor fix into package. - Fix: Minor fix into package.

View File

@ -76,61 +76,63 @@ See ChangeLog file found into package.
### Main modules/features: ### Main modules/features:
- Customers, Prospects or Suppliers directory - Customers, Prospects or Suppliers directory.
- Products and services catalog - Products and services catalog.
- Bank accounts management - Bank accounts management.
- Orders management - Orders management.
- Commercial proposals management - Commercial proposals management.
- Contracts management - Contracts management.
- Invoices management - Invoices management.
- Payments management - Payments management.
- Standing orders management - Standing orders management.
- Stock management - Stock management.
- Shipping management - Shipping management.
- PDF or ODT generation for invoice, proposals, orders... - PDF or ODT generation for invoice, proposals, orders...
- Agenda with ical,vcal export for third tools integration - Agenda with ical,vcal export for third tools integration.
- EDM (Electronic Document Management) - EDM (Electronic Document Management).
- Foundations members management - Foundations members management.
- Employee's holidays management - Employee's holidays management.
- Mass Emailing - Mass Emailing.
- Realize surveys - Realize surveys.
- Point of Sale - Point of Sale.
### Other modules: ### Other modules:
- Bookmarks management - Bookmarks management.
- Donations management - Donations management.
- Reporting - Reporting.
- Data export/import - Data export/import.
- LDAP connectivity - Third parties or products categories.
- Third parties or products categories - LDAP connectivity.
- ClickToDial integration - ClickToDial integration.
- RSS integration - RSS integration.
- Can be extended with a lot of other external modules available onto DoliStore.com.
### Miscellaneous: ### Miscellaneous:
- Multi-user, with several permissions levels for each feature. - Multi-user, with several permissions levels for each feature.
- Serveral menu managers (can be used by internal users, as a back-office, with a particular menu, or by external users, as a front-office, with another menu and permissions).
- Very user friendly and easy to use. - Very user friendly and easy to use.
- Optional WYSIWYG forms, optional Ajax forms. - Highly customizable: Enable only modules you need, user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one).
- Several skins. - Works with PHP 5.2.1, MySql 4.1 or PostgreSQL 8.1.
- Code is highly customizable (a lot of use of modules and submodules). - Compatible with all Cloud solutions that match MySql, PHP or PostgreSQL prerequisites.
- Works with Mysql 4.1 or higher, or PostgreSql 8.14 or higher. - An easy to understand, maintain and code interfaces with your own system information (PHP with no heavy frameworks, trigger and hook architecture).
- Works with PHP 5.0 or higher. - Support countries specific features:
- An easy to understand and maintain code (PHP with no heavy frameworks). Spanish Tax RE and ISPF.
- A trigger architecture to allow you to make Dolibarr business events run PHP code to update your own information system. French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM).
- "NPR VAT Rate" (French particularity for managing VAT in DOM-TOM called "Non Perçue Récupérable"). Canadian double taxes (federal/province) and other countries using cumulative VAT.
Tunisian tax stamp.
Compatible with European directives (2006/112/CE ... 2010/45/UE) (http://europa.eu/legislation_summaries/taxation/l31057_en.htm)
...
## WHAT DOLIBARR CAN'T DO YET (TODO LIST) ## WHAT DOLIBARR CAN'T DO YET (TODO LIST)
This is features that Dolibarr does not support completely yet: This is features that Dolibarr does not support completely yet:
- No double party accountancy (only bank management). - No double party accountancy (only bank and treasury management).
- Dolibarr manage one currency at once (mono-currency). - Dolibarr manage one currency at once (mono-currency).
- Dolibarr manage one master company/foundation (mono-company). If you want to manage several companies or foundations, you must install several time the software (on same server or not). Another solution is to extend Dolibarr with the addon Module MultiCompany that allows to manage several companies in one Dolibarr instance (one database but with a logical isolation of datas). - Dolibarr manage one master activity (mono-company). If you want to manage several companies or foundations, you must install several time the software (on same server or not). Another solution is to extend Dolibarr with the addon Module MultiCompany that allows to manage several companies in one Dolibarr instance (one database but with a logical isolation of datas).
- Dolibarr does not contains Payroll module.
- Tasks on module project can't have dependencies between each other. - Tasks on module project can't have dependencies between each other.
- Dolibarr does not contains Payroll module.
- Dolibarr does not include any Webmail. - Dolibarr does not include any Webmail.
- Dolibarr can't do coffee (not yet). - Dolibarr can't do coffee (not yet).

View File

@ -158,7 +158,7 @@ foreach ($modulesdir as $dir)
if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified=0; if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified=0;
if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified=0; if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified=0;
// We discard modules according to property disabled // We discard modules according to property disabled
if (isset($objMod->hidden) && $objMod->hidden) $modulequalified=false; if (! empty($objMod->hidden)) $modulequalified=false;
// Define array $categ with categ with at least one qualified module // Define array $categ with categ with at least one qualified module
if ($modulequalified) if ($modulequalified)

View File

@ -528,13 +528,13 @@ class Categorie
} }
/** /**
* Return list of contents of a category * Return list of id of elements having this category
* *
* @param string $field Field name for select in table. Full field name will be fk_field. * @param string $field Field name for select in table. Full field name will be fk_field.
* @param string $classname PHP Class of object to store entity * @param string $classname PHP Class of object to store entity
* @param string $category_table Table name for select in table. Full table name will be PREFIX_categorie_table. * @param string $category_table Table name for select in table. Full table name will be PREFIX_categorie_table.
* @param string $object_table Table name for select in table. Full table name will be PREFIX_table. * @param string $object_table Table name for select in table. Full table name will be PREFIX_table.
* @return void * @return mixed -1 if KO, array of instance of object if OK
*/ */
function get_type($field,$classname,$category_table='',$object_table='') function get_type($field,$classname,$category_table='',$object_table='')
{ {

View File

@ -365,6 +365,8 @@ if($object->type == 2)
$var=true; $var=true;
foreach ($socs as $key => $soc) foreach ($socs as $key => $soc)
{ {
if ($user->societe_id > 0 && $soc->id != $user->societe_id) continue; // External user always see only themself
$i++; $i++;
$var=!$var; $var=!$var;
print "\t<tr ".$bc[$var].">\n"; print "\t<tr ".$bc[$var].">\n";

View File

@ -250,9 +250,12 @@ if ($id > 0)
// Country // Country
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
$img=picto_from_langcode($object->country_code); if (! empty($object->country_code))
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); {
else print ($img?$img.' ':'').$object->country; $img=picto_from_langcode($object->country_code);
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
else print ($img?$img.' ':'').$object->country;
}
print '</td></tr>'; print '</td></tr>';
// EMail // EMail

View File

@ -52,7 +52,9 @@ $startyear=$year-1;
$endyear=$year; $endyear=$year;
$langs->load('orders'); $langs->load('orders');
$langs->load('companies');
$langs->load('other'); $langs->load('other');
$langs->load('suppliers');
/* /*

View File

@ -27,8 +27,7 @@
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
/** /**
* \class Deplacement * Class to manage trips and working credit notes
* \brief Class to manage trips and working credit notes
*/ */
class Deplacement extends CommonObject class Deplacement extends CommonObject
{ {
@ -65,6 +64,9 @@ class Deplacement extends CommonObject
{ {
$this->db = $db; $this->db = $db;
$this->statuts_short = array(0 => 'Draft', 1 => 'Validated', 2 => 'Closed');
$this->statuts = array(0 => 'Draft', 1 => 'Validated', 2 => 'Closed');
return 1; return 1;
} }
@ -327,7 +329,6 @@ class Deplacement extends CommonObject
} }
if ($mode == 4) if ($mode == 4)
{ {
//if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
} }

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2013 Antoine Iauch <aiauch@gpcsolutions.fr> /* Copyright (C) 2013 Antoine Iauch <aiauch@gpcsolutions.fr>
* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -173,23 +174,21 @@ report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportl
// SQL request // SQL request
$catotal=0; $catotal=0;
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES')
{
$sql = "SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label,"; $sql = "SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label,";
$sql.= " sum(l.total_ht) as amount, sum(l.total_ttc) as amount_ttc"; $sql.= " sum(l.total_ht) as amount, sum(l.total_ttc) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as l, ".MAIN_DB_PREFIX."product as p";
$sql.= " JOIN ".MAIN_DB_PREFIX."facturedet as l"; if ($selected_cat === -2) // Without any category
$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";
$sql.=" LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; }
} else if ($selected_cat) // Into a specific category
if ($selected_cat && $selected_cat !== -2) { {
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON c.rowid = " . $selected_cat; $sql.= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp";
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.= " WHERE l.fk_product = p.rowid";
$sql.= " AND l.fk_facture = f.rowid";
$sql.= " AND f.fk_statut in (1,2)"; $sql.= " AND f.fk_statut in (1,2)";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql.= " AND f.type IN (0,1,2)"; $sql.= " AND f.type IN (0,1,2)";
@ -199,16 +198,21 @@ if ($modecompta == 'CREANCES-DETTES') {
if ($date_start && $date_end) { if ($date_start && $date_end) {
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
} }
if ($selected_cat === -2) { if ($selected_cat === -2) // Without any category
$sql.=" AND cp.fk_product is null"; {
} $sql.=" AND cp.fk_product is null";
if ($selected_cat && $selected_cat !== -2) { }
$sql.= " AND cp.fk_product = p.rowid"; else if ($selected_cat) { // Into a specific category
} $sql.= " AND (c.rowid = ".$selected_cat;
if ($subcat) $sql.=" OR c.fk_parent = " . $selected_cat;
$sql.= ")";
$sql.= " AND cp.fk_categorie = c.rowid AND cp.fk_product = p.rowid";
}
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
$sql.= " GROUP BY p.rowid "; $sql.= " GROUP BY p.rowid";
$sql.= "ORDER BY p.ref "; $sql.= " ORDER BY p.ref";
dol_syslog("cabyprodserv sql=".$sql);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
@ -384,7 +388,10 @@ if ($modecompta == 'CREANCES-DETTES') {
print '</form>'; print '</form>';
} else { } else {
// $modecompta != 'CREANCES-DETTES' // $modecompta != 'CREANCES-DETTES'
print '<br>'.$langs->trans("TurnoverPerProductInCommitmentAccountingNotRelevant") . '<br>'; // "Calculation of part of each product for accountancy in this mode is not possible. When a partial payment (for example 5 euros) is done on an
// invoice with 2 product (product A for 10 euros and product B for 20 euros), what is part of paiment for product A and part of paiment for product B ?
// Because there is no way to know this, this report is not relevant.
print '<br>'.$langs->trans("TurnoverPerProductInCommitmentAccountingNotRelevant") . '<br>';
} }
llxFooter(); llxFooter();

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2013 Antoine Iauch <aiauch@gpcsolutions.fr> * Copyright (C) 2013 Antoine Iauch <aiauch@gpcsolutions.fr>
@ -180,17 +180,14 @@ $catotal=0;
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES') {
$sql = "SELECT DISTINCT s.rowid as socid, s.nom as name,"; $sql = "SELECT DISTINCT s.rowid as socid, s.nom as name,";
$sql.= " sum(f.total) as amount, sum(f.total_ttc) as amount_ttc"; $sql.= " sum(f.total) as amount, sum(f.total_ttc) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
$sql.= " JOIN ".MAIN_DB_PREFIX."facture as f"; if ($selected_cat === -2) // Without any category
if ($selected_cat === -2) { {
$sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_societe"; $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_societe";
} }
if ($selected_cat && $selected_cat !== -2) { else if ($selected_cat) // Into a specific category
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON c.rowid = ".$selected_cat; {
if ($subcat) { $sql.= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs";
$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)"; $sql.= " WHERE f.fk_statut in (1,2)";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
@ -202,28 +199,50 @@ if ($modecompta == 'CREANCES-DETTES') {
if ($date_start && $date_end) { if ($date_start && $date_end) {
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
} }
if ($selected_cat === -2) { if ($selected_cat === -2) // Without any category
{
$sql.=" AND cs.fk_societe is null"; $sql.=" AND cs.fk_societe is null";
} }
if ($selected_cat && $selected_cat !== -2) { else if ($selected_cat) { // Into a specific category
$sql.= " AND cs.fk_societe = s.rowid"; $sql.= " AND (c.rowid = ".$selected_cat;
if ($subcat) $sql.=" OR c.fk_parent = " . $selected_cat;
$sql.= ")";
$sql.= " AND cs.fk_categorie = c.rowid AND cs.fk_societe = s.rowid";
} }
} else { } else {
/* /*
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les * 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) * vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
*/ */
$sql = "SELECT s.rowid as socid, s.nom as name, sum(pf.amount) as amount_ttc"; $sql = "SELECT s.rowid as socid, s.nom as name, sum(pf.amount) as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
$sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf"; $sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf";
$sql.= ", ".MAIN_DB_PREFIX."paiement as p"; $sql.= ", ".MAIN_DB_PREFIX."paiement as p";
$sql .= " WHERE p.rowid = pf.fk_paiement"; $sql.= ", ".MAIN_DB_PREFIX."societe as s";
if ($selected_cat === -2) // Without any category
{
$sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_societe";
}
else if ($selected_cat) // Into a specific category
{
$sql.= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs";
}
$sql.= " WHERE p.rowid = pf.fk_paiement";
$sql.= " AND pf.fk_facture = f.rowid"; $sql.= " AND pf.fk_facture = f.rowid";
$sql.= " AND f.fk_soc = s.rowid"; $sql.= " AND f.fk_soc = s.rowid";
if ($date_start && $date_end) { if ($date_start && $date_end) {
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
} }
if ($selected_cat === -2) // Without any category
{
$sql.=" AND cs.fk_societe is null";
}
else if ($selected_cat) { // Into a specific category
$sql.= " AND (c.rowid = ".$selected_cat;
if ($subcat) $sql.=" OR c.fk_parent = " . $selected_cat;
$sql.= ")";
$sql.= " AND cs.fk_categorie = c.rowid AND cs.fk_societe = s.rowid";
}
} }
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
if ($socid) $sql.= " AND f.fk_soc = ".$socid; if ($socid) $sql.= " AND f.fk_soc = ".$socid;
@ -231,6 +250,7 @@ $sql.= " GROUP BY s.rowid, s.nom";
$sql.= " ORDER BY s.rowid"; $sql.= " ORDER BY s.rowid";
//echo $sql; //echo $sql;
dol_syslog("casoc sql=".$sql);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
@ -251,7 +271,7 @@ if ($result) {
// On ajoute les paiements anciennes version, non lies par paiement_facture // On ajoute les paiements anciennes version, non lies par paiement_facture
if ($modecompta != 'CREANCES-DETTES') { if ($modecompta != 'CREANCES-DETTES') {
$sql = "SELECT '0' as socid, 'Autres' as name, sum(DISTINCT p.amount) as amount_ttc"; $sql = "SELECT '0' as socid, 'Autres' as name, sum(p.amount) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= ", ".MAIN_DB_PREFIX."paiement as p"; $sql.= ", ".MAIN_DB_PREFIX."paiement as p";
@ -483,4 +503,4 @@ print '</form>';
llxFooter(); llxFooter();
$db->close(); $db->close();
?> ?>

View File

@ -3,8 +3,8 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -448,8 +448,8 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
$desc=$product_desc; $desc=$product_desc;
} }
$localtax1_tx=get_localtax($tva_tx,1,$object->societe); $localtax1_tx=get_localtax($tva_tx,1,$object->thirdparty);
$localtax2_tx=get_localtax($tva_tx,2,$object->societe); $localtax2_tx=get_localtax($tva_tx,2,$object->thirdparty);
// ajout prix achat // ajout prix achat
$fk_fournprice = $_POST['fournprice']; $fk_fournprice = $_POST['fournprice'];

View File

@ -213,30 +213,42 @@ if ($type == 'directory')
$textifempty = $langs->trans('NoFileFound'); $textifempty = $langs->trans('NoFileFound');
} }
else $textifempty=($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection")); 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); $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))
if ($section)
{ {
if ($section) $useajax=1;
{ if (! empty($conf->dol_use_jmobile)) $useajax=0;
$param.=($param?'?':'').(preg_replace('/^&/','',$param)); if (empty($conf->use_javascript_ajax)) $useajax=0;
if (! empty($conf->global->MAIN_ECM_DISABLE_JS)) $useajax=0;
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $param.=($param?'?':'').(preg_replace('/^&/','',$param));
$useglobalvars=1;
$form = new Form($db);
$formquestion=array('urlfile'=>array('type'=>'hidden','value'=>'','name'=>'urlfile'));
print $form->formconfirm($url,$langs->trans("DeleteFile"),$langs->trans("ConfirmDeleteFile"),'confirm_deletefile',$formquestion,"no",'deletefile');
// Enable jquery handlers on new generated HTML objects if ($useajax || $action == 'delete')
print '<script type="text/javascript">'."\n"; {
print 'jQuery(document).ready(function() {'."\n"; $urlfile='';
print 'jQuery(".deletefilelink").click(function(e) { jQuery("#urlfile").val(jQuery(this).attr("rel")); jQuery("#dialog-confirm-deletefile").dialog("open"); return false; });'."\n"; if ($action == 'delete') $urlfile=GETPOST('urlfile');
print '});'."\n";
print '</script>'."\n"; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
} $useglobalvars=1;
$form = new Form($db);
$formquestion=array('urlfile'=>array('type'=>'hidden','value'=>$urlfile,'name'=>'urlfile'));
print $form->formconfirm($url,$langs->trans("DeleteFile"),$langs->trans("ConfirmDeleteFile"),'confirm_deletefile',$formquestion,"no",($useajax?'deletefile':0));
}
if ($useajax)
{
// Enable jquery handlers on new generated HTML objects
print '<script type="text/javascript">'."\n";
print 'jQuery(document).ready(function() {'."\n";
print 'jQuery(".deletefilelink").click(function(e) { jQuery("#urlfile").val(jQuery(this).attr("rel")); jQuery("#dialog-confirm-deletefile").dialog("open"); return false; });'."\n";
print '});'."\n";
print '</script>'."\n";
}
} }
// Close db if mode is not noajax // Close db if mode is not noajax

View File

@ -403,7 +403,7 @@ class Conf
$this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : $this->global->MAIN_UPLOAD_DOC * 1024); $this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : $this->global->MAIN_UPLOAD_DOC * 1024);
// Define list of limited modules // Define list of limited modules
if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,facture,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda'; // '' means 'all'. Note that contact is added here as it should be a module later. if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,facture,categorie,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda'; // '' means 'all'. Note that contact is added here as it should be a module later.
// Timeouts // Timeouts
if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT=10; if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT=10;

View File

@ -2525,6 +2525,19 @@ class Form
if (is_array($formquestion) && ! empty($formquestion)) if (is_array($formquestion) && ! empty($formquestion))
{ {
// First add hidden fields and value
foreach ($formquestion as $key => $input)
{
if (is_array($input) && ! empty($input))
{
if ($input['type'] == 'hidden')
{
$more.='<input type="hidden" id="'.$input['name'].'" name="'.$input['name'].'" value="'.dol_escape_htmltag($input['value']).'">'."\n";
}
}
}
// Now add questions
$more.='<table class="paddingrightonly" width="100%">'."\n"; $more.='<table class="paddingrightonly" width="100%">'."\n";
$more.='<tr><td colspan="3" valign="top">'.(! empty($formquestion['text'])?$formquestion['text']:'').'</td></tr>'."\n"; $more.='<tr><td colspan="3" valign="top">'.(! empty($formquestion['text'])?$formquestion['text']:'').'</td></tr>'."\n";
foreach ($formquestion as $key => $input) foreach ($formquestion as $key => $input)
@ -2584,10 +2597,6 @@ class Form
$more.=$input['value']; $more.=$input['value'];
$more.='</td></tr>'."\n"; $more.='</td></tr>'."\n";
} }
else if ($input['type'] == 'hidden')
{
$more.='<input type="hidden" id="'.$input['name'].'" name="'.$input['name'].'" value="'.$input['value'].'">';
}
} }
} }
$more.='</table>'."\n"; $more.='</table>'."\n";

View File

@ -813,7 +813,12 @@ class FormFile
else else
$filepath=$file['name']; $filepath=$file['name'];
*/ */
print '<a href="'.(($useinecm && ! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':$url.'?action=delete&urlfile='.urlencode($filepath).$param).'" class="deletefilelink" rel="'.$filepath.'">'.img_delete().'</a>'; $useajax=1;
if (! empty($conf->dol_use_jmobile)) $useajax=0;
if (empty($conf->use_javascript_ajax)) $useajax=0;
if (! empty($conf->global->MAIN_ECM_DISABLE_JS)) $useajax=0;
print '<a href="'.(($useinecm && $useajax)?'#':$url.'?action=delete&urlfile='.urlencode($filepath).$param).'" class="deletefilelink" rel="'.$filepath.'">'.img_delete().'</a>';
} }
else print '&nbsp;'; else print '&nbsp;';
print "</td>"; print "</td>";

View File

@ -557,19 +557,18 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ContactsForCompany") : $langs->trans("ContactsAddressesForCompany")); $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ContactsForCompany") : $langs->trans("ContactsAddressesForCompany"));
print_fiche_titre($title,$buttoncreate,''); print_fiche_titre($title,$buttoncreate,'');
print "\n".'<table class="noborder" width="100%">'."\n";
$param="socid=".$object->id;
if ($search_status != '') $param.='&amp;search_status='.$search_status;
if ($search_name != '') $param.='&amp;search_name='.urlencode($search_name);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">'; print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">';
print '<input type="hidden" name="socid" value="'.$object->id.'">'; print '<input type="hidden" name="socid" value="'.$object->id.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
$colspan=8; print "\n".'<table class="noborder" width="100%">'."\n";
$param="socid=".$object->id;
if ($search_status != '') $param.='&amp;search_status='.$search_status;
if ($search_name != '') $param.='&amp;search_name='.urlencode($search_name);
$colspan=9;
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Poste"),$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Poste"),$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder);
@ -579,21 +578,20 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email","",$param,'',$sortfield,$sortorder);
if (! empty($conf->skype->enabled)) if (! empty($conf->skype->enabled))
{ {
$colspan++; $colspan++;
print '<td>'.$langs->trans("Skype").'</td>'; print '<td>'.$langs->trans("Skype").'</td>';
} }
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'',$sortfield,$sortorder);
// Copy to clipboard
print "<td>&nbsp;</td>"; print "<td>&nbsp;</td>";
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) // Add to agenda
{ if (! empty($conf->agenda->enabled) && ! empty($user->rights->agenda->myactions->create))
$colspan++;
print '<td>&nbsp;</td>';
}
if ($user->rights->societe->contact->creer)
{ {
$colspan++; $colspan++;
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
} }
// Edit
print '<td>&nbsp;</td>';
print "</tr>"; print "</tr>";
@ -603,7 +601,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print '</td>'; print '</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
@ -612,21 +610,26 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
if (! empty($conf->skype->enabled)) if (! empty($conf->skype->enabled))
{ {
$colspan++; $colspan++;
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
} }
print '<td class="liste_titre">';
// Status
print '<td class="liste_titre maxwidthonsmartphone">';
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
print '</td>'; print '</td>';
// Copy to clipboard
print "<td>&nbsp;</td>"; print "<td>&nbsp;</td>";
// Add to agenda
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
{ {
$colspan++; $colspan++;
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
} }
// Edit
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" 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 '<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 '</td>';
@ -689,9 +692,10 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print '</td>'; print '</td>';
} }
// Status
print '<td>'.$contactstatic->getLibStatut(5).'</td>'; print '<td>'.$contactstatic->getLibStatut(5).'</td>';
// copy in clipboard // Copy to clipboard
$coords = ''; $coords = '';
if (!empty($object->name)) if (!empty($object->name))
$coords .= addslashes($object->name)."<br />"; $coords .= addslashes($object->name)."<br />";
@ -722,10 +726,12 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
if (!empty($object->country)) if (!empty($object->country))
$coords .= "<br />".addslashes($object->country); $coords .= "<br />".addslashes($object->country);
} }
print '<td align="center"><a href="#" onclick="return copyToClipboard(\''.$coords.'\');">'; print '<td align="center"><a href="#" onclick="return copyToClipboard(\''.$coords.'\');">';
print img_picto($langs->trans("Address"), 'object_address.png'); print img_picto($langs->trans("Address"), 'object_address.png');
print '</a></td>'; print '</a></td>';
// Add to agenda
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
{ {
print '<td align="center">'; print '<td align="center">';
@ -739,8 +745,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print img_object($langs->trans("Event"),"action"); print img_object($langs->trans("Event"),"action");
print '</a></td>'; print '</a></td>';
} }
// Edit
if ($user->rights->societe->contact->creer) if ($user->rights->societe->contact->creer)
{ {
print '<td align="right">'; print '<td align="right">';
@ -748,7 +754,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print img_edit(); print img_edit();
print '</a></td>'; print '</a></td>';
} }
else print '<td>&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
@ -762,6 +768,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
} }
print "\n</table>\n"; print "\n</table>\n";
print '</form>'."\n";
print "<br>\n"; print "<br>\n";
?> ?>
<div id="dialog" title="<?php echo dol_escape_htmltag($langs->trans('Address')); ?>" style="display: none;"> <div id="dialog" title="<?php echo dol_escape_htmltag($langs->trans('Address')); ?>" style="display: none;">

View File

@ -18,7 +18,14 @@
* or see http://www.gnu.org/ * or see http://www.gnu.org/
*/ */
function payment_prepare_head($object) { /**
* Returns an array with the tabs for the "Payment" section
* It loads tabs from modules looking for the entity payment
*
* @param Paiement $object Current payment object
* @return array Tabs for the payment section
*/
function payment_prepare_head(Paiement $object) {
global $langs, $conf; global $langs, $conf;
@ -46,7 +53,14 @@ function payment_prepare_head($object) {
return $head; return $head;
} }
function payment_supplier_prepare_head($object) { /**
* Returns an array with the tabs for the "Supplier payment" section
* It loads tabs from modules looking for the entity payment_supplier
*
* @param Paiement $object Current payment object
* @return array Tabs for the payment section
*/
function payment_supplier_prepare_head(Paiement $object) {
global $langs, $conf; global $langs, $conf;

View File

@ -207,7 +207,7 @@ function project_admin_prepare_head()
* @param string $var Color * @param string $var Color
* @param int $showproject Show project columns * @param int $showproject Show project columns
* @param int &$taskrole Array of roles of user for each tasks * @param int &$taskrole Array of roles of user for each tasks
* @param int $projectsListId List of id of project allowed to user (separated with comma) * @param int $projectsListId List of id of project allowed to user (string separated with comma)
* @param int $addordertick Add a tick to move task * @param int $addordertick Add a tick to move task
* @return void * @return void
*/ */
@ -257,6 +257,22 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
} }
} }
} }
else
{
// Caller did not ask to filter on tasks of a specific user (this probably means he want also tasks of all users, into public project
// or into all other projects if user has permission to).
if (empty($user->rights->projet->all->lire))
{
// User is not allowed on this project and project is not public, so we hide line
if (! in_array($lines[$i]->fk_project, $projectsArrayId))
{
// Note that having a user assigned to a task into a project user has no permission on, should not be possible
// because assignement on task can be done only on contact of project.
// If assignement was done and after, was removed from contact of project, then we can hide the line.
$showline=0;
}
}
}
if ($showline) if ($showline)
{ {
@ -367,7 +383,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
if (! $showlineingray) $inc++; if (! $showlineingray) $inc++;
$level++; $level++;
if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId); if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, 0, $showalsopublicproj);
$level--; $level--;
$total += $lines[$i]->duration; $total += $lines[$i]->duration;
} }

View File

@ -341,7 +341,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
$sql.= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; $sql.= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
} }
} }
else if (in_array($feature,$checksoc)) else if (in_array($feature,$checksoc)) // We check feature = checksoc
{ {
// If external user: Check permission for external users // If external user: Check permission for external users
if ($user->societe_id > 0) if ($user->societe_id > 0)
@ -450,7 +450,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
} }
} }
//print $sql."<br>"; //print "sql=".$sql."<br>";
if ($sql) if ($sql)
{ {
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -72,9 +72,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 600__+MAX_llx_menu__, 'companies', 'contacts', 2__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts', 'ContactsAddresses', 0, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 600__+MAX_llx_menu__, 'companies', 'contacts', 2__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts', 'ContactsAddresses', 0, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 601__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/fiche.php?leftmenu=contacts&amp;action=create', 'NewContactAddress', 1, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 601__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/fiche.php?leftmenu=contacts&amp;action=create', 'NewContactAddress', 1, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 602__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 602__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 604__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts&amp;type=p', 'Prospects', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 604__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts&amp;type=p', 'ThirdPartyProspects', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 605__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts&amp;type=c', 'Customers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 605__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts&amp;type=c', 'ThirdPartyCustomers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 606__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts&amp;type=f', 'Suppliers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 606__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts&amp;type=f', 'ThirdPartySuppliers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 607__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts&amp;type=o', 'Others', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 607__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts&amp;type=o', 'Others', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 4, __ENTITY__);
-- Third parties - Category customer -- Third parties - Category customer
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 650__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&amp;type=1', 'SuppliersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 650__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&amp;type=1', 'SuppliersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__);

View File

@ -613,11 +613,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{ {
$langs->load("suppliers"); $langs->load("suppliers");
$newmenu->add("/fourn/liste.php?leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers'); $newmenu->add("/fourn/liste.php?leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers');
$newmenu->add("/societe/soc.php?leftmenu=suppliers&amp;action=create&amp;type=f",$langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && $user->rights->fournisseur->lire);
if (empty($user->societe_id))
{
$newmenu->add("/societe/soc.php?leftmenu=suppliers&amp;action=create&amp;type=f",$langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && $user->rights->fournisseur->lire);
}
//$newmenu->add("/fourn/liste.php?leftmenu=suppliers", $langs->trans("List"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire); //$newmenu->add("/fourn/liste.php?leftmenu=suppliers", $langs->trans("List"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire);
//$newmenu->add("/contact/list.php?leftmenu=suppliers&amp;type=f",$langs->trans("Contacts"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire && $user->rights->societe->contact->lire); //$newmenu->add("/contact/list.php?leftmenu=suppliers&amp;type=f",$langs->trans("Contacts"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire && $user->rights->societe->contact->lire);
} }
@ -640,25 +636,16 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{ {
// Categories prospects/customers // Categories prospects/customers
$newmenu->add("/categories/index.php?leftmenu=cat&amp;type=2", $langs->trans("CustomersProspectsCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); $newmenu->add("/categories/index.php?leftmenu=cat&amp;type=2", $langs->trans("CustomersProspectsCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat');
if (empty($user->societe_id)) $newmenu->add("/categories/fiche.php?action=create&amp;type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
{
$newmenu->add("/categories/fiche.php?action=create&amp;type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
}
} }
// Categories Contact // Categories Contact
$newmenu->add("/categories/index.php?leftmenu=cat&amp;type=4", $langs->trans("ContactCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); $newmenu->add("/categories/index.php?leftmenu=cat&amp;type=4", $langs->trans("ContactCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat');
if (empty($user->societe_id)) $newmenu->add("/categories/fiche.php?action=create&amp;type=4", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
{
$newmenu->add("/categories/fiche.php?action=create&amp;type=4", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
}
// Categories suppliers // Categories suppliers
if (! empty($conf->fournisseur->enabled)) if (! empty($conf->fournisseur->enabled))
{ {
$newmenu->add("/categories/index.php?leftmenu=cat&amp;type=1", $langs->trans("SuppliersCategoriesShort"), 0, $user->rights->categorie->lire); $newmenu->add("/categories/index.php?leftmenu=cat&amp;type=1", $langs->trans("SuppliersCategoriesShort"), 0, $user->rights->categorie->lire);
if (empty($user->societe_id)) $newmenu->add("/categories/fiche.php?action=create&amp;type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
{
$newmenu->add("/categories/fiche.php?action=create&amp;type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
}
} }
//if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire);
} }
@ -752,10 +739,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{ {
$langs->load("bills"); $langs->load("bills");
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills",$langs->trans("BillsCustomers"),0,$user->rights->facture->lire, '', $mainmenu, 'customers_bills'); $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills",$langs->trans("BillsCustomers"),0,$user->rights->facture->lire, '', $mainmenu, 'customers_bills');
if (empty($user->societe_id)) $newmenu->add("/compta/facture.php?action=create&amp;leftmenu=customers_bills",$langs->trans("NewBill"),1,$user->rights->facture->creer);
{
$newmenu->add("/compta/facture.php?action=create&amp;leftmenu=customers_bills",$langs->trans("NewBill"),1,$user->rights->facture->creer);
}
$newmenu->add("/compta/facture/fiche-rec.php?leftmenu=customers_bills",$langs->trans("Repeatables"),1,$user->rights->facture->lire); $newmenu->add("/compta/facture/fiche-rec.php?leftmenu=customers_bills",$langs->trans("Repeatables"),1,$user->rights->facture->lire);
$newmenu->add("/compta/facture/impayees.php?leftmenu=customers_bills",$langs->trans("Unpaid"),1,$user->rights->facture->lire); $newmenu->add("/compta/facture/impayees.php?leftmenu=customers_bills",$langs->trans("Unpaid"),1,$user->rights->facture->lire);
@ -778,10 +762,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{ {
$langs->load("bills"); $langs->load("bills");
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills'); $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
if (empty($user->societe_id)) $newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer);
{
$newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer);
}
$newmenu->add("/fourn/facture/impayees.php", $langs->trans("Unpaid"),1,$user->rights->fournisseur->facture->lire); $newmenu->add("/fourn/facture/impayees.php", $langs->trans("Unpaid"),1,$user->rights->fournisseur->facture->lire);
$newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire); $newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire);
@ -959,11 +940,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (! empty($conf->product->enabled)) if (! empty($conf->product->enabled))
{ {
$newmenu->add("/product/index.php?leftmenu=product&amp;type=0", $langs->trans("Products"), 0, $user->rights->produit->lire, '', $mainmenu, 'product'); $newmenu->add("/product/index.php?leftmenu=product&amp;type=0", $langs->trans("Products"), 0, $user->rights->produit->lire, '', $mainmenu, 'product');
if (empty($user->societe_id)) $newmenu->add("/product/fiche.php?leftmenu=product&amp;action=create&amp;type=0", $langs->trans("NewProduct"), 1, $user->rights->produit->creer);
{ $newmenu->add("/product/liste.php?leftmenu=product&amp;type=0", $langs->trans("List"), 1, $user->rights->produit->lire);
$newmenu->add("/product/fiche.php?leftmenu=product&amp;action=create&amp;type=0", $langs->trans("NewProduct"), 1, $user->rights->produit->creer);
$newmenu->add("/product/liste.php?leftmenu=product&amp;type=0", $langs->trans("List"), 1, $user->rights->produit->lire);
}
if (! empty($conf->propal->enabled)) if (! empty($conf->propal->enabled))
{ {
$newmenu->add("/product/popuprop.php?leftmenu=stats&amp;type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire && $user->rights->propale->lire); $newmenu->add("/product/popuprop.php?leftmenu=stats&amp;type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire && $user->rights->propale->lire);
@ -978,10 +956,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (! empty($conf->service->enabled)) if (! empty($conf->service->enabled))
{ {
$newmenu->add("/product/index.php?leftmenu=service&amp;type=1", $langs->trans("Services"), 0, $user->rights->service->lire, '', $mainmenu, 'service'); $newmenu->add("/product/index.php?leftmenu=service&amp;type=1", $langs->trans("Services"), 0, $user->rights->service->lire, '', $mainmenu, 'service');
if (empty($user->societe_id)) $newmenu->add("/product/fiche.php?leftmenu=service&amp;action=create&amp;type=1", $langs->trans("NewService"), 1, $user->rights->service->creer);
{
$newmenu->add("/product/fiche.php?leftmenu=service&amp;action=create&amp;type=1", $langs->trans("NewService"), 1, $user->rights->service->creer);
}
$newmenu->add("/product/liste.php?leftmenu=service&amp;type=1", $langs->trans("List"), 1, $user->rights->service->lire); $newmenu->add("/product/liste.php?leftmenu=service&amp;type=1", $langs->trans("List"), 1, $user->rights->service->lire);
if (! empty($conf->propal->enabled)) if (! empty($conf->propal->enabled))
{ {
@ -994,10 +969,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{ {
$langs->load("categories"); $langs->load("categories");
$newmenu->add("/categories/index.php?leftmenu=cat&amp;type=0", $langs->trans("Categories"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); $newmenu->add("/categories/index.php?leftmenu=cat&amp;type=0", $langs->trans("Categories"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat');
if (empty($user->societe_id)) $newmenu->add("/categories/fiche.php?action=create&amp;type=0", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
{
$newmenu->add("/categories/fiche.php?action=create&amp;type=0", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
}
//if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire);
} }
@ -1039,10 +1011,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/fourn/index.php?leftmenu=suppliers", $langs->trans("Suppliers"), 0, $user->rights->societe->lire && $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers'); $newmenu->add("/fourn/index.php?leftmenu=suppliers", $langs->trans("Suppliers"), 0, $user->rights->societe->lire && $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers');
// Security check // Security check
if (empty($user->societe_id)) $newmenu->add("/societe/soc.php?leftmenu=suppliers&amp;action=create&amp;type=f",$langs->trans("NewSupplier"), 1, $user->rights->societe->creer && $user->rights->fournisseur->lire);
{
$newmenu->add("/societe/soc.php?leftmenu=suppliers&amp;action=create&amp;type=f",$langs->trans("NewSupplier"), 1, $user->rights->societe->creer && $user->rights->fournisseur->lire);
}
$newmenu->add("/fourn/liste.php",$langs->trans("List"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire); $newmenu->add("/fourn/liste.php",$langs->trans("List"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire);
$newmenu->add("/contact/list.php?leftmenu=suppliers&amp;type=f",$langs->trans("Contacts"), 1, $user->rights->societe->contact->lire && $user->rights->fournisseur->lire); $newmenu->add("/contact/list.php?leftmenu=suppliers&amp;type=f",$langs->trans("Contacts"), 1, $user->rights->societe->contact->lire && $user->rights->fournisseur->lire);
$newmenu->add("/fourn/stats.php",$langs->trans("Statistics"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire); $newmenu->add("/fourn/stats.php",$langs->trans("Statistics"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire);
@ -1052,12 +1021,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{ {
$langs->load("bills"); $langs->load("bills");
$newmenu->add("/fourn/facture/list.php?leftmenu=orders", $langs->trans("Bills"), 0, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'orders'); $newmenu->add("/fourn/facture/list.php?leftmenu=orders", $langs->trans("Bills"), 0, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'orders');
$newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"), 1, $user->rights->fournisseur->facture->creer);
if (empty($user->societe_id))
{
$newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"), 1, $user->rights->fournisseur->facture->creer);
}
$newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"), 1, $user->rights->fournisseur->facture->lire); $newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"), 1, $user->rights->fournisseur->facture->lire);
} }
@ -1073,10 +1037,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{ {
$langs->load("categories"); $langs->load("categories");
$newmenu->add("/categories/index.php?leftmenu=cat&amp;type=1", $langs->trans("Categories"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); $newmenu->add("/categories/index.php?leftmenu=cat&amp;type=1", $langs->trans("Categories"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat');
if (empty($user->societe_id)) $newmenu->add("/categories/fiche.php?action=create&amp;type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
{
$newmenu->add("/categories/fiche.php?action=create&amp;type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
}
//if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire);
} }
@ -1196,10 +1157,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{ {
$langs->load("categories"); $langs->load("categories");
$newmenu->add("/categories/index.php?leftmenu=cat&amp;type=3", $langs->trans("Categories"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); $newmenu->add("/categories/index.php?leftmenu=cat&amp;type=3", $langs->trans("Categories"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat');
if (empty($user->societe_id)) $newmenu->add("/categories/fiche.php?action=create&amp;type=3", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
{
$newmenu->add("/categories/fiche.php?action=create&amp;type=3", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
}
//if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire);
} }

View File

@ -62,6 +62,8 @@ class modFckeditor extends DolibarrModules
$this->config_page_url = array("fckeditor.php"); $this->config_page_url = array("fckeditor.php");
// Dependances // Dependances
global $dolibarr_js_CKEDITOR;
$this->hidden = ($dolibarr_js_CKEDITOR == 'disabled'?1:0); // A condition to disable module (used for native debian packages)
$this->depends = array(); $this->depends = array();
$this->requiredby = array(); $this->requiredby = array();

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> /* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -16,12 +17,13 @@
* or see http://www.gnu.org/ * or see http://www.gnu.org/
*/ */
$langs->load("link");
/* /*
* Confirm suppression * Confirm suppression
*/ */
if ($action == 'delete') if ($action == 'delete')
{ {
$ret = $form->form_confirm( $ret = $form->form_confirm(
$_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int'), $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int'),

View File

@ -375,7 +375,7 @@ if ($id > 0 || ! empty($ref))
print '<tr>'; print '<tr>';
print '<td colspan="2">'.$langs->trans("TotalBuyingPriceMin").': '; print '<td colspan="2">'.$langs->trans("TotalBuyingPriceMin").': ';
if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')'; if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')';
print '</td>'; print '</td>';
print '<td align="right">'.($atleastonenotdefined?'':price($total,'','',0,0,-1,$conf->currency)).'</td>'; print '<td align="right">'.($atleastonenotdefined?'':price($total,'','',0,0,-1,$conf->currency)).'</td>';
if (! empty($conf->stock->enabled)) print '<td class="liste_total" align="right">&nbsp;</td>'; if (! empty($conf->stock->enabled)) print '<td class="liste_total" align="right">&nbsp;</td>';
print '</tr>'; print '</tr>';
@ -436,7 +436,7 @@ if ($id > 0 || ! empty($ref))
if (! empty($conf->categorie->enabled)) if (! empty($conf->categorie->enabled))
{ {
print '<tr><td>'.$langs->trans("CategoryFilter").' &nbsp; </td>'; print '<tr><td>'.$langs->trans("CategoryFilter").' &nbsp; </td>';
print '<td class="overflowwithjm200">'.$form->select_all_categories(0, $parent).'</td></tr>'; print '<td class="maxwidthonsmartphone">'.$form->select_all_categories(0, $parent).'</td></tr>';
} }
print '</table>'; print '</table>';
print '</form>'; print '</form>';

View File

@ -1281,7 +1281,7 @@ class Project extends CommonObject
} }
/** /**
* Clean task not linked to a parent * Clean tasks not linked to an existing parent
* *
* @return int Nb of records deleted * @return int Nb of records deleted
*/ */
@ -1292,7 +1292,7 @@ class Project extends CommonObject
// There is orphelins. We clean that // There is orphelins. We clean that
$listofid=array(); $listofid=array();
// Get list of id in array listofid // Get list of all id in array listofid
$sql='SELECT rowid FROM '.MAIN_DB_PREFIX.'projet_task'; $sql='SELECT rowid FROM '.MAIN_DB_PREFIX.'projet_task';
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
@ -1313,19 +1313,24 @@ class Project extends CommonObject
if (count($listofid)) if (count($listofid))
{ {
// Removed orphelins records print 'Code asked to check and clean orphelins.';
print 'Some orphelins were found and restored to be parents so records are visible again: ';
print join(',',$listofid);
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task"; $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task";
$sql.= " SET fk_task_parent = 0"; $sql.= " SET fk_task_parent = 0";
$sql.= " WHERE fk_task_parent NOT IN (".join(',',$listofid).")"; $sql.= " WHERE fk_task_parent NOT IN (".join(',',$listofid).")"; // So we update only records linked to a non existing parent
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$nb=$this->db->affected_rows($sql); $nb=$this->db->affected_rows($sql);
if ($nb > 0)
{
// Removed orphelins records
print 'Some orphelins were found and modified to be parent so records are visible again: ';
print join(',',$listofid);
}
return $nb; return $nb;
} }
else else

View File

@ -79,7 +79,7 @@ $userAccess=0;
/* /*
* Actions * Actions
*/ */
if ($action == 'createtask' && $user->rights->projet->creer) if ($action == 'createtask' && $user->rights->projet->creer)
{ {
@ -396,8 +396,7 @@ else
print '</td></tr></table>'; print '</td></tr></table>';
// Get list of tasks in tasksarray and taskarrayfiltered // Get list of tasks in tasksarray and taskarrayfiltered
// We need all tasks (even not limited to a user because a task to user // We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him).
// can have a parent that is not affected to him).
$tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $socid, 0); $tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $socid, 0);
// We load also tasks limited to a particular user // We load also tasks limited to a particular user
$tasksrole=($mode=='mine' ? $taskstatic->getUserRolesForProjectsOrTasks(0,$user,$object->id,0) : ''); $tasksrole=($mode=='mine' ? $taskstatic->getUserRolesForProjectsOrTasks(0,$user,$object->id,0) : '');
@ -426,7 +425,7 @@ else
{ {
// Show all lines in taskarray (recursive function to go down on tree) // Show all lines in taskarray (recursive function to go down on tree)
$j=0; $j=0;
$nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, '', 1); $nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $id, 1);
} }
else else
{ {
@ -437,13 +436,16 @@ else
// Test if database is clean. If not we clean it. // Test if database is clean. If not we clean it.
//print 'mode='.$_REQUEST["mode"].' $nboftaskshown='.$nboftaskshown.' count($tasksarray)='.count($tasksarray).' count($tasksrole)='.count($tasksrole).'<br>'; //print 'mode='.$_REQUEST["mode"].' $nboftaskshown='.$nboftaskshown.' count($tasksarray)='.count($tasksarray).' count($tasksrole)='.count($tasksrole).'<br>';
if ($mode=='mine') if (! empty($user->rights->projet->all->lire)) // We make test to clean only if user has permission to see all (test may report false positive otherwise)
{ {
if ($nboftaskshown < count($tasksrole)) $object->clean_orphelins(); if ($mode=='mine')
} {
else if ($nboftaskshown < count($tasksrole)) $object->clean_orphelins();
{ }
if ($nboftaskshown < count($tasksarray)) $object->clean_orphelins(); else
{
if ($nboftaskshown < count($tasksarray)) $object->clean_orphelins();
}
} }
} }

View File

@ -80,7 +80,7 @@ else
else print $langs->trans("ProjectsPublicDesc").'<br><br>'; else print $langs->trans("ProjectsPublicDesc").'<br><br>';
} }
// Get list of project id allowed to user // Get list of project id allowed to user (in a string list separated by coma)
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid); $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
// Get list of tasks in tasksarray and taskarrayfiltered // Get list of tasks in tasksarray and taskarrayfiltered
@ -121,7 +121,7 @@ print "</tr>\n";
// Show all lines in taskarray (recursive function to go down on tree) // Show all lines in taskarray (recursive function to go down on tree)
$j=0; $level=0; $j=0; $level=0;
$nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 1, $tasksrole, $projectsListId); $nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 1, $tasksrole, $projectsListId, 0);
print "</table>"; print "</table>";
print '</form>'; print '</form>';

View File

@ -38,12 +38,11 @@
define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site. define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
// For MultiCompany module // For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
// TODO This should be useless. Because entity must be retreive from object ref and not from url.
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_int($entity)) if (is_int($entity)) define("DOLENTITY", $entity);
{
define("DOLENTITY", $entity);
}
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';

View File

@ -27,12 +27,11 @@
define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site. define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
// For MultiCompany module // For MultiCompany module.
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : 1); // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
if (is_int($entity)) // TODO This should be useless. Because entity must be retreive from object ref and not from url.
{ $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
define("DOLENTITY", $entity); if (is_int($entity)) define("DOLENTITY", $entity);
}
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';

View File

@ -27,12 +27,11 @@
define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site. define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
// For MultiCompany module // For MultiCompany module.
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : 1); // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
if (is_int($entity)) // TODO This should be useless. Because entity must be retreive from object ref and not from url.
{ $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
define("DOLENTITY", $entity); if (is_int($entity)) define("DOLENTITY", $entity);
}
require '../../main.inc.php'; require '../../main.inc.php';

View File

@ -27,6 +27,12 @@
define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site. define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
// TODO This should be useless. Because entity must be retreive from object ref and not from url.
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_int($entity)) define("DOLENTITY", $entity);
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/paybox/lib/paybox.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paybox/lib/paybox.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';

View File

@ -26,6 +26,12 @@
define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site. define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
// TODO This should be useless. Because entity must be retreive from object ref and not from url.
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_int($entity)) define("DOLENTITY", $entity);
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/paybox/lib/paybox.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paybox/lib/paybox.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@ -95,7 +101,7 @@ llxHeaderPayBox($langs->trans("PaymentForm"));
print '<span id="dolpaymentspan"></span>'."\n"; print '<span id="dolpaymentspan"></span>'."\n";
print '<div id="dolpaymentdiv" align="center">'."\n"; print '<div id="dolpaymentdiv" align="center">'."\n";
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br>\n"; print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>\n";
if (! empty($conf->global->PAYBOX_MESSAGE_KO)) print $conf->global->PAYBOX_MESSAGE_KO; if (! empty($conf->global->PAYBOX_MESSAGE_KO)) print $conf->global->PAYBOX_MESSAGE_KO;

View File

@ -26,6 +26,12 @@
define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site. define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
// TODO This should be useless. Because entity must be retreive from object ref and not from url.
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_int($entity)) define("DOLENTITY", $entity);
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/paybox/lib/paybox.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paybox/lib/paybox.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@ -118,7 +124,7 @@ if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL))
} }
print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n"; print $langs->trans("YourPaymentHasBeenRecorded")."<br><br>\n";
if (! empty($conf->global->PAYBOX_MESSAGE_OK)) print $conf->global->PAYBOX_MESSAGE_OK; if (! empty($conf->global->PAYBOX_MESSAGE_OK)) print $conf->global->PAYBOX_MESSAGE_OK;

View File

@ -29,12 +29,11 @@
define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site. define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
// For MultiCompany module // For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
// TODO This should be useless. Because entity must be retreive from object ref and not from url.
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_int($entity)) if (is_int($entity)) define("DOLENTITY", $entity);
{
define("DOLENTITY", $entity);
}
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';

View File

@ -29,11 +29,12 @@
define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site. define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
// For MultiCompany module. This should be useless. Because entity must be retreive from object ref and not from url. // For MultiCompany module.
$entity=GETPOST('entity')?GETPOST('entity','int'):1; // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
// TODO This should be useless. Because entity must be retreive from object ref and not from url.
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_int($entity)) define("DOLENTITY", $entity); if (is_int($entity)) define("DOLENTITY", $entity);
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
@ -100,7 +101,7 @@ llxHeaderPaypal($langs->trans("PaymentForm"));
// Show ko message // Show ko message
print '<span id="dolpaymentspan"></span>'."\n"; print '<span id="dolpaymentspan"></span>'."\n";
print '<div id="dolpaymentdiv" align="center">'."\n"; print '<div id="dolpaymentdiv" align="center">'."\n";
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br>"; print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
$PAYPALTOKEN=GETPOST('TOKEN'); $PAYPALTOKEN=GETPOST('TOKEN');
if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token'); if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token');

View File

@ -29,11 +29,12 @@
define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site. define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
// For MultiCompany module. This should be useless. Because entity must be retreive from object ref and not from url. // For MultiCompany module.
$entity=GETPOST('entity')?GETPOST('entity','int'):1; // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
// TODO This should be useless. Because entity must be retreive from object ref and not from url.
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_int($entity)) define("DOLENTITY", $entity); if (is_int($entity)) define("DOLENTITY", $entity);
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
@ -128,33 +129,6 @@ if ($PAYPALTOKEN)
dol_syslog("Call paymentok with token=".$token." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_paypal'); dol_syslog("Call paymentok with token=".$token." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_paypal');
// Send an email
//if (! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL) && preg_match('/MEM=/',$fulltag))
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL))
{
//$sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL;
$sendto=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
$from=$conf->global->MAILING_EMAIL_FROM;
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile(
'['.$conf->global->MAIN_APPLICATION_TITLE.'] '.$langs->transnoentitiesnoconv("NewPaypalPaymentReceived"),
$sendto,
$from,
$langs->transnoentitiesnoconv("NewPaypalPaymentReceived")."\ntag=".$fulltag."\ntoken=".$token." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt
);
$result=$mailfile->sendfile();
if ($result)
{
dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_paypal');
}
else
{
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_paypal');
}
}
// Validate record // Validate record
if (! empty($paymentType)) if (! empty($paymentType))
{ {
@ -183,7 +157,7 @@ if ($PAYPALTOKEN)
$NOTE=urldecode($resArray["NOTE"]); $NOTE=urldecode($resArray["NOTE"]);
print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n"; print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br>\n"; print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br><br>\n";
if (! empty($conf->global->PAYPAL_MESSAGE_OK)) print $conf->global->PAYPAL_MESSAGE_OK; if (! empty($conf->global->PAYPAL_MESSAGE_OK)) print $conf->global->PAYPAL_MESSAGE_OK;
// Appel des triggers // Appel des triggers
@ -192,6 +166,30 @@ if ($PAYPALTOKEN)
$result=$interface->run_triggers('PAYPAL_PAYMENT_OK',$object,$user,$langs,$conf); $result=$interface->run_triggers('PAYPAL_PAYMENT_OK',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $errors=$interface->errors; } if ($result < 0) { $error++; $errors=$interface->errors; }
// Fin appel triggers // Fin appel triggers
// Send an email
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL))
{
$sendto=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
$from=$conf->global->MAILING_EMAIL_FROM;
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile(
'['.$conf->global->MAIN_APPLICATION_TITLE.'] '.$langs->transnoentitiesnoconv("NewPaypalPaymentReceived"),
$sendto,
$from,
$langs->transnoentitiesnoconv("NewPaypalPaymentReceived")."\ntag=".$fulltag."\ntoken=".$token." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt
);
$result=$mailfile->sendfile();
if ($result)
{
dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_paypal');
}
else
{
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_paypal');
}
}
} }
else else
{ {
@ -208,6 +206,30 @@ if ($PAYPALTOKEN)
echo "Error Severity Code: " . $ErrorSeverityCode; echo "Error Severity Code: " . $ErrorSeverityCode;
if ($mysoc->email) echo "\nPlease, send a screenshot of this page to ".$mysoc->email; if ($mysoc->email) echo "\nPlease, send a screenshot of this page to ".$mysoc->email;
// Send an email
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL))
{
$sendto=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
$from=$conf->global->MAILING_EMAIL_FROM;
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile(
'['.$conf->global->MAIN_APPLICATION_TITLE.'] '.$langs->transnoentitiesnoconv("ValidationOfPaypalPaymentFailed"),
$sendto,
$from,
$langs->transnoentitiesnoconv("PaypalConfirmPaymentPageWasCalledButFailed")."\ntag=".$fulltag."\ntoken=".$token." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt."\nErrorCode=".$ErrorCode."\nErrorLongMsg=".$ErrorLongMsg
);
$result=$mailfile->sendfile();
if ($result)
{
dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_paypal');
}
else
{
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_paypal');
}
}
} }
} }
else else

View File

@ -4,7 +4,7 @@ define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
require '../../main.inc.php'; require '../../main.inc.php';
if (empty($conf->global->MAIN_FEATURES_LEVEL)) if (!empty($conf->global->MAIN_FEATURES_LEVEL))
{ {
print "Page available onto dev environment only"; print "Page available onto dev environment only";
exit; exit;

View File

@ -158,7 +158,14 @@ if ($socid)
if (! empty($conf->agenda->enabled)) if (! empty($conf->agenda->enabled))
{ {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&socid='.$socid.'">'.$langs->trans("AddAction").'</a>'; if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&socid='.$socid.'">'.$langs->trans("AddAction").'</a>';
}
else
{
print '<a class="butActionRefused" href="#">'.$langs->trans("AddAction").'</a>';
}
} }
print '</div>'; print '</div>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2012-2013 Philippe Berthet <berthet@systune.be> /* Copyright (C) 2012-2013 Philippe Berthet <berthet@systune.be>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* *
* Version V1.1 Initial version of Philippe Berthet * Version V1.1 Initial version of Philippe Berthet
@ -30,10 +30,7 @@ require("../main.inc.php");
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
// Security check // Security check
$socid = GETPOST('socid','int'); $socid = GETPOST('socid','int');
@ -104,10 +101,6 @@ if (empty($socid))
$head = societe_prepare_head($object); $head = societe_prepare_head($object);
dol_fiche_head($head, 'consumption', $langs->trans("ThirdParty"),0,'company'); dol_fiche_head($head, 'consumption', $langs->trans("ThirdParty"),0,'company');
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="socid" value="'.$socid.'">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="25%">'.$langs->trans('ThirdPartyName').'</td>'; print '<tr><td width="25%">'.$langs->trans('ThirdPartyName').'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
@ -160,47 +153,61 @@ dol_fiche_end();
print '<br>'; print '<br>';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="socid" value="'.$socid.'">'."\n";
$sql_select=''; $sql_select='';
if ($type_element == 'invoice') if ($type_element == 'invoice')
{ // Customer : show products from invoices { // Customer : show products from invoices
$documentstatic=new Facture($db); require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$sql_select = 'SELECT f.rowid as doc_id, f.facnumber as doc_number, f.type as doc_type, f.datef as datePrint, '; $documentstatic=new Facture($db);
$tables_from = MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."facturedet as d"; $sql_select = 'SELECT f.rowid as doc_id, f.facnumber as doc_number, f.type as doc_type, f.datef as datePrint, ';
$where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; $tables_from = MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."facturedet as d";
$where.= " AND d.fk_facture = f.rowid"; $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid;
$where.= " AND f.entity = ".$conf->entity; $where.= " AND d.fk_facture = f.rowid";
$datePrint = 'f.datef'; $where.= " AND f.entity = ".$conf->entity;
$doc_number='f.facnumber'; $datePrint = 'f.datef';
$thirdTypeSelect='customer'; $doc_number='f.facnumber';
$thirdTypeSelect='customer';
} }
if ($type_element == 'order') if ($type_element == 'order')
{ {
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$documentstatic=new Commande($db); $documentstatic=new Commande($db);
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, "1" as doc_type, f.date_commande as datePrint, '; $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, "1" as doc_type, c.date_commande as datePrint, ';
$tables_from = MAIN_DB_PREFIX."commande as f,".MAIN_DB_PREFIX."commandedet as d"; $tables_from = MAIN_DB_PREFIX."commande as c,".MAIN_DB_PREFIX."commandedet as d";
$where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid;
$where.= " AND d.fk_commande = f.rowid"; $where.= " AND d.fk_commande = c.rowid";
$where.= " AND f.entity = ".$conf->entity; $where.= " AND c.entity = ".$conf->entity;
$datePrint = 'f.date_creation'; $datePrint = 'c.datef';
$doc_number='f.ref'; $doc_number='c.ref';
$thirdTypeSelect='customer'; $thirdTypeSelect='customer';
}
if ($type_element == 'supplier_order')
{ // Supplier : Show products from orders.
$documentstatic=new CommandeFournisseur($db);
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, "1" as doc_type, c.date_valid as datePrint, ';
$tables_from = MAIN_DB_PREFIX."commande_fournisseur as c,".MAIN_DB_PREFIX."commande_fournisseurdet as d";
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid;
$where.= " AND d.fk_commande = c.rowid";
$datePrint = 'c.date_creation';
$doc_number='c.ref';
$thirdTypeSelect='supplier';
} }
if ($type_element == 'supplier_invoice') if ($type_element == 'supplier_invoice')
{ { // Supplier : Show products from invoices.
// TODO require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$documentstatic=new FactureFournisseur($db);
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, "1" as doc_type, f.datef as datePrint, ';
$tables_from = MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."facture_fourn_det as d";
$where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid;
$where.= " AND d.fk_facture_fourn = f.rowid";
$datePrint = 'f.datef';
$doc_number='f.ref';
$thirdTypeSelect='supplier';
}
if ($type_element == 'supplier_order')
{ // Supplier : Show products from orders.
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$documentstatic=new CommandeFournisseur($db);
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, "1" as doc_type, c.date_valid as datePrint, ';
$tables_from = MAIN_DB_PREFIX."commande_fournisseur as c,".MAIN_DB_PREFIX."commande_fournisseurdet as d";
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid;
$where.= " AND d.fk_commande = c.rowid";
$datePrint = 'c.date_valid';
$doc_number='c.ref';
$thirdTypeSelect='supplier';
} }
$sql = $sql_select; $sql = $sql_select;

View File

@ -1576,12 +1576,12 @@ else
// Country // Country
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'" class="nowrap">'; print '<tr><td>'.$langs->trans("Country").'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'" class="nowrap">';
if ($object->country_code) if (! empty($object->country_code))
{ {
$img=picto_from_langcode($object->country_code); $img=picto_from_langcode($object->country_code);
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
else print ($img?$img.' ':'').$object->country; else print ($img?$img.' ':'').$object->country;
} }
print '</td></tr>'; print '</td></tr>';
// State // State
@ -1826,7 +1826,7 @@ else
else else
{ {
$langs->load("mails"); $langs->load("mails");
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoEmailDefined")).'">'.$langs->trans('SendMail').'</a></div>'; print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoEmail")).'">'.$langs->trans('SendMail').'</a></div>';
} }
if ($user->rights->societe->creer) if ($user->rights->societe->creer)

View File

@ -1357,7 +1357,7 @@ div.tabs {
/* margin: 0px 0px 2px 6px; /* margin: 0px 0px 2px 6px;
padding: 0px 6px 3px 0px; */ padding: 0px 6px 3px 0px; */
text-align: <?php print $left; ?>; text-align: <?php print $left; ?>;
margin-left: 4px !important;
clear:both; clear:both;
height:100%; height:100%;
} }
@ -2761,7 +2761,7 @@ a.tab span.ui-btn-inner
} }
.ui-link { .ui-link {
color: rgb(<?php print $colortext; ?>) !important; color: rgb(<?php print $colortext; ?>);
} }
.liste_titre .ui-link { .liste_titre .ui-link {
color: #<?php print $colortexttitle; ?> !important; color: #<?php print $colortexttitle; ?> !important;
@ -2843,10 +2843,21 @@ ul.ulmenu {
border: 1px solid #ccc; border: 1px solid #ccc;
text-shadow: none; text-shadow: none;
} }
.ui-body-c .ui-link, .ui-body-c .ui-link:visited, .ui-body-c .ui-link:hover {
color: rgb(<?php print $colortext; ?>);
}
.ui-btn-up-c .vsmenudisabled { .ui-btn-up-c .vsmenudisabled {
color: #<?php echo $colorshadowtitle; ?> !important; color: #<?php echo $colorshadowtitle; ?> !important;
text-shadow: none !important; text-shadow: none !important;
} }
.ui-controlgroup-horizontal .ui-btn.ui-first-child {
-webkit-border-top-left-radius: 6px;
border-top-left-radius: 6px;
}
.ui-controlgroup-horizontal .ui-btn.ui-last-child {
-webkit-border-top-right-radius: 6px;
border-top-right-radius: 6px;
}
.alilevel1 { .alilevel1 {
color: #<?php echo $colortexttitle; ?> !important; color: #<?php echo $colortexttitle; ?> !important;
text-shadow: 1px 0px 1px #<?php echo $colorshadowtitle; ?>; text-shadow: 1px 0px 1px #<?php echo $colorshadowtitle; ?>;
@ -2859,14 +2870,6 @@ ul.ulmenu {
background-image: -o-linear-gradient( #ddd,#d1d1d1 ) !important; background-image: -o-linear-gradient( #ddd,#d1d1d1 ) !important;
background-image: linear-gradient( #ddd,#d1d1d1 ) !important; background-image: linear-gradient( #ddd,#d1d1d1 ) !important;
} }
<?php if ($dol_use_jmobile) { ?>
.overflowwithjm200
{
max-width: 200px;
overflow: hidden;
white-space: nowrap;
}
<?php } ?>
<?php <?php
if (is_object($db)) $db->close(); if (is_object($db)) $db->close();

146
test/phpunit/PaypalTest.php Normal file
View File

@ -0,0 +1,146 @@
<?php
/* Copyright (C) 2014 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 test/phpunit/PaypalTest.php
* \ingroup test
* \brief PHPUnit test
* \remarks To run this script as CLI: phpunit filename.php
*/
global $conf,$user,$langs,$db;
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
require_once 'PHPUnit/Autoload.php';
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
require_once dirname(__FILE__).'/../../htdocs/core/lib/geturl.lib.php';
require_once dirname(__FILE__).'/../../htdocs/paypal/lib/paypal.lib.php';
if (empty($user->id))
{
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
}
$conf->global->MAIN_DISABLE_ALL_MAILS=1;
/**
* Class for PHPUnit tests
*
* @backupGlobals disabled
* @backupStaticAttributes enabled
* @remarks backupGlobals must be disabled to have db,conf,user and lang not erased.
*/
class PaypalTest extends PHPUnit_Framework_TestCase
{
protected $savconf;
protected $savuser;
protected $savlangs;
protected $savdb;
/**
* Constructor
* We save global variables into local variables
*
* @return ProductTest
*/
function __construct()
{
//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
$this->savuser=$user;
$this->savlangs=$langs;
$this->savdb=$db;
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
//print " - db ".$db->db;
print "\n";
}
// Static methods
public static function setUpBeforeClass()
{
global $conf,$user,$langs,$db;
if (empty($conf->paypal->enabled)) { print __METHOD__." Module Paypal must be enabled.\n"; die(); }
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
print __METHOD__."\n";
}
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;
$db->rollback();
print __METHOD__."\n";
}
/**
* Init phpunit tests
*
* @return void
*/
protected function setUp()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
print __METHOD__."\n";
}
/**
* End phpunit tests
*
* @return void
*/
protected function tearDown()
{
print __METHOD__."\n";
}
/**
* testProductCreate
*
* @return void
*/
public function testPaypalOk()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$urltotest=getPaypalPaymentUrl(1,'free');
print "urltotest=".$urltotest."\n";
$result=getURLContent($urltotest, 'GET');
print __METHOD__." result=".$result."\n";
$this->assertLessThanOrEqual($result, 0);
return $result;
}
}
?>