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

This commit is contained in:
Laurent Destailleur 2012-12-27 11:14:11 +01:00
commit 35ee168d9a
4 changed files with 70 additions and 47 deletions

View File

@ -27,7 +27,9 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
Group: Productivity/Office/Management Group: Productivity/Office/Management
Requires: apache2, apache2-mod_php5, php5 >= 5.3.0, php5-gd, php5-ldap, php5-imap, php5-mysql, php5-openssl, dejavu Requires: apache2, apache2-mod_php5, php5 >= 5.3.0, php5-gd, php5-ldap, php5-imap, php5-mysql, php5-openssl, dejavu
Requires: mysql-community-server, mysql-community-server-client Requires: mysql-community-server, mysql-community-server-client
%if 0%{?suse_version}
BuildRequires: update-desktop-files fdupes BuildRequires: update-desktop-files fdupes
%endif
# Set yes to build test package, no for release (this disable need of /usr/bin/php not found by OpenSuse) # Set yes to build test package, no for release (this disable need of /usr/bin/php not found by OpenSuse)
AutoReqProv: no AutoReqProv: no
@ -119,6 +121,7 @@ do
fi fi
done >>%{name}.lang done >>%{name}.lang
%if 0%{?suse_version}
# Enable this command to tag desktop file for suse # Enable this command to tag desktop file for suse
%suse_update_desktop_file dolibarr %suse_update_desktop_file dolibarr
@ -126,6 +129,8 @@ done >>%{name}.lang
# Enable this command to allow suse detection of duplicate files and create hardlinks instead # Enable this command to allow suse detection of duplicate files and create hardlinks instead
%fdupes $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs %fdupes $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs
%endif
#---- clean #---- clean
%clean %clean

View File

@ -352,7 +352,7 @@ if ($action == 'update')
$actioncomm->array_options[$key]=GETPOST($key); $actioncomm->array_options[$key]=GETPOST($key);
} }
} }
if (! $error) if (! $error)
{ {
$db->begin(); $db->begin();
@ -646,7 +646,7 @@ if ($id)
$act = new ActionComm($db); $act = new ActionComm($db);
$result=$act->fetch($id); $result=$act->fetch($id);
$act->fetch_optionals($id,$extralabels); $act->fetch_optionals($id,$extralabels);
if ($result < 0) if ($result < 0)
{ {
dol_print_error($db,$act->error); dol_print_error($db,$act->error);
@ -786,16 +786,19 @@ if ($id)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Company // Thirdparty - Contact
print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td>'; if ($conf->societe->enabled)
print '<td>'; {
print $form->select_company($act->societe->id,'socid','',1,1); print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td>';
print '</td>'; print '<td>';
print $form->select_company($act->societe->id,'socid','',1,1);
print '</td>';
// Contact // Contact
print '<td>'.$langs->trans("Contact").'</td><td width="30%">'; print '<td>'.$langs->trans("Contact").'</td><td width="30%">';
print $form->selectarray("contactid", (empty($act->societe->id)?array():$act->societe->contact_array()), $act->contact->id, 1); print $form->selectarray("contactid", (empty($act->societe->id)?array():$act->societe->contact_array()), $act->contact->id, 1);
print '</td></tr>'; print '</td></tr>';
}
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
@ -803,7 +806,7 @@ if ($id)
// Projet associe // Projet associe
$langs->load("project"); $langs->load("project");
print '<tr><td valign="top">'.$langs->trans("Project").'</td><td colspan="3">'; print '<tr><td width="30%" valign="top">'.$langs->trans("Project").'</td><td colspan="3">';
$numprojet=select_projects($act->societe->id,$act->fk_project,'projectid'); $numprojet=select_projects($act->societe->id,$act->fk_project,'projectid');
if ($numprojet==0) if ($numprojet==0)
{ {
@ -813,7 +816,7 @@ if ($id)
} }
// Priority // Priority
print '<tr><td nowrap>'.$langs->trans("Priority").'</td><td colspan="3">'; print '<tr><td nowrap width="30%">'.$langs->trans("Priority").'</td><td colspan="3">';
print '<input type="text" name="priority" value="'.($act->priority?$act->priority:'').'" size="5">'; print '<input type="text" name="priority" value="'.($act->priority?$act->priority:'').'" size="5">';
print '</td></tr>'; print '</td></tr>';
@ -835,7 +838,7 @@ if ($id)
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
print '</table>'; print '</table>';
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
@ -852,7 +855,7 @@ if ($id)
} }
print '</table><br><br>'; print '</table><br><br>';
} }
print '<center><br><input type="submit" class="button" name="edit" value="'.$langs->trans("Save").'">'; print '<center><br><input type="submit" class="button" name="edit" value="'.$langs->trans("Save").'">';
print ' &nbsp; &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; print ' &nbsp; &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
@ -958,39 +961,41 @@ if ($id)
print '</table><br><br><table class="border" width="100%">'; print '</table><br><br><table class="border" width="100%">';
// Third party - Contact // Third party - Contact
print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td><td>'.($act->societe->id?$act->societe->getNomUrl(1):$langs->trans("None")); if ($conf->societe->enabled)
if ($act->societe->id && $act->type_code == 'AC_TEL') {
{ print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td><td>'.($act->societe->id?$act->societe->getNomUrl(1):$langs->trans("None"));
if ($act->societe->fetch($act->societe->id)) if ($act->societe->id && $act->type_code == 'AC_TEL')
{ {
print "<br>".dol_print_phone($act->societe->tel); if ($act->societe->fetch($act->societe->id))
}
}
print '</td>';
print '<td>'.$langs->trans("Contact").'</td>';
print '<td>';
if ($act->contact->id > 0)
{
print $act->contact->getNomUrl(1);
if ($act->contact->id && $act->type_code == 'AC_TEL')
{
if ($act->contact->fetch($act->contact->id))
{ {
print "<br>".dol_print_phone($act->contact->phone_pro); print "<br>".dol_print_phone($act->societe->tel);
} }
} }
print '</td>';
print '<td>'.$langs->trans("Contact").'</td>';
print '<td>';
if ($act->contact->id > 0)
{
print $act->contact->getNomUrl(1);
if ($act->contact->id && $act->type_code == 'AC_TEL')
{
if ($act->contact->fetch($act->contact->id))
{
print "<br>".dol_print_phone($act->contact->phone_pro);
}
}
}
else
{
print $langs->trans("None");
}
print '</td></tr>';
} }
else
{
print $langs->trans("None");
}
print '</td></tr>';
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {
print '<tr><td valign="top">'.$langs->trans("Project").'</td><td colspan="3">'; print '<tr><td width="30%" valign="top">'.$langs->trans("Project").'</td><td colspan="3">';
if ($act->fk_project) if ($act->fk_project)
{ {
$project=new Project($db); $project=new Project($db);
@ -1001,7 +1006,7 @@ if ($id)
} }
// Priority // Priority
print '<tr><td nowrap>'.$langs->trans("Priority").'</td><td colspan="3">'; print '<tr><td nowrap width="30%">'.$langs->trans("Priority").'</td><td colspan="3">';
print ($act->priority?$act->priority:''); print ($act->priority?$act->priority:'');
print '</td></tr>'; print '</td></tr>';
@ -1022,10 +1027,10 @@ if ($id)
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
print '</table>'; print '</table>';
//Extra field //Extra field
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
print '<br><br><table class="border" width="100%">'; print '<br><br><table class="border" width="100%">';
foreach($extrafields->attribute_label as $key=>$label) foreach($extrafields->attribute_label as $key=>$label)
{ {

View File

@ -3317,15 +3317,21 @@ function migrate_mode_reglement($db,$langs,$conf)
$db->begin(); $db->begin();
$sqla = "UPDATE ".MAIN_DB_PREFIX."paiement SET ";
$sqla.= "fk_paiement = ".$elements['new_id'][$key];
$sqla.= " WHERE fk_paiement = ".$old_id;
$sqla.= " AND fk_paiement IN (SELECT id FROM ".MAIN_DB_PREFIX."c_paiement WHERE id = ".$old_id." AND code = '".$elements['code'][$key]."')";
$resqla = $db->query($sqla);
$sql = "UPDATE ".MAIN_DB_PREFIX."c_paiement SET "; $sql = "UPDATE ".MAIN_DB_PREFIX."c_paiement SET ";
$sql.= "id = ".$elements['new_id'][$key]; $sql.= "id = ".$elements['new_id'][$key];
$sql.= " WHERE id = ".$old_id; $sql.= " WHERE id = ".$old_id;
$sql.= " AND code = '".$elements['code'][$key]."'"; $sql.= " AND code = '".$elements['code'][$key]."'";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql)
if ($resqla && $resql)
{ {
foreach($elements['tables'] as $table) foreach($elements['tables'] as $table) // FIXME We must not update tables if oldid is not renamed
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET "; $sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET ";
$sql.= "fk_mode_reglement = ".$elements['new_id'][$key]; $sql.= "fk_mode_reglement = ".$elements['new_id'][$key];

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk> * Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk>
@ -1367,7 +1367,14 @@ else
if ($user->id <> $id && $candisableuser && if ($user->id <> $id && $candisableuser &&
(empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) (empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1)))
{ {
print '<a class="butActionDelete" href="fiche.php?action=delete&amp;id='.$object->id.'">'.$langs->trans("DeleteUser").'</a>'; if ($user->admin || ! $object->admin) // If user edited is admin, delete is possible on for an admin
{
print '<a class="butActionDelete" href="fiche.php?action=delete&amp;id='.$object->id.'">'.$langs->trans("DeleteUser").'</a>';
}
else
{
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("MustBeAdminToDeleteOtherAdmin")).'">'.$langs->trans("DeleteUser").'</a>';
}
} }
print "</div>\n"; print "</div>\n";