forked from Wavyzz/dolibarr
Merge branch '5.0' of git@github.com:Dolibarr/dolibarr.git into 6.0
Conflicts: htdocs/accountancy/class/bookkeeping.class.php htdocs/compta/facture/list.php htdocs/compta/paiement/class/cpaiement.class.php htdocs/compta/sociales/card.php htdocs/core/lib/functions.lib.php htdocs/expensereport/card.php htdocs/expensereport/class/expensereport.class.php htdocs/product/stats/facture.php
This commit is contained in:
@@ -609,6 +609,7 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load object in memory from the database
|
* Load object in memory from the database
|
||||||
*
|
*
|
||||||
@@ -1093,7 +1094,6 @@ class BookKeeping extends CommonObject
|
|||||||
* @param User $user User that deletes
|
* @param User $user User that deletes
|
||||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||||
* @param string $mode Mode
|
* @param string $mode Mode
|
||||||
*
|
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function delete(User $user, $notrigger = false, $mode='') {
|
public function delete(User $user, $notrigger = false, $mode='') {
|
||||||
|
|||||||
@@ -1359,8 +1359,8 @@ class Commande extends CommonOrder
|
|||||||
|
|
||||||
$this->line->vat_src_code=$vat_src_code;
|
$this->line->vat_src_code=$vat_src_code;
|
||||||
$this->line->tva_tx=$txtva;
|
$this->line->tva_tx=$txtva;
|
||||||
$this->line->localtax1_tx=$txlocaltax1;
|
$this->line->localtax1_tx=$localtaxes_type[1];
|
||||||
$this->line->localtax2_tx=$txlocaltax2;
|
$this->line->localtax2_tx=$localtaxes_type[3];
|
||||||
$this->line->localtax1_type=$localtaxes_type[0];
|
$this->line->localtax1_type=$localtaxes_type[0];
|
||||||
$this->line->localtax2_type=$localtaxes_type[2];
|
$this->line->localtax2_type=$localtaxes_type[2];
|
||||||
$this->line->fk_product=$fk_product;
|
$this->line->fk_product=$fk_product;
|
||||||
|
|||||||
@@ -594,6 +594,7 @@ if ($resql)
|
|||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||||
|
|
||||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ class Contrat extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function active_line($user, $line_id, $date, $date_end='', $comment='')
|
function active_line($user, $line_id, $date, $date_end='', $comment='')
|
||||||
{
|
{
|
||||||
$this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment);
|
return $this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ class Contrat extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function close_line($user, $line_id, $date_end, $comment='')
|
function close_line($user, $line_id, $date_end, $comment='')
|
||||||
{
|
{
|
||||||
$this->lines[$this->lines_id_index_mapper[$line_id]]->close_line($user, $date_end, $comment);
|
return $this->lines[$this->lines_id_index_mapper[$line_id]]->close_line($user, $date_end, $comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -600,6 +600,20 @@ abstract class CommonObject
|
|||||||
|
|
||||||
$datecreate = dol_now();
|
$datecreate = dol_now();
|
||||||
|
|
||||||
|
// Socpeople must have already been added by some a trigger, then we have to check it to avoid DB_ERROR_RECORD_ALREADY_EXISTS error
|
||||||
|
$TListeContacts=$this->liste_contact(-1, $source);
|
||||||
|
$already_added=false;
|
||||||
|
if(!empty($TListeContacts)) {
|
||||||
|
foreach($TListeContacts as $array_contact) {
|
||||||
|
if($array_contact['status'] == 4 && $array_contact['id'] == $fk_socpeople && $array_contact['fk_c_type_contact'] == $id_type_contact) {
|
||||||
|
$already_added=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$already_added) {
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// Insertion dans la base
|
// Insertion dans la base
|
||||||
@@ -632,6 +646,7 @@ abstract class CommonObject
|
|||||||
{
|
{
|
||||||
$this->error=$this->db->errno();
|
$this->error=$this->db->errno();
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
|
echo 'err rollback';
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -641,6 +656,7 @@ abstract class CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4161,7 +4161,7 @@ function getTaxesFromId($vatrate, $buyer=null, $seller=null, $firstparamisid=1)
|
|||||||
* @param Societe $buyer Company object
|
* @param Societe $buyer Company object
|
||||||
* @param Societe $seller Company object
|
* @param Societe $seller Company object
|
||||||
* @param int $firstparamisid 1 if first param is id into table (use this if you can)
|
* @param int $firstparamisid 1 if first param is id into table (use this if you can)
|
||||||
* @return array array(localtax_type1(1-6/0 if not found), rate localtax1, localtax_type1, rate localtax2, accountancycodecust, accountancycodesupp)
|
* @return array array(localtax_type1(1-6/0 if not found), rate localtax1, localtax_type2, rate localtax2, accountancycodecust, accountancycodesupp)
|
||||||
* @see getTaxesFromId
|
* @see getTaxesFromId
|
||||||
*/
|
*/
|
||||||
function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
|
function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_payment/modules_supplier
|
|||||||
/**
|
/**
|
||||||
* Class to manage customer payment numbering rules Ant
|
* Class to manage customer payment numbering rules Ant
|
||||||
*/
|
*/
|
||||||
class mod_supplier_payment_brodator extends ModeleNumRefPayments
|
class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments
|
||||||
{
|
{
|
||||||
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
|
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||||
var $error = '';
|
var $error = '';
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_payment/modules_supplier
|
|||||||
/**
|
/**
|
||||||
* Class to manage customer payment numbering rules Cicada
|
* Class to manage customer payment numbering rules Cicada
|
||||||
*/
|
*/
|
||||||
class mod_supplier_payment_bronan extends ModeleNumRefPayments
|
class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
|
||||||
{
|
{
|
||||||
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
|
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||||
var $prefix='SPAY';
|
var $prefix='SPAY';
|
||||||
|
|||||||
@@ -48,11 +48,11 @@ abstract class ModelePDFSuppliersPayments extends CommonDocGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class ModeleNumRefPayments
|
* \class ModeleNumRefSupplierPayments
|
||||||
* \brief Payment numbering references mother class
|
* \brief Payment numbering references mother class
|
||||||
*/
|
*/
|
||||||
|
|
||||||
abstract class ModeleNumRefPayments
|
abstract class ModeleNumRefSupplierPayments
|
||||||
{
|
{
|
||||||
var $error='';
|
var $error='';
|
||||||
|
|
||||||
|
|||||||
@@ -479,6 +479,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// PREPARE SEND
|
// PREPARE SEND
|
||||||
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
|
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
|
||||||
|
|
||||||
@@ -1063,7 +1064,8 @@ if (empty($reshook))
|
|||||||
|
|
||||||
$object_ligne = new ExpenseReportLine($db);
|
$object_ligne = new ExpenseReportLine($db);
|
||||||
|
|
||||||
$vatrate = GETPOST('vatrate');
|
$vatrate = GETPOST('vatrate','alpha'); // May be 8.5* (8.5NPROM)
|
||||||
|
|
||||||
$object_ligne->comments = GETPOST('comments');
|
$object_ligne->comments = GETPOST('comments');
|
||||||
$qty = GETPOST('qty','int');
|
$qty = GETPOST('qty','int');
|
||||||
if (empty($qty)) $qty=1;
|
if (empty($qty)) $qty=1;
|
||||||
@@ -1125,13 +1127,34 @@ if (empty($reshook))
|
|||||||
$object_ligne->fk_expensereport = $_POST['fk_expensereport'];
|
$object_ligne->fk_expensereport = $_POST['fk_expensereport'];
|
||||||
|
|
||||||
$type = 0; // TODO What if service ?
|
$type = 0; // TODO What if service ?
|
||||||
$seller = ''; // seller is unknown
|
|
||||||
$tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller);
|
|
||||||
|
|
||||||
|
// We don't know seller and buyer for expense reports
|
||||||
|
$seller = $mysoc;
|
||||||
|
$buyer = new Societe($db);
|
||||||
|
|
||||||
|
$localtaxes_type=getLocalTaxesFromRate($vatrate,0,$buyer,$seller);
|
||||||
|
|
||||||
|
// Clean vat code
|
||||||
|
$vat_src_code='';
|
||||||
|
|
||||||
|
if (preg_match('/\((.*)\)/', $vatrate, $reg))
|
||||||
|
{
|
||||||
|
$vat_src_code = $reg[1];
|
||||||
|
$vatrate = preg_replace('/\s*\(.*\)/', '', $vatrate); // Remove code into vatrate.
|
||||||
|
}
|
||||||
|
$vatrate = preg_replace('/\*/','',$vatrate);
|
||||||
|
|
||||||
|
$tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type);
|
||||||
|
|
||||||
|
$object_ligne->vat_src_code = $vat_src_code;
|
||||||
$object_ligne->vatrate = price2num($vatrate);
|
$object_ligne->vatrate = price2num($vatrate);
|
||||||
$object_ligne->total_ttc = $tmp[2];
|
$object_ligne->total_ttc = $tmp[2];
|
||||||
$object_ligne->total_ht = $tmp[0];
|
$object_ligne->total_ht = $tmp[0];
|
||||||
$object_ligne->total_tva = $tmp[1];
|
$object_ligne->total_tva = $tmp[1];
|
||||||
|
$object_ligne->localtax1_tx = $localtaxes_type[1];
|
||||||
|
$object_ligne->localtax2_tx = $localtaxes_type[3];
|
||||||
|
$object_ligne->localtax1_type = $localtaxes_type[0];
|
||||||
|
$object_ligne->localtax2_type = $localtaxes_type[2];
|
||||||
|
|
||||||
$result = $object_ligne->insert();
|
$result = $object_ligne->insert();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
@@ -1862,7 +1885,8 @@ else
|
|||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
|
|
||||||
print '<tr class="oddseven"><td>';
|
print '<tr class="oddseven">';
|
||||||
|
print '<td>';
|
||||||
$paymentexpensereportstatic->id = $objp->rowid;
|
$paymentexpensereportstatic->id = $objp->rowid;
|
||||||
$paymentexpensereportstatic->datepaye = $db->jdate($objp->dp);
|
$paymentexpensereportstatic->datepaye = $db->jdate($objp->dp);
|
||||||
$paymentexpensereportstatic->ref = $objp->rowid;
|
$paymentexpensereportstatic->ref = $objp->rowid;
|
||||||
@@ -1893,6 +1917,7 @@ else
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '<td align="right">'.price($objp->amount)."</td>";
|
print '<td align="right">'.price($objp->amount)."</td>";
|
||||||
|
print '<td></td>';
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
$totalpaid += $objp->amount;
|
$totalpaid += $objp->amount;
|
||||||
$i++;
|
$i++;
|
||||||
@@ -1900,21 +1925,21 @@ else
|
|||||||
|
|
||||||
if ($object->paid == 0)
|
if ($object->paid == 0)
|
||||||
{
|
{
|
||||||
print '<tr><td colspan="' . $nbcols . '" align="right">'.$langs->trans("AlreadyPaid").':</td><td align="right">'.price($totalpaid).'</td></tr>';
|
print '<tr><td colspan="' . $nbcols . '" align="right">'.$langs->trans("AlreadyPaid").':</td><td align="right">'.price($totalpaid).'</td><td></td></tr>';
|
||||||
print '<tr><td colspan="' . $nbcols . '" align="right">'.$langs->trans("AmountExpected").':</td><td align="right">'.price($object->total_ttc).'</td></tr>';
|
print '<tr><td colspan="' . $nbcols . '" align="right">'.$langs->trans("AmountExpected").':</td><td align="right">'.price($object->total_ttc).'</td><td></td></tr>';
|
||||||
|
|
||||||
$remaintopay = $object->total_ttc - $totalpaid;
|
$remaintopay = $object->total_ttc - $totalpaid;
|
||||||
|
|
||||||
print '<tr><td colspan="' . $nbcols . '" align="right">'.$langs->trans("RemainderToPay").':</td>';
|
print '<tr><td colspan="' . $nbcols . '" align="right">'.$langs->trans("RemainderToPay").':</td>';
|
||||||
print '<td align="right"'.($remaintopay?' class="amountremaintopay"':'').'>'.price($remaintopay).'</td></tr>';
|
print '<td align="right"'.($remaintopay?' class="amountremaintopay"':'').'>'.price($remaintopay).'</td><td></td></tr>';
|
||||||
}
|
}
|
||||||
print "</table>";
|
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@@ -2062,7 +2087,9 @@ else
|
|||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
print '<td style="text-align:right;">';
|
print '<td style="text-align:right;">';
|
||||||
print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$objp->vatrate), $mysoc, '');
|
$seller=$mysoc;
|
||||||
|
$buyer=new Societe($db);
|
||||||
|
print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$objp->vatrate), $seller, $buyer, 0, 0, '', false, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Unit price
|
// Unit price
|
||||||
@@ -2148,7 +2175,7 @@ else
|
|||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
$defaultvat=-1;
|
$defaultvat=-1;
|
||||||
if (! empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none';
|
if (! empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none';
|
||||||
print $form->load_tva('vatrate', ($vatrate!=''?$vatrate:$defaultvat), $mysoc, '', 0, 0, '', false);
|
print $form->load_tva('vatrate', ($vatrate!=''?$vatrate:$defaultvat), $mysoc, '', 0, 0, '', false, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Unit price
|
// Unit price
|
||||||
|
|||||||
@@ -268,7 +268,6 @@ class ExpenseReport extends CommonObject
|
|||||||
if (empty($fk_user_author)) $fk_user_author = $user->id;
|
if (empty($fk_user_author)) $fk_user_author = $user->id;
|
||||||
|
|
||||||
$this->context['createfromclone'] = 'createfromclone';
|
$this->context['createfromclone'] = 'createfromclone';
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// get extrafields so they will be clone
|
// get extrafields so they will be clone
|
||||||
@@ -307,6 +306,7 @@ class ExpenseReport extends CommonObject
|
|||||||
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('EXPENSEREPORT_CLONE',$user);
|
$result=$this->call_trigger('EXPENSEREPORT_CLONE',$user);
|
||||||
|
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
@@ -1577,7 +1577,7 @@ class ExpenseReport extends CommonObject
|
|||||||
* @param int $rowid Line to edit
|
* @param int $rowid Line to edit
|
||||||
* @param int $type_fees_id Type payment
|
* @param int $type_fees_id Type payment
|
||||||
* @param int $projet_id Project id
|
* @param int $projet_id Project id
|
||||||
* @param double $vatrate Vat rate
|
* @param double $vatrate Vat rate. Can be '8.5* (8.5NPROM...)'
|
||||||
* @param string $comments Description
|
* @param string $comments Description
|
||||||
* @param real $qty Qty
|
* @param real $qty Qty
|
||||||
* @param double $value_unit Value init
|
* @param double $value_unit Value init
|
||||||
@@ -1587,14 +1587,34 @@ class ExpenseReport extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $expensereport_id)
|
function updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $expensereport_id)
|
||||||
{
|
{
|
||||||
global $user;
|
global $user, $mysoc;
|
||||||
|
|
||||||
if ($this->fk_statut==0 || $this->fk_statut==99)
|
if ($this->fk_statut==0 || $this->fk_statut==99)
|
||||||
{
|
{
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
|
$type = 0; // TODO What if type is service ?
|
||||||
|
|
||||||
|
// We don't know seller and buyer for expense reports
|
||||||
|
$seller = $mysoc;
|
||||||
|
$buyer = new Societe($this->db);
|
||||||
|
|
||||||
|
$localtaxes_type=getLocalTaxesFromRate($vatrate,0,$buyer,$seller);
|
||||||
|
|
||||||
|
// Clean vat code
|
||||||
|
$vat_src_code='';
|
||||||
|
|
||||||
|
if (preg_match('/\((.*)\)/', $vatrate, $reg))
|
||||||
|
{
|
||||||
|
$vat_src_code = $reg[1];
|
||||||
|
$vatrate = preg_replace('/\s*\(.*\)/', '', $vatrate); // Remove code into vatrate.
|
||||||
|
}
|
||||||
|
$vatrate = preg_replace('/\*/','',$vatrate);
|
||||||
|
|
||||||
|
$tmp = calcul_price_total($qty, $value_unit, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type);
|
||||||
|
|
||||||
// calcul de tous les totaux de la ligne
|
// calcul de tous les totaux de la ligne
|
||||||
$total_ttc = price2num($qty*$value_unit, 'MT');
|
//$total_ttc = price2num($qty*$value_unit, 'MT');
|
||||||
|
|
||||||
$tx_tva = $vatrate / 100;
|
$tx_tva = $vatrate / 100;
|
||||||
$tx_tva = $tx_tva + 1;
|
$tx_tva = $tx_tva + 1;
|
||||||
@@ -1604,6 +1624,9 @@ class ExpenseReport extends CommonObject
|
|||||||
// fin calculs
|
// fin calculs
|
||||||
|
|
||||||
$ligne = new ExpenseReportLine($this->db);
|
$ligne = new ExpenseReportLine($this->db);
|
||||||
|
|
||||||
|
$ligne->rowid = $rowid;
|
||||||
|
|
||||||
$ligne->comments = $comments;
|
$ligne->comments = $comments;
|
||||||
$ligne->qty = $qty;
|
$ligne->qty = $qty;
|
||||||
$ligne->value_unit = $value_unit;
|
$ligne->value_unit = $value_unit;
|
||||||
@@ -1613,11 +1636,21 @@ class ExpenseReport extends CommonObject
|
|||||||
$ligne->fk_c_type_fees = $type_fees_id;
|
$ligne->fk_c_type_fees = $type_fees_id;
|
||||||
$ligne->fk_projet = $projet_id;
|
$ligne->fk_projet = $projet_id;
|
||||||
|
|
||||||
$ligne->total_ht = $total_ht;
|
//$ligne->total_ht = $total_ht;
|
||||||
$ligne->total_tva = $total_tva;
|
//$ligne->total_tva = $total_tva;
|
||||||
$ligne->total_ttc = $total_ttc;
|
//$ligne->total_ttc = $total_ttc;
|
||||||
|
//$ligne->vatrate = price2num($vatrate);
|
||||||
|
|
||||||
|
$ligne->vat_src_code = $vat_src_code;
|
||||||
$ligne->vatrate = price2num($vatrate);
|
$ligne->vatrate = price2num($vatrate);
|
||||||
$ligne->rowid = $rowid;
|
$ligne->total_ttc = $tmp[2];
|
||||||
|
$ligne->total_ht = $tmp[0];
|
||||||
|
$ligne->total_tva = $tmp[1];
|
||||||
|
$ligne->localtax1_tx = $localtaxes_type[1];
|
||||||
|
$ligne->localtax2_tx = $localtaxes_type[3];
|
||||||
|
$ligne->localtax1_type = $localtaxes_type[0];
|
||||||
|
$ligne->localtax2_type = $localtaxes_type[2];
|
||||||
|
|
||||||
|
|
||||||
// Select des infos sur le type fees
|
// Select des infos sur le type fees
|
||||||
$sql = "SELECT c.code as code_type_fees, c.label as libelle_type_fees";
|
$sql = "SELECT c.code as code_type_fees, c.label as libelle_type_fees";
|
||||||
|
|||||||
@@ -896,7 +896,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Actions to build doc
|
// Actions to build doc
|
||||||
$upload_dir = $conf->commande->dir_output;
|
$upload_dir = $conf->fournisseur->commande->dir_output;
|
||||||
$permissioncreate = $user->rights->fournisseur->commande->creer;
|
$permissioncreate = $user->rights->fournisseur->commande->creer;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
* Copyright (C) 2012-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2012-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2012-2016 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2012-2016 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
|
||||||
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
|
* Copyright (C) 2014-2017 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
|
||||||
@@ -41,7 +41,6 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
|
|||||||
$myparam = GETPOST("myparam");
|
$myparam = GETPOST("myparam");
|
||||||
$action=GETPOST('action', 'alpha');
|
$action=GETPOST('action', 'alpha');
|
||||||
$id=GETPOST('id', 'int');
|
$id=GETPOST('id', 'int');
|
||||||
$userid = GETPOST('userid')?GETPOST('userid'):$user->id;
|
|
||||||
|
|
||||||
// Protection if external user
|
// Protection if external user
|
||||||
if ($user->societe_id > 0) accessforbidden();
|
if ($user->societe_id > 0) accessforbidden();
|
||||||
@@ -61,7 +60,8 @@ if ($action == 'create')
|
|||||||
$object = new Holiday($db);
|
$object = new Holiday($db);
|
||||||
|
|
||||||
// If no right to create a request
|
// If no right to create a request
|
||||||
if (($userid == $user->id && empty($user->rights->holiday->write)) || ($userid != $user->id && empty($user->rights->holiday->write_all)))
|
$fuserid = GETPOST('fuserid');
|
||||||
|
if (($fuserid == $user->id && empty($user->rights->holiday->write)) || ($fuserid != $user->id && empty($user->rights->holiday->write_all)))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans('CantCreateCP'), null, 'errors');
|
setEventMessages($langs->trans('CantCreateCP'), null, 'errors');
|
||||||
@@ -86,7 +86,6 @@ if ($action == 'create')
|
|||||||
|
|
||||||
$valideur = GETPOST('valideur');
|
$valideur = GETPOST('valideur');
|
||||||
$description = trim(GETPOST('description'));
|
$description = trim(GETPOST('description'));
|
||||||
$userID = GETPOST('userID');
|
|
||||||
|
|
||||||
// If no type
|
// If no type
|
||||||
if ($type <= 0)
|
if ($type <= 0)
|
||||||
@@ -722,7 +721,7 @@ llxHeader('', $langs->trans('CPTitreMenu'));
|
|||||||
if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create')
|
if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create')
|
||||||
{
|
{
|
||||||
// Si l'utilisateur n'a pas le droit de faire une demande
|
// Si l'utilisateur n'a pas le droit de faire une demande
|
||||||
if (($userid == $user->id && empty($user->rights->holiday->write)) || ($userid != $user->id && empty($user->rights->holiday->write_all)))
|
if (($fuserid == $user->id && empty($user->rights->holiday->write)) || ($fuserid != $user->id && empty($user->rights->holiday->write_all)))
|
||||||
{
|
{
|
||||||
$errors[]=$langs->trans('CantCreateCP');
|
$errors[]=$langs->trans('CantCreateCP');
|
||||||
}
|
}
|
||||||
@@ -802,7 +801,6 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
|
|||||||
// Formulaire de demande
|
// Formulaire de demande
|
||||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" onsubmit="return valider()" name="demandeCP">'."\n";
|
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" onsubmit="return valider()" name="demandeCP">'."\n";
|
||||||
print '<input type="hidden" name="action" value="create" />'."\n";
|
print '<input type="hidden" name="action" value="create" />'."\n";
|
||||||
print '<input type="hidden" name="userID" value="'.$userid.'" />'."\n";
|
|
||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
@@ -833,10 +831,10 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
if (empty($user->rights->holiday->write_all))
|
if (empty($user->rights->holiday->write_all))
|
||||||
{
|
{
|
||||||
print $form->select_dolusers($userid, 'useridbis', 0, '', 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
print $form->select_dolusers($fuserid, 'useridbis', 0, '', 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||||
print '<input type="hidden" name="userid" value="'.$userid.'">';
|
print '<input type="hidden" name="fuserid" value="'.($fuserid?$fuserid:$user->id).'">';
|
||||||
}
|
}
|
||||||
else print $form->select_dolusers(GETPOST('userid')?GETPOST('userid'):$user->id,'userid',0,'',0);
|
else print $form->select_dolusers(GETPOST('fuserid')?GETPOST('fuserid'):$user->id,'fuserid',0,'',0);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ $search_type = GETPOST('search_type','int');
|
|||||||
|
|
||||||
// List of fields to search into when doing a "search in all"
|
// List of fields to search into when doing a "search in all"
|
||||||
$fieldstosearchall = array(
|
$fieldstosearchall = array(
|
||||||
'cp.rowid'=>'Ref',
|
|
||||||
'cp.description'=>'Description',
|
'cp.description'=>'Description',
|
||||||
'uu.lastname'=>'EmployeeLastname',
|
'uu.lastname'=>'EmployeeLastname',
|
||||||
'uu.firstname'=>'EmployeeFirstname'
|
'uu.firstname'=>'EmployeeFirstname'
|
||||||
@@ -124,7 +123,7 @@ $order = $db->order($sortfield,$sortorder).$db->plimit($limit + 1, $offset);
|
|||||||
// Ref
|
// Ref
|
||||||
if(!empty($search_ref))
|
if(!empty($search_ref))
|
||||||
{
|
{
|
||||||
$filter.= " AND cp.rowid LIKE '%".$db->escape($search_ref)."%'\n";
|
$filter.= " AND cp.rowid = ".$db->escape($search_ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start date
|
// Start date
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ ALTER TABLE llx_bookmark ADD COLUMN entity integer DEFAULT 1 NOT NULL;
|
|||||||
ALTER TABLE llx_bookmark MODIFY COLUMN url varchar(255) NOT NULL;
|
ALTER TABLE llx_bookmark MODIFY COLUMN url varchar(255) NOT NULL;
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT '2001-01-01 00:00:00';
|
-- VMYSQL4.1 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT '2001-01-01 00:00:00';
|
||||||
|
|
||||||
-- Clean corrupted values for tms
|
-- Clean corrupted values for tms
|
||||||
-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES';
|
-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES';
|
||||||
@@ -74,7 +74,7 @@ ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT '2001-01-
|
|||||||
-- VMYSQL4.3 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN date_fin DATETIME NULL DEFAULT NULL;
|
-- VMYSQL4.3 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN date_fin DATETIME NULL DEFAULT NULL;
|
||||||
-- VPGSQL8.2 ALTER TABLE llx_opensurvey_sondage ALTER COLUMN date_fin DROP NOT NULL;
|
-- VPGSQL8.2 ALTER TABLE llx_opensurvey_sondage ALTER COLUMN date_fin DROP NOT NULL;
|
||||||
|
|
||||||
ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP;
|
-- VMYSQL4.1 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP;
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE llx_opensurvey_sondage ADD COLUMN entity integer DEFAULT 1 NOT NULL;
|
ALTER TABLE llx_opensurvey_sondage ADD COLUMN entity integer DEFAULT 1 NOT NULL;
|
||||||
@@ -204,9 +204,14 @@ CREATE TABLE llx_payment_salary (
|
|||||||
fk_user_modif integer
|
fk_user_modif integer
|
||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|
||||||
|
|
||||||
|
DELETE FROM llx_product_batch where fk_product_stock NOT IN (SELECT rowid from llx_product_stock);
|
||||||
|
|
||||||
ALTER TABLE llx_product_batch ADD INDEX idx_fk_product_stock (fk_product_stock);
|
ALTER TABLE llx_product_batch ADD INDEX idx_fk_product_stock (fk_product_stock);
|
||||||
ALTER TABLE llx_product_batch ADD CONSTRAINT fk_product_batch_fk_product_stock FOREIGN KEY (fk_product_stock) REFERENCES llx_product_stock (rowid);
|
ALTER TABLE llx_product_batch ADD CONSTRAINT fk_product_batch_fk_product_stock FOREIGN KEY (fk_product_stock) REFERENCES llx_product_stock (rowid);
|
||||||
|
|
||||||
|
DELETE FROM llx_expeditiondet_batch where fk_expeditiondet NOT IN (SELECT rowid from llx_expeditiondet);
|
||||||
|
|
||||||
ALTER TABLE llx_expeditiondet_batch ADD INDEX idx_fk_expeditiondet (fk_expeditiondet);
|
ALTER TABLE llx_expeditiondet_batch ADD INDEX idx_fk_expeditiondet (fk_expeditiondet);
|
||||||
ALTER TABLE llx_expeditiondet_batch ADD CONSTRAINT fk_expeditiondet_batch_fk_expeditiondet FOREIGN KEY (fk_expeditiondet) REFERENCES llx_expeditiondet(rowid);
|
ALTER TABLE llx_expeditiondet_batch ADD CONSTRAINT fk_expeditiondet_batch_fk_expeditiondet FOREIGN KEY (fk_expeditiondet) REFERENCES llx_expeditiondet(rowid);
|
||||||
|
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
elseif ($user->rights->facture->lire)
|
elseif ($user->rights->facture->lire)
|
||||||
{
|
{
|
||||||
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,";
|
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,";
|
||||||
$sql.= " f.facnumber, f.datef, f.paye, f.fk_statut as statut, f.rowid as facid,";
|
$sql.= " f.facnumber, f.datef, f.paye, f.type, f.fk_statut as statut, f.rowid as facid,";
|
||||||
$sql.= " d.rowid, d.total_ht as total_ht, d.qty"; // We must keep the d.rowid here to not loose record because of the distinct used to ignore duplicate line when link on societe_commerciaux is used
|
$sql.= " d.rowid, d.total_ht as total_ht, d.qty"; // We must keep the d.rowid here to not loose record because of the distinct used to ignore duplicate line when link on societe_commerciaux is used
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
@@ -239,21 +239,22 @@ if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
|
$invoicestatic->id=$objp->facid;
|
||||||
|
$invoicestatic->ref=$objp->facnumber;
|
||||||
|
$societestatic->fetch($objp->socid);
|
||||||
|
$paiement = $invoicestatic->getSommePaiement();
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$invoicestatic->id=$objp->facid;
|
|
||||||
$invoicestatic->ref=$objp->facnumber;
|
|
||||||
print $invoicestatic->getNomUrl(1);
|
print $invoicestatic->getNomUrl(1);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
$societestatic->fetch($objp->socid);
|
|
||||||
print '<td>'.$societestatic->getNomUrl(1).'</td>';
|
print '<td>'.$societestatic->getNomUrl(1).'</td>';
|
||||||
print "<td>".$objp->code_client."</td>\n";
|
print "<td>".$objp->code_client."</td>\n";
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print dol_print_date($db->jdate($objp->datef),'day')."</td>";
|
print dol_print_date($db->jdate($objp->datef),'day')."</td>";
|
||||||
print '<td align="center">'.$objp->qty."</td>\n";
|
print '<td align="center">'.$objp->qty."</td>\n";
|
||||||
print '<td align="right">'.price($objp->total_ht)."</td>\n";
|
print '<td align="right">'.price($objp->total_ht)."</td>\n";
|
||||||
print '<td align="right">'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).'</td>';
|
print '<td align="right">'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5,$paiement,$objp->type).'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user