';
+ }
+
// Other attributes
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
@@ -333,19 +363,52 @@ if ($action == 'create')
if ($id)
{
-
$head=various_payment_prepare_head($object);
- dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), 0, 'payment');
-
- print '
';
print_liste_field_titre('');
-print_liste_field_titre($langs->trans("Groups"), $_SERVER["PHP_SELF"],'s.nom, s.rowid','',$param,'',$sortfield,$sortorder);
+print_liste_field_titre("Groups", $_SERVER["PHP_SELF"],'s.nom, s.rowid','',$param,'',$sortfield,$sortorder);
if ($modecompta == 'BOOKKEEPING')
{
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"],'amount','',$param,'align="right"',$sortfield,$sortorder);
diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php
index 131cdae3952..6389733f72c 100644
--- a/htdocs/core/class/html.formcompany.class.php
+++ b/htdocs/core/class/html.formcompany.class.php
@@ -2,6 +2,7 @@
/* Copyright (C) 2008-2012 Laurent Destailleur
* Copyright (C) 2008-2012 Regis Houssin
* Copyright (C) 2014 Juanjo Menent
+ * Copyright (C) 2017 Rui Strecht
*
* 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
@@ -217,7 +218,7 @@ class FormCompany
$out='';
// On recherche les departements/cantons/province active d'une region et pays actif
- $sql = "SELECT d.rowid, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code FROM";
+ $sql = "SELECT d.rowid, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code, r.nom as region_name FROM";
$sql .= " ".MAIN_DB_PREFIX ."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r,".MAIN_DB_PREFIX."c_country as c";
$sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid";
$sql .= " AND d.active = 1 AND r.active = 1 AND c.active = 1";
@@ -265,7 +266,15 @@ class FormCompany
$out.= '';
}
$i++;
diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
index a4b6af7917e..8458a6167d2 100644
--- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
+++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
@@ -70,24 +70,24 @@ CREATE TABLE IF NOT EXISTS llx_expensereport_ik (
datec datetime DEFAULT NULL,
tms timestamp,
fk_c_exp_tax_cat integer DEFAULT 0 NOT NULL,
- fk_range integer DEFAULT 0 NOT NULL,
- coef double DEFAULT 0 NOT NULL,
- offset double DEFAULT 0 NOT NULL
+ fk_range integer DEFAULT 0 NOT NULL,
+ coef double DEFAULT 0 NOT NULL,
+ offset double DEFAULT 0 NOT NULL
)ENGINE=innodb DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS llx_c_exp_tax_cat (
rowid integer AUTO_INCREMENT PRIMARY KEY,
label varchar(48) NOT NULL,
entity integer DEFAULT 1 NOT NULL,
- active integer DEFAULT 1 NOT NULL
+ active integer DEFAULT 1 NOT NULL
)ENGINE=innodb DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS llx_c_exp_tax_range (
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_c_exp_tax_cat integer DEFAULT 1 NOT NULL,
- range_ik double DEFAULT 0 NOT NULL,
+ range_ik double DEFAULT 0 NOT NULL,
entity integer DEFAULT 1 NOT NULL,
- active integer DEFAULT 1 NOT NULL
+ active integer DEFAULT 1 NOT NULL
)ENGINE=innodb DEFAULT CHARSET=utf8;
INSERT INTO llx_c_type_fees (code, label, active, accountancy_code) VALUES
@@ -207,6 +207,8 @@ ALTER TABLE llx_extrafields ADD COLUMN tms timestamp;
ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128);
ALTER TABLE llx_holiday_config ADD UNIQUE INDEX idx_holiday_config (name);
+ALTER TABLE llx_payment_various ADD COLUMN fk_projet integer DEFAULT NULL after accountancy_code;
+
UPDATE llx_const set name = 'ONLINE_PAYMENT_MESSAGE_OK' where name = 'PAYPAL_MESSAGE_OK';
UPDATE llx_const set name = 'ONLINE_PAYMENT_MESSAGE_KO' where name = 'PAYPAL_MESSAGE_KO';
UPDATE llx_const set name = 'ONLINE_PAYMENT_CREDITOR' where name = 'PAYPAL_CREDITOR';
@@ -234,5 +236,3 @@ UPDATE llx_accounting_account SET pcg_type = 'EXPENSE' where pcg_type = 'COMPRAS
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_sell VARCHAR(32) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_buy VARCHAR(32) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_buy VARCHAR(32) COLLATE utf8_unicode_ci;
-
-
diff --git a/htdocs/install/mysql/tables/llx_payment_various.sql b/htdocs/install/mysql/tables/llx_payment_various.sql
index abaf9fdab26..e92b244b009 100644
--- a/htdocs/install/mysql/tables/llx_payment_various.sql
+++ b/htdocs/install/mysql/tables/llx_payment_various.sql
@@ -28,7 +28,8 @@ create table llx_payment_various
fk_typepayment integer NOT NULL,
num_payment varchar(50), -- ref
label varchar(255),
- accountancy_code varchar(32),
+ accountancy_code varchar(32),
+ fk_projet integer DEFAULT NULL,
entity integer DEFAULT 1 NOT NULL, -- multi company id
note text,
fk_bank integer,
diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang
index 46222fca80c..d261fe8a53d 100644
--- a/htdocs/langs/en_US/banks.lang
+++ b/htdocs/langs/en_US/banks.lang
@@ -156,4 +156,5 @@ DocumentModelBan=Template to print a page with BAN information.
NewVariousPayment=New miscellaneous payments
VariousPayment=Miscellaneous payments
VariousPayments=Miscellaneous payments
-ShowVariousPayment=Show miscellaneous payments
+ShowVariousPayment=Show miscellaneous payments
+AddVariousPayment=Add miscellaneous payments
\ No newline at end of file
diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang
index 8b380645f73..92282fd29f0 100644
--- a/htdocs/langs/en_US/projects.lang
+++ b/htdocs/langs/en_US/projects.lang
@@ -88,6 +88,7 @@ ListShippingAssociatedProject=List of shippings associated with the project
ListFichinterAssociatedProject=List of interventions associated with the project
ListExpenseReportsAssociatedProject=List of expense reports associated with the project
ListDonationsAssociatedProject=List of donations associated with the project
+ListVariousPaymentsAssociatedProject=List of various payments associated with the project
ListActionsAssociatedProject=List of events associated with the project
ListTaskTimeUserProject=List of time consumed on tasks of project
ActivityOnProjectToday=Activity on project today
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index bda8d793840..0dcb710cfb5 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -51,6 +51,7 @@ if (! empty($conf->don->enabled)) require_once DOL_DOCUMENT_ROOT.'/don/class/d
if (! empty($conf->loan->enabled)) require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
if (! empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
if (! empty($conf->tax->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
+if (! empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
$langs->load("projects");
$langs->load("companies");
@@ -439,6 +440,19 @@ $listofreferent=array(
'datefieldname'=>'datem',
'disableamount'=>0,
'test'=>($conf->stock->enabled && $user->rights->stock->mouvement->lire && ! empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW))),
+'variouspayment'=>array(
+ 'name'=>"VariousPayments",
+ 'title'=>"ListVariousPaymentsAssociatedProject",
+ 'class'=>'PaymentVarious',
+ 'table'=>'payment_various',
+ 'datefieldname'=>'datev',
+ 'margin'=>'minus',
+ 'disableamount'=>0,
+ 'urlnew'=>DOL_URL_ROOT.'/compta/bank_various_payment/card.php?action=create&projectid='.$id.'&socid='.$socid,
+ 'lang'=>'banks',
+ 'buttonnew'=>'AddVariousPayment',
+ 'testnew'=>$user->rights->banque->modifier,
+ 'test'=>$conf->banque->enabled && $user->rights->banque->lire),
/* No need for this, available on dedicated tab "Agenda/Events"
'agenda'=>array(
'name'=>"Agenda",
@@ -769,6 +783,7 @@ foreach ($listofreferent as $key => $value)
// Thirdparty or user
print '
';
if (in_array($tablename, array('projet_task')) && $key == 'project_task') print ''; // if $key == 'project_task', we don't want details per user
+ elseif (in_array($tablename, array('payment_various'))) print ''; // if $key == 'payment_various', we don't have any thirdparty
elseif (in_array($tablename, array('expensereport_det','don','projet_task','stock_mouvement'))) print $langs->trans("User");
else print $langs->trans("ThirdParty");
print '
';
@@ -898,7 +913,8 @@ foreach ($listofreferent as $key => $value)
$date=''; $total_time_by_line = null;
if ($tablename == 'expensereport_det') $date = $element->date; // No draft status on lines
elseif ($tablename == 'stock_mouvement') $date = $element->datem;
- if ($tablename == 'chargesociales') $date = $element->date_ech;
+ elseif ($tablename == 'payment_various') $date = $element->datev;
+ elseif ($tablename == 'chargesociales') $date = $element->date_ech;
elseif (! empty($element->status) || ! empty($element->statut) || ! empty($element->fk_status))
{
if ($tablename == 'don') $date = $element->datedon;
@@ -909,7 +925,7 @@ foreach ($listofreferent as $key => $value)
elseif ($tablename == 'supplier_proposal') $date=$element->date_validation; // There is no other date for this
elseif ($tablename == 'fichinter') $date=$element->datev; // There is no other date for this
elseif ($tablename == 'projet_task') $date=''; // We show no date. Showing date of beginning of task make user think it is date of time consumed
- else
+ else
{
$date=$element->date; // invoice, ...
if (empty($date)) $date=$element->date_contrat;
@@ -963,7 +979,7 @@ foreach ($listofreferent as $key => $value)
{
$total_ht_by_line=null;
$othermessage='';
- if ($tablename == 'don' || $tablename == 'chargesociales') $total_ht_by_line=$element->amount;
+ if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various') $total_ht_by_line=$element->amount;
else if($tablename == 'fichinter') $total_ht_by_line=$element->getAmount();
elseif ($tablename == 'stock_mouvement') $total_ht_by_line=$element->price*abs($element->qty);
elseif (in_array($tablename, array('projet_task')))
@@ -1004,7 +1020,7 @@ foreach ($listofreferent as $key => $value)
if (empty($value['disableamount']))
{
$total_ttc_by_line=null;
- if ($tablename == 'don' || $tablename == 'chargesociales') $total_ttc_by_line=$element->amount;
+ if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various') $total_ttc_by_line=$element->amount;
else if($tablename == 'fichinter') $total_ttc_by_line=$element->getAmount();
elseif ($tablename == 'stock_mouvement') $total_ttc_by_line=$element->price*abs($element->qty);
elseif ($tablename == 'projet_task')
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index c7ede7c5e3f..00ff84d6bfe 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -7,6 +7,7 @@
* Copyright (C) 2015 Florian Henry
* Copyright (C) 2016 Josep Lluis Amador
* Copyright (C) 2016 Ferran Marcet
+ * Copyright (C) 2017 Rui Strecht
*
* 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
@@ -63,6 +64,7 @@ $search_account_supplier_code=trim(GETPOST('search_account_supplier_code'));
$search_town=trim(GETPOST("search_town"));
$search_zip=trim(GETPOST("search_zip"));
$search_state=trim(GETPOST("search_state"));
+$search_region=trim(GETPOST("search_region"));
$search_email=trim(GETPOST('search_email'));
$search_phone=trim(GETPOST('search_phone'));
$search_url=trim(GETPOST('search_url'));
@@ -168,6 +170,7 @@ $arrayfields=array(
's.town'=>array('label'=>"Town", 'checked'=>1),
's.zip'=>array('label'=>"Zip", 'checked'=>1),
'state.nom'=>array('label'=>"State", 'checked'=>0),
+ 'region.nom'=>array('label'=>"Region", 'checked'=>0),
'country.code_iso'=>array('label'=>"Country", 'checked'=>0),
's.email'=>array('label'=>"Email", 'checked'=>0),
's.url'=>array('label'=>"Url", 'checked'=>0),
@@ -387,7 +390,8 @@ $sql.= " s.email, s.phone, s.url, s.siren as idprof1, s.siret as idprof2, s.ape
$sql.= " s.tms as date_update, s.datec as date_creation,";
$sql.= " s.code_compta,s.code_compta_fournisseur,";
$sql.= " typent.code as typent_code,";
-$sql.= " state.code_departement as state_code, state.nom as state_name";
+$sql.= " state.code_departement as state_code, state.nom as state_name,";
+$sql.= " region.code_region as region_code, region.nom as region_name";
// We'll need these fields in order to filter by sale (including the case where the user can only see his prospects)
if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user";
// We'll need these fields in order to filter by categ
@@ -404,6 +408,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
+$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region = state.fk_region)";
// We'll need this table joined to the select in order to filter by categ
if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
if (! empty($search_categ_sup)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ
@@ -436,6 +441,7 @@ if ($search_account_supplier_code) $sql.= natural_search("s.code_compta_fourniss
if ($search_town) $sql.= natural_search("s.town",$search_town);
if (strlen($search_zip)) $sql.= natural_search("s.zip",$search_zip);
if ($search_state) $sql.= natural_search("state.nom",$search_state);
+if ($search_region) $sql.= natural_search("region.nom",$search_region);
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
if ($search_email) $sql.= natural_search("s.email",$search_email);
if (strlen($search_phone)) $sql.= natural_search("s.phone", $search_phone);
@@ -728,6 +734,13 @@ if (! empty($arrayfields['state.nom']['checked']))
print '';
print '';
}
+// Region
+if (! empty($arrayfields['region.nom']['checked']))
+{
+ print '
';
+ print '';
+ print '
';
+}
// Country
if (! empty($arrayfields['country.code_iso']['checked']))
{
@@ -937,6 +950,7 @@ if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) print_liste_f
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],"s.town","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],"s.zip","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
+if (! empty($arrayfields['region.nom']['checked'])) print_liste_field_titre($arrayfields['region.nom']['label'],$_SERVER["PHP_SELF"],"region.nom","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'],$_SERVER["PHP_SELF"],"s.email","",$param,'',$sortfield,$sortorder);
@@ -1068,6 +1082,12 @@ while ($i < min($num, $limit))
print "
".$obj->state_name."
\n";
if (! $i) $totalarray['nbfield']++;
}
+ // Region
+ if (! empty($arrayfields['region.nom']['checked']))
+ {
+ print "
".$obj->region_name."
\n";
+ if (! $i) $totalarray['nbfield']++;
+ }
// Country
if (! empty($arrayfields['country.code_iso']['checked']))
{
diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php
index f763c8dd39b..0d4763f5dc3 100644
--- a/htdocs/websites/index.php
+++ b/htdocs/websites/index.php
@@ -169,7 +169,7 @@ if ($action == 'addsite')
{
$db->begin();
- if (! $error && empty(GETPOST('WEBSITE_REF','alpha')))
+ if (! $error && ! GETPOST('WEBSITE_REF','alpha'))
{
$error++;
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Ref")), null, 'errors');