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

develop

Conflicts:
	htdocs/install/mysql/migration/3.7.0-3.8.0.sql
This commit is contained in:
Laurent Destailleur 2015-03-10 13:46:44 +01:00
commit 51b67704ee
11 changed files with 69 additions and 26 deletions

View File

@ -103,6 +103,21 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
print "</table></form><br>\n"; print "</table></form><br>\n";
} }
// Search supplier order
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
{
$var=false;
print '<form method="post" action="'.DOL_URL_ROOT.'/fourn/commande/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchASupplierOrder").'</td></tr>';
print '<tr '.$bc[$var].'><td>';
print '<label for="search_ref">'.$langs->trans("Ref").'</label>:</td><td><input type="text" class="flat" name="search_ref" id="search_ref" size=18></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
print '<tr '.$bc[$var].'><td class="nowrap"><label for="search_all">'.$langs->trans("Other").'</label>:</td><td><input type="text" class="flat" name="search_all" id="search_all" size="18"></td>';
print '</tr>';
print "</table></form><br>\n";
}
// Search contract // Search contract
if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
{ {

View File

@ -93,9 +93,10 @@ if ($conf->salaries->enabled)
print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
$sql = "SELECT s.rowid, s.amount, s.label, s.datev as dm"; $sql = "SELECT s.rowid, s.amount, s.label, s.datev as dm, s.salary, u.salary as current_salary";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s, ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE s.entity = ".$conf->entity; $sql.= " WHERE s.entity IN (".getEntity('user',1).")";
$sql.= " AND u.rowid = s.fk_user";
if ($year > 0) if ($year > 0)
{ {
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance, // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
@ -132,11 +133,11 @@ if ($conf->salaries->enabled)
print "<td>".$obj->label."</td>\n"; print "<td>".$obj->label."</td>\n";
print '<td align="right">'.price($obj->amount)."</td>"; print '<td align="right">'.($obj->salary?price($obj->salary):'')."</td>";
// Ref payment // Ref payment
$sal_static->id=$obj->rowid; $sal_static->id=$obj->rowid;
$sal_static->ref=$obj->rowid; $sal_static->ref=$obj->rowid;
print '<td align="left">'.$sal_static->getNomUrl(1)."</td>\n"; print '<td align="left">'.$sal_static->getNomUrl(1)."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n"; print '<td align="center">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
@ -146,7 +147,7 @@ if ($conf->salaries->enabled)
$i++; $i++;
} }
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").'</td>'; print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").'</td>';
print '<td align="right">'.price($total)."</td>"; print '<td align="right">'."</td>";
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
print '<td align="right">'.price($total)."</td>"; print '<td align="right">'.price($total)."</td>";

View File

@ -67,8 +67,8 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
$datesp=dol_mktime(12,0,0, $_POST["datespmonth"], $_POST["datespday"], $_POST["datespyear"]); $datesp=dol_mktime(12,0,0, $_POST["datespmonth"], $_POST["datespday"], $_POST["datespyear"]);
$dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]); $dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]);
$sal->accountid=GETPOST("accountid"); $sal->accountid=GETPOST("accountid","int");
$sal->fk_user=GETPOST("fk_user"); $sal->fk_user=GETPOST("fk_user","int");
$sal->datev=$datev; $sal->datev=$datev;
$sal->datep=$datep; $sal->datep=$datep;
$sal->amount=price2num(GETPOST("amount")); $sal->amount=price2num(GETPOST("amount"));
@ -80,6 +80,11 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
$sal->num_payment=GETPOST("num_payment"); $sal->num_payment=GETPOST("num_payment");
$sal->fk_user_creat=$user->id; $sal->fk_user_creat=$user->id;
// Set user current salary as ref salaray for the payment
$fuser=new User($db);
$fuser->fetch(GETPOST("fk_user","int"));
$sal->salary=$fuser->salary;
if (empty($datep) || empty($datev) || empty($datesp) || empty($dateep)) if (empty($datep) || empty($datev) || empty($datesp) || empty($dateep))
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors');

View File

@ -324,6 +324,7 @@ class PaymentSalary extends CommonObject
$sql.= ", datep"; $sql.= ", datep";
$sql.= ", datev"; $sql.= ", datev";
$sql.= ", amount"; $sql.= ", amount";
$sql.= ", salary";
$sql.= ", fk_typepayment"; $sql.= ", fk_typepayment";
$sql.= ", num_payment"; $sql.= ", num_payment";
if ($this->note) $sql.= ", note"; if ($this->note) $sql.= ", note";
@ -338,7 +339,8 @@ class PaymentSalary extends CommonObject
$sql.= "'".$this->fk_user."'"; $sql.= "'".$this->fk_user."'";
$sql.= ", '".$this->db->idate($this->datep)."'"; $sql.= ", '".$this->db->idate($this->datep)."'";
$sql.= ", '".$this->db->idate($this->datev)."'"; $sql.= ", '".$this->db->idate($this->datev)."'";
$sql.= ", '".$this->amount."'"; $sql.= ", ".$this->amount;
$sql.= ", ".($this->salary > 0 ? $this->salary : "null");
$sql.= ", '".$this->type_payment."'"; $sql.= ", '".$this->type_payment."'";
$sql.= ", '".$this->num_payment."'"; $sql.= ", '".$this->num_payment."'";
if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'"; if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'";

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> /* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2015 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
@ -82,7 +83,8 @@ $form = new Form($db);
$salstatic = new PaymentSalary($db); $salstatic = new PaymentSalary($db);
$userstatic = new User($db); $userstatic = new User($db);
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev as dm, s.fk_typepayment as type, s.num_payment,"; $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary as current_salary, u.fk_societe as fk_soc,";
$sql.= " s.rowid, s.fk_user, s.amount, s.salary, s.label, s.datev as dm, s.fk_typepayment as type, s.num_payment,";
$sql.= " pst.code as payment_code"; $sql.= " pst.code as payment_code";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id,"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id,";
@ -93,7 +95,7 @@ $sql.= " AND s.entity = ".$conf->entity;
// Search criteria // Search criteria
if ($search_ref) $sql.=" AND s.rowid=".$search_ref; if ($search_ref) $sql.=" AND s.rowid=".$search_ref;
if ($search_label) $sql.=" AND s.label LIKE '%".$db->escape($search_label)."%'"; if ($search_label) $sql.=" AND s.label LIKE '%".$db->escape($search_label)."%'";
if ($search_amount) $sql.=" AND s.amount='".$db->escape(price2num(trim($search_amount)))."'"; if ($search_amount) $sql.=natural_search("s.amount", $search_amount, 1);
if ($filtre) { if ($filtre) {
$filtre=str_replace(":","=",$filtre); $filtre=str_replace(":","=",$filtre);
$sql .= " AND ".$filtre; $sql .= " AND ".$filtre;
@ -124,9 +126,10 @@ if ($result)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"s.rowid","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"s.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"u.rowid","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"u.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.salary","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datev","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datev","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre(""); print_liste_field_titre("");
print "</tr>\n"; print "</tr>\n";
@ -136,6 +139,9 @@ if ($result)
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="3" name="search_ref" value="'.$search_ref.'">'; print '<input class="flat" type="text" size="3" name="search_ref" value="'.$search_ref.'">';
print '</td>'; print '</td>';
// People
print '<td class="liste_titre">&nbsp;</td>';
// Current salary
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
// Label // Label
print '<td class="liste_titre"><input type="text" class="flat" size="14" name="search_label" value="'.$search_label.'"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="14" name="search_label" value="'.$search_label.'"></td>';
@ -159,10 +165,19 @@ if ($result)
$userstatic->id=$obj->uid; $userstatic->id=$obj->uid;
$userstatic->lastname=$obj->lastname; $userstatic->lastname=$obj->lastname;
$userstatic->firstname=$obj->firstname; $userstatic->firstname=$obj->firstname;
$userstatic->admin=$obj->admin;
$userstatic->login=$obj->login;
$userstatic->email=$obj->email;
$userstatic->societe_id=$obj->fk_soc;
$salstatic->id=$obj->rowid; $salstatic->id=$obj->rowid;
$salstatic->ref=$obj->rowid; $salstatic->ref=$obj->rowid;
print "<td>".$salstatic->getNomUrl(1)."</td>\n"; // Ref
print "<td>".$salstatic->getNomUrl(1)."</td>\n";
// User name
print "<td>".$userstatic->getNomUrl(1)."</td>\n"; print "<td>".$userstatic->getNomUrl(1)."</td>\n";
// Current salary
print "<td>".($obj->salary?price($obj->salary):'')."</td>\n";
// Label payment
print "<td>".dol_trunc($obj->label,40)."</td>\n"; print "<td>".dol_trunc($obj->label,40)."</td>\n";
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n"; print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
// Type // Type
@ -176,7 +191,7 @@ if ($result)
$i++; $i++;
} }
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").'</td>'; print '<tr class="liste_total"><td colspan="6" class="liste_total">'.$langs->trans("Total").'</td>';
print '<td class="liste_total" align="right">'.price($total,0,$outputlangs,1,-1,-1,$conf->currency)."</td>"; print '<td class="liste_total" align="right">'.price($total,0,$outputlangs,1,-1,-1,$conf->currency)."</td>";
print "<td>&nbsp;</td></tr>"; print "<td>&nbsp;</td></tr>";

View File

@ -4949,7 +4949,7 @@ function dol_getmypid()
* Generate natural SQL search string * Generate natural SQL search string
* *
* @param string|string[] $fields String or array of strings, filled with the name of fields in the SQL query * @param string|string[] $fields String or array of strings, filled with the name of fields in the SQL query
* @param string $value The value to look for. * @param string $value The value to look for.
* If param $numeric is 0, can contains several keywords separated with a space, like "keyword1 keyword2" = We want record field like keyword1 and field like keyword2 * If param $numeric is 0, can contains several keywords separated with a space, like "keyword1 keyword2" = We want record field like keyword1 and field like keyword2
* If param $numeric is 1, can contains an operator <>= like "<10" or ">=100.5 < 1000" * If param $numeric is 1, can contains an operator <>= like "<10" or ">=100.5 < 1000"
* @param string $number 0=value is list of keywords, 1=value is a numeric test * @param string $number 0=value is list of keywords, 1=value is a numeric test
@ -4958,10 +4958,10 @@ function dol_getmypid()
function natural_search($fields, $value, $numeric=0) function natural_search($fields, $value, $numeric=0)
{ {
global $db,$langs; global $db,$langs;
if ($numeric) if ($numeric)
{ {
$value=preg_replace('/([<>=]+)\s([0-9'.preg_quote($langs->trans("DecimalSeparator"),'/').'\-])/','\1\2',$value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do $value=preg_replace('/([<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"),'/').'\-])/','\1\2',$value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do
} }
$crits = explode(' ', $value); $crits = explode(' ', $value);
$res = ''; $res = '';
@ -4970,19 +4970,19 @@ function natural_search($fields, $value, $numeric=0)
$nboffields = count($fields); $nboffields = count($fields);
$end2 = count($crits); $end2 = count($crits);
$j = 0; $j = 0;
foreach ($crits as $crit) foreach ($crits as $crit)
{ {
$i = 0; $i2 = 0; $i = 0; $i2 = 0;
$newres = ''; $newres = '';
foreach ($fields as $field) foreach ($fields as $field)
{ {
if ($numeric) if ($numeric)
{ {
$operator='='; $operator='=';
$newcrit = preg_replace('/([<>=]+)/','',trim($crit)); $newcrit = preg_replace('/([<>=]+)/','',trim($crit));
preg_match('/([<>=]+)/',trim($crit), $reg); preg_match('/([<>=]+)/',trim($crit), $reg);
if ($reg[1]) if ($reg[1])
{ {
$operator = $reg[1]; $operator = $reg[1];
} }
@ -4992,7 +4992,7 @@ function natural_search($fields, $value, $numeric=0)
$i2++; // a criteria was added to string $i2++; // a criteria was added to string
} }
} }
else else
{ {
$newres .= ($i2 > 0 ? ' OR ' : '') . $field . " LIKE '%" . $db->escape(trim($crit)) . "%'"; $newres .= ($i2 > 0 ? ' OR ' : '') . $field . " LIKE '%" . $db->escape(trim($crit)) . "%'";
$i2++; // a criteria was added to string $i2++; // a criteria was added to string

View File

@ -140,7 +140,7 @@ if ($search_ttc != '')
} }
if ($sall) if ($sall)
{ {
$sql .= natural_search(array('cf.ref', 'cf.note_public', 'cf.note_private'), $sall); $sql .= natural_search(array('cf.ref', 'cf.ref_supplier', 'cf.note_public', 'cf.note_private'), $sall);
} }
if ($socid) $sql.= " AND s.rowid = ".$socid; if ($socid) $sql.= " AND s.rowid = ".$socid;

View File

@ -21,6 +21,8 @@
ALTER TABLE llx_extrafields ADD COLUMN perms varchar(255) after fieldrequired; ALTER TABLE llx_extrafields ADD COLUMN perms varchar(255) after fieldrequired;
ALTER TABLE llx_payment_salary ADD COLUMN salary real after datev;
UPDATE llx_projet_task_time SET task_datehour = task_date where task_datehour IS NULL; UPDATE llx_projet_task_time SET task_datehour = task_date where task_datehour IS NULL;
ALTER TABLE llx_projet_task_time ADD COLUMN task_date_withhour integer DEFAULT 0 after task_datehour; ALTER TABLE llx_projet_task_time ADD COLUMN task_date_withhour integer DEFAULT 0 after task_datehour;

View File

@ -23,6 +23,7 @@ create table llx_payment_salary
fk_user integer NOT NULL, fk_user integer NOT NULL,
datep date, -- date de paiement datep date, -- date de paiement
datev date, -- date de valeur datev date, -- date de valeur
salary real, -- salary of user when payment was done
amount real NOT NULL DEFAULT 0, amount real NOT NULL DEFAULT 0,
fk_typepayment integer NOT NULL, fk_typepayment integer NOT NULL,
num_payment varchar(50), num_payment varchar(50),

View File

@ -59,6 +59,7 @@ MenuOrdersToBill=Orders delivered
MenuOrdersToBill2=Billable orders MenuOrdersToBill2=Billable orders
SearchOrder=Search order SearchOrder=Search order
SearchACustomerOrder=Search a customer order SearchACustomerOrder=Search a customer order
SearchASupplierOrder=Search a supplier order
ShipProduct=Ship product ShipProduct=Ship product
Discount=Discount Discount=Discount
CreateOrder=Create Order CreateOrder=Create Order

View File

@ -10,3 +10,4 @@ SalariesPayments=Salaries payments
ShowSalaryPayment=Show salary payment ShowSalaryPayment=Show salary payment
THM=Average hourly price THM=Average hourly price
TJM=Average daily price TJM=Average daily price
CurrentSalary=Current salary