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

This commit is contained in:
Laurent Destailleur 2016-09-08 11:39:47 +02:00
commit 99a3cc6efc
10 changed files with 215 additions and 152 deletions

View File

@ -80,8 +80,8 @@ $max = 100;
$form = new Form($db); $form = new Form($db);
$title = $langs->trans('FiscalYears'); $title = $langs->trans('FiscalYears');
$helpurl = "";
llxHeader('', $title, LOG_ERR); llxHeader('', $title, $helpurl);
$sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut, f.entity"; $sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut, f.entity";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_fiscalyear as f"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_fiscalyear as f";
@ -137,7 +137,6 @@ if ($result) {
} else { } else {
print '<tr ' . $bc[$var] . '><td colspan="5" class="opacitymedium">' . $langs->trans("None") . '</td></tr>'; print '<tr ' . $bc[$var] . '><td colspan="5" class="opacitymedium">' . $langs->trans("None") . '</td></tr>';
} }
print '</table>'; print '</table>';
} else { } else {
dol_print_error($db); dol_print_error($db);

View File

@ -28,7 +28,9 @@ $langs->load("admin");
$langs->load("compta"); $langs->load("compta");
// Security check // Security check
if (! $user->admin) if ($user->societe_id > 0)
accessforbidden();
if (! $user->rights->accounting->fiscalyear)
accessforbidden(); accessforbidden();
$error = 0; $error = 0;
@ -139,8 +141,9 @@ else if ($action == 'update') {
/* /*
* View * View
*/ */
$title = $langs->trans("Fiscalyear") . " - " . $langs->trans("Card");
llxHeader(); $helpurl = "";
llxHeader("",$title,$helpurl);
$form = new Form($db); $form = new Form($db);
@ -157,7 +160,7 @@ if ($action == 'create')
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Label // Label
print '<tr><td class="fieldrequired">' . $langs->trans("Label") . '</td><td><input name="label" size="32" value="' . GETPOST("label") . '"></td></tr>'; print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans("Label") . '</td><td><input name="label" size="32" value="' . GETPOST("label") . '"></td></tr>';
// Date start // Date start
print '<tr><td class="fieldrequired">' . $langs->trans("DateStart") . '</td><td>'; print '<tr><td class="fieldrequired">' . $langs->trans("DateStart") . '</td><td>';
@ -193,7 +196,7 @@ if ($action == 'create')
$head = fiscalyear_prepare_head($object); $head = fiscalyear_prepare_head($object);
if ($action == 'edit') { if ($action == 'edit') {
dol_fiche_head($head, 'card', $langs->trans("FiscalYearCard"), 0, 'cron'); dol_fiche_head($head, 'card', $langs->trans("Fiscalyear"), 0, 'cron');
print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n"; print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
@ -204,7 +207,7 @@ if ($action == 'create')
// Ref // Ref
print "<tr>"; print "<tr>";
print '<td class="titlefield">' . $langs->trans("Ref") . '</td><td>'; print '<td class="titlefieldcreate titlefield">' . $langs->trans("Ref") . '</td><td>';
print $object->ref; print $object->ref;
print '</td></tr>'; print '</td></tr>';
@ -247,16 +250,16 @@ if ($action == 'create')
print $form->formconfirm($_SERVER["PHP_SELF"] . "?id=" . $id, $langs->trans("DeleteFiscalYear"), $langs->trans("ConfirmDeleteFiscalYear"), "confirm_delete"); print $form->formconfirm($_SERVER["PHP_SELF"] . "?id=" . $id, $langs->trans("DeleteFiscalYear"), $langs->trans("ConfirmDeleteFiscalYear"), "confirm_delete");
} }
dol_fiche_head($head, 'card', $langs->trans("FiscalYearCard"), 0, 'cron'); dol_fiche_head($head, 'card', $langs->trans("Fiscalyear"), 0, 'cron');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
$linkback = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/fiscalyear.php">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/fiscalyear.php">' . $langs->trans("BackToList") . '</a>';
// Ref // Ref
print '<tr><td width="25%">' . $langs->trans("Ref") . '</td><td width="50%">'; print '<tr><td class="titlefield">' . $langs->trans("Ref") . '</td><td width="50%">';
print $object->ref; print $object->ref;
print '</td><td width="25%">'; print '</td><td>';
print $linkback; print $linkback;
print '</td></tr>'; print '</td></tr>';
@ -291,7 +294,6 @@ if ($action == 'create')
/* /*
* Barre d'actions * Barre d'actions
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=edit&id=' . $id . '">' . $langs->trans('Modify') . '</a>'; print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=edit&id=' . $id . '">' . $langs->trans('Modify') . '</a>';

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> /* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* *
* 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,8 +16,8 @@
*/ */
/** /**
* \file htdocs/accountancy/admin/fiscalyear_card.php * \file htdocs/accountancy/admin/fiscalyear_card.php
* \brief Page to show info of a fiscal year * \brief Page to show info of a fiscal year
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
@ -29,13 +29,17 @@ $langs->load("admin");
$langs->load("compta"); $langs->load("compta");
// Security check // Security check
if (! $user->admin) if ($user->societe_id > 0)
accessforbidden();
if (! $user->rights->accounting->fiscalyear)
accessforbidden(); accessforbidden();
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
// View // View
llxHeader(); $title = $langs->trans("Fiscalyear") . " - " . $langs->trans("Info");
$helpurl = "";
llxHeader("",$title,$helpurl);
if ($id) { if ($id) {
$object = new Fiscalyear($db); $object = new Fiscalyear($db);
@ -44,7 +48,7 @@ if ($id) {
$head = fiscalyear_prepare_head($object); $head = fiscalyear_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("FiscalYearCard"), 0, 'cron'); dol_fiche_head($head, 'info', $langs->trans("Fiscalyear"), 0, 'cron');
print '<table width="100%"><tr><td>'; print '<table width="100%"><tr><td>';
dol_print_object_info($object); dol_print_object_info($object);

View File

@ -80,6 +80,7 @@ $workflowcodes=array(
// For the following 2 options, if module invoice is disabled, they does not exists, so "Classify billed" for order must be done manually from order card. // For the following 2 options, if module invoice is disabled, they does not exists, so "Classify billed" for order must be done manually from order card.
'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>40, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'), 'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>40, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'),
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>50, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'), 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>50, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'),
'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->expedition->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
); );
if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow'])) if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow']))

View File

@ -159,6 +159,63 @@ class InterfaceWorkflowManager extends DolibarrTriggers
} }
} }
if ($action=='SHIPPING_VALIDATE') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (! empty($conf->commande->enabled) && ! empty($conf->expedition->enabled) && ! empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING))
{
$qtyshipped=array();
$qtyordred=array();
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
//find all shippement on order origin
$order = new Commande($this->db);
$ret=$order->fetch($object->origin_id);
if ($ret<0) {
$this->error=$order->error; $this->errors=$order->errors;
return $ret;
}
$ret=$order->fetchObjectLinked($order->id,'commande',null,'shipping');
if ($ret<0) {
$this->error=$order->error; $this->errors=$order->errors;
return $ret;
}
//Build array of quantity shipped by product for an order
if (is_array($order->linkedObjects) && count($order->linkedObjects)>0) {
foreach($order->linkedObjects as $type=>$shipping_array) {
if ($type=='shipping' && is_array($shipping_array) && count($shipping_array)>0) {
foreach ($shipping_array as $shipping) {
if (is_array($shipping->lines) && count($shipping->lines)>0) {
foreach($shipping->lines as $shippingline) {
$qtyshipped[$shippingline->fk_product]+=$shippingline->qty;
}
}
}
}
}
}
//Build array of quantity ordered by product
if (is_array($order->lines) && count($order->lines)>0) {
foreach($order->lines as $orderline) {
$qtyordred[$orderline->fk_product]+=$orderline->qty;
}
}
//dol_syslog(var_export($qtyordred,true),LOG_DEBUG);
//dol_syslog(var_export($qtyshipped,true),LOG_DEBUG);
//Compare array
$diff_array=array_diff_assoc($qtyordred,$qtyshipped);
if (count($diff_array)==0) {
//No diff => mean everythings is shipped
$ret=$object->setStatut(Commande::STATUS_CLOSED, $object->origin_id, $object->origin);
if ($ret<0) {
$this->error=$object->error; $this->errors=$object->errors;
return $ret;
}
}
}
}
return 0; return 0;
} }

View File

@ -732,8 +732,6 @@ class Expedition extends CommonObject
return -2; return -2;
} }
// FIXME Set status of order to "delivered" if check box "set order as delivered if remain to ship is 0" is on and if sum of all validated shipment = products or order to ship (because we are in case of stock movement on shipment validation)
} }
// Change status of order to "shipment in process" // Change status of order to "shipment in process"

View File

@ -28,7 +28,7 @@ ALTER TABLE llx_user DROP COLUMN phenix_pass;
ALTER TABLE llx_societe ADD COLUMN fk_account integer; ALTER TABLE llx_societe ADD COLUMN fk_account integer;
ALTER TABLE llx_commandedet ADD COLUMN fk_commandefourndet integer NOT NULL after import_key; -- link to detail line of commande fourn (resplenish) ALTER TABLE llx_commandedet ADD COLUMN fk_commandefourndet integer DEFAULT NULL after import_key; -- link to detail line of commande fourn (resplenish)
ALTER TABLE llx_website ADD COLUMN virtualhost varchar(255) after fk_default_home; ALTER TABLE llx_website ADD COLUMN virtualhost varchar(255) after fk_default_home;

View File

@ -57,7 +57,7 @@ create table llx_commandedet
fk_unit integer DEFAULT NULL, -- lien vers table des unités fk_unit integer DEFAULT NULL, -- lien vers table des unités
import_key varchar(14), import_key varchar(14),
fk_commandefourndet integer NOT NULL, -- link to detail line of commande fourn (resplenish) fk_commandefourndet integer DEFAULT NULL, -- link to detail line of commande fourn (resplenish)
fk_multicurrency integer, fk_multicurrency integer,
multicurrency_code varchar(255), multicurrency_code varchar(255),

View File

@ -49,7 +49,7 @@ ErrorDecimalLargerThanAreForbidden=Error, a precision higher than <b>%s</b> is n
DictionarySetup=Dictionary setup DictionarySetup=Dictionary setup
Dictionary=Dictionaries Dictionary=Dictionaries
Chartofaccounts=Chart of accounts Chartofaccounts=Chart of accounts
Fiscalyear=Fiscal years Fiscalyear=Fiscal year
ErrorReservedTypeSystemSystemAuto=Value 'system' and 'systemauto' for type is reserved. You can use 'user' as value to add your own record ErrorReservedTypeSystemSystemAuto=Value 'system' and 'systemauto' for type is reserved. You can use 'user' as value to add your own record
ErrorCodeCantContainZero=Code can't contain value 0 ErrorCodeCantContainZero=Code can't contain value 0
DisableJavascript=Disable JavaScript and Ajax functions (Recommended for blind person or text browsers) DisableJavascript=Disable JavaScript and Ajax functions (Recommended for blind person or text browsers)
@ -1522,6 +1522,7 @@ OpenFiscalYear=Open fiscal year
CloseFiscalYear=Close fiscal year CloseFiscalYear=Close fiscal year
DeleteFiscalYear=Delete fiscal year DeleteFiscalYear=Delete fiscal year
ConfirmDeleteFiscalYear=Are you sure to delete this fiscal year ? ConfirmDeleteFiscalYear=Are you sure to delete this fiscal year ?
ShowFiscalYear=Show fiscal year
AlwaysEditable=Can always be edited AlwaysEditable=Can always be edited
MAIN_APPLICATION_TITLE=Force visible name of application (warning: setting your own name here may break autofill login feature when using DoliDroid mobile application) MAIN_APPLICATION_TITLE=Force visible name of application (warning: setting your own name here may break autofill login feature when using DoliDroid mobile application)
NbMajMin=Minimum number of uppercase characters NbMajMin=Minimum number of uppercase characters

View File

@ -10,3 +10,4 @@ descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Classify linked source proposal to bil
descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is set to paid descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is set to paid
descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is validated descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is validated
descWORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL=Classify linked source proposal to billed when customer invoice is validated descWORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL=Classify linked source proposal to billed when customer invoice is validated
descWORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING=Classify shipped linked source order on shipping validate if quantity shipped is the same as in order