Skip to content

Commit

Permalink
Merge branch '3.1' of https://github.com/Dolibarr/dolibarr into 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Mar 27, 2012
2 parents c0ff123 + dec8309 commit e788e5d
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 38 deletions.
50 changes: 25 additions & 25 deletions htdocs/commande/class/commande.class.php
Expand Up @@ -700,35 +700,35 @@ function create($user, $notrigger=0)
{
$this->ref="(PROV".$this->id.")";

// Add linked object
// Add linked object and contacts
if ($this->origin && $this->origin_id)
{
$ret = $this->add_object_linked();
if (! $ret) dol_print_error($this->db);
}

// TODO mutualiser
if ($this->origin == 'propal' && $this->origin_id)
{
// On recupere les differents contact interne et externe
$prop = new Propal($this->db, $this->socid, $this->origin_id);

// On recupere le commercial suivi propale
$this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL');

if ($this->userid)
{
//On passe le commercial suivi propale en commercial suivi commande
$this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal');
}

// On recupere le contact client suivi propale
$this->contactid = $prop->getIdcontact('external', 'CUSTOMER');

if ($this->contactid)
{
//On passe le contact client suivi propale en contact client suivi commande
$this->add_contact($this->contactid[0], 'CUSTOMER', 'external');
// TODO mutualiser
if ($this->origin == 'propal')
{
// On recupere les differents contact interne et externe
$prop = new Propal($this->db, $this->socid, $this->origin_id);

// On recupere le commercial suivi propale
$this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL');

if ($this->userid)
{
//On passe le commercial suivi propale en commercial suivi commande
$this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal');
}

// On recupere le contact client suivi propale
$this->contactid = $prop->getIdcontact('external', 'CUSTOMER');

if ($this->contactid)
{
//On passe le contact client suivi propale en contact client suivi commande
$this->add_contact($this->contactid[0], 'CUSTOMER', 'external');
}
}
}
}
Expand Down
11 changes: 7 additions & 4 deletions htdocs/commande/fiche.php
Expand Up @@ -1190,6 +1190,9 @@
$remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;

$note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : ''));
$note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : '');

// Object source contacts list
$srccontactslist = $objectsrc->liste_contact(-1,'external',1);
Expand Down Expand Up @@ -1327,17 +1330,17 @@
print '<tr>';
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
print '<td valign="top" colspan="2">';
print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">';
print '</textarea></td></tr>';
print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_public.'</textarea>';
print '</td></tr>';

// Note privee
if (! $user->societe_id)
{
print '<tr>';
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
print '<td valign="top" colspan="2">';
print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">';
print '</textarea></td></tr>';
print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'</textarea>';
print '</td></tr>';
}

if (is_object($objectsrc))
Expand Down
11 changes: 8 additions & 3 deletions htdocs/compta/facture.php
Expand Up @@ -38,8 +38,12 @@
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php');
require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php");
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/lib/project.lib.php');
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php');
if ($conf->projet->enabled)
{
require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/project.lib.php');
}

$langs->load('bills');
//print 'ee'.$langs->trans('BillsCustomer');exit;
Expand Down Expand Up @@ -2286,7 +2290,8 @@
{
// Remise dispo de type avoir
if (! $absolute_discount) print '<br>';
$html->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer);
//$html->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer);
$html->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0); // We must allow credit not even if amount is higher
}
}
if (! $absolute_discount && ! $absolute_creditnote)
Expand Down
26 changes: 26 additions & 0 deletions htdocs/compta/facture/class/facture.class.php
Expand Up @@ -275,6 +275,32 @@ function create($user,$notrigger=0,$forceduedate=0)
dol_print_error($this->db);
$error++;
}

// TODO mutualiser
if ($this->origin == 'commande')
{
// On recupere les differents contact interne et externe
$order = new Commande($this->db);
$order->id = $this->origin_id;

// On recupere le commercial suivi propale
$this->userid = $order->getIdcontact('internal', 'SALESREPFOLL');

if ($this->userid)
{
//On passe le commercial suivi commande en commercial suivi paiement
$this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal');
}

// On recupere le contact client facturation commande
$this->contactid = $order->getIdcontact('external', 'BILLING');

if ($this->contactid)
{
//On passe le contact client facturation commande en contact client facturation
$this->add_contact($this->contactid[0], 'BILLING', 'external');
}
}
}

/*
Expand Down
2 changes: 1 addition & 1 deletion htdocs/fourn/commande/fiche.php
Expand Up @@ -1194,7 +1194,7 @@

print '</td>';
print '<td>';
print $html->load_tva('tva_tx',$line->tva_tx);
print $form->load_tva('tva_tx',$line->tva_tx,$soc,$mysoc);
print '</td>';
print '<td align="right"><input size="5" type="text" name="pu" value="'.price($line->subprice).'"></td>';
print '<td align="right"><input size="2" type="text" name="qty" value="'.$line->qty.'"></td>';
Expand Down
2 changes: 1 addition & 1 deletion htdocs/includes/modules/mailings/contacts3.modules.php
Expand Up @@ -82,7 +82,7 @@ function add_to_target($mailing_id,$filtersarray=array())
$sql.= " AND sp.entity = ".$conf->entity;
if ($filtersarray[0] <> 'all') $sql.= " AND cs.fk_categorie = c.rowid";
if ($filtersarray[0] <> 'all') $sql.= " AND cs.fk_societe = sp.fk_soc";
if ($filtersarray[0] <> 'all') $sql.= " AND c.label = '".$this->db>escape($filtersarray[0])."'";
if ($filtersarray[0] <> 'all') $sql.= " AND c.label = '".$this->db->escape($filtersarray[0])."'";
$sql.= " ORDER BY sp.name, sp.firstname";

$resql = $this->db->query($sql);
Expand Down
4 changes: 2 additions & 2 deletions htdocs/install/check.php
Expand Up @@ -394,8 +394,8 @@
$dolibarrversiontoarray=preg_split('/[\.-]/',$versionto);
$version=preg_split('/[\.-]/',DOL_VERSION);
$newversionfrombis='';
if (versioncompare($dolibarrversiontoarray,$version) < -2) $newversionfrombis='/'.$versionto;
print '<tr><td nowrap="nowrap" align="center"><b>'.$langs->trans("Upgrade").'<br>'.$newversionfrom.' -> '.$newversionto.'</b></td>';
if (versioncompare($dolibarrversiontoarray,$version) < -2) $newversionfrombis=' '.$langs->trans("or").' '.$versionto;
print '<tr><td nowrap="nowrap" align="center"><b>'.$langs->trans("Upgrade").'<br>'.$newversionfrom.$newversionfrombis.' -> '.$newversionto.'</b></td>';
print '<td>';
print $langs->trans("UpgradeDesc");
if ($ok)
Expand Down
4 changes: 2 additions & 2 deletions htdocs/user/perms.php
Expand Up @@ -45,14 +45,14 @@
{
$canreaduser=($user->admin || ($user->rights->user->user->lire && $user->rights->user->user_advance->readperms));
$caneditselfperms=($user->id == $id && $user->rights->user->self_advance->writeperms);
$caneditperms = '('.$caneditperms.' || '.$caneditselfperms.')';
$caneditperms = (($caneditperms || $caneditselfperms) ? 0 : 1);
}

// Security check
$socid=0;
if ($user->societe_id > 0) $socid = $user->societe_id;
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
if ($user->id == $id) // A user can always read its own card
if ($user->id == $id && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->user->self_advance->readperms)) // A user can always read its own card if not advanced perms enabled, or if he has advanced perms
{
$feature2='';
$canreaduser=1;
Expand Down

0 comments on commit e788e5d

Please sign in to comment.