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

This commit is contained in:
Laurent Destailleur 2016-09-01 11:37:40 +02:00
commit 91ede48390
10 changed files with 140 additions and 116 deletions

View File

@ -2513,7 +2513,7 @@ if ($action == 'create' && $user->rights->commande->creer)
} }
// Create contract // Create contract
if ($conf->contrat->enabled && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_ACCEPTED)) { if ($conf->contrat->enabled && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_ACCEPTED || $object->statut == Commande::STATUS_CLOSED)) {
$langs->load("contracts"); $langs->load("contracts");
if ($user->rights->contrat->creer) { if ($user->rights->contrat->creer) {

View File

@ -2185,6 +2185,8 @@ if ($action == 'create')
if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid)))) if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid))))
{ {
// Deposit // Deposit
if (empty($conf->global->INVOICE_DISABLE_DEPOSIT))
{
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp='<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '> '; $tmp='<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '> ';
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript" language="javascript">
@ -2211,6 +2213,7 @@ if ($action == 'create')
print '</div></div>'; print '</div></div>';
} }
}
if ($socid > 0) if ($socid > 0)
{ {
@ -2239,7 +2242,10 @@ if ($action == 'create')
} }
// Replacement // Replacement
print '<!-- replacement line --><div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT))
{
print '<!-- replacement line -->';
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp='<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked' : ''); $tmp='<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked' : '');
if (! $options) $tmp.=' disabled'; if (! $options) $tmp.=' disabled';
$tmp.='> '; $tmp.='> ';
@ -2266,6 +2272,7 @@ if ($action == 'create')
print $desc; print $desc;
print '</div></div>'; print '</div></div>';
} }
}
else else
{ {
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
@ -2282,6 +2289,8 @@ if ($action == 'create')
if ($socid > 0) if ($socid > 0)
{ {
// Credit note // Credit note
if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE))
{
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : ''); $tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : '');
if (! $optionsav) $tmp.=' disabled'; if (! $optionsav) $tmp.=' disabled';
@ -2324,6 +2333,7 @@ if ($action == 'create')
print '</div></div>'; print '</div></div>';
} }
}
else else
{ {
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com> /* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2016 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
@ -71,7 +72,8 @@ class box_contracts extends ModeleBoxes
$sql.= " AND c.entity = ".$conf->entity; $sql.= " AND c.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
$sql.= " ORDER BY c.date_contrat DESC, c.ref DESC "; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_contrat DESC, c.ref DESC ";
else $sql.= " ORDER BY c.tms DESC, c.ref DESC ";
$sql.= $db->plimit($max, 0); $sql.= $db->plimit($max, 0);
$resql = $db->query($sql); $resql = $db->query($sql);

View File

@ -68,6 +68,7 @@ class box_services_expired extends ModeleBoxes
$sql.= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe s, ".MAIN_DB_PREFIX."contratdet as cd"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe s, ".MAIN_DB_PREFIX."contratdet as cd";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE cd.statut = 4 AND cd.date_fin_validite <= '".$db->idate($now)."'"; $sql.= " WHERE cd.statut = 4 AND cd.date_fin_validite <= '".$db->idate($now)."'";
$sql.= " AND c.entity = ".$conf->entity;
$sql.= " AND c.fk_soc=s.rowid AND cd.fk_contrat=c.rowid AND c.statut > 0"; $sql.= " AND c.fk_soc=s.rowid AND cd.fk_contrat=c.rowid AND c.statut > 0";
if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id; if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;

View File

@ -110,6 +110,7 @@ if ($result)
$establishmentstatic->id=$obj->rowid; $establishmentstatic->id=$obj->rowid;
$establishmentstatic->name=$obj->name; $establishmentstatic->name=$obj->name;
$establishmentstatic->status=$obj->status;
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
@ -119,7 +120,7 @@ if ($result)
print '<td align="left">'.$obj->town.'</td>'; print '<td align="left">'.$obj->town.'</td>';
print '<td align="right">'; print '<td align="right">';
print $establishmenttmp->getLibStatus(5); print $establishmentstatic->getLibStatus(5);
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -58,8 +58,8 @@ class Establishment extends CommonObject
{ {
$this->db = $db; $this->db = $db;
$this->statuts_short = array(0 => 'Opened', 1 => 'Closed'); $this->statuts_short = array(0 => 'Closed', 1 => 'Opened');
$this->statuts = array(0 => 'Opened', 1 => 'Closed'); $this->statuts = array(0 => 'Closed', 1 => 'Opened');
return 1; return 1;
} }
@ -157,7 +157,7 @@ class Establishment extends CommonObject
$sql .= ", address = '".$this->address."'"; $sql .= ", address = '".$this->address."'";
$sql .= ", zip = '".$this->zip."'"; $sql .= ", zip = '".$this->zip."'";
$sql .= ", town = '".$this->town."'"; $sql .= ", town = '".$this->town."'";
$sql .= ", fk_country = ".($this->country_id > 0 ? $this->country_id : 'null');
$sql .= ", status = '".$this->status."'"; $sql .= ", status = '".$this->status."'";
$sql .= ", fk_user_mod = " . $user->id; $sql .= ", fk_user_mod = " . $user->id;
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
@ -273,23 +273,23 @@ class Establishment extends CommonObject
} }
if ($mode == 2) if ($mode == 2)
{ {
if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts_short[$status]); if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]),'statut5').' '.$langs->trans($this->statuts_short[$status]);
if ($status==1) return img_picto($langs->trans($this->statuts_short[$status]),'statut8').' '.$langs->trans($this->statuts_short[$status]); if ($status==1) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts_short[$status]);
} }
if ($mode == 3) if ($mode == 3)
{ {
if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4'); if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut5');
if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut8'); if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4');
} }
if ($mode == 4) if ($mode == 4)
{ {
if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts[$status]); if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut5').' '.$langs->trans($this->statuts[$status]);
if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut8').' '.$langs->trans($this->statuts[$status]); if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts[$status]);
} }
if ($mode == 5) if ($mode == 5)
{ {
if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut4'); if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut5');
if ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut8'); if ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut4');
} }
} }

View File

@ -40,14 +40,18 @@ $id = GETPOST('id','int');
// List of status // List of status
static $tmpstatus2label=array( static $tmpstatus2label=array(
'0'=>'OpenEtablishment', '0'=>'CloseEtablishment',
'1'=>'CloseEtablishment' '1'=>'OpenEtablishment'
); );
$status2label=array(''); $status2label=array('');
foreach ($tmpstatus2label as $key => $val) $status2label[$key]=$langs->trans($val); foreach ($tmpstatus2label as $key => $val) $status2label[$key]=$langs->trans($val);
$object = new Establishment($db); $object = new Establishment($db);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
/* /*
* Actions * Actions
*/ */
@ -128,12 +132,13 @@ else if ($action == 'update')
$error ++; $error ++;
} }
if (empty($error)) { if (empty($error))
{
$object->name = GETPOST('name', 'alpha'); $object->name = GETPOST('name', 'alpha');
$object->address = GETPOST('address', 'alpha'); $object->address = GETPOST('address', 'alpha');
$object->zip = GETPOST('zipcode', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha');
$object->town = GETPOST('town', 'alpha'); $object->town = GETPOST('town', 'alpha');
$object->country_id = $_POST["country_id"]; $object->country_id = GETPOST('country_id', 'int');
$object->fk_user_mod = $user->id; $object->fk_user_mod = $user->id;
$result = $object->update($user); $result = $object->update($user);
@ -373,7 +378,8 @@ else if ($id)
print '</tr>'; print '</tr>';
// Status // Status
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">'.$object->getLibStatus(4).'</td></tr>'; print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">';
print $object->getLibStatus(4).'</td></tr>';
print "</table>"; print "</table>";

View File

@ -540,3 +540,7 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178,
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178, '17804', 'Sociedad Civil', 1); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178, '17804', 'Sociedad Civil', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178, '17805', 'Sociedad Anónima', 1); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178, '17805', 'Sociedad Anónima', 1);
-- VMYSQL4.1 ALTER TABLE llx_establishment CHANGE COLUMN fk_user_mod fk_user_mod integer NULL;
-- VPGSQL8.2 ALTER TABLE llx_establishment ALTER COLUMN fk_user_mod DROP NOT NULL;

View File

@ -33,7 +33,7 @@ CREATE TABLE llx_establishment (
profid3 varchar(20), profid3 varchar(20),
phone varchar(20), phone varchar(20),
fk_user_author integer NOT NULL, fk_user_author integer NOT NULL,
fk_user_mod integer NOT NULL, fk_user_mod integer,
datec datetime NOT NULL, datec datetime NOT NULL,
tms timestamp NOT NULL, tms timestamp NOT NULL,
status tinyint DEFAULT 1 status tinyint DEFAULT 1

View File

@ -38,7 +38,7 @@ BoxMyLastBookmarks=My latest %s bookmarks
BoxOldestExpiredServices=Oldest active expired services BoxOldestExpiredServices=Oldest active expired services
BoxLastExpiredServices=Latest %s oldest contacts with active expired services BoxLastExpiredServices=Latest %s oldest contacts with active expired services
BoxTitleLastActionsToDo=Latest %s actions to do BoxTitleLastActionsToDo=Latest %s actions to do
BoxTitleLastContracts=Latest %s contracts BoxTitleLastContracts=Latest %s modified contracts
BoxTitleLastModifiedDonations=Latest %s modified donations BoxTitleLastModifiedDonations=Latest %s modified donations
BoxTitleLastModifiedExpenses=Latest %s modified expense reports BoxTitleLastModifiedExpenses=Latest %s modified expense reports
BoxGlobalActivity=Global activity (invoices, proposals, orders) BoxGlobalActivity=Global activity (invoices, proposals, orders)