Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop
This commit is contained in:
commit
bfc5cfebce
@ -1,79 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
||||
* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/categories/liste.php
|
||||
* \ingroup category
|
||||
* \brief Page liste des categories
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
|
||||
if (!$user->rights->categorie->lire) accessforbidden();
|
||||
|
||||
|
||||
llxHeader("","",$langs->trans("Categories"));
|
||||
|
||||
print_fiche_titre($langs->trans("CatList"));
|
||||
|
||||
print '<table border="0" width="100%" class="notopnoleftnoright">';
|
||||
|
||||
print '<tr><td valign="top" width="30%" class="notopnoleft">';
|
||||
|
||||
$c = new Categorie($db);
|
||||
$cats = $c->get_all_categories();
|
||||
|
||||
|
||||
if ($cats != -1)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Ref").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Type").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=true;
|
||||
foreach ($cats as $cat)
|
||||
{
|
||||
$var = ! $var;
|
||||
print "\t<tr ".$bc[$var].">\n";
|
||||
print "\t\t<td><a href='viewcat.php?id=".$cat->id."'>".$cat->label."</a></td>\n";
|
||||
print "\t\t<td>".dol_trunc($cat->description,36)."</td>\n";
|
||||
print '<td align="right">';
|
||||
if ($cat->type == 0) print $langs->trans("Product");
|
||||
elseif ($cat->type == 1) print $langs->trans("Supplier");
|
||||
elseif ($cat->type == 2) print $langs->trans("Customer");
|
||||
else print $cat->type;
|
||||
print "</td>\n";
|
||||
print "\t</tr>\n";
|
||||
}
|
||||
print "</table>";
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error();
|
||||
}
|
||||
|
||||
print '</td></tr></table>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
?>
|
||||
@ -183,7 +183,7 @@ if ($action == 'add_action')
|
||||
if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $actioncomm->use_phenix=1;
|
||||
|
||||
// Check parameters
|
||||
if ($actioncomm->type_code == 'AC_RDV' && ($datep == '' || $datef == ''))
|
||||
if ($actioncomm->type_code == 'AC_RDV' && ($datep == '' || ($datef == '' && empty($fulldayevent))))
|
||||
{
|
||||
$error++;
|
||||
$action = 'create';
|
||||
@ -559,7 +559,7 @@ if ($action == 'create')
|
||||
} else {
|
||||
print $form->select_company('','socid','',1,1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -55,16 +55,11 @@ $result = restrictedArea($user, 'societe',$socid,'');
|
||||
|
||||
llxHeader('','Contacts');
|
||||
|
||||
if ($type == "c")
|
||||
if ($type == "c" || $type == "p")
|
||||
{
|
||||
$label = $langs->trans("Customers");
|
||||
$urlfiche="fiche.php";
|
||||
}
|
||||
if ($type == "p")
|
||||
{
|
||||
$label = $langs->trans("Prospects");
|
||||
$urlfiche="prospect/fiche.php";
|
||||
}
|
||||
if ($type == "f")
|
||||
{
|
||||
$label = $langs->trans("Suppliers");
|
||||
|
||||
@ -31,6 +31,7 @@ require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
@ -109,6 +110,24 @@ if ($action == 'setassujtva' && $user->rights->societe->creer)
|
||||
if (! $result) dol_print_error($result);
|
||||
}
|
||||
|
||||
// set prospect level
|
||||
if ($action == 'setprospectlevel' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->fk_prospectlevel=GETPOST('prospect_level_id','alpha');
|
||||
$result=$object->set_prospect_level($user);
|
||||
if ($result < 0) setEventMessage($object->error,'errors');
|
||||
}
|
||||
|
||||
// Update communication level
|
||||
if ($action == 'cstc')
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->stcomm_id=GETPOST('stcomm','int');
|
||||
$result=$object->set_commnucation_level($user);
|
||||
if ($result < 0) setEventMessage($object->error,'errors');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -121,6 +140,7 @@ llxHeader('',$langs->trans('CustomerCard'));
|
||||
$contactstatic = new Contact($db);
|
||||
$userstatic=new User($db);
|
||||
$form = new Form($db);
|
||||
$formcompany=new FormCompany($db);
|
||||
|
||||
|
||||
if ($mode == 'search')
|
||||
@ -176,6 +196,11 @@ if ($id > 0)
|
||||
$object->next_prev_filter="te.client in (1,3)";
|
||||
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
|
||||
print '</td></tr>';
|
||||
|
||||
// Prospect/Customer
|
||||
print '<tr><td width="30%">'.$langs->trans('ProspectCustomer').'</td><td width="70%" colspan="3">';
|
||||
print $object->getLibCustProspStatut();
|
||||
print '</td></tr>';
|
||||
|
||||
// Prefix
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
@ -359,6 +384,31 @@ if ($id > 0)
|
||||
print '</td><td colspan="3">'.$object->price_level."</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Level of prospect
|
||||
print '<tr><td nowrap>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
|
||||
print $langs->trans('ProspectLevelShort');
|
||||
print '<td>';
|
||||
if ($action != 'editlevel' && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editlevel&socid='.$object->id.'">'.img_edit($langs->trans('Modify'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editlevel')
|
||||
$formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_prospectlevel,'prospect_level_id',1);
|
||||
else
|
||||
print $object->getLibProspLevel();
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("StatusProsp").'</td><td colspan="2">'.$object->getLibProspCommStatut(4).'</td>';
|
||||
print '<td>';
|
||||
if ($object->stcomm_id != -1) print '<a href="fiche.php?socid='.$object->id.'&stcomm=-1&action=cstc">'.img_action(0,-1).'</a>';
|
||||
if ($object->stcomm_id != 0) print '<a href="fiche.php?socid='.$object->id.'&stcomm=0&action=cstc">'.img_action(0,0).'</a>';
|
||||
if ($object->stcomm_id != 1) print '<a href="fiche.php?socid='.$object->id.'&stcomm=1&action=cstc">'.img_action(0,1).'</a>';
|
||||
if ($object->stcomm_id != 2) print '<a href="fiche.php?socid='.$object->id.'&stcomm=2&action=cstc">'.img_action(0,2).'</a>';
|
||||
if ($object->stcomm_id != 3) print '<a href="fiche.php?socid='.$object->id.'&stcomm=3&action=cstc">'.img_action(0,3).'</a>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Sales representative
|
||||
include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php';
|
||||
|
||||
@ -315,9 +315,7 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td nowrap="nowrap">'.$companystatic->getNomUrl(1,'customer',48).'</td>';
|
||||
print '<td align="right" nowrap>';
|
||||
if ($objp->client == 2 || $objp->client == 3) print $langs->trans("Prospect");
|
||||
if ($objp->client == 3) print ' / ';
|
||||
if ($objp->client == 1 || $objp->client == 3) print $langs->trans("Customer");
|
||||
print $companystatic->getLibCustProspStatut();
|
||||
print "</td>";
|
||||
print '<td align="right" nowrap>'.dol_print_date($db->jdate($objp->tms),'day')."</td>";
|
||||
print '</tr>';
|
||||
|
||||
@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
if (! empty($conf->projet->enabled))
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
||||
@ -260,7 +260,7 @@ else if ($action == 'add' && $user->rights->propal->creer)
|
||||
$action='create';
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
if ($socid<1)
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Customer")),'errors');
|
||||
@ -1174,7 +1174,7 @@ $now=dol_now();
|
||||
if ($action == 'create')
|
||||
{
|
||||
print_fiche_titre($langs->trans("NewProp"));
|
||||
|
||||
|
||||
$soc = new Societe($db);
|
||||
if ($socid>0) $res=$soc->fetch($socid);
|
||||
|
||||
@ -1214,7 +1214,7 @@ if ($action == 'create')
|
||||
print '<form name="addprop" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
|
||||
if ($origin != 'project' && $originid)
|
||||
{
|
||||
print '<input type="hidden" name="origin" value="'.$origin.'">';
|
||||
@ -1459,20 +1459,20 @@ if ($action == 'create')
|
||||
|
||||
print "</form>";
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Show object in view mode
|
||||
*/
|
||||
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($object->socid);
|
||||
|
||||
|
||||
$head = propal_prepare_head($object);
|
||||
dol_fiche_head($head, 'comm', $langs->trans('Proposal'), 0, 'propal');
|
||||
|
||||
|
||||
$formconfirm='';
|
||||
|
||||
|
||||
// Clone confirmation
|
||||
if ($action == 'clone')
|
||||
{
|
||||
@ -1486,30 +1486,30 @@ else
|
||||
// Paiement incomplet. On demande si motif = escompte ou autre
|
||||
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('ClonePropal'),$langs->trans('ConfirmClonePropal',$object->ref),'confirm_clone',$formquestion,'yes',1);
|
||||
}
|
||||
|
||||
|
||||
// Confirm delete
|
||||
else if ($action == 'delete')
|
||||
{
|
||||
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp',$object->ref), 'confirm_delete','',0,1);
|
||||
}
|
||||
|
||||
|
||||
// Confirm reopen
|
||||
else if ($action == 'reopen')
|
||||
{
|
||||
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenProp',$object->ref), 'confirm_reopen','',0,1);
|
||||
}
|
||||
|
||||
|
||||
// Confirmation delete product/service line
|
||||
else if ($action == 'ask_deleteline')
|
||||
{
|
||||
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline','',0,1);
|
||||
}
|
||||
|
||||
|
||||
// Confirm validate proposal
|
||||
else if ($action == 'validate')
|
||||
{
|
||||
$error=0;
|
||||
|
||||
|
||||
// on verifie si l'objet est en numerotation provisoire
|
||||
$ref = substr($object->ref, 1, 4);
|
||||
if ($ref == 'PROV')
|
||||
@ -1525,7 +1525,7 @@ else
|
||||
{
|
||||
$numref = $object->ref;
|
||||
}
|
||||
|
||||
|
||||
$text=$langs->trans('ConfirmValidateProp',$numref);
|
||||
if (! empty($conf->notification->enabled))
|
||||
{
|
||||
@ -1534,29 +1534,29 @@ else
|
||||
$text.='<br>';
|
||||
$text.=$notify->confirmMessage('NOTIFY_VAL_PROPAL',$object->socid);
|
||||
}
|
||||
|
||||
|
||||
if (! $error) $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate','',0,1);
|
||||
}
|
||||
|
||||
|
||||
if (! $formconfirm)
|
||||
{
|
||||
$parameters=array('lineid'=>$lineid);
|
||||
$formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
}
|
||||
|
||||
|
||||
// Print form confirm
|
||||
print $formconfirm;
|
||||
|
||||
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/propal/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
// Ref
|
||||
print '<tr><td>'.$langs->trans('Ref').'</td><td colspan="5">';
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Ref client
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">';
|
||||
@ -1580,11 +1580,11 @@ else
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="5">'.$soc->getNomUrl(1).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Ligne info remises tiers
|
||||
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
|
||||
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
|
||||
@ -1614,7 +1614,7 @@ else
|
||||
}
|
||||
if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Date of proposal
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
@ -1645,7 +1645,7 @@ else
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Date end proposal
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
@ -1678,7 +1678,7 @@ else
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Payment term
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
@ -1697,7 +1697,7 @@ else
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Delivery date
|
||||
$langs->load('deliveries');
|
||||
print '<tr><td>';
|
||||
@ -1722,7 +1722,7 @@ else
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Delivery delay
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
@ -1740,10 +1740,10 @@ else
|
||||
{
|
||||
$form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id,$object->availability_id,'none',1);
|
||||
}
|
||||
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Origin of demand
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
@ -1761,10 +1761,10 @@ else
|
||||
{
|
||||
$form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'none');
|
||||
}
|
||||
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Payment mode
|
||||
print '<tr>';
|
||||
print '<td width="25%">';
|
||||
@ -1783,7 +1783,7 @@ else
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
@ -1825,7 +1825,7 @@ else
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="3"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
@ -1841,12 +1841,12 @@ else
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Amount HT
|
||||
print '<tr><td height="10">'.$langs->trans('AmountHT').'</td>';
|
||||
print '<td align="right" nowrap><b>'.price($object->total_ht).'</b></td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td>';
|
||||
|
||||
|
||||
// Margin Infos
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
print '<td valign="top" width="50%" rowspan="4">';
|
||||
@ -1854,12 +1854,12 @@ else
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Amount VAT
|
||||
print '<tr><td height="10">'.$langs->trans('AmountVAT').'</td>';
|
||||
print '<td align="right" nowrap>'.price($object->total_tva).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->localtax1_assuj=="1") //Localtax1
|
||||
{
|
||||
@ -1873,55 +1873,55 @@ else
|
||||
print '<td align="right" nowrap>'.price($object->total_localtax2).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Amount TTC
|
||||
print '<tr><td height="10">'.$langs->trans('AmountTTC').'</td>';
|
||||
print '<td align="right" nowrap>'.price($object->total_ttc).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
|
||||
|
||||
// Statut
|
||||
print '<tr><td height="10">'.$langs->trans('Status').'</td><td align="left" colspan="2">'.$object->getLibStatut(4).'</td></tr>';
|
||||
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
$blocname = 'contacts';
|
||||
$title = $langs->trans('ContactsAddresses');
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
|
||||
}
|
||||
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$blocname = 'notes';
|
||||
$title = $langs->trans('Notes');
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Lines
|
||||
*/
|
||||
|
||||
|
||||
if (! empty($conf->use_javascript_ajax) && $object->statut == 0)
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
|
||||
}
|
||||
|
||||
|
||||
print '<table id="tablelines" class="noborder" width="100%">';
|
||||
|
||||
|
||||
// Show object lines
|
||||
$result = $object->getLinesArray();
|
||||
if (! empty($object->lines))
|
||||
$ret=$object->printObjectLines($action,$mysoc,$soc,$lineid);
|
||||
|
||||
|
||||
// Form to add new line
|
||||
if ($object->statut == 0 && $user->rights->propal->creer)
|
||||
{
|
||||
if ($action != 'editline')
|
||||
{
|
||||
$var=true;
|
||||
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
{
|
||||
// Add free or predefined products/services
|
||||
@ -1931,7 +1931,7 @@ else
|
||||
{
|
||||
// Add free products/services
|
||||
$object->formAddFreeProduct(0,$mysoc,$soc);
|
||||
|
||||
|
||||
// Add predefined products/services
|
||||
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
|
||||
{
|
||||
@ -1939,17 +1939,17 @@ else
|
||||
$object->formAddPredefinedProduct(0,$mysoc,$soc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('formAddObjectLine',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '</div>';
|
||||
print "\n";
|
||||
|
||||
|
||||
if ($action == 'statut')
|
||||
{
|
||||
/*
|
||||
@ -1975,18 +1975,18 @@ else
|
||||
$form_close.= '<a name="close"> </a>';
|
||||
$form_close.= '</td>';
|
||||
$form_close.= '</tr></table></form>';
|
||||
|
||||
|
||||
print $form_close;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Boutons Actions
|
||||
*/
|
||||
if ($action != 'presend')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
|
||||
if ($action != 'statut' && $action <> 'editline')
|
||||
{
|
||||
// Validate
|
||||
@ -1995,20 +1995,20 @@ else
|
||||
if (count($object->lines) > 0) print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=validate">'.$langs->trans('Validate').'</a>';
|
||||
else print '<a class="butActionRefused" href="#">'.$langs->trans('Validate').'</a>';
|
||||
}
|
||||
|
||||
|
||||
// Edit
|
||||
if ($object->statut == 1 && $user->rights->propal->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=modif">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
|
||||
|
||||
// ReOpen
|
||||
if (($object->statut == 2 || $object->statut == 3) && $user->rights->propal->cloturer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen'.(empty($conf->global->MAIN_JUMP_TAG)?'':'#reopen').'"';
|
||||
print '>'.$langs->trans('ReOpen').'</a>';
|
||||
}
|
||||
|
||||
|
||||
// Send
|
||||
if ($object->statut == 1 || $object->statut == 2)
|
||||
{
|
||||
@ -2018,7 +2018,7 @@ else
|
||||
}
|
||||
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
|
||||
}
|
||||
|
||||
|
||||
// Create an order
|
||||
if (! empty($conf->commande->enabled) && $object->statut == 2 && $user->societe_id == 0)
|
||||
{
|
||||
@ -2027,7 +2027,7 @@ else
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/commande/fiche.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddOrder").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Create an invoice and classify billed
|
||||
if ($object->statut == 2 && $user->societe_id == 0)
|
||||
{
|
||||
@ -2035,46 +2035,46 @@ else
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddBill").'</a>';
|
||||
}
|
||||
|
||||
|
||||
$arraypropal=$object->getInvoiceArrayList();
|
||||
if (is_array($arraypropal) && count($arraypropal) > 0)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled&socid='.$object->socid.'">'.$langs->trans("ClassifyBilled").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Close
|
||||
if ($object->statut == 1 && $user->rights->propal->cloturer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=statut'.(empty($conf->global->MAIN_JUMP_TAG)?'':'#close').'"';
|
||||
print '>'.$langs->trans('Close').'</a>';
|
||||
}
|
||||
|
||||
|
||||
// Clone
|
||||
if ($user->rights->propal->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object='.$object->element.'">'.$langs->trans("ToClone").'</a>';
|
||||
}
|
||||
|
||||
|
||||
// Delete
|
||||
if ($user->rights->propal->supprimer)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete"';
|
||||
print '>'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
print "<br>\n";
|
||||
}
|
||||
|
||||
|
||||
if ($action != 'presend')
|
||||
{
|
||||
print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Documents generes
|
||||
*/
|
||||
@ -2083,28 +2083,28 @@ else
|
||||
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
$genallowed=$user->rights->propal->creer;
|
||||
$delallowed=$user->rights->propal->supprimer;
|
||||
|
||||
|
||||
$var=true;
|
||||
|
||||
|
||||
$somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'',0,'',$soc->default_lang);
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Linked object block
|
||||
*/
|
||||
$somethingshown=$object->showLinkedObjectBlock();
|
||||
|
||||
|
||||
print '</td><td valign="top" width="50%">';
|
||||
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$formactions=new FormActions($db);
|
||||
$somethingshown=$formactions->showactions($object,'propal',$socid);
|
||||
|
||||
|
||||
print '</td></tr></table>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Action presend
|
||||
*
|
||||
@ -2115,7 +2115,7 @@ else
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/'));
|
||||
$file=$fileparams['fullname'];
|
||||
|
||||
|
||||
// Build document if it not exists
|
||||
if (! $file || ! is_readable($file))
|
||||
{
|
||||
@ -2129,7 +2129,7 @@ else
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
|
||||
|
||||
$result=propale_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0)
|
||||
{
|
||||
@ -2139,10 +2139,10 @@ else
|
||||
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/'));
|
||||
$file=$fileparams['fullname'];
|
||||
}
|
||||
|
||||
|
||||
print '<br>';
|
||||
print_titre($langs->trans('SendPropalByMail'));
|
||||
|
||||
|
||||
// Create form object
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
@ -2151,18 +2151,17 @@ else
|
||||
$formmail->fromname = $user->getFullName($langs);
|
||||
$formmail->frommail = $user->email;
|
||||
$formmail->withfrom=1;
|
||||
$formmail->withto=empty($_POST["sendto"])?1:$_POST["sendto"];
|
||||
$formmail->withtosocid=$soc->id;
|
||||
$formmail->withtocc=1;
|
||||
$formmail->withtoccsocid=0;
|
||||
$liste=array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
|
||||
$formmail->withto=GETPOST("sendto")?GETPOST("sendto"):$liste;
|
||||
$formmail->withtocc=$liste;
|
||||
$formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false);
|
||||
$formmail->withtocccsocid=0;
|
||||
$formmail->withtopic=$langs->trans('SendPropalRef','__PROPREF__');
|
||||
$formmail->withfile=2;
|
||||
$formmail->withbody=1;
|
||||
$formmail->withdeliveryreceipt=1;
|
||||
$formmail->withcancel=1;
|
||||
|
||||
|
||||
// Tableau des substitutions
|
||||
$formmail->substit['__PROPREF__']=$object->ref;
|
||||
$formmail->substit['__SIGNATURE__']=$user->signature;
|
||||
@ -2172,16 +2171,16 @@ else
|
||||
$formmail->param['models']='propal_send';
|
||||
$formmail->param['id']=$object->id;
|
||||
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||
|
||||
|
||||
// Init list of files
|
||||
if (GETPOST("mode")=='init')
|
||||
{
|
||||
$formmail->clear_attached_files();
|
||||
$formmail->add_attached_files($file,basename($file),dol_mimetype($file));
|
||||
}
|
||||
|
||||
|
||||
$formmail->show_form();
|
||||
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -322,14 +322,7 @@ if ($result)
|
||||
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
|
||||
if ($objp->client == 1)
|
||||
{
|
||||
$url = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objp->rowid;
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$objp->rowid;
|
||||
}
|
||||
$url = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objp->rowid;
|
||||
|
||||
// Company
|
||||
$companystatic->id=$objp->rowid;
|
||||
|
||||
@ -148,9 +148,9 @@ class Prospect extends Societe
|
||||
*
|
||||
* @return string Libelle
|
||||
*/
|
||||
function getLibLevel()
|
||||
function getLibProspLevel()
|
||||
{
|
||||
return $this->LibLevel($this->fk_prospectlevel);
|
||||
return $this->LibProspLevel($this->fk_prospectlevel);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,7 +159,7 @@ class Prospect extends Societe
|
||||
* @param int $fk_prospectlevel Prospect level
|
||||
* @return string Libelle du niveau
|
||||
*/
|
||||
function LibLevel($fk_prospectlevel)
|
||||
function LibProspLevel($fk_prospectlevel)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
||||
@ -1,343 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/comm/prospect/fiche.php
|
||||
* \ingroup prospect
|
||||
* \brief Page de la fiche prospect
|
||||
*/
|
||||
|
||||
require_once '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/prospect/class/prospect.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
|
||||
$langs->load('companies');
|
||||
$langs->load('projects');
|
||||
$langs->load('propal');
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'societe', $socid, '&societe');
|
||||
|
||||
$object = new Prospect($db);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'cstc')
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm = ".$_GET["stcomm"];
|
||||
$sql .= " WHERE rowid = ".$socid;
|
||||
$db->query($sql);
|
||||
}
|
||||
// set prospect level
|
||||
if ($action == 'setprospectlevel' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($socid);
|
||||
$object->fk_prospectlevel=$_POST['prospect_level_id'];
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_prospectlevel='".$_POST['prospect_level_id'];
|
||||
$sql.= " WHERE rowid = ".$socid;
|
||||
$result = $db->query($sql);
|
||||
if (! $result) dol_print_error($result);
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************
|
||||
*
|
||||
* Mode fiche
|
||||
*
|
||||
*********************************************************************************/
|
||||
|
||||
llxHeader();
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
$form=new Form($db);
|
||||
$formcompany=new FormCompany($db);
|
||||
|
||||
if ($socid > 0)
|
||||
{
|
||||
$actionstatic=new ActionComm($db);
|
||||
$result = $object->fetch($socid);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$head = societe_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'prospect', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
print '<table width="100%" class="notopnoleftnoright">';
|
||||
print '<tr><td valign="top" width="50%" class="notopnoleft">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="25%">'.$langs->trans("ThirdPartyName").'</td><td colspan="3">';
|
||||
$object->next_prev_filter="te.client in (2,3)";
|
||||
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
|
||||
print '</td></tr>';
|
||||
|
||||
// Address
|
||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">';
|
||||
dol_print_address($object->address,'gmap','thirdparty',$object->id);
|
||||
print "</td></tr>";
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td nowrap="nowrap">'.$langs->trans('Zip').' / '.$langs->trans("Town").'</td><td colspan="3">'.$object->zip.(($object->zip && $object->town)?' / ':'').$object->town.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Country
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
||||
$img=picto_from_langcode($object->country_code);
|
||||
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
|
||||
else print ($img?$img.' ':'').$object->country;
|
||||
print '</td></tr>';
|
||||
|
||||
// Phone
|
||||
print '<tr><td>'.$langs->trans("Phone").'</td><td style="min-width: 25%;">'.dol_print_phone($object->tel,$object->country_code,0,$object->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td style="min-width: 25%;">'.dol_print_phone($object->fax,$object->country_code).'</td></tr>';
|
||||
|
||||
// EMail
|
||||
print '<td>'.$langs->trans('EMail').'</td><td colspan="3">'.dol_print_email($object->email,0,$object->id,'AC_EMAIL').'</td></tr>';
|
||||
|
||||
// Web
|
||||
print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$object->url\">$object->url</a></td></tr>";
|
||||
|
||||
// Level of prospect
|
||||
print '<tr><td nowrap>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
|
||||
print $langs->trans('ProspectLevelShort');
|
||||
print '<td>';
|
||||
if ($action != 'editlevel' && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editlevel&socid='.$object->id.'">'.img_edit($langs->trans('Modify'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editlevel')
|
||||
$formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_prospectlevel,'prospect_level_id',1);
|
||||
else
|
||||
print $object->getLibLevel();
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Multiprice level
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
print '<tr><td nowrap>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
|
||||
print $langs->trans("PriceLevel");
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/multiprix.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</td><td colspan="3">'.$object->price_level."</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("StatusProsp").'</td><td colspan="2">'.$object->getLibProspStatut(4).'</td>';
|
||||
print '<td>';
|
||||
if ($object->stcomm_id != -1) print '<a href="fiche.php?socid='.$object->id.'&stcomm=-1&action=cstc">'.img_action(0,-1).'</a>';
|
||||
if ($object->stcomm_id != 0) print '<a href="fiche.php?socid='.$object->id.'&stcomm=0&action=cstc">'.img_action(0,0).'</a>';
|
||||
if ($object->stcomm_id != 1) print '<a href="fiche.php?socid='.$object->id.'&stcomm=1&action=cstc">'.img_action(0,1).'</a>';
|
||||
if ($object->stcomm_id != 2) print '<a href="fiche.php?socid='.$object->id.'&stcomm=2&action=cstc">'.img_action(0,2).'</a>';
|
||||
if ($object->stcomm_id != 3) print '<a href="fiche.php?socid='.$object->id.'&stcomm=3&action=cstc">'.img_action(0,3).'</a>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Sales representative
|
||||
include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php';
|
||||
|
||||
// Module Adherent
|
||||
if (! empty($conf->adherent->enabled))
|
||||
{
|
||||
$langs->load("members");
|
||||
$langs->load("users");
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("LinkedToDolibarrMember").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$adh=new Adherent($db);
|
||||
$result=$adh->fetch('','',$object->id);
|
||||
if ($result > 0)
|
||||
{
|
||||
$adh->ref=$adh->getFullName($langs);
|
||||
print $adh->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("UserNotLinkedToMember");
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print "</td>\n";
|
||||
print '<td valign="top" width="50%" class="notopnoleftnoright">';
|
||||
|
||||
// Nbre max d'elements des petites listes
|
||||
$MAXLIST=5;
|
||||
$tableaushown=0;
|
||||
|
||||
// Lien recap
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("Summary").'</td>';
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/comm/prospect/recap-prospect.php?socid='.$object->id.'">'.$langs->trans("ShowProspectPreview").'</a></td></tr></table></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
/*
|
||||
* Last proposals
|
||||
*/
|
||||
if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||
{
|
||||
$propal_static=new Propal($db);
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid, p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.remise, ";
|
||||
$sql.= " p.datep as dp, p.fin_validite as datelimite,";
|
||||
$sql.= " c.label as statut, c.id as statutid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."c_propalst as c";
|
||||
$sql.= " WHERE p.fk_soc = s.rowid";
|
||||
$sql.= " AND p.fk_statut = c.id";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
$sql.= " AND s.rowid = ".$object->id;
|
||||
$sql.= " ORDER BY p.datep DESC";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$var=true;
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/comm/propal.php?socid='.$object->id.'">'.$langs->trans("AllPropals").' ('.$num.')</a></td>';
|
||||
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
while ($i < $num && $i < $MAXLIST)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td><a href=\"../propal.php?id=$objp->propalid\">";
|
||||
print img_object($langs->trans("ShowPropal"),"propal");
|
||||
print " ".$objp->ref."</a>\n";
|
||||
if ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay) && $objp->fk_statut == 1)
|
||||
{
|
||||
print " ".img_warning();
|
||||
}
|
||||
print "</td><td align=\"right\">".dol_print_date($db->jdate($objp->dp),"day")."</td>\n";
|
||||
print "<td align=\"right\">".price($objp->total_ht)."</td>\n";
|
||||
print "<td align=\"right\">".$propal_static->LibStatut($objp->fk_statut,5)."</td></tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
|
||||
if ($num > 0) print "</table>";
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
print "</td></tr>";
|
||||
print "</table>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
/*
|
||||
* Barre d'action
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if (! empty($conf->propal->enabled) && $user->rights->propale->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal.php?socid='.$object->id.'&action=create">'.$langs->trans("AddProp").'</a>';
|
||||
}
|
||||
|
||||
// Add action
|
||||
if (! empty($conf->agenda->enabled) && ! empty($conf->global->MAIN_REPEATTASKONEACHTAB))
|
||||
{
|
||||
if ($user->rights->agenda->myactions->create)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&socid='.$object->id.'">'.$langs->trans("AddAction").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butAction" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddAction").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB))
|
||||
{
|
||||
print '<br>';
|
||||
// List of contacts
|
||||
show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_REPEATTASKONEACHTAB))
|
||||
{
|
||||
print load_fiche_titre($langs->trans("ActionsOnCompany"),'','');
|
||||
|
||||
// List of todo actions
|
||||
show_actions_todo($conf,$langs,$db,$object);
|
||||
|
||||
// List of done actions
|
||||
show_actions_done($conf,$langs,$db,$object);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
@ -2418,12 +2418,11 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
|
||||
$formmail->fromname = $user->getFullName($langs);
|
||||
$formmail->frommail = $user->email;
|
||||
$formmail->withfrom=1;
|
||||
$formmail->withto=GETPOST('sendto')?GETPOST('sendto'):1;
|
||||
$formmail->withtosocid=$soc->id;
|
||||
$formmail->withtocc=1;
|
||||
$formmail->withtoccsocid=0;
|
||||
$liste=array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
|
||||
$formmail->withto=GETPOST('sendto')?GETPOST('sendto'):$liste;
|
||||
$formmail->withtocc=$liste;
|
||||
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtocccsocid=0;
|
||||
$formmail->withtopic=$langs->trans('SendOrderRef','__ORDERREF__');
|
||||
$formmail->withfile=2;
|
||||
$formmail->withbody=1;
|
||||
|
||||
@ -3403,12 +3403,11 @@ else if ($id > 0 || ! empty($ref))
|
||||
$formmail->fromname = $user->getFullName($langs);
|
||||
$formmail->frommail = $user->email;
|
||||
$formmail->withfrom=1;
|
||||
$formmail->withto=empty($_POST["sendto"])?1:$_POST["sendto"];
|
||||
$formmail->withtosocid=$soc->id;
|
||||
$formmail->withtocc=1;
|
||||
$formmail->withtoccsocid=0;
|
||||
$liste=array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
|
||||
$formmail->withto=GETPOST('sendto')?GETPOST('sendto'):$liste;
|
||||
$formmail->withtocc=$liste;
|
||||
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtocccsocid=0;
|
||||
$formmail->withtopic=$langs->transnoentities($topicmail,'__FACREF__');
|
||||
$formmail->withfile=2;
|
||||
$formmail->withbody=1;
|
||||
|
||||
@ -65,16 +65,11 @@ $offset = $limit * $page;
|
||||
|
||||
$langs->load("companies");
|
||||
$titre = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses"));
|
||||
if ($type == "c")
|
||||
if ($type == "c" || $type=="p")
|
||||
{
|
||||
$titre.=' ('.$langs->trans("ThirdPartyCustomers").')';
|
||||
$urlfiche="fiche.php";
|
||||
}
|
||||
else if ($type == "p")
|
||||
{
|
||||
$titre.=' ('.$langs->trans("ThirdPartyProspects").')';
|
||||
$urlfiche="prospect/fiche.php";
|
||||
}
|
||||
else if ($type == "f")
|
||||
{
|
||||
$titre.=' ('.$langs->trans("ThirdPartySuppliers").')';
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
*
|
||||
* 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
|
||||
@ -27,7 +28,7 @@
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/margin/lib/margins.lib.php");
|
||||
|
||||
/**
|
||||
* Class to manage contracts
|
||||
@ -402,7 +403,7 @@ class Contrat extends CommonObject
|
||||
|
||||
// Selectionne les lignes contrats liees a un produit
|
||||
$sql = "SELECT p.label, p.description as product_desc, p.ref,";
|
||||
$sql.= " d.rowid, d.fk_contrat, d.statut, d.description, d.price_ht, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.remise_percent, d.subprice,";
|
||||
$sql.= " d.rowid, d.fk_contrat, d.statut, d.description, d.price_ht, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.remise_percent, d.subprice, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht,";
|
||||
$sql.= " d.total_ht,";
|
||||
$sql.= " d.total_tva,";
|
||||
$sql.= " d.total_localtax1,";
|
||||
@ -451,6 +452,10 @@ class Contrat extends CommonObject
|
||||
$line->fk_product = $objp->fk_product;
|
||||
$line->info_bits = $objp->info_bits;
|
||||
|
||||
$line->fk_fournprice = $objp->fk_fournprice;
|
||||
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht);
|
||||
$line->pa_ht = $marginInfos[0];
|
||||
|
||||
$line->fk_user_author = $objp->fk_user_author;
|
||||
$line->fk_user_ouverture= $objp->fk_user_ouverture;
|
||||
$line->fk_user_cloture = $objp->fk_user_cloture;
|
||||
@ -856,7 +861,7 @@ class Contrat extends CommonObject
|
||||
* @param int $info_bits Bits de type de lignes
|
||||
* @return int <0 si erreur, >0 si ok
|
||||
*/
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0, $info_bits=0)
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0)
|
||||
{
|
||||
global $user, $langs, $conf;
|
||||
|
||||
@ -875,6 +880,7 @@ class Contrat extends CommonObject
|
||||
if (! $pu_ttc) $pu_ttc=0;
|
||||
$pu_ht=price2num($pu_ht);
|
||||
$pu_ttc=price2num($pu_ttc);
|
||||
$pa_ht=price2num($pa_ht);
|
||||
$txtva=price2num($txtva);
|
||||
$txlocaltax1=price2num($txlocaltax1);
|
||||
$txlocaltax2=price2num($txlocaltax2);
|
||||
@ -908,13 +914,21 @@ class Contrat extends CommonObject
|
||||
$price = $pu_ht - $remise;
|
||||
}
|
||||
|
||||
if (empty($pa_ht)) $pa_ht=0;
|
||||
|
||||
// si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente
|
||||
if ($pa_ht == 0) {
|
||||
if ($pu_ht > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1))
|
||||
$pa_ht = $pu_ht * (1 - $remise_percent / 100);
|
||||
}
|
||||
|
||||
// Insertion dans la base
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contratdet";
|
||||
$sql.= " (fk_contrat, label, description, fk_product, qty, tva_tx,";
|
||||
$sql.= " localtax1_tx, localtax2_tx, remise_percent, subprice,";
|
||||
$sql.= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc,";
|
||||
$sql.= " info_bits,";
|
||||
$sql.= " price_ht, remise"; // TODO A virer
|
||||
$sql.= " price_ht, remise, fk_product_fournisseur_price, buy_price_ht";
|
||||
if ($date_start > 0) { $sql.= ",date_ouverture_prevue"; }
|
||||
if ($date_end > 0) { $sql.= ",date_fin_validite"; }
|
||||
$sql.= ") VALUES ($this->id, '', '" . $this->db->escape($desc) . "',";
|
||||
@ -926,7 +940,11 @@ class Contrat extends CommonObject
|
||||
$sql.= " ".price2num($remise_percent).",".price2num($pu_ht).",";
|
||||
$sql.= " ".price2num($total_ht).",".price2num($total_tva).",".price2num($total_localtax1).",".price2num($total_localtax2).",".price2num($total_ttc).",";
|
||||
$sql.= " '".$info_bits."',";
|
||||
$sql.= " ".price2num($price).",".price2num($remise); // TODO A virer
|
||||
$sql.= " ".price2num($price).",".price2num($remise).",";
|
||||
if (isset($fk_fournprice)) $sql.= ' '.$fk_fournprice.',';
|
||||
else $sql.= ' null,';
|
||||
if (isset($pa_ht)) $sql.= ' '.price2num($pa_ht);
|
||||
else $sql.= ' null';
|
||||
if ($date_start > 0) { $sql.= ",'".$this->db->idate($date_start)."'"; }
|
||||
if ($date_end > 0) { $sql.= ",'".$this->db->idate($date_end)."'"; }
|
||||
$sql.= ")";
|
||||
@ -983,7 +1001,7 @@ class Contrat extends CommonObject
|
||||
* @param int $info_bits Bits de type de lignes
|
||||
* @return int < 0 si erreur, > 0 si ok
|
||||
*/
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0, $localtax2tx=0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0)
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0, $localtax2tx=0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0)
|
||||
{
|
||||
global $user, $conf, $langs;
|
||||
|
||||
@ -995,6 +1013,7 @@ class Contrat extends CommonObject
|
||||
$tvatx = price2num($tvatx);
|
||||
$localtax1tx = price2num($localtax1tx);
|
||||
$localtax2tx = price2num($localtax2tx);
|
||||
$pa_ht=price2num($pa_ht);
|
||||
|
||||
$subprice = $price;
|
||||
$remise = 0;
|
||||
@ -1016,7 +1035,7 @@ class Contrat extends CommonObject
|
||||
// qty, pu, remise_percent et txtva
|
||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $localtaxtx1, $txlocaltaxtx2, 0, $price_base_type, $info_bits, 1);
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtaxtx1, $txlocaltaxtx2, 0, $price_base_type, $info_bits, 1);
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
@ -1032,6 +1051,14 @@ class Contrat extends CommonObject
|
||||
$price = $pu_ht - $remise;
|
||||
}
|
||||
|
||||
if (empty($pa_ht)) $pa_ht=0;
|
||||
|
||||
// si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente
|
||||
if ($pa_ht == 0) {
|
||||
if ($pu_ht > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1))
|
||||
$pa_ht = $pu_ht * (1 - $remise_percent / 100);
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet set description='".$this->db->escape($desc)."'";
|
||||
$sql.= ",price_ht='" . price2num($price)."'";
|
||||
$sql.= ",subprice='" . price2num($subprice)."'";
|
||||
@ -1046,6 +1073,8 @@ class Contrat extends CommonObject
|
||||
$sql.= ", total_localtax1='".price2num($total_localtax1)."'";
|
||||
$sql.= ", total_localtax2='".price2num($total_localtax2)."'";
|
||||
$sql.= ", total_ttc='". price2num($total_ttc)."'";
|
||||
$sql.= ", fk_product_fournisseur_price='".$fk_fournprice."'";
|
||||
$sql.= ", buy_price_ht='".price2num($pa_ht)."'";
|
||||
if ($date_start > 0) { $sql.= ",date_ouverture_prevue='".$this->db->idate($date_start)."'"; }
|
||||
else { $sql.=",date_ouverture_prevue=null"; }
|
||||
if ($date_end > 0) { $sql.= ",date_fin_validite='".$this->db->idate($date_end)."'"; }
|
||||
@ -1610,6 +1639,9 @@ class ContratLigne
|
||||
var $total_localtax2;
|
||||
var $total_ttc;
|
||||
|
||||
var $fk_fournprice;
|
||||
var $pa_ht;
|
||||
|
||||
var $info_bits;
|
||||
var $fk_user_author;
|
||||
var $fk_user_ouverture;
|
||||
@ -1769,6 +1801,8 @@ class ContratLigne
|
||||
$sql.= " t.total_localtax1,";
|
||||
$sql.= " t.total_localtax2,";
|
||||
$sql.= " t.total_ttc,";
|
||||
$sql.= " t.fk_product_fournisseur_price as fk_fournprice,";
|
||||
$sql.= " t.buy_price_ht as pa_ht,";
|
||||
$sql.= " t.info_bits,";
|
||||
$sql.= " t.fk_user_author,";
|
||||
$sql.= " t.fk_user_ouverture,";
|
||||
@ -1819,6 +1853,9 @@ class ContratLigne
|
||||
$this->fk_user_ouverture = $obj->fk_user_ouverture;
|
||||
$this->fk_user_cloture = $obj->fk_user_cloture;
|
||||
$this->commentaire = $obj->commentaire;
|
||||
$this->fk_fournprice = $obj->fk_fournprice;
|
||||
$marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->fk_fournprice, $obj->pa_ht);
|
||||
$this->pa_ht = $marginInfos[0];
|
||||
|
||||
}
|
||||
$this->db->free($resql);
|
||||
@ -1887,6 +1924,14 @@ class ContratLigne
|
||||
$this->total_localtax1= $tabprice[9];
|
||||
$this->total_localtax2= $tabprice[10];
|
||||
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
// si prix d'achat non renseigné et utilisé pour calcul des marges alors prix achat = prix vente
|
||||
if ($this->pa_ht == 0) {
|
||||
if ($this->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1))
|
||||
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
|
||||
}
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET";
|
||||
$sql.= " fk_contrat='".$this->fk_contrat."',";
|
||||
@ -1913,6 +1958,8 @@ class ContratLigne
|
||||
$sql.= " total_localtax1='".$this->total_localtax1."',";
|
||||
$sql.= " total_localtax2='".$this->total_localtax2."',";
|
||||
$sql.= " total_ttc='".$this->total_ttc."',";
|
||||
$sql.= " fk_product_fournisseur_price='".$this->fk_fournprice."',";
|
||||
$sql.= " buy_price_ht='".price2num($this->pa_ht)."',";
|
||||
$sql.= " info_bits='".$this->info_bits."',";
|
||||
$sql.= " fk_user_author=".($this->fk_user_author >= 0?$this->fk_user_author:"NULL").",";
|
||||
$sql.= " fk_user_ouverture=".($this->fk_user_ouverture > 0?$this->fk_user_ouverture:"NULL").",";
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
*
|
||||
* 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
|
||||
@ -305,6 +306,13 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
|
||||
$localtax1_tx=get_localtax($tva_tx,1,$object->societe);
|
||||
$localtax2_tx=get_localtax($tva_tx,2,$object->societe);
|
||||
|
||||
// ajout prix achat
|
||||
$fk_fournprice = $_POST['fournprice'];
|
||||
if ( ! empty($_POST['buying_price']) )
|
||||
$pa_ht = $_POST['buying_price'];
|
||||
else
|
||||
$pa_ht = null;
|
||||
|
||||
$info_bits=0;
|
||||
if ($tva_npr) $info_bits |= 0x01;
|
||||
|
||||
@ -329,7 +337,9 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
|
||||
$date_end,
|
||||
$price_base_type,
|
||||
$pu_ttc,
|
||||
$info_bits
|
||||
$info_bits,
|
||||
$fk_fournprice,
|
||||
$pa_ht
|
||||
);
|
||||
}
|
||||
|
||||
@ -353,13 +363,18 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
|
||||
}
|
||||
*/
|
||||
|
||||
unset($_POST['qty']);
|
||||
unset($_POST['type']);
|
||||
unset($_POST['idprod']);
|
||||
unset($_POST['remise_percent']);
|
||||
unset($_POST['price_ht']);
|
||||
unset($_POST['tva_tx']);
|
||||
unset($_POST['dp_desc']);
|
||||
unset($_POST['qty']);
|
||||
unset($_POST['type']);
|
||||
unset($_POST['idprod']);
|
||||
unset($_POST['remise_percent']);
|
||||
unset($_POST['price_ht']);
|
||||
unset($_POST['price_ttc']);
|
||||
unset($_POST['tva_tx']);
|
||||
unset($_POST['product_ref']);
|
||||
unset($_POST['product_label']);
|
||||
unset($_POST['product_desc']);
|
||||
unset($_POST['fournprice']);
|
||||
unset($_POST['buying_price']);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -389,6 +404,13 @@ else if ($action == 'updateligne' && $user->rights->contrat->creer && ! GETPOST(
|
||||
$localtax1_tx=get_localtax(GETPOST('eltva_tx'),1,$object->thirdparty);
|
||||
$localtax2_tx=get_localtax(GETPOST('eltva_tx'),2,$object->thirdparty);
|
||||
|
||||
// ajout prix d'achat
|
||||
$fk_fournprice = $_POST['fournprice'];
|
||||
if ( ! empty($_POST['buying_price']) )
|
||||
$pa_ht = $_POST['buying_price'];
|
||||
else
|
||||
$pa_ht = null;
|
||||
|
||||
$objectline->description=GETPOST('product_desc');
|
||||
$objectline->price_ht=GETPOST('elprice');
|
||||
$objectline->subprice=GETPOST('elprice');
|
||||
@ -402,6 +424,8 @@ else if ($action == 'updateligne' && $user->rights->contrat->creer && ! GETPOST(
|
||||
$objectline->date_fin_validite=$date_end_update;
|
||||
$objectline->date_cloture=$date_end_real_update;
|
||||
$objectline->fk_user_cloture=$user->id;
|
||||
$objectline->fk_fournprice=$fk_fournprice;
|
||||
$objectline->pa_ht=$pa_ht;
|
||||
|
||||
// TODO verifier price_min si fk_product et multiprix
|
||||
|
||||
@ -872,7 +896,7 @@ else
|
||||
$sql.= " cd.tva_tx, cd.remise_percent, cd.info_bits, cd.subprice,";
|
||||
$sql.= " cd.date_ouverture_prevue as date_debut, cd.date_ouverture as date_debut_reelle,";
|
||||
$sql.= " cd.date_fin_validite as date_fin, cd.date_cloture as date_fin_reelle,";
|
||||
$sql.= " cd.commentaire as comment,";
|
||||
$sql.= " cd.commentaire as comment, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht,";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
@ -889,6 +913,8 @@ else
|
||||
print '<td width="50" align="right">'.$langs->trans("PriceUHT").'</td>';
|
||||
print '<td width="30" align="center">'.$langs->trans("Qty").'</td>';
|
||||
print '<td width="50" align="right">'.$langs->trans("ReductionShort").'</td>';
|
||||
if ($conf->margin->enabled)
|
||||
print '<td width="50" align="right">'.$langs->trans("BuyingPrice").'</td>';
|
||||
print '<td width="30"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -932,6 +958,10 @@ else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
if ($conf->margin->enabled)
|
||||
print '<td align="right" nowrap="nowrap">'.price($objp->pa_ht).'</td>';
|
||||
|
||||
// Icon move, update et delete (statut contrat 0=brouillon,1=valide,2=ferme)
|
||||
print '<td align="right" nowrap="nowrap">';
|
||||
if ($user->rights->contrat->creer && count($arrayothercontracts) && ($object->statut >= 0))
|
||||
@ -967,7 +997,7 @@ else
|
||||
if ($objp->subprice >= 0)
|
||||
{
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td colspan="6">';
|
||||
print '<td colspan="'.($conf->margin->enabled?7:6).'">';
|
||||
|
||||
// Date planned
|
||||
print $langs->trans("DateStartPlanned").': ';
|
||||
@ -998,6 +1028,8 @@ else
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="updateligne">';
|
||||
print '<input type="hidden" name="elrowid" value="'.GETPOST('rowid').'">';
|
||||
print '<input type="hidden" name="idprod" value="'.($objp->fk_product?$objp->fk_product:'0').'">';
|
||||
print '<input type="hidden" name="fournprice" value="'.($objp->fk_fournprice?$objp->fk_fournprice:'0').'">';
|
||||
// Ligne carac
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>';
|
||||
@ -1030,12 +1062,18 @@ else
|
||||
print '<td align="right"><input size="5" type="text" name="elprice" value="'.price($objp->subprice).'"></td>';
|
||||
print '<td align="center"><input size="2" type="text" name="elqty" value="'.$objp->qty.'"></td>';
|
||||
print '<td align="right" nowrap="nowrap"><input size="1" type="text" name="elremise_percent" value="'.$objp->remise_percent.'">%</td>';
|
||||
if ($conf->margin->enabled) {
|
||||
print '<td align="right">';
|
||||
if ($objp->fk_product)
|
||||
print '<select id="fournprice" name="fournprice"></select>';
|
||||
print '<input id="buying_price" type="text" size="5" name="buying_price" value="'.price($objp->pa_ht,0,'',0).'"></td>';
|
||||
}
|
||||
print '<td align="center" rowspan="2" valign="middle"><input type="submit" class="button" name="save" value="'.$langs->trans("Modify").'">';
|
||||
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td>';
|
||||
// Ligne dates prevues
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td colspan="5">';
|
||||
print '<td colspan="'.($conf->margin->enabled?6:5).'">';
|
||||
print $langs->trans("DateStartPlanned").' ';
|
||||
$form->select_date($db->jdate($objp->date_debut),"date_start_update",$usehm,$usehm,($db->jdate($objp->date_debut)>0?0:1),"update");
|
||||
print '<br>'.$langs->trans("DateEndPlanned").' ';
|
||||
@ -1056,7 +1094,7 @@ else
|
||||
if ($object->statut > 0)
|
||||
{
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<td colspan="6"><hr></td>';
|
||||
print '<td colspan="'.($conf->margin->enabled?7:6).'"><hr></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
@ -1213,7 +1251,7 @@ else
|
||||
|
||||
print '</tr>';
|
||||
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("Comment").'</td><td colspan="3"><input size="80" type="text" name="comment" value="'.GETPOST('comment').'"></td></tr>';
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("Comment").'</td><td colspan="'.($conf->margin->enabled?4:3).'"><input size="80" type="text" name="comment" value="'.$_POST["comment"].'"></td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -1395,3 +1433,59 @@ llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
<?php
|
||||
if ($conf->margin->enabled) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
<?php if ($action == 'editline') { ?>
|
||||
$(document).ready(function() {
|
||||
var idprod = $("input[name='idprod']").val();
|
||||
var fournprice = $("input[name='fournprice']").val();
|
||||
if (idprod > 0) {
|
||||
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': idprod}, function(data) {
|
||||
if (data.length > 0) {
|
||||
var options = '';
|
||||
var trouve=false;
|
||||
$(data).each(function() {
|
||||
options += '<option value="'+this.id+'" price="'+this.price+'"';
|
||||
if (fournprice > 0) {
|
||||
if (this.id == fournprice) {
|
||||
options += ' selected';
|
||||
$("#buying_price").val(this.price);
|
||||
trouve = true;
|
||||
}
|
||||
}
|
||||
options += '>'+this.label+'</option>';
|
||||
});
|
||||
options += '<option value=null'+(trouve?'':' selected')+'><?php echo $langs->trans("InputPrice"); ?></option>';
|
||||
$("#fournprice").html(options);
|
||||
if (trouve) {
|
||||
$("#buying_price").hide();
|
||||
$("#fournprice").show();
|
||||
}
|
||||
else {
|
||||
$("#buying_price").show();
|
||||
}
|
||||
$("#fournprice").change(function() {
|
||||
var selval = $(this).find('option:selected').attr("price");
|
||||
if (selval)
|
||||
$("#buying_price").val(selval).hide();
|
||||
else
|
||||
$('#buying_price').show();
|
||||
});
|
||||
}
|
||||
else {
|
||||
$("#fournprice").hide();
|
||||
$('#buying_price').show();
|
||||
}
|
||||
},
|
||||
'json');
|
||||
}
|
||||
else {
|
||||
$("#fournprice").hide();
|
||||
$('#buying_price').show();
|
||||
}
|
||||
});
|
||||
<?php } ?>
|
||||
</script>
|
||||
<?php } ?>
|
||||
|
||||
@ -89,11 +89,11 @@ class box_prospect extends ModeleBoxes
|
||||
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'url' => DOL_URL_ROOT."/comm/prospect/fiche.php?socid=".$objp->socid);
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
||||
'text' => $objp->nom,
|
||||
'url' => DOL_URL_ROOT."/comm/prospect/fiche.php?socid=".$objp->socid);
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
|
||||
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
|
||||
'text' => dol_print_date($datem, "day"));
|
||||
|
||||
@ -823,11 +823,13 @@ class Form
|
||||
* @param string $showfunction Add function into label
|
||||
* @param string $moreclass Add more class to class style
|
||||
* @param string $showsoc Add company into label
|
||||
* @param int $forcecombo Force to use combo box
|
||||
* @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
|
||||
* @return int <0 if KO, Nb of contact in list if OK
|
||||
*/
|
||||
function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $showsoc=0)
|
||||
function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $showsoc=0, $forcecombo=0, $event=array())
|
||||
{
|
||||
print $this->selectcontacts($socid,$selected,$htmlname,$showempty,$exclude,$limitto,$showfunction, $moreclass, $showsoc);
|
||||
print $this->selectcontacts($socid,$selected,$htmlname,$showempty,$exclude,$limitto,$showfunction, $moreclass, $showsoc, $forcecombo, $event);
|
||||
return $this->num;
|
||||
}
|
||||
|
||||
@ -844,9 +846,11 @@ class Form
|
||||
* @param string $moreclass Add more class to class style
|
||||
* @param bool $options_only Return options only (for ajax treatment)
|
||||
* @param string $showsoc Add company into label
|
||||
* @param int $forcecombo Force to use combo box
|
||||
* @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
|
||||
* @return int <0 if KO, Nb of contact in list if OK
|
||||
*/
|
||||
function selectcontacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $options_only=false, $showsoc=0)
|
||||
function selectcontacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $options_only=false, $showsoc=0, $forcecombo=0, $event=array())
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
@ -872,6 +876,11 @@ class Form
|
||||
if ($resql)
|
||||
{
|
||||
$num=$this->db->num_rows($resql);
|
||||
|
||||
if ($conf->use_javascript_ajax && $conf->global->CONTACT_USE_SEARCH_TO_SELECT && ! $forcecombo)
|
||||
{
|
||||
$out.= ajax_combobox($htmlname, $event);
|
||||
}
|
||||
|
||||
if ($htmlname != 'none' || $options_only) $out.= '<select class="flat'.($moreclass?' '.$moreclass:'').'" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
if ($showempty == 1) $out.= '<option value="0"'.($selected=='0'?' selected="selected"':'').'></option>';
|
||||
|
||||
@ -135,9 +135,10 @@ class FormActions
|
||||
* @param Object $object Object
|
||||
* @param string $typeelement 'invoice','propal','order','invoice_supplier','order_supplier','fichinter'
|
||||
* @param int $socid socid of user
|
||||
* @param int $forceshowtitle Show title even if there is no actions to show
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function showactions($object,$typeelement,$socid=0)
|
||||
function showactions($object,$typeelement,$socid=0,$forceshowtitle=0)
|
||||
{
|
||||
global $langs,$conf,$user;
|
||||
global $bc;
|
||||
@ -148,7 +149,7 @@ class FormActions
|
||||
if (! is_array($listofactions)) dol_print_error($this->db,'FailedToGetActions');
|
||||
|
||||
$num = count($listofactions);
|
||||
if ($num)
|
||||
if ($num || $forceshowtitle)
|
||||
{
|
||||
if ($typeelement == 'invoice') $title=$langs->trans('ActionsOnBill');
|
||||
elseif ($typeelement == 'invoice_supplier' || $typeelement == 'supplier_invoice') $title=$langs->trans('ActionsOnBill');
|
||||
|
||||
@ -49,6 +49,7 @@ class FormMail
|
||||
var $withto;
|
||||
var $withtofree;
|
||||
var $withtocc;
|
||||
var $withtoccc;
|
||||
var $withtopic;
|
||||
var $withfile; // 0=No attaches files, 1=Show attached files, 2=Can add new attached files
|
||||
var $withbody;
|
||||
@ -428,23 +429,11 @@ class FormMail
|
||||
else
|
||||
{
|
||||
$out.= '<input size="'.(is_array($this->withtocc)?"30":"60").'" id="sendtocc" name="sendtocc" value="'.((! is_array($this->withtocc) && ! is_numeric($this->withtocc))? (isset($_POST["sendtocc"])?$_POST["sendtocc"]:$this->withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") ).'" />';
|
||||
if (! empty($this->withto) && is_array($this->withto))
|
||||
if (! empty($this->withtocc) && is_array($this->withtocc))
|
||||
{
|
||||
$out.= " ".$langs->trans("or")." ";
|
||||
$out.= $form->selectarray("receivercc", $this->withto, GETPOST("receivercc"), 1);
|
||||
}
|
||||
if (! empty($this->withtoccsocid) && $this->withtoccsocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method.
|
||||
{
|
||||
$liste=array();
|
||||
$soc=new Societe($this->db);
|
||||
$soc->fetch($this->withtoccsocid);
|
||||
foreach ($soc->thirdparty_and_contact_email_array(1) as $key=>$value)
|
||||
{
|
||||
$liste[$key]=$value;
|
||||
}
|
||||
$out.= " ".$langs->trans("or")." ";
|
||||
$out.= $form->selectarray("receivercc", $liste, GETPOST("receivercc"), 1);
|
||||
}
|
||||
}
|
||||
$out.= "</td></tr>\n";
|
||||
}
|
||||
@ -462,23 +451,11 @@ class FormMail
|
||||
else
|
||||
{
|
||||
$out.= '<input size="'.(is_array($this->withtoccc)?"30":"60").'" id="sendtoccc" name="sendtoccc" value="'.((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))? (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:$this->withtoccc) : (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:"") ).'" />';
|
||||
if (! empty($this->withto) && is_array($this->withto))
|
||||
if (! empty($this->withtoccc) && is_array($this->withtoccc))
|
||||
{
|
||||
$out.= " ".$langs->trans("or")." ";
|
||||
$out.= $form->selectarray("receiverccc", $this->withto, GETPOST("receiverccc"), 1);
|
||||
}
|
||||
if (! empty($this->withtocccsocid) && $this->withtocccsocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method.
|
||||
{
|
||||
$liste=array();
|
||||
$soc=new Societe($this->db);
|
||||
$soc->fetch($this->withtosocid);
|
||||
foreach ($soc->thirdparty_and_contact_email_array(1) as $key=>$value)
|
||||
{
|
||||
$liste[$key]=$value;
|
||||
}
|
||||
$out.= " ".$langs->trans("or")." ";
|
||||
$out.= $form->selectarray("receiverccc", $liste, GETPOST("receiverccc"), 1);
|
||||
}
|
||||
}
|
||||
//if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print ' '.info_admin("+ ".$conf->global->MAIN_MAIL_AUTOCOPY_TO,1);
|
||||
$out.= "</td></tr>\n";
|
||||
|
||||
@ -42,16 +42,7 @@ function societe_prepare_head($object)
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
// TODO Remove tests on object->object. Functions must be called with a company object directly
|
||||
if (($object->client==2 || $object->client==3
|
||||
|| (isset($object->object) && $object->object->client==2) || (isset($object->object) && $object->object->client==3)) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Prospect");
|
||||
$head[$h][2] = 'prospect';
|
||||
$h++;
|
||||
}
|
||||
if ($object->client==1 || $object->client==3 || (isset($object->object) && $object->object->client==1) || (isset($object->object) && $object->object->client==3))
|
||||
if ($object->client==1 || $object->client==2 || $object->client==3 || (isset($object->object) && $object->object->client==1) || (isset($object->object) && $object->object->client==3))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Customer");
|
||||
|
||||
@ -110,7 +110,7 @@ $(document).ready(function () {
|
||||
<!-- Password -->
|
||||
<tr><td valign="top" nowrap="nowrap"> <strong><label for="password"><?php echo $langs->trans('Password'); ?></label></strong> </td>
|
||||
<td valign="top" nowrap="nowrap">
|
||||
<input id="password" name="password" class="flat" type="password" size="15" maxlength="30" value="<?php echo dol_escape_htmltag($password); ?>" tabindex="2" />
|
||||
<input id="password" name="password" class="flat" type="password" size="15" maxlength="30" value="<?php echo dol_escape_htmltag($password); ?>" tabindex="2" autocomplete="off" />
|
||||
</td></tr>
|
||||
|
||||
<?php
|
||||
|
||||
@ -1443,12 +1443,11 @@ else
|
||||
$formmail->fromname = $user->getFullName($langs);
|
||||
$formmail->frommail = $user->email;
|
||||
$formmail->withfrom=1;
|
||||
$formmail->withto=GETPOST('sendto','int')?GETPOST('sendto','int'):1;
|
||||
$formmail->withtosocid=$soc->id;
|
||||
$formmail->withtocc=1;
|
||||
$formmail->withtoccsocid=0;
|
||||
$liste=array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
|
||||
$formmail->withto=GETPOST("sendto")?GETOST("sendto"):$liste;
|
||||
$formmail->withtocc=$liste;
|
||||
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtocccsocid=0;
|
||||
$formmail->withtopic=$langs->trans('SendShippingRef','__SHIPPINGREF__');
|
||||
$formmail->withfile=2;
|
||||
$formmail->withbody=1;
|
||||
|
||||
@ -1487,12 +1487,11 @@ else if ($id > 0 || ! empty($ref))
|
||||
$formmail->fromname = $user->getFullName($langs);
|
||||
$formmail->frommail = $user->email;
|
||||
$formmail->withfrom=1;
|
||||
$formmail->withto=(!GETPOST('sendto','alpha'))?1:GETPOST('sendto','alpha');
|
||||
$formmail->withtosocid=$societe->id;
|
||||
$formmail->withtocc=1;
|
||||
$formmail->withtoccsocid=0;
|
||||
$liste=array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
|
||||
$formmail->withto=GETPOST("sendto")?GETOST("sendto"):$liste;
|
||||
$formmail->withtocc=$liste;
|
||||
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtocccsocid=0;
|
||||
$formmail->withtopic=$langs->trans('SendInterventionRef','__FICHINTERREF__');
|
||||
$formmail->withfile=2;
|
||||
$formmail->withbody=1;
|
||||
|
||||
@ -106,6 +106,7 @@ if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey='';
|
||||
if (empty($dolibarr_main_limit_users)) $dolibarr_main_limit_users=0;
|
||||
if (empty($dolibarr_mailing_limit_sendbyweb)) $dolibarr_mailing_limit_sendbyweb=0;
|
||||
if (empty($dolibarr_strict_mode)) $dolibarr_strict_mode=0; // For debug in php strict mode
|
||||
// TODO Multicompany Remove this. Useless.
|
||||
if (empty($multicompany_transverse_mode)) $multicompany_transverse_mode=0;
|
||||
if (empty($multicompany_force_entity)) $multicompany_force_entity=0; // To force entity in login page
|
||||
|
||||
|
||||
@ -344,6 +344,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->model_pdf = $obj->model_pdf;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
$this->import_key = $obj->import_key;
|
||||
|
||||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||
|
||||
@ -1819,12 +1819,11 @@ if (! empty($object->id))
|
||||
$formmail->fromname = $user->getFullName($langs);
|
||||
$formmail->frommail = $user->email;
|
||||
$formmail->withfrom=1;
|
||||
$formmail->withto=empty($_POST["sendto"])?1:$_POST["sendto"];
|
||||
$formmail->withtosocid=$object->thirdparty->id;
|
||||
$formmail->withtocc=1;
|
||||
$formmail->withtoccsocid=0;
|
||||
$liste=array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
|
||||
$formmail->withto=GETPOST("sendto")?GETOST("sendto"):$liste;
|
||||
$formmail->withtocc=$liste;
|
||||
$formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false);
|
||||
$formmail->withtocccsocid=0;
|
||||
$formmail->withtopic=$langs->trans('SendOrderRef','__ORDERREF__');
|
||||
$formmail->withfile=2;
|
||||
$formmail->withbody=1;
|
||||
|
||||
@ -2008,7 +2008,7 @@ else
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$object->id;
|
||||
$genallowed=$user->rights->fournisseur->facture->creer;
|
||||
$delallowed=$user->rights->fournisseur->facture->supprimer;
|
||||
$modelpdf=(! empty($object->modelpdf)?$object->modelpdf:'');
|
||||
$modelpdf=(! empty($object->modelpdf)?$object->modelpdf:(empty($conf->global->INVOICE_SUPPLIER_ADDON_PDF)?'':$conf->global->INVOICE_SUPPLIER_ADDON_PDF));
|
||||
|
||||
print '<br>';
|
||||
print $formfile->showdocuments('facture_fournisseur',$subdir,$filedir,$urlsource,$genallowed,$delallowed,$modelpdf,1,0,0,0,0,'','','',$societe->default_lang);
|
||||
@ -2075,12 +2075,11 @@ else
|
||||
$formmail->fromname = $user->getFullName($langs);
|
||||
$formmail->frommail = $user->email;
|
||||
$formmail->withfrom=1;
|
||||
$formmail->withto=empty($_POST["sendto"])?1:$_POST["sendto"];
|
||||
$formmail->withtosocid=$societe->id;
|
||||
$formmail->withtocc=1;
|
||||
$formmail->withtoccsocid=0;
|
||||
$liste=array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
|
||||
$formmail->withto=GETPOST("sendto")?GETOST("sendto"):$liste;
|
||||
$formmail->withtocc=$liste;
|
||||
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtocccsocid=0;
|
||||
$formmail->withtopic=$langs->trans('SendBillRef','__FACREF__');
|
||||
$formmail->withfile=2;
|
||||
$formmail->withbody=1;
|
||||
|
||||
@ -32,14 +32,14 @@ class Holiday extends CommonObject
|
||||
{
|
||||
public $element='holiday';
|
||||
public $table_element='holiday';
|
||||
|
||||
|
||||
var $db;
|
||||
var $error;
|
||||
var $errors=array();
|
||||
|
||||
var $rowid;
|
||||
var $ref;
|
||||
|
||||
|
||||
var $fk_user;
|
||||
var $date_create='';
|
||||
var $description;
|
||||
@ -72,16 +72,24 @@ class Holiday extends CommonObject
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
// Mets à jour les congés payés en début de mois
|
||||
$this->updateSoldeCP();
|
||||
|
||||
// Vérifie le nombre d'utilisateur et mets à jour si besoin
|
||||
$this->verifNbUsers($this->countActiveUsers(),$this->getConfCP('nbUser'));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* updateSold
|
||||
*
|
||||
* @return int Return 1
|
||||
*/
|
||||
function updateSold()
|
||||
{
|
||||
// Mets à jour les congés payés en début de mois
|
||||
$this->updateSoldeCP();
|
||||
|
||||
// Vérifie le nombre d'utilisateur et mets à jour si besoin
|
||||
$this->verifNbUsers($this->countActiveUsers(),$this->getConfCP('nbUser'));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Créer un congés payés dans la base de données
|
||||
*
|
||||
@ -358,10 +366,10 @@ class Holiday extends CommonObject
|
||||
|
||||
$sql.= " uu.name as user_lastname,";
|
||||
$sql.= " uu.firstname as user_firstname,";
|
||||
|
||||
|
||||
$sql.= " ua.name as validator_lastname,";
|
||||
$sql.= " ua.firstname as validator_firstname";
|
||||
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp, ".MAIN_DB_PREFIX."user as uu, ".MAIN_DB_PREFIX."user as ua";
|
||||
$sql.= " WHERE cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau
|
||||
|
||||
@ -415,10 +423,10 @@ class Holiday extends CommonObject
|
||||
|
||||
$tab_result[$i]['user_firstname'] = $obj->user_firstname;
|
||||
$tab_result[$i]['user_lastname'] = $obj->user_lastname;
|
||||
|
||||
|
||||
$tab_result[$i]['validator_firstname'] = $obj->validator_firstname;
|
||||
$tab_result[$i]['validator_lastname'] = $obj->validator_lastname;
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
// Retourne 1 et ajoute le tableau à la variable
|
||||
@ -601,13 +609,13 @@ class Holiday extends CommonObject
|
||||
{
|
||||
$this->fetchByUser($fk_user,'','');
|
||||
|
||||
foreach($this->holiday as $infos_CP)
|
||||
foreach($this->holiday as $infos_CP)
|
||||
{
|
||||
if ($infos_CP['statut'] == 4) continue; // ignore not validated holidays
|
||||
if ($infos_CP['statut'] == 5) continue; // ignore not validated holidays
|
||||
|
||||
|
||||
// TODO Also use halfday for the check
|
||||
if ($dateDebut >= $infos_CP['date_debut'] && $dateDebut <= $infos_CP['date_fin'] || $dateFin <= $infos_CP['date_fin'] && $dateFin >= $infos_CP['date_debut'])
|
||||
if ($dateDebut >= $infos_CP['date_debut'] && $dateDebut <= $infos_CP['date_fin'] || $dateFin <= $infos_CP['date_fin'] && $dateFin >= $infos_CP['date_debut'])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -627,23 +635,24 @@ class Holiday extends CommonObject
|
||||
function getNomUrl($withpicto=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
||||
$result='';
|
||||
|
||||
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/holiday/fiche.php?id='.$this->id.'">';
|
||||
$lienfin='</a>';
|
||||
|
||||
|
||||
$picto='holiday';
|
||||
|
||||
|
||||
$label=$langs->trans("Show").': '.$this->ref;
|
||||
|
||||
|
||||
if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the label status
|
||||
*
|
||||
@ -654,7 +663,7 @@ class Holiday extends CommonObject
|
||||
{
|
||||
return $this->LibStatut($this->statut, $mode, $this->date_debut);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the label of a statut
|
||||
*
|
||||
@ -678,7 +687,7 @@ class Holiday extends CommonObject
|
||||
if ($mode == 2)
|
||||
{
|
||||
$pictoapproved='statut6';
|
||||
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
|
||||
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
|
||||
if ($statut == 1) return img_picto($langs->trans('DraftCP'),'statut0').' '.$langs->trans('DraftCP'); // Draft
|
||||
if ($statut == 2) return img_picto($langs->trans('ToValidateCP'),'statut1').' '.$langs->trans('ToValidateCP'); // Waiting approval
|
||||
if ($statut == 3) return img_picto($langs->trans('ValidateCP'),$pictoapproved).' '.$langs->trans('ValidateCP');
|
||||
@ -688,18 +697,18 @@ class Holiday extends CommonObject
|
||||
if ($mode == 5)
|
||||
{
|
||||
$pictoapproved='statut6';
|
||||
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
|
||||
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
|
||||
if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'),'statut0'); // Draft
|
||||
if ($statut == 2) return $langs->trans('ToValidateCP').' '.img_picto($langs->trans('ToValidateCP'),'statut1'); // Waiting approval
|
||||
if ($statut == 3) return $langs->trans('ValidateCP').' '.img_picto($langs->trans('ValidateCP'),$pictoapproved);
|
||||
if ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'),'statut5');
|
||||
if ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'),'statut5');
|
||||
}
|
||||
|
||||
|
||||
return $statut;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Affiche un select HTML des statuts de congés payés
|
||||
*
|
||||
@ -857,19 +866,21 @@ class Holiday extends CommonObject
|
||||
{
|
||||
// Si mise à jour pour tout le monde en début de mois
|
||||
$now=dol_now();
|
||||
|
||||
|
||||
// Mois actuel
|
||||
$month = date('m',$now);
|
||||
$lastUpdate = $this->getConfCP('lastUpdate');
|
||||
$monthLastUpdate = date('m', $lastUpdate);
|
||||
$monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
|
||||
//print 'month: '.$month.' '.$lastUpdate.' '.$monthLastUpdate;
|
||||
|
||||
// Si la date du mois n'est pas la même que celle sauvegardée, on met à jour le timestamp
|
||||
if ($month != $monthLastUpdate)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET";
|
||||
$sql.= " value = '".$this->db->idate($now)."'";
|
||||
$sql.= " value = '".dol_print_date($now,'%Y%m%d%H%M%S')."'";
|
||||
$sql.= " WHERE name = 'lastUpdate'";
|
||||
|
||||
dol_syslog(get_class($this).'::updateSoldeCP sql='.$sql);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
// On ajoute x jours à chaque utilisateurs
|
||||
|
||||
@ -50,7 +50,7 @@ $sql.= " WHERE name = 'userGroup'";
|
||||
$result = $db->query($sql);
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
if ($obj->value == null)
|
||||
if ($obj->value == null || $obj->value < 0)
|
||||
{
|
||||
llxHeader('',$langs->trans('CPTitreMenu'));
|
||||
|
||||
|
||||
@ -73,6 +73,9 @@ $search_statut = GETPOST('select_statut');
|
||||
$holiday = new Holiday($db);
|
||||
$holidaystatic=new Holiday($db);
|
||||
|
||||
// Update sold
|
||||
$holiday->updateSold();
|
||||
|
||||
$max_year = 5;
|
||||
$min_year = 10;
|
||||
$filter='';
|
||||
|
||||
@ -75,8 +75,8 @@ insert into llx_cond_reglement(rowid, code, sortorder, active, libelle, libelle_
|
||||
|
||||
alter table llx_cond_reglement add (decalage smallint(6) default 0);
|
||||
|
||||
alter table llx_commande add fk_cond_reglement int(11) DEFAULT NULL;
|
||||
alter table llx_commande add fk_mode_reglement int(11) DEFAULT NULL;
|
||||
alter table llx_commande add fk_cond_reglement integer DEFAULT NULL;
|
||||
alter table llx_commande add fk_mode_reglement integer DEFAULT NULL;
|
||||
|
||||
|
||||
alter table llx_categorie drop column fk_statut;
|
||||
|
||||
@ -143,8 +143,8 @@ alter table llx_categorie ADD type int not null default '0';
|
||||
-- V4 ALTER TABLE llx_categorie DROP INDEX uk_categorie_ref;
|
||||
|
||||
create table `llx_categorie_societe` (
|
||||
`fk_categorie` int(11) not null,
|
||||
`fk_societe` int(11) not null,
|
||||
`fk_categorie` integer not null,
|
||||
`fk_societe` integer not null,
|
||||
UNIQUE KEY `fk_categorie` (`fk_categorie`,`fk_societe`),
|
||||
KEY `fk_societe` (`fk_societe`)
|
||||
) ENGINE=innodb;
|
||||
@ -154,8 +154,8 @@ alter table `llx_categorie_societe` add constraint `fk_categorie_societe_categor
|
||||
alter table `llx_categorie_societe` add constraint `fk_categorie_societe_fk_soc` foreign key(`fk_societe`) REFERENCES `llx_societe` (`rowid`);
|
||||
|
||||
create table `llx_categorie_product` (
|
||||
`fk_categorie` int(11) not null,
|
||||
`fk_product` int(11) not null,
|
||||
`fk_categorie` integer not null,
|
||||
`fk_product` integer not null,
|
||||
PRIMARY KEY (`fk_categorie`,`fk_product`),
|
||||
KEY `idx_categorie_product_fk_categorie` (`fk_categorie`),
|
||||
KEY `idx_categorie_product_fk_product` (`fk_product`)
|
||||
@ -169,24 +169,24 @@ alter table `llx_categorie_product`
|
||||
-- Ajout gestion du droit de pret
|
||||
drop table if exists `llx_droitpret_rapport`;
|
||||
create table `llx_droitpret_rapport` (
|
||||
`rowid` int(11) NOT NULL auto_increment,
|
||||
`rowid` integer NOT NULL auto_increment,
|
||||
`date_envoie` datetime NOT NULL,
|
||||
`format` varchar(10) NOT NULL,
|
||||
`date_debut` datetime NOT NULL,
|
||||
`date_fin` datetime NOT NULL,
|
||||
`fichier` varchar(255) NOT NULL,
|
||||
`nbfact` int(11) NOT NULL,
|
||||
`nbfact` integer NOT NULL,
|
||||
PRIMARY KEY (`rowid`)
|
||||
) ENGINE=innodb;
|
||||
|
||||
|
||||
-- Gestion des menu
|
||||
CREATE TABLE `llx_menu` (
|
||||
`rowid` int(11) NOT NULL,
|
||||
`rowid` integer NOT NULL,
|
||||
`menu_handler` varchar(16) NOT NULL default 'auguria',
|
||||
`type` enum('top','left') NOT NULL default 'left',
|
||||
`mainmenu` varchar(100) NOT NULL,
|
||||
`fk_menu` int(11) NOT NULL,
|
||||
`fk_menu` integer NOT NULL,
|
||||
`order` tinyint(4) NOT NULL,
|
||||
`url` varchar(255) NOT NULL,
|
||||
`target` varchar(100) NULL,
|
||||
@ -200,15 +200,15 @@ CREATE TABLE `llx_menu` (
|
||||
) ENGINE=innodb;
|
||||
|
||||
create table `llx_menu_constraint` (
|
||||
`rowid` int(11) NOT NULL,
|
||||
`rowid` integer NOT NULL,
|
||||
`action` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`rowid`)
|
||||
) ENGINE=innodb;
|
||||
|
||||
create table `llx_menu_const` (
|
||||
`rowid` int(11) NOT NULL auto_increment,
|
||||
`fk_menu` int(11) NOT NULL,
|
||||
`fk_constraint` int(11) NOT NULL,
|
||||
`rowid` integer NOT NULL auto_increment,
|
||||
`fk_menu` integer NOT NULL,
|
||||
`fk_constraint` integer NOT NULL,
|
||||
`user` tinyint(4) NOT NULL default '2',
|
||||
PRIMARY KEY (`rowid`)
|
||||
) ENGINE=innodb;
|
||||
|
||||
@ -33,3 +33,6 @@ UPDATE llx_const set value='smartphone_menu.php' where value='smartphone_frontof
|
||||
|
||||
ALTER TABLE llx_user add COLUMN fk_user integer;
|
||||
|
||||
-- margin on contracts
|
||||
alter table llx_contratdet add column fk_product_fournisseur_price integer after info_bits;
|
||||
alter table llx_contratdet add column buy_price_ht double(24,8) DEFAULT 0 after fk_product_fournisseur_price;
|
||||
@ -52,7 +52,9 @@ create table llx_contratdet
|
||||
total_localtax1 double(24,8) DEFAULT 0, -- Total Local tax 1 de la ligne
|
||||
total_localtax2 double(24,8) DEFAULT 0, -- Total Local tax 2 de la ligne
|
||||
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
|
||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||
fk_product_fournisseur_price integer DEFAULT NULL, -- supplier price id
|
||||
buy_price_ht double(24,8) DEFAULT NULL, -- buying price
|
||||
|
||||
fk_user_author integer NOT NULL DEFAULT 0,
|
||||
fk_user_ouverture integer,
|
||||
|
||||
@ -50,6 +50,7 @@ DisableJavascript=Disable JavaScript and Ajax functions
|
||||
ConfirmAjax=Use Ajax confirmation popups
|
||||
UseSearchToSelectCompany=Use autocompletion fields to choose third parties (instead of using a list box).<br><br>Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant SOCIETE_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string.
|
||||
ActivityStateToSelectCompany= Add a filter option to show/hide thirdparties which are currently in activity or has ceased it
|
||||
UseSearchToSelectContact=Use autocompletion fields to choose contact (instead of using a list box).<br><br>Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant CONTACT_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string.
|
||||
SearchFilter=Search filters options
|
||||
NumberOfKeyToSearch=Nbr of characters to trigger search: %s
|
||||
ViewFullDateActions=Show full dates events in the third sheet
|
||||
|
||||
@ -15,7 +15,7 @@ MyEvents=My events
|
||||
OtherEvents=Other events
|
||||
ListOfActions=List of events
|
||||
Location=Location
|
||||
EventOnFullDay=Event on full day
|
||||
EventOnFullDay=Event on all day(s)
|
||||
SearchAnAction= Search an event/task
|
||||
MenuToDoActions= All incomplete events
|
||||
MenuDoneActions= All terminated events
|
||||
|
||||
@ -85,7 +85,7 @@ CountryDM=Dominica
|
||||
CountryDO=República Dominicana
|
||||
CountryEC=Ecuador
|
||||
CountryEG=Egipto
|
||||
CountrySV=Salvador
|
||||
CountrySV=El Salvador
|
||||
CountryGQ=Guinea Ecuatorial
|
||||
CountryER=Eritrea
|
||||
CountryEE=Estonia
|
||||
|
||||
@ -49,6 +49,7 @@ DisableJavascript= Désactiver les fonctions Javascript et Ajax
|
||||
ConfirmAjax= Utiliser les popups de confirmation Ajax
|
||||
UseSearchToSelectCompany= Utiliser un champ avec autocomplétion pour choisir un tiers (plutôt qu'une liste déroulante).<br><br>Notez que si vous avez un nombre important de produits ou services (> 100 000), vous pouvez améliorer les performances en définissant la constante SOCIETE_DONOTSEARCH_ANYWHERE à 1 dans Configuration->Divers. La recherche sera alors limitée au début de la chaine.
|
||||
ActivityStateToSelectCompany= Ajouter une option de filtrage lors des recherches pour afficher/masquer les tiers en exercice ou ayant cessés d'exercer
|
||||
UseSearchToSelectContact= Utiliser un champ avec autocomplétion pour choisir un contact (plutôt qu'une liste déroulante).<br><br>Notez que si vous avez un nombre important de produits ou services (> 100 000), vous pouvez améliorer les performances en définissant la constante CONTACT_DONOTSEARCH_ANYWHERE à 1 dans Configuration->Divers. La recherche sera alors limitée au début de la chaine.
|
||||
SearchFilter=Options des filtres de recherche
|
||||
NumberOfKeyToSearch=Nb carac. déclenchant recherche: %s
|
||||
ViewFullDateActions= Visualiser les dates des actions en entier dans la fiche tiers
|
||||
@ -313,7 +314,7 @@ FirstnameNamePosition=Ordre affichage prénom/nom
|
||||
DescWeather=Les graphiques suivant seront affichées sur le tableau de bord si le nombre d'éléments en retard atteints ces valeurs:
|
||||
KeyForWebServicesAccess=Clé pour utiliser les Web Services (paramètre "dolibarrkey" dans les webservices)
|
||||
TestSubmitForm=Formulaire de test de saisie
|
||||
ThisForceAlsoTheme=Utiliser ce gestionnaire de menu force aussi le theme quelquesoit le choix de theme de l'utilisateur. De plus, ce gestionnaire de menu, spécialisé pour smartphone, ne fonctionne que sur certains téléphones. Utiliser un autre gestionnaire si vous constatez des problèmes.
|
||||
ThisForceAlsoTheme=Utiliser ce gestionnaire de menu force aussi le thème quelque soit le choix de thème de l'utilisateur. De plus, ce gestionnaire de menu, spécialisé pour smartphone, ne fonctionne que sur certains téléphones. Utilisez un autre gestionnaire si vous constatez des problèmes.
|
||||
ThemeDir=Répertoire des thèmes
|
||||
ConnectionTimeout=Timeout de connexion
|
||||
ResponseTimeout=Timeout de réponse
|
||||
@ -445,7 +446,7 @@ Module1200Desc= Interface avec le bug tracking Mantis
|
||||
Module1400Name= Comptabilité
|
||||
Module1400Desc= Gestion de la comptabilité (doubles parties)
|
||||
Module1780Name= Catégories
|
||||
Module1780Desc= Gestion des catégories (produits, fournisseurs et clients)
|
||||
Module1780Desc= Gestion des catégories (produits, fournisseurs, clients et adhérents)
|
||||
Module2000Name= Editeur WYSIWYG
|
||||
Module2000Desc= Permet la saisie de certaines zones de textes grace à un éditeur avancé
|
||||
Module2200Name= Droit de prêts
|
||||
@ -458,6 +459,8 @@ Module2500Name= Gestion Electronique de Documents
|
||||
Module2500Desc= Permet de stocker et administrer une base de documents
|
||||
Module2600Name= WebServices
|
||||
Module2600Desc= Active le serveur de Web Services de Dolibarr
|
||||
Module2650Name= Ultimatepdf
|
||||
Module2650Desc= Gestion de la présentation des modèles de pdf (propales, factures, commandes etc...)
|
||||
Module2700Name= Gravatar
|
||||
Module2700Desc= Utilise le service en ligne Gravatar (www.gravatar.com) pour afficher les photos d'utilisateurs/membres (qui se trouvent avec leurs e-mails). Besoin d'un accès Internet
|
||||
Module2900Name= GeoIPMaxmind
|
||||
@ -943,7 +946,7 @@ TranslationSetup=Translation setup
|
||||
TranslationDesc=Le choix de la langue affichée à l'écran se modifie:<br>* Soit de manière globale depuis le menu <strong>Accueil - Configuration - Affichage</strong><br>* Soit de manière spécifique à l'utilisateur depuis l'onglet <strong>Interface utilisateur</strong> de sa fiche utilisateur (cliquer sur le login en haut de l'écran).
|
||||
ClassNotFoundIntoPathWarning=La class %s n'a pas été trouvée dans le path PHP
|
||||
YesInSummer=Oui en été
|
||||
OnlyFollowingModulesAreOpenedToExternalUsers=Remarque, seuls les modules suivants sont ouverts aux utilisateurs externes (quelquesoit les permissions de ces utilisateurs):
|
||||
OnlyFollowingModulesAreOpenedToExternalUsers=Remarque, seuls les modules suivants sont ouverts aux utilisateurs externes (quelque soit les permissions de ces utilisateurs):
|
||||
|
||||
##### Module password generation= undefined
|
||||
PasswordGenerationStandard= Renvoie un mot de passe généré selon algorithme interne Dolibarr: 8 caractères, chiffres et caractères en minuscules mélangés.
|
||||
|
||||
@ -14,7 +14,7 @@ EventsNb=Nombre d'événements
|
||||
MyEvents=Mes événements
|
||||
OtherEvents=Autres événements
|
||||
ListOfActions=Liste des événements
|
||||
EventOnFullDay=Événement sur la journée
|
||||
EventOnFullDay=Événement sur la(les) journée(s)
|
||||
Location=Lieu
|
||||
SearchAnAction=Rechercher un événement/tâche
|
||||
MenuToDoActions=Les événem. incomplets
|
||||
|
||||
@ -584,6 +584,7 @@ if (! defined('NOLOGIN'))
|
||||
}
|
||||
|
||||
// Create entity cookie, just used for login page
|
||||
// TODO Multicompany Move this into hook
|
||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_COOKIE_ENABLED) && isset($_POST["entity"]))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/cookie.class.php';
|
||||
@ -754,6 +755,7 @@ else
|
||||
$heightforframes=52;
|
||||
|
||||
// Switch to another entity
|
||||
// TODO Multicompany Remove this
|
||||
if (! empty($conf->multicompany->enabled) && GETPOST('action') == 'switchentity')
|
||||
{
|
||||
if ($mc->switchEntity(GETPOST('entity','int')) > 0)
|
||||
|
||||
@ -75,6 +75,7 @@ if (! empty($dolibarr_main_document_root_alt))
|
||||
}
|
||||
|
||||
// Set properties specific to multicompany
|
||||
// TODO Multicompany Remove this. Useless. Var should be read when required.
|
||||
$conf->multicompany->transverse_mode = empty($multicompany_transverse_mode)?'':$multicompany_transverse_mode; // Force Multi-Company transverse mode
|
||||
$conf->multicompany->force_entity = empty($multicompany_force_entity)?'':(int) $multicompany_force_entity; // Force entity in login page
|
||||
|
||||
@ -141,6 +142,7 @@ if (! defined('NOREQUIREDB'))
|
||||
{
|
||||
$conf->entity = DOLENTITY;
|
||||
}
|
||||
// TODO Multicompany Remove this.
|
||||
else if (! empty($conf->multicompany->force_entity) && is_int($conf->multicompany->force_entity)) // To force entity in login page
|
||||
{
|
||||
$conf->entity = $conf->multicompany->force_entity;
|
||||
|
||||
@ -2186,7 +2186,7 @@ class Product extends CommonObject
|
||||
}
|
||||
|
||||
// Recursive call
|
||||
if (is_array($desc_pere))
|
||||
if (is_array($desc_pere)>2)
|
||||
{
|
||||
$this ->fetch_prod_arbo($desc_pere, $nom_pere." -> ", $desc_pere[1]*$multiply, $level+1);
|
||||
}
|
||||
@ -2340,12 +2340,13 @@ class Product extends CommonObject
|
||||
$prods = array();
|
||||
while ($rec = $this->db->fetch_array($res))
|
||||
{
|
||||
$prods[$rec['rowid']]= array(0=>$rec['id'],1=>$rec['qty'],2=>$rec['fk_product_type'],3=>$this->db->escape($rec['label']));
|
||||
//$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty'],2=>$rec['fk_product_type']);
|
||||
$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty']);
|
||||
//$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty']);
|
||||
$listofchilds=$this->getChildsArbo($rec['id']);
|
||||
foreach($listofchilds as $keyChild => $valueChild)
|
||||
{
|
||||
$prods[$this->db->escape($rec['label'])][$keyChild] = $valueChild;
|
||||
$prods[$rec['rowid']][$keyChild] = $valueChild;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -82,6 +82,21 @@ if ($action == 'COMPANY_USE_SEARCH_TO_SELECT')
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'CONTACT_USE_SEARCH_TO_SELECT')
|
||||
{
|
||||
$contactsearch = GETPOST('activate_CONTACT_USE_SEARCH_TO_SELECT','alpha');
|
||||
$res = dolibarr_set_const($db, "CONTACT_USE_SEARCH_TO_SELECT", $contactsearch,'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
if (! $error)
|
||||
{
|
||||
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
|
||||
}
|
||||
}
|
||||
|
||||
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
||||
if ($action == 'setModuleOptions')
|
||||
{
|
||||
@ -647,9 +662,37 @@ else
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
|
||||
|
||||
$var=!$var;
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="CONTACT_USE_SEARCH_TO_SELECT">';
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="80%">'.$langs->trans("UseSearchToSelectContact").'</td>';
|
||||
if (! $conf->use_javascript_ajax)
|
||||
{
|
||||
print '<td nowrap="nowrap" align="right" colspan="2">';
|
||||
print $langs->trans("NotAvailableWhenAjaxDisabled");
|
||||
print "</td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td width="60" align="right">';
|
||||
$arrval=array('0'=>$langs->trans("No"),
|
||||
'1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",1).')',
|
||||
'2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",2).')',
|
||||
'3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",3).')',
|
||||
);
|
||||
print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT",$arrval,$conf->global->CONTACT_USE_SEARCH_TO_SELECT);
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</td>";
|
||||
}
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -1437,18 +1437,11 @@ class Societe extends CommonObject
|
||||
|
||||
if ($option == 'customer' || $option == 'compta')
|
||||
{
|
||||
if (($this->client == 1 || $this->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) // Only customer
|
||||
{
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$this->id;
|
||||
}
|
||||
elseif($this->client == 2 && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) // Only prospect
|
||||
{
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$this->id;
|
||||
}
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$this->id;
|
||||
}
|
||||
else if ($option == 'prospect' && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
|
||||
{
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$this->id;
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$this->id;
|
||||
}
|
||||
else if ($option == 'supplier')
|
||||
{
|
||||
@ -2655,7 +2648,181 @@ class Societe extends CommonObject
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
/**
|
||||
* Return prostect level
|
||||
*
|
||||
* @return string Libelle
|
||||
*/
|
||||
function getLibProspLevel()
|
||||
{
|
||||
return $this->LibProspLevel($this->fk_prospectlevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return label of prospect level
|
||||
*
|
||||
* @param int $fk_prospectlevel Prospect level
|
||||
* @return string label of level
|
||||
*/
|
||||
function LibProspLevel($fk_prospectlevel)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$lib=$langs->trans("ProspectLevel".$fk_prospectlevel);
|
||||
// If lib not found in language file, we get label from cache/databse
|
||||
if ($lib == $langs->trans("ProspectLevel".$fk_prospectlevel))
|
||||
{
|
||||
$lib=$langs->getLabelFromKey($this->db,$fk_prospectlevel,'c_prospectlevel','code','label');
|
||||
}
|
||||
return $lib;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set prospect level
|
||||
*
|
||||
* @param User $user Utilisateur qui definie la remise
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_prospect_level($user)
|
||||
{
|
||||
if ($this->id)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
// Positionne remise courante
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
|
||||
$sql.= " fk_prospectlevel='".$this->fk_prospectlevel."'";
|
||||
$sql.= ",fk_user_modif='".$user->id."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
dol_syslog(get_class($this)."::set_prospect_level sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return status of prospect
|
||||
*
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
|
||||
* @return string Libelle
|
||||
*/
|
||||
function getLibProspCommStatut($mode=0)
|
||||
{
|
||||
return $this->LibProspCommStatut($this->stcomm_id,$mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return label of a given status
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @return string Libelle du statut
|
||||
*/
|
||||
function LibProspCommStatut($statut,$mode=0)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load('customers');
|
||||
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($statut == -1) return img_action($langs->trans("StatusProspect-1"),-1).' '.$langs->trans("StatusProspect-1");
|
||||
if ($statut == 0) return img_action($langs->trans("StatusProspect0"), 0).' '.$langs->trans("StatusProspect0");
|
||||
if ($statut == 1) return img_action($langs->trans("StatusProspect1"), 1).' '.$langs->trans("StatusProspect1");
|
||||
if ($statut == 2) return img_action($langs->trans("StatusProspect2"), 2).' '.$langs->trans("StatusProspect2");
|
||||
if ($statut == 3) return img_action($langs->trans("StatusProspect3"), 3).' '.$langs->trans("StatusProspect3");
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($statut == -1) return img_action($langs->trans("StatusProspect-1"),-1);
|
||||
if ($statut == 0) return img_action($langs->trans("StatusProspect0"), 0);
|
||||
if ($statut == 1) return img_action($langs->trans("StatusProspect1"), 1);
|
||||
if ($statut == 2) return img_action($langs->trans("StatusProspect2"), 2);
|
||||
if ($statut == 3) return img_action($langs->trans("StatusProspect3"), 3);
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($statut == -1) return img_action($langs->trans("StatusProspect-1"),-1).' '.$langs->trans("StatusProspect-1");
|
||||
if ($statut == 0) return img_action($langs->trans("StatusProspect0"), 0).' '.$langs->trans("StatusProspect0");
|
||||
if ($statut == 1) return img_action($langs->trans("StatusProspect1"), 1).' '.$langs->trans("StatusProspect1");
|
||||
if ($statut == 2) return img_action($langs->trans("StatusProspect2"), 2).' '.$langs->trans("StatusProspect2");
|
||||
if ($statut == 3) return img_action($langs->trans("StatusProspect3"), 3).' '.$langs->trans("StatusProspect3");
|
||||
}
|
||||
|
||||
return "Error, mode/status not found";
|
||||
}
|
||||
|
||||
/**
|
||||
* Set commnunication level
|
||||
*
|
||||
* @param User $user Utilisateur qui definie la remise
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_commnucation_level($user)
|
||||
{
|
||||
if ($this->id)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
// Positionne remise courante
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
|
||||
$sql.= " fk_stcomm='".$this->stcomm_id."'";
|
||||
$sql.= ",fk_user_modif='".$user->id."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::set_commnucation_level sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return label of status customer is prospect/customer
|
||||
*
|
||||
* @return string Libelle
|
||||
*/
|
||||
function getLibCustProspStatut()
|
||||
{
|
||||
return $this->LibCustProspStatut($this->client,$mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @return string Libelle du statut
|
||||
*/
|
||||
function LibCustProspStatut($statut)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load('companies');
|
||||
|
||||
if ($statut==0) return $langs->trans("NorProspectNorCustomer");
|
||||
if ($statut==1) return $langs->trans("Customer");
|
||||
if ($statut==2) return $langs->trans("Prospect");
|
||||
if ($statut==3) return $langs->trans("ProspectCustomer");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
BIN
htdocs/theme/amarok/img/background_login.png
Executable file → Normal file
BIN
htdocs/theme/amarok/img/background_login.png
Executable file → Normal file
Binary file not shown.
|
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 13 KiB |
@ -210,8 +210,8 @@ form#login {
|
||||
}
|
||||
form#login img {width:auto; height:auto; opacity:.7;}
|
||||
form#login img#img_logo {
|
||||
width:220px;
|
||||
max-width:220px;
|
||||
width:190px;
|
||||
max-width:190px;
|
||||
height:auto;
|
||||
border-radius:6px;
|
||||
padding:6px;
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk>
|
||||
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
|
||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
*
|
||||
* 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
|
||||
@ -75,6 +76,7 @@ class User extends CommonObject
|
||||
var $contact_id;
|
||||
|
||||
var $fk_member;
|
||||
var $fk_user;
|
||||
|
||||
var $webcal_login;
|
||||
var $phenix_login;
|
||||
@ -91,9 +93,11 @@ class User extends CommonObject
|
||||
var $all_permissions_are_loaded; /**< \private all_permissions_are_loaded */
|
||||
private $_tab_loaded=array(); // Array of cache of already loaded permissions
|
||||
|
||||
var $conf; // To store personal config
|
||||
var $oldcopy; // To contains a clone of this when we need to save old properties of object
|
||||
var $conf; // To store personal config
|
||||
var $oldcopy; // To contains a clone of this when we need to save old properties of object
|
||||
|
||||
var $users; // To store all tree of users hierarchy
|
||||
var $parentof; // To store an array of all parents for all ids.
|
||||
|
||||
|
||||
/**
|
||||
@ -139,7 +143,7 @@ class User extends CommonObject
|
||||
$sql = "SELECT u.rowid, u.name, u.firstname, u.email, u.job, u.signature, u.office_phone, u.office_fax, u.user_mobile,";
|
||||
$sql.= " u.admin, u.login, u.webcal_login, u.phenix_login, u.phenix_pass, u.note,";
|
||||
$sql.= " u.pass, u.pass_crypted, u.pass_temp,";
|
||||
$sql.= " u.fk_societe, u.fk_socpeople, u.fk_member, u.ldap_sid,";
|
||||
$sql.= " u.fk_societe, u.fk_socpeople, u.fk_member, u.fk_user, u.ldap_sid,";
|
||||
$sql.= " u.statut, u.lang, u.entity,";
|
||||
$sql.= " u.datec as datec,";
|
||||
$sql.= " u.tms as datem,";
|
||||
@ -221,8 +225,7 @@ class User extends CommonObject
|
||||
$this->societe_id = $obj->fk_societe;
|
||||
$this->contact_id = $obj->fk_socpeople;
|
||||
$this->fk_member = $obj->fk_member;
|
||||
|
||||
if (! $this->lang) $this->lang='fr_FR';
|
||||
$this->fk_user = $obj->fk_user;
|
||||
|
||||
$this->db->free($result);
|
||||
}
|
||||
@ -993,11 +996,11 @@ class User extends CommonObject
|
||||
if ($result > 0)
|
||||
{
|
||||
$result=$this->setPassword($user,$this->pass);
|
||||
if ($member->fk_soc) {
|
||||
if ($member->fk_soc) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
||||
$sql.= " SET fk_societe=".$member->fk_soc;
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::create_from_member sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -1009,7 +1012,7 @@ class User extends CommonObject
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::create_from_member - 1 - ".$this->error, LOG_ERR);
|
||||
|
||||
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -1069,7 +1072,7 @@ class User extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a user into databse (and also password if this->pass is defined)
|
||||
* Update a user into database (and also password if this->pass is defined)
|
||||
*
|
||||
* @param User $user User qui fait la mise a jour
|
||||
* @param int $notrigger 1 ne declenche pas les triggers, 0 sinon
|
||||
@ -1153,7 +1156,7 @@ class User extends CommonObject
|
||||
{
|
||||
// Si mot de passe saisi et different de celui en base
|
||||
$result=$this->setPassword($user,$this->pass,0,$notrigger,$nosyncmemberpass);
|
||||
if (! $nbrowsaffected) $nbrowsaffected++;
|
||||
if (! $nbrowsaffected) $nbrowsaffected++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1268,7 +1271,7 @@ class User extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise e jour en base de la date de deniere connexion d'un utilisateur
|
||||
* Mise a jour en base de la date de derniere connexion d'un utilisateur
|
||||
* Fonction appelee lors d'une nouvelle connexion
|
||||
*
|
||||
* @return <0 si echec, >=0 si ok
|
||||
@ -2074,7 +2077,8 @@ class User extends CommonObject
|
||||
* Update user using data from the LDAP
|
||||
* // TODO: Voir pourquoi le update met à jour avec toutes les valeurs vide (global $user écrase ?)
|
||||
*/
|
||||
function update_ldap2dolibarr(&$ldapuser) {
|
||||
function update_ldap2dolibarr(&$ldapuser)
|
||||
{
|
||||
global $user, $conf;
|
||||
|
||||
$this->firstname=$ldapuser->{$conf->global->LDAP_FIELD_FIRSTNAME};
|
||||
@ -2091,13 +2095,214 @@ class User extends CommonObject
|
||||
|
||||
$this->job=$ldapuser->{$conf->global->LDAP_FIELD_TITLE};
|
||||
$this->note=$ldapuser->{$conf->global->LDAP_FIELD_DESCRIPTION};
|
||||
|
||||
|
||||
$result = $this->update($user);
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::update_ldap2dolibarr result=".$result, LOG_DEBUG);
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return and array with all instanciated children users of current user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function get_children()
|
||||
{
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."user";
|
||||
$sql.= " WHERE fk_user = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::get_children result=".$result, LOG_DEBUG);
|
||||
$res = $this->db->query($sql);
|
||||
if ($res)
|
||||
{
|
||||
$users = array ();
|
||||
while ($rec = $this->db->fetch_array($res))
|
||||
{
|
||||
$user = new User($this->db);
|
||||
$user->fetch($rec['rowid']);
|
||||
$users[] = $user;
|
||||
}
|
||||
return $users;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load this->parentof that is array(id_son=>id_parent, ...)
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
private function load_parentof()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->parentof=array();
|
||||
|
||||
// Load array[child]=parent
|
||||
$sql = "SELECT fk_user as id_parent, rowid as id_son";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user";
|
||||
$sql.= " WHERE fk_user != 0";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog(get_class($this)."::load_parentof sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($obj= $this->db->fetch_object($resql))
|
||||
{
|
||||
$this->parentof[$obj->id_son]=$obj->id_parent;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reconstruit l'arborescence hierarchique des users sous la forme d'un tableau
|
||||
* Renvoi un tableau de tableau('id','id_parent',...) trie selon arbre et avec:
|
||||
* id = id du user
|
||||
* id_parent = id du user parent
|
||||
* id_children = tableau des id enfant
|
||||
* name = nom du user
|
||||
* fullname = nom avec chemin complet du user
|
||||
* fullpath = chemin complet compose des id
|
||||
*
|
||||
* @param int $markafterid Removed all users including the leaf $markafterid in user tree.
|
||||
* @return array Array of users. this->users and this->parentof are set.
|
||||
*/
|
||||
function get_full_tree($markafterid=0)
|
||||
{
|
||||
$this->users = array();
|
||||
|
||||
// Init this->parentof that is array(id_son=>id_parent, ...)
|
||||
$this->load_parentof();
|
||||
|
||||
// Init $this->users array
|
||||
$sql = "SELECT DISTINCT u.rowid, u.firstname, u.name, u.fk_user"; // Distinct reduce pb with old tables with duplicates
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE u.entity IN (".getEntity('user',1).")";
|
||||
|
||||
dol_syslog(get_class($this)."::get_full_tree get user list sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i=0;
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$this->users[$obj->rowid]['rowid'] = $obj->rowid;
|
||||
$this->users[$obj->rowid]['id'] = $obj->rowid;
|
||||
$this->users[$obj->rowid]['fk_user'] = $obj->fk_parent;
|
||||
$this->users[$obj->rowid]['firstname'] = $obj->firstname;
|
||||
$this->users[$obj->rowid]['name'] = $obj->name;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// We add the fullpath property to each elements of first level (no parent exists)
|
||||
dol_syslog(get_class($this)."::get_full_tree call to build_path_from_id_user", LOG_DEBUG);
|
||||
foreach($this->users as $key => $val)
|
||||
{
|
||||
$this->build_path_from_id_user($key,0); // Process a branch from the root user key (this user has no parent)
|
||||
}
|
||||
|
||||
// Exclude leaf including $markafterid from tree
|
||||
if ($markafterid)
|
||||
{
|
||||
//print "Look to discard user ".$markafterid."\n";
|
||||
$keyfilter1='^'.$markafterid.'$';
|
||||
$keyfilter2='_'.$markafterid.'$';
|
||||
$keyfilter3='^'.$markafterid.'_';
|
||||
$keyfilter4='_'.$markafterid.'_';
|
||||
foreach($this->users as $key => $val)
|
||||
{
|
||||
if (preg_match('/'.$keyfilter1.'/',$val['fullpath']) || preg_match('/'.$keyfilter2.'/',$val['fullpath'])
|
||||
|| preg_match('/'.$keyfilter3.'/',$val['fullpath']) || preg_match('/'.$keyfilter4.'/',$val['fullpath']))
|
||||
{
|
||||
unset($this->users[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::get_full_tree dol_sort_array", LOG_DEBUG);
|
||||
$this->users=dol_sort_array($this->users, 'fullname', 'asc', true, false);
|
||||
|
||||
//$this->debug_users();
|
||||
|
||||
return $this->users;
|
||||
}
|
||||
|
||||
/**
|
||||
* For user id_user and its childs available in this->users, define property fullpath and fullname
|
||||
*
|
||||
* @param int $id_user id_user entry to update
|
||||
* @param int $protection Deep counter to avoid infinite loop
|
||||
* @return void
|
||||
*/
|
||||
function build_path_from_id_user($id_user,$protection=1000)
|
||||
{
|
||||
dol_syslog(get_class($this)."::build_path_from_id_user id_user=".$id_user." protection=".$protection, LOG_DEBUG);
|
||||
|
||||
if (! empty($this->users[$id_user]['fullpath']))
|
||||
{
|
||||
// Already defined
|
||||
dol_syslog(get_class($this)."::build_path_from_id_user fullpath and fullname already defined", LOG_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
// Define fullpath and fullname
|
||||
$this->users[$id_user]['fullpath'] = '_'.$id_user;
|
||||
$this->users[$id_user]['fullname'] = $this->users[$id_user]['label'];
|
||||
$i=0; $cursor_user=$id_user;
|
||||
|
||||
while ((empty($protection) || $i < $protection) && ! empty($this->parentof[$cursor_user]))
|
||||
{
|
||||
$this->users[$id_user]['fullpath'] = '_'.$this->parentof[$cursor_user].$this->users[$id_user]['fullpath'];
|
||||
$this->users[$id_user]['fullname'] = $this->users[$this->parentof[$cursor_user]]['label'].' >> '.$this->users[$id_user]['fullname'];
|
||||
$i++; $cursor_user=$this->parentof[$cursor_user];
|
||||
}
|
||||
|
||||
// We count number of _ to have level
|
||||
$this->users[$id_user]['level']=dol_strlen(preg_replace('/[^_]/i','',$this->users[$id_user]['fullpath']));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche contenu de $this->users
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function debug_users()
|
||||
{
|
||||
// Affiche $this->users
|
||||
foreach($this->users as $key => $val)
|
||||
{
|
||||
print 'id: '.$this->users[$key]['id'];
|
||||
print ' name: '.$this->users[$key]['name'];
|
||||
print ' parent: '.$this->users[$key]['fk_parent'];
|
||||
print ' fullpath: '.$this->users[$key]['fullpath'];
|
||||
print ' fullname: '.$this->users[$key]['fullname'];
|
||||
print "<br>\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -324,9 +324,7 @@ if ($action == 'update' && ! $_POST["cancel"])
|
||||
$object->firstname = GETPOST("prenom");
|
||||
$object->login = GETPOST("login");
|
||||
$object->pass = GETPOST("password");
|
||||
if($user->admin == 1) { // A user can only be set admin by an admin
|
||||
$object->admin = GETPOST("admin");
|
||||
}
|
||||
$object->admin = empty($user->admin)?0:GETPOST("admin"); // A user can only be set admin by an admin
|
||||
$object->office_phone=GETPOST("office_phone");
|
||||
$object->office_fax = GETPOST("office_fax");
|
||||
$object->user_mobile= GETPOST("user_mobile");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user