Merge remote-tracking branch 'origin/3.8' into develop

Conflicts:
	.travis.yml
	htdocs/core/modules/askpricesupplier/doc/pdf_aurore.modules.php
	htdocs/core/modules/commande/doc/pdf_proforma.modules.php
	htdocs/includes/adodbtime/adodb-time.inc.php
	htdocs/langs/en_US/accountancy.lang
This commit is contained in:
Laurent Destailleur 2015-12-18 22:12:03 +01:00
commit f25a9030eb
19 changed files with 90 additions and 47 deletions

View File

@ -113,6 +113,7 @@ before_script:
echo Start travis echo Start travis
echo Current dir is `pwd` echo Current dir is `pwd`
echo Home dir is `echo ~` echo Home dir is `echo ~`
echo TRAVIS_BUILD_DIR is $TRAVIS_BUILD_DIR
- | - |
echo "Re-enabling Xdebug for PHP CodeSniffer and PHP Unit" echo "Re-enabling Xdebug for PHP CodeSniffer and PHP Unit"
@ -138,22 +139,20 @@ before_script:
echo echo
- | - |
if [ "$DEBUG" = true ]; then echo "Debugging informations"
echo "Debugging informations" # Check PHP
# Check PHP php -i
php -i # Check PHP CodeSniffer installation
# Check PHP CodeSniffer installation which phpcs
which phpcs phpcs --version
phpcs --version phpcs -i
phpcs -i # Check PHPUnit installation
# Check PHPUnit installation which phpunit
which phpunit phpunit --version
phpunit --version # Check MySQL
# Check MySQL mysql --version
mysql --version mysql -e "SELECT VERSION();"
mysql -e "SELECT VERSION();" echo
echo
fi
- | - |
echo "Setting up database" echo "Setting up database"
@ -311,3 +310,4 @@ after_failure:
fi fi
after_script: after_script:

View File

@ -124,7 +124,7 @@
<!-- Tweaks to metrics --> <!-- Tweaks to metrics -->
<rule ref="Generic.Metrics.CyclomaticComplexity"> <rule ref="Generic.Metrics.CyclomaticComplexity">
<properties> <properties>
<property name="complexity" value="80" /> <property name="complexity" value="120" />
<property name="absoluteComplexity" value="250" /> <property name="absoluteComplexity" value="250" />
</properties> </properties>
</rule> </rule>

View File

@ -148,14 +148,14 @@ if ($action == 'create')
dol_fiche_head(); dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>'; print '<tr><td width="25%"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
print '<td><input name="account_number" size="30" value="' . $accounting->account_number . '"</td></tr>'; print '<td><input name="account_number" size="30" value="' . $accounting->account_number . '"</td></tr>';
print '<tr><td>' . $langs->trans("Label") . '</td>'; print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>';
print '<td><input name="label" size="70" value="' . $accounting->label . '"</td></tr>'; print '<td><input name="label" size="70" value="' . $accounting->label . '"</td></tr>';
print '<tr><td>' . $langs->trans("Accountparent") . '</td>'; print '<tr><td>' . $langs->trans("Accountparent") . '</td>';
print '<td>'; print '<td>';
print $htmlacc->select_account($accounting->account_parent, 'account_parent'); print $htmlacc->select_account($accounting->account_parent, 'account_parent', 1);
print '</td></tr>'; print '</td></tr>';
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>'; print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
print '<td>'; print '<td>';
@ -204,13 +204,13 @@ else if ($id)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>'; print '<tr><td width="25%"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
print '<td><input name="account_number" size="30" value="' . $accounting->account_number . '"</td></tr>'; print '<td><input name="account_number" size="30" value="' . $accounting->account_number . '"</td></tr>';
print '<tr><td>' . $langs->trans("Label") . '</td>'; print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>';
print '<td><input name="label" size="70" value="' . $accounting->label . '"</td></tr>'; print '<td><input name="label" size="70" value="' . $accounting->label . '"</td></tr>';
print '<tr><td>' . $langs->trans("Accountparent") . '</td>'; print '<tr><td>' . $langs->trans("Accountparent") . '</td>';
print '<td>'; print '<td>';
print $htmlacc->select_account($accounting->account_parent, 'account_parent'); print $htmlacc->select_account($accounting->account_parent, 'account_parent', 1);
print '</td></tr>'; print '</td></tr>';
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>'; print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
print '<td>'; print '<td>';

View File

@ -325,7 +325,7 @@ if (empty($reshook))
for($i = 0; $i < $num; $i ++) for($i = 0; $i < $num; $i ++)
{ {
$label = (! empty($lines[$i]->label) ? $lines[$i]->label : ''); $label = (! empty($lines[$i]->label) ? $lines[$i]->label : '');
$desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : $lines[$i]->libelle); $desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : '');
$product_type = (! empty($lines[$i]->product_type) ? $lines[$i]->product_type : 0); $product_type = (! empty($lines[$i]->product_type) ? $lines[$i]->product_type : 0);
// Dates // Dates

View File

@ -8,6 +8,7 @@
* 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>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* *
* 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
@ -989,6 +990,13 @@ class Contrat extends CommonObject
} }
} }
if (! $error)
{
// Delete linked object
$res = $this->deleteObjectLinked();
if ($res < 0) $error++;
}
if (! $error) if (! $error)
{ {
// Delete contratdet_log // Delete contratdet_log

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com> /* Copyright (C) 2010-2015 Regis Houssin <regis.houssin@capnetworks.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
@ -21,12 +21,13 @@
* This ajax page is called when doing an up or down drag and drop. * This ajax page is called when doing an up or down drag and drop.
*/ */
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disable token renewal
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
if (! defined('NOREQUIREHOOK')) define('NOREQUIREHOOK','1'); // Disable "main.inc.php" hooks
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';

View File

@ -4243,7 +4243,7 @@ class Form
else else
{ {
// Day // Day
$retstring.='<select'.($disabled?' disabled':'').' class="flat" name="'.$prefix.'day">'; $retstring.='<select'.($disabled?' disabled':'').' class="flat" id="'.$prefix.'day" name="'.$prefix.'day">';
if ($emptydate || $set_time == -1) if ($emptydate || $set_time == -1)
{ {
@ -4257,7 +4257,7 @@ class Form
$retstring.="</select>"; $retstring.="</select>";
$retstring.='<select'.($disabled?' disabled':'').' class="flat" name="'.$prefix.'month">'; $retstring.='<select'.($disabled?' disabled':'').' class="flat" id="'.$prefix.'month" name="'.$prefix.'month">';
if ($emptydate || $set_time == -1) if ($emptydate || $set_time == -1)
{ {
$retstring.='<option value="0" selected>&nbsp;</option>'; $retstring.='<option value="0" selected>&nbsp;</option>';
@ -4275,11 +4275,11 @@ class Form
// Year // Year
if ($emptydate || $set_time == -1) if ($emptydate || $set_time == -1)
{ {
$retstring.='<input'.($disabled?' disabled':'').' placeholder="'.dol_escape_htmltag($langs->trans("Year")).'" class="flat" type="text" size="3" maxlength="4" name="'.$prefix.'year" value="'.$syear.'">'; $retstring.='<input'.($disabled?' disabled':'').' placeholder="'.dol_escape_htmltag($langs->trans("Year")).'" class="flat" type="text" size="3" maxlength="4" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">';
} }
else else
{ {
$retstring.='<select'.($disabled?' disabled':'').' class="flat" name="'.$prefix.'year">'; $retstring.='<select'.($disabled?' disabled':'').' class="flat" id="'.$prefix.'year" name="'.$prefix.'year">';
for ($year = $syear - 5; $year < $syear + 10 ; $year++) for ($year = $syear - 5; $year < $syear + 10 ; $year++)
{ {

View File

@ -484,7 +484,7 @@ class pdf_einstein extends ModelePDFCommandes
$this->tva[$vatrate] += $tvaligne; $this->tva[$vatrate] += $tvaligne;
// Add line // Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
{ {
$pdf->setPage($pageposafter); $pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));

View File

@ -279,7 +279,7 @@ class pdf_merou extends ModelePdfExpedition
$pdf->MultiCell(30, 3, $object->lines[$i]->qty_shipped, 0, 'C', 0); $pdf->MultiCell(30, 3, $object->lines[$i]->qty_shipped, 0, 'C', 0);
// Add line // Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
{ {
$pdf->setPage($pageposafter); $pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));

View File

@ -452,7 +452,7 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxqtytoship), 3, $object->lines[$i]->qty_shipped,'','C'); $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxqtytoship), 3, $object->lines[$i]->qty_shipped,'','C');
// Add line // Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
{ {
$pdf->setPage($pageposafter); $pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));

View File

@ -579,7 +579,7 @@ class pdf_crabe extends ModelePDFFactures
if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage; if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage;
// Add line // Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
{ {
$pdf->setPage($pageposafter); $pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));

View File

@ -572,7 +572,7 @@ class pdf_azur extends ModelePDFPropales
if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage; if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage;
// Add line // Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
{ {
$pdf->setPage($pageposafter); $pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));

View File

@ -448,7 +448,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$this->localtax2[$localtax2rate]+=$localtax2ligne; $this->localtax2[$localtax2rate]+=$localtax2ligne;
// Add line // Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
{ {
$pdf->setPage($pageposafter); $pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));

View File

@ -470,7 +470,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// Add line // Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
{ {
$pdf->setPage($pageposafter); $pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));

View File

@ -494,7 +494,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage; if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage;
// Add line // Add line
if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1)) if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
{ {
$pdf->setPage($pageposafter); $pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));

View File

@ -732,7 +732,8 @@ class CommandeFournisseur extends CommonOrder
// Do we have to change status now ? (If double approval is required and first approval, we keep status to 1 = validated) // Do we have to change status now ? (If double approval is required and first approval, we keep status to 1 = validated)
$movetoapprovestatus=true; $movetoapprovestatus=true;
$comment='';
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur"; $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur";
$sql.= " SET ref='".$this->db->escape($num)."',"; $sql.= " SET ref='".$this->db->escape($num)."',";
if (empty($secondlevel)) // standard or first level approval if (empty($secondlevel)) // standard or first level approval
@ -741,7 +742,11 @@ class CommandeFournisseur extends CommonOrder
$sql.= " fk_user_approve = ".$user->id; $sql.= " fk_user_approve = ".$user->id;
if (! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $this->total_ht >= $conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) if (! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $this->total_ht >= $conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL)
{ {
if (empty($this->user_approve_id2)) $movetoapprovestatus=false; // second level approval not done if (empty($this->user_approve_id2))
{
$movetoapprovestatus=false; // second level approval not done
$comment=' (first level)';
}
} }
} }
else // request a second level approval else // request a second level approval
@ -749,6 +754,7 @@ class CommandeFournisseur extends CommonOrder
$sql.= " date_approve2='".$this->db->idate($now)."',"; $sql.= " date_approve2='".$this->db->idate($now)."',";
$sql.= " fk_user_approve2 = ".$user->id; $sql.= " fk_user_approve2 = ".$user->id;
if (empty($this->user_approve_id)) $movetoapprovestatus=false; // first level approval not done if (empty($this->user_approve_id)) $movetoapprovestatus=false; // first level approval not done
$comment=' (second level)';
} }
// If double approval is required and first approval, we keep status to 1 = validated // If double approval is required and first approval, we keep status to 1 = validated
if ($movetoapprovestatus) $sql.= ", fk_statut = 2"; if ($movetoapprovestatus) $sql.= ", fk_statut = 2";
@ -758,7 +764,7 @@ class CommandeFournisseur extends CommonOrder
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
$this->log($user, 2, time()); // Statut 2 $this->log($user, 2, time(), $comment); // Statut 2
if (! empty($conf->global->SUPPLIER_ORDER_AUTOADD_USER_CONTACT)) if (! empty($conf->global->SUPPLIER_ORDER_AUTOADD_USER_CONTACT))
{ {

View File

@ -2733,10 +2733,24 @@ elseif (! empty($object->id))
// Reopen // Reopen
if (in_array($object->statut, array(2))) if (in_array($object->statut, array(2)))
{ {
if ($user->rights->fournisseur->commande->commander) $buttonshown=0;
{ if (! $buttonshown && $user->rights->fournisseur->commande->approuver)
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans("Disapprove").'</a>'; {
} if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY)
|| (! empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) && $user->id == $object->user_approve_id))
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans("Disapprove").'</a>';
$buttonshown++;
}
}
if (! $buttonshown && $user->rights->fournisseur->commande->approve2 && ! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL))
{
if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY)
|| (! empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) && $user->id == $object->user_approve_id2))
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans("Disapprove").'</a>';
}
}
} }
if (in_array($object->statut, array(3, 5, 6, 7, 9)) || ($object->statut == 4 && $object->billed)) if (in_array($object->statut, array(3, 5, 6, 7, 9)) || ($object->statut == 4 && $object->billed))
{ {

View File

@ -155,3 +155,17 @@ ErrorAccountancyCodeIsAlreadyUse=Error, you cannot delete this accounting accoun
FicheVentilation=Breakdown card FicheVentilation=Breakdown card
GeneralLedgerIsWritten=Operations are written in the general ledger GeneralLedgerIsWritten=Operations are written in the general ledger
##Export Journal Feature
ExportFormat=Format of Export
Prefixname=Prefix of export File
Separate=Export separator
Textframe=Frame of text value
Headercol=Colname in header of file
Fieldname=Name of Field
Headername=Name in header
Type=Type of fields
Param=Additionnal parameters
EnabledProduct=In Product
EnabledTiers=In Tiers
EnabledVat=In Vat

View File

@ -31,7 +31,7 @@ TripNDF=Informations expense report
PDFStandardExpenseReports=Standard template to generate a PDF document for expense report PDFStandardExpenseReports=Standard template to generate a PDF document for expense report
ExpenseReportLine=Expense report line ExpenseReportLine=Expense report line
TF_OTHER=Other TF_OTHER=Other
TF_TRANSPORTATION=Transportation TF_TRIP=Transportation
TF_LUNCH=Lunch TF_LUNCH=Lunch
TF_METRO=Metro TF_METRO=Metro
TF_TRAIN=Train TF_TRAIN=Train