diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index cc00e37ad79..fa035920386 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -700,35 +700,35 @@ class Commande extends CommonObject { $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'); + } } } } diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index dc737c250d2..ecab4b70747 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1190,6 +1190,9 @@ if ($action == 'create' && $user->rights->commande->creer) $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); @@ -1327,8 +1330,8 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print ''.$langs->trans('NotePublic').''; print ''; - print ''; + print ''; + print ''; // Note privee if (! $user->societe_id) @@ -1336,8 +1339,8 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print ''.$langs->trans('NotePrivate').''; print ''; - print ''; + print ''; + print ''; } if (is_object($objectsrc)) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 4711ecf7c60..545683caf25 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -38,8 +38,12 @@ require_once(DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'); 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; @@ -2286,7 +2290,8 @@ else { // Remise dispo de type avoir if (! $absolute_discount) print '
'; - $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) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f96490b1c81..06db0239c72 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -275,6 +275,32 @@ class Facture extends CommonObject 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'); + } + } } /* diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index e42fc5ab098..929321aff65 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -1194,7 +1194,7 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; - print $html->load_tva('tva_tx',$line->tva_tx); + print $form->load_tva('tva_tx',$line->tva_tx,$soc,$mysoc); print ''; print ''; print ''; diff --git a/htdocs/includes/modules/mailings/contacts3.modules.php b/htdocs/includes/modules/mailings/contacts3.modules.php index 813c8263ce2..a36083f293e 100755 --- a/htdocs/includes/modules/mailings/contacts3.modules.php +++ b/htdocs/includes/modules/mailings/contacts3.modules.php @@ -82,7 +82,7 @@ class mailing_contacts3 extends MailingTargets $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); diff --git a/htdocs/install/check.php b/htdocs/install/check.php index e774dbd3f5c..ec846c43404 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -394,8 +394,8 @@ else $dolibarrversiontoarray=preg_split('/[\.-]/',$versionto); $version=preg_split('/[\.-]/',DOL_VERSION); $newversionfrombis=''; - if (versioncompare($dolibarrversiontoarray,$version) < -2) $newversionfrombis='/'.$versionto; - print ''.$langs->trans("Upgrade").'
'.$newversionfrom.' -> '.$newversionto.'
'; + if (versioncompare($dolibarrversiontoarray,$version) < -2) $newversionfrombis=' '.$langs->trans("or").' '.$versionto; + print ''.$langs->trans("Upgrade").'
'.$newversionfrom.$newversionfrombis.' -> '.$newversionto.'
'; print ''; print $langs->trans("UpgradeDesc"); if ($ok) diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index adb16ebda79..94f01637c69 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -45,14 +45,14 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $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;