Qual: On renomme les champs proprits id socit de soc_id en socidp partout
This commit is contained in:
parent
c37521eea2
commit
4cd9a03b93
@ -117,7 +117,7 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++)
|
||||
print "Commande $s";
|
||||
$com = new Commande($db);
|
||||
|
||||
$com->soc_id = 4;
|
||||
$com->socidp = 4;
|
||||
$com->date_commande = $dates[rand(1, sizeof($dates)-1)];
|
||||
$com->note = $_POST["note"];
|
||||
$com->source = 1;
|
||||
|
||||
@ -58,10 +58,10 @@ class Cotisation
|
||||
/*!
|
||||
\brief Cotisation
|
||||
\param DB base de données
|
||||
\param soc_idp
|
||||
\param socidp
|
||||
*/
|
||||
|
||||
function Cotisation($DB, $soc_idp="")
|
||||
function Cotisation($DB, $socidp="")
|
||||
{
|
||||
$this->db = $DB ;
|
||||
$this->modepaiementid = 0;
|
||||
|
||||
@ -62,8 +62,8 @@ $socidp='';
|
||||
if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; }
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socidp = $user->societe_id;
|
||||
$action = '';
|
||||
$socidp = $user->societe_id;
|
||||
}
|
||||
|
||||
// Nombre de ligne pour choix de produit/service prédéfinis
|
||||
@ -211,7 +211,7 @@ if ($_POST['action'] == 'add')
|
||||
|
||||
$propal->ref = $_POST['ref'];
|
||||
|
||||
for ($i = 1 ; $i <= PROPALE_NEW_FORM_NB_PRODUCT ; $i++)
|
||||
for ($i = 1 ; $i <= $conf->global->PROPALE_NEW_FORM_NB_PRODUCT ; $i++)
|
||||
{
|
||||
if ($_POST['idprod'.$i])
|
||||
{
|
||||
@ -227,10 +227,25 @@ if ($_POST['action'] == 'add')
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
// Insertion contact par defaut
|
||||
$result=$propal->add_contact($_POST["contactidp"],'CUSTOMER','external');
|
||||
$error=0;
|
||||
|
||||
if ($result > 0)
|
||||
// Insertion contact par defaut si défini
|
||||
if ($_POST["contactidp"])
|
||||
{
|
||||
$result=$propal->add_contact($_POST["contactidp"],'CUSTOMER','external');
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$error=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = '<div class="error">'.$langs->trans("ErrorFailedToAddContact").'</div>';
|
||||
$error=1;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
|
||||
@ -241,13 +256,12 @@ if ($_POST['action'] == 'add')
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
propale_pdf_create($db, $id, $_POST['model'], $outputlangs);
|
||||
|
||||
dolibarr_syslog('Redirect to '.$_SERVER["PHP_SELF"].'?propalid='.$id);
|
||||
Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = '<div class="error">'.$langs->trans("ErrorFailedToAddContact").'</div>';
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
@ -611,6 +625,8 @@ if ($_GET['action'] == 'down' && $user->rights->propale->creer)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
$html = new Form($db);
|
||||
@ -624,10 +640,16 @@ if ($_GET['propalid'] > 0)
|
||||
if ($msg) print "$msg<br>";
|
||||
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET['propalid']);
|
||||
|
||||
$result=$propal->fetch($_GET['propalid']);
|
||||
if (! $result > 0)
|
||||
{
|
||||
dolibarr_print_error($db,$propal->error);
|
||||
exit;
|
||||
}
|
||||
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($propal->soc_id);
|
||||
$societe->fetch($propal->socidp);
|
||||
|
||||
$head = propal_prepare_head($propal);
|
||||
dolibarr_fiche_head($head, 'comm', $langs->trans('Proposal'));
|
||||
|
||||
@ -68,7 +68,7 @@ if ($_GET["propalid"])
|
||||
$propal->fetch($_GET["propalid"]);
|
||||
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($propal->soc_id);
|
||||
$societe->fetch($propal->socidp);
|
||||
|
||||
$head[0][0] = DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id;
|
||||
$head[0][1] = "Proposition commerciale : $propal->ref";
|
||||
|
||||
@ -220,8 +220,8 @@ if ($id > 0)
|
||||
$propal = New Propal($db);
|
||||
if ( $propal->fetch($_GET['propalid'], $user->societe_id) > 0)
|
||||
{
|
||||
$soc = new Societe($db, $propal->soc_id);
|
||||
$soc->fetch($propal->soc_id);
|
||||
$soc = new Societe($db, $propal->socidp);
|
||||
$soc->fetch($propal->socidp);
|
||||
|
||||
|
||||
$head = propal_prepare_head($propal);
|
||||
|
||||
@ -56,7 +56,7 @@ $propal = new Propal($db);
|
||||
$propal->fetch($_GET['propalid']);
|
||||
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($propal->soc_id);
|
||||
$societe->fetch($propal->socidp);
|
||||
|
||||
$head = propal_prepare_head($propal);
|
||||
dolibarr_fiche_head($head, 'info', $langs->trans('Proposal'));
|
||||
|
||||
@ -109,7 +109,7 @@ if ($_GET['propalid'])
|
||||
if ( $propal->fetch($_GET['propalid']) )
|
||||
{
|
||||
$societe = new Societe($db);
|
||||
if ( $societe->fetch($propal->soc_id) )
|
||||
if ( $societe->fetch($propal->socidp) )
|
||||
{
|
||||
$head = propal_prepare_head($propal);
|
||||
dolibarr_fiche_head($head, 'note', $langs->trans('Proposal'));
|
||||
|
||||
@ -69,12 +69,12 @@ class Commande extends CommonObject
|
||||
* \brief Constructeur
|
||||
* \param DB Handler d'accès base
|
||||
*/
|
||||
function Commande($DB, $soc_idp="", $commandeid=0)
|
||||
function Commande($DB, $socidp="", $commandeid=0)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load('orders');
|
||||
$this->db = $DB;
|
||||
$this->socidp = $soc_idp;
|
||||
$this->socidp = $socidp;
|
||||
$this->id = $commandeid;
|
||||
|
||||
$this->sources[0] = $langs->trans('OrderSource0');
|
||||
@ -98,12 +98,13 @@ class Commande extends CommonObject
|
||||
{
|
||||
$propal = new Propal($this->db);
|
||||
$propal->fetch($propale_id);
|
||||
|
||||
$this->lines = array();
|
||||
$this->date_commande = time();
|
||||
$this->source = 0;
|
||||
for ($i = 0 ; $i < sizeof($propal->lignes) ; $i++)
|
||||
{
|
||||
$CommLigne = new CommandeLigne();
|
||||
$CommLigne = new CommandeLigne($this->db);
|
||||
$CommLigne->libelle = $propal->lignes[$i]->libelle;
|
||||
$CommLigne->description = $propal->lignes[$i]->desc;
|
||||
$CommLigne->price = $propal->lignes[$i]->subprice;
|
||||
@ -113,9 +114,15 @@ class Commande extends CommonObject
|
||||
$CommLigne->remise_percent = $propal->lignes[$i]->remise_percent;
|
||||
$CommLigne->product_id = $propal->lignes[$i]->product_id;
|
||||
$this->lines[$i] = $CommLigne;
|
||||
|
||||
// \todo La methode create doit utiliser le tableau products plutot que lines
|
||||
// ce qui permettrait de virer ces lignes
|
||||
$this->products[$i]=$propal->lignes[$i]->product_id;
|
||||
$this->products_qty[$i]=$propal->lignes[$i]->qty;
|
||||
$this->products_remise_percent[$i]=$propal->lignes[$i]->remise_percent;
|
||||
}
|
||||
|
||||
$this->soc_id = $propal->soc_id;
|
||||
$this->socidp = $propal->socidp;
|
||||
$this->projetid = $propal->projetidp;
|
||||
$this->cond_reglement_id = $propal->cond_reglement_id;
|
||||
$this->mode_reglement_id = $propal->mode_reglement_id;
|
||||
@ -126,7 +133,7 @@ class Commande extends CommonObject
|
||||
|
||||
/* Définit la société comme un client */
|
||||
$soc = new Societe($this->db);
|
||||
$soc->id = $this->soc_id;
|
||||
$soc->id = $this->socidp;
|
||||
$soc->set_as_client();
|
||||
$this->propale_id = $propal->id;
|
||||
|
||||
@ -160,7 +167,7 @@ class Commande extends CommonObject
|
||||
// Recuperation de la nouvelle reference
|
||||
$objMod = new $modName($this->db);
|
||||
$soc = new Societe($this->db);
|
||||
$soc->fetch($this->soc_id);
|
||||
$soc->fetch($this->socidp);
|
||||
|
||||
// on vérifie si la commande est en numérotation provisoire
|
||||
$comref = substr($this->ref, 1, 4);
|
||||
@ -335,28 +342,28 @@ class Commande extends CommonObject
|
||||
if ($this->source < 0)
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Source"));
|
||||
dolibarr_syslog("Commande.class.php::create ".$this->error);
|
||||
dolibarr_syslog("Commande.class.php::create ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
if (! $remise) $remise=0;
|
||||
if (! $this->projetid) $this->projetid = 0;
|
||||
|
||||
$soc = new Societe($this->db);
|
||||
$result=$soc->fetch($this->soc_id);
|
||||
$result=$soc->fetch($this->socidp);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error="Failed to fetch company";
|
||||
dolibarr_syslog("Commande.class.php::create ".$this->error);
|
||||
dolibarr_syslog("Commande.class.php::create ".$this->error, LOG_ERR);
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commande (';
|
||||
$sql.= 'fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note, ref_client,';
|
||||
$sql.= ' model_pdf, fk_cond_reglement, fk_mode_reglement, date_livraison, fk_adresse_livraison,';
|
||||
$sql.= ' remise_absolue, remise_percent)';
|
||||
$sql.= ' VALUES ('.$this->soc_id.', now(), '.$user->id.', '.$this->projetid.',';
|
||||
$sql.= ' VALUES ('.$this->socidp.', now(), '.$user->id.', '.$this->projetid.',';
|
||||
$sql.= ' '.$this->db->idate($this->date_commande).',';
|
||||
$sql.= ' '.$this->source.', ';
|
||||
$sql.= " '".addslashes($this->note)."', ";
|
||||
@ -737,7 +744,6 @@ class Commande extends CommonObject
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->ref;
|
||||
$this->ref_client = $obj->ref_client;
|
||||
$this->soc_id = $obj->fk_soc;
|
||||
$this->socidp = $obj->fk_soc;
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
|
||||
@ -220,8 +220,8 @@ if ($id > 0)
|
||||
$commande = New Commande($db);
|
||||
if ( $commande->fetch($_GET['id'], $user->societe_id) > 0)
|
||||
{
|
||||
$soc = new Societe($db, $commande->soc_id);
|
||||
$soc->fetch($commande->soc_id);
|
||||
$soc = new Societe($db, $commande->socidp);
|
||||
$soc->fetch($commande->socidp);
|
||||
|
||||
|
||||
$head = commande_prepare_head($commande);
|
||||
|
||||
@ -89,7 +89,7 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
|
||||
|
||||
$commande = new Commande($db);
|
||||
|
||||
$commande->soc_id = $_POST['soc_id'];
|
||||
$commande->socidp = $_POST['socidp'];
|
||||
$commande->date_commande = $datecommande;
|
||||
$commande->note = $_POST['note'];
|
||||
$commande->source = $_POST['source_id'];
|
||||
@ -117,7 +117,7 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
|
||||
if ($commande_id <= 0)
|
||||
{
|
||||
$_GET['action']='create';
|
||||
$_GET['socidp']=$_POST['soc_id'];
|
||||
$_GET['socidp']=$_POST['socidp'];
|
||||
$mesg='<div class="error">'.$commande->error.'</div>';
|
||||
}
|
||||
else
|
||||
@ -322,7 +322,7 @@ if ($_POST['action'] == 'confirm_valid' && $_POST['confirm'] == 'yes' && $user->
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($_GET['id']);
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($commande->soc_id);
|
||||
$soc->fetch($commande->socidp);
|
||||
$result = $commande->valid($user);
|
||||
}
|
||||
|
||||
@ -447,7 +447,7 @@ if ($_POST['action'] == 'send')
|
||||
$file = $conf->commande->dir_output . '/' . $orderref . '/' . $orderref . '.pdf';
|
||||
if (is_readable($file))
|
||||
{
|
||||
$soc = new Societe($db, $commande->soc_id);
|
||||
$soc = new Societe($db, $commande->socidp);
|
||||
if ($_POST['sendto'])
|
||||
{
|
||||
// Le destinataire a été fourni via le champ libre
|
||||
@ -512,7 +512,7 @@ if ($_POST['action'] == 'send')
|
||||
$actioncomm->date = time(); // L'action est faite maintenant
|
||||
$actioncomm->percent = 100;
|
||||
$actioncomm->contact = new Contact($db,$sendtoid);
|
||||
$actioncomm->societe = new Societe($db,$commande->soc_id);
|
||||
$actioncomm->societe = new Societe($db,$commande->socidp);
|
||||
$actioncomm->user = $user; // User qui a fait l'action
|
||||
$actioncomm->orderrowid = $commande->id;
|
||||
$ret=$actioncomm->add($user); // User qui saisi l'action
|
||||
@ -596,7 +596,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
|
||||
|
||||
print '<form name="crea_commande" action="fiche.php" method="post">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="soc_id" value="'.$soc->id.'">' ."\n";
|
||||
print '<input type="hidden" name="socidp" value="'.$soc->id.'">' ."\n";
|
||||
print '<input type="hidden" name="remise_percent" value="'.$soc->remise_client.'">';
|
||||
print '<input name="facnumber" type="hidden" value="provisoire">';
|
||||
|
||||
@ -865,7 +865,7 @@ else
|
||||
if ( $commande->fetch($_GET['id']) > 0)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($commande->soc_id);
|
||||
$soc->fetch($commande->socidp);
|
||||
|
||||
$author = new User($db);
|
||||
$author->id = $commande->user_author_id;
|
||||
@ -1022,7 +1022,7 @@ else
|
||||
print $langs->trans('DeliveryAddress');
|
||||
print '</td>';
|
||||
|
||||
if ($_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_adress&socid='.$commande->soc_id.'&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'</a></td>';
|
||||
if ($_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_adress&socid='.$commande->socidp.'&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="2">';
|
||||
|
||||
@ -1084,11 +1084,11 @@ else
|
||||
print '</td><td colspan="2">';
|
||||
if ($_GET['action'] == 'classer')
|
||||
{
|
||||
$html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->soc_id, $commande->projet_id, 'projetid');
|
||||
$html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socidp, $commande->projet_id, 'projetid');
|
||||
}
|
||||
else
|
||||
{
|
||||
$html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->soc_id, $commande->projet_id, 'none');
|
||||
$html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socidp, $commande->projet_id, 'none');
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1734,7 +1734,7 @@ else
|
||||
print_titre($langs->trans('SendOrderByMail'));
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($commande->soc_id);
|
||||
$soc->fetch($commande->socidp);
|
||||
|
||||
$liste[0]=" ";
|
||||
foreach ($soc->contact_email_array() as $key=>$value)
|
||||
|
||||
@ -49,8 +49,8 @@ llxHeader();
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($_GET["id"]);
|
||||
$commande->info($_GET["id"]);
|
||||
$soc = new Societe($db, $commande->soc_id);
|
||||
$soc->fetch($commande->soc_id);
|
||||
$soc = new Societe($db, $commande->socidp);
|
||||
$soc->fetch($commande->socidp);
|
||||
|
||||
$head = commande_prepare_head($commande);
|
||||
dolibarr_fiche_head($head, 'info', $langs->trans("CustomerOrder"));
|
||||
|
||||
@ -21,26 +21,27 @@
|
||||
|
||||
class CompanyBankAccount
|
||||
{
|
||||
var $rowid;
|
||||
|
||||
var $bank;
|
||||
var $courant;
|
||||
var $clos;
|
||||
var $code_banque;
|
||||
var $code_guichet;
|
||||
var $number;
|
||||
var $cle_rib;
|
||||
var $bic;
|
||||
var $iban_prefix;
|
||||
var $proprio;
|
||||
var $adresse_proprio;
|
||||
|
||||
function CompanyBankAccount($DB, $soc_id)
|
||||
{
|
||||
var $rowid;
|
||||
var $socidp;
|
||||
|
||||
var $bank;
|
||||
var $courant;
|
||||
var $clos;
|
||||
var $code_banque;
|
||||
var $code_guichet;
|
||||
var $number;
|
||||
var $cle_rib;
|
||||
var $bic;
|
||||
var $iban_prefix;
|
||||
var $proprio;
|
||||
var $adresse_proprio;
|
||||
|
||||
function CompanyBankAccount($DB, $socid)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$this->db = $DB;
|
||||
$this->soc_id = $soc_id;
|
||||
$this->socidp = $socid;
|
||||
|
||||
$this->clos = 0;
|
||||
$this->solde = 0;
|
||||
@ -55,8 +56,7 @@ class CompanyBankAccount
|
||||
*/
|
||||
function create()
|
||||
{
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->soc_id, now());";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->socidp, now());";
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if ($this->db->affected_rows())
|
||||
@ -79,7 +79,7 @@ class CompanyBankAccount
|
||||
{
|
||||
|
||||
$sql = "SELECT fk_soc FROM ".MAIN_DB_PREFIX."societe_rib ";
|
||||
$sql .= " WHERE fk_soc = ".$this->soc_id;
|
||||
$sql .= " WHERE fk_soc = ".$this->socidp;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
@ -116,7 +116,7 @@ class CompanyBankAccount
|
||||
$sql .= ",proprio = '".addslashes($this->proprio)."'";
|
||||
$sql .= ",adresse_proprio = '".addslashes($this->adresse_proprio)."'";
|
||||
|
||||
$sql .= " WHERE fk_soc = ".$this->soc_id;
|
||||
$sql .= " WHERE fk_soc = ".$this->socidp;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
@ -139,7 +139,7 @@ class CompanyBankAccount
|
||||
{
|
||||
|
||||
$sql = "SELECT rowid, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix, domiciliation, proprio, adresse_proprio FROM ".MAIN_DB_PREFIX."societe_rib";
|
||||
$sql .= " WHERE fk_soc = ".$this->soc_id;
|
||||
$sql .= " WHERE fk_soc = ".$this->socidp;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ if ($_GET["id"] > 0)
|
||||
if ( $commande->fetch($_GET["id"]) > 0)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($commande->soc_id);
|
||||
$soc->fetch($commande->socidp);
|
||||
$author = new User($db);
|
||||
$author->id = $commande->user_author_id;
|
||||
$author->fetch();
|
||||
@ -189,7 +189,7 @@ if ($_GET["id"] > 0)
|
||||
print $langs->trans('DeliveryAddress');
|
||||
print '</td>';
|
||||
|
||||
if (1 == 2 && $_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_adress&socid='.$commande->soc_id.'&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'</a></td>';
|
||||
if (1 == 2 && $_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_adress&socid='.$commande->socidp.'&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="2">';
|
||||
|
||||
@ -251,11 +251,11 @@ if ($_GET["id"] > 0)
|
||||
print '</td><td colspan="2">';
|
||||
if ($_GET['action'] == 'classer')
|
||||
{
|
||||
$html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->soc_id, $commande->projet_id, 'projetid');
|
||||
$html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socidp, $commande->projet_id, 'projetid');
|
||||
}
|
||||
else
|
||||
{
|
||||
$html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->soc_id, $commande->projet_id, 'none');
|
||||
$html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socidp, $commande->projet_id, 'none');
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -500,7 +500,7 @@ if ($_GET["id"] > 0)
|
||||
|
||||
if ($commande->statut > 0 && $user->rights->facture->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&commandeid='.$commande->id.'&socidp='.$commande->soc_id.'">'.$langs->trans("CreateBill").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&commandeid='.$commande->id.'&socidp='.$commande->socidp.'">'.$langs->trans("CreateBill").'</a>';
|
||||
}
|
||||
|
||||
if ($commande->statut > 0 && $user->rights->commande->creer)
|
||||
|
||||
@ -55,7 +55,7 @@ if ($_POST["action"] == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
|
||||
$_POST["reyear"]);
|
||||
|
||||
$deplacement->km = $_POST["km"];
|
||||
$deplacement->socid = $_POST["soc_id"];
|
||||
$deplacement->socidp = $_POST["socidp"];
|
||||
$deplacement->userid = $user->id; //$_POST["km"];
|
||||
$id = $deplacement->create($user);
|
||||
|
||||
|
||||
@ -748,7 +748,7 @@ if ($_GET['action'] == 'create')
|
||||
{
|
||||
$propal = New Propal($db);
|
||||
$propal->fetch($_GET['propalid']);
|
||||
$societe_id = $propal->soc_id;
|
||||
$societe_id = $propal->socidp;
|
||||
$projetid=$propal->projetidp;
|
||||
|
||||
$soc->fetch($societe_id);
|
||||
@ -761,7 +761,7 @@ if ($_GET['action'] == 'create')
|
||||
{
|
||||
$commande = New Commande($db);
|
||||
$commande->fetch($_GET['commandeid']);
|
||||
$societe_id = $commande->soc_id;
|
||||
$societe_id = $commande->socidp;
|
||||
$projetid=$commande-> projet_id;
|
||||
$ref_client=$commande->ref_client;
|
||||
|
||||
|
||||
@ -124,7 +124,7 @@ if ($_GET["propalid"] > 0)
|
||||
$propal->fetch($_GET['propalid']);
|
||||
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($propal->soc_id);
|
||||
$societe->fetch($propal->socidp);
|
||||
|
||||
$head = propal_prepare_head($propal);
|
||||
dolibarr_fiche_head($head, 'compta', $langs->trans('Proposal'));
|
||||
|
||||
@ -43,10 +43,11 @@ class Contrat extends CommonObject
|
||||
|
||||
var $id;
|
||||
var $ref;
|
||||
var $product;
|
||||
|
||||
var $socidp;
|
||||
var $societe; // Objet societe
|
||||
|
||||
var $product;
|
||||
|
||||
var $user_author;
|
||||
var $user_service;
|
||||
var $user_cloture;
|
||||
@ -301,6 +302,7 @@ class Contrat extends CommonObject
|
||||
|
||||
$this->fk_projet = $result["fk_projet"];
|
||||
|
||||
$this->socidp = $result["fk_soc"];
|
||||
$this->societe->fetch($result["fk_soc"]);
|
||||
|
||||
$this->db->free($resql);
|
||||
@ -466,7 +468,7 @@ class Contrat extends CommonObject
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat";
|
||||
// $sql.= ", fk_commercial_signature, fk_commercial_suivi";
|
||||
$sql.= " , ref)";
|
||||
$sql.= " VALUES (now(),".$this->soc_id.",".$user->id;
|
||||
$sql.= " VALUES (now(),".$this->socidp.",".$user->id;
|
||||
$sql.= ",".$this->db->idate($this->date_contrat);
|
||||
// $sql.= ",".($this->commercial_signature_id>=0?$this->commercial_signature_id:"null");
|
||||
// $sql.= ",".($this->commercial_suivi_id>=0?$this->commercial_suivi_id:"null");
|
||||
|
||||
@ -134,7 +134,7 @@ if ($_POST["action"] == 'add')
|
||||
|
||||
$contrat = new Contrat($db);
|
||||
|
||||
$contrat->soc_id = $_POST["soc_id"];
|
||||
$contrat->socidp = $_POST["socidp"];
|
||||
$contrat->date_contrat = $datecontrat;
|
||||
|
||||
$contrat->commercial_suivi_id = $_POST["commercial_suivi_id"];
|
||||
@ -154,7 +154,7 @@ if ($_POST["action"] == 'add')
|
||||
else {
|
||||
$mesg='<div class="error">'.$contrat->error.'</div>';
|
||||
}
|
||||
$_GET["socid"]=$_POST["soc_id"];
|
||||
$_GET["socid"]=$_POST["socidp"];
|
||||
$_GET["action"]='create';
|
||||
$action = '';
|
||||
}
|
||||
@ -330,7 +330,7 @@ if ($_GET["action"] == 'create')
|
||||
print '<form name="contrat" action="fiche.php" method="post">';
|
||||
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="soc_id" value="'.$soc->id.'">'."\n";
|
||||
print '<input type="hidden" name="socidp" value="'.$soc->id.'">'."\n";
|
||||
print '<input type="hidden" name="remise_percent" value="0">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -59,10 +59,10 @@ class Don
|
||||
|
||||
/**
|
||||
* \brief Constructeur
|
||||
* \param DB handler d'accès base
|
||||
* \param soc_idp id sociét
|
||||
* \param DB Handler d'accès base
|
||||
* \param socidp Id société
|
||||
*/
|
||||
function Don($DB, $soc_idp="")
|
||||
function Don($DB, $socidp="")
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
||||
@ -87,7 +87,7 @@ if ($_GET["id"] > 0)
|
||||
$commande->expedition_array(1);
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($commande->soc_id);
|
||||
$soc->fetch($commande->socidp);
|
||||
$author = new User($db);
|
||||
$author->id = $commande->user_author_id;
|
||||
$author->fetch();
|
||||
@ -204,7 +204,7 @@ if ($_GET["id"] > 0)
|
||||
print $langs->trans('DeliveryAddress');
|
||||
print '</td>';
|
||||
|
||||
if ($_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_adress&socid='.$commande->soc_id.'&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'</a></td>';
|
||||
if ($_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_adress&socid='.$commande->socidp.'&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="2">';
|
||||
|
||||
@ -266,11 +266,11 @@ if ($_GET["id"] > 0)
|
||||
print '</td><td colspan="2">';
|
||||
if ($_GET['action'] == 'classer')
|
||||
{
|
||||
$html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->soc_id, $commande->projet_id, 'projetid');
|
||||
$html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socidp, $commande->projet_id, 'projetid');
|
||||
}
|
||||
else
|
||||
{
|
||||
$html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->soc_id, $commande->projet_id, 'none');
|
||||
$html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socidp, $commande->projet_id, 'none');
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ if ($_GET["action"] == 'create')
|
||||
if ( $commande->fetch($_GET["commande_id"]))
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($commande->soc_id);
|
||||
$soc->fetch($commande->socidp);
|
||||
$author = new User($db);
|
||||
$author->id = $commande->user_author_id;
|
||||
$author->fetch();
|
||||
@ -348,7 +348,7 @@ else
|
||||
$commande->fetch($expedition->commande_id);
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($commande->soc_id);
|
||||
$soc->fetch($commande->socidp);
|
||||
|
||||
$h=0;
|
||||
$head[$h][0] = DOL_URL_ROOT."/expedition/fiche.php?id=".$expedition->id;
|
||||
@ -649,7 +649,7 @@ else
|
||||
*/
|
||||
$sql = "SELECT ".$db->pdate("a.datea")." as da, a.note";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql .= " WHERE a.fk_soc = ".$commande->soc_id." AND a.fk_action in (9,10)";
|
||||
$sql .= " WHERE a.fk_soc = ".$commande->socidp." AND a.fk_action in (9,10)";
|
||||
$sql .= " AND a.fk_commande = ".$expedition->id;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
@ -65,7 +65,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
||||
$this->expe->fetch_commande();
|
||||
//Creation du Client
|
||||
$soc = new Societe($this->db);
|
||||
$soc->fetch($this->expe->commande->soc_id);
|
||||
$soc->fetch($this->expe->commande->socidp);
|
||||
//Creation de l expediteur
|
||||
$this->expediteur = $soc;
|
||||
//Creation du destinataire
|
||||
|
||||
@ -80,16 +80,16 @@ class Facture extends CommonObject
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
* \param DB handler accès base de données
|
||||
* \param soc_idp id societe ('' par defaut)
|
||||
* \param facid id facture ('' par defaut)
|
||||
* \param DB handler accès base de données
|
||||
* \param socidp id societe ('' par defaut)
|
||||
* \param facid id facture ('' par defaut)
|
||||
*/
|
||||
function Facture($DB, $soc_idp='', $facid='')
|
||||
function Facture($DB, $socidp='', $facid='')
|
||||
{
|
||||
$this->db = $DB ;
|
||||
|
||||
$this->id = $facid;
|
||||
$this->socidp = $soc_idp;
|
||||
$this->socidp = $socidp;
|
||||
|
||||
$this->amount = 0;
|
||||
$this->remise = 0;
|
||||
|
||||
@ -50,14 +50,14 @@ class Fichinter extends CommonObject
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
* \param DB Handler accès base de données
|
||||
* \param soc_idp Id societe
|
||||
* \param socidp Id societe
|
||||
*/
|
||||
function Fichinter($DB, $soc_idp="")
|
||||
function Fichinter($DB, $socidp="")
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$this->db = $DB ;
|
||||
$this->socidp = $soc_idp;
|
||||
$this->socidp = $socidp;
|
||||
$this->products = array();
|
||||
$this->projet_id = 0;
|
||||
|
||||
|
||||
@ -132,7 +132,7 @@ if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == 'yes' && $user->
|
||||
$commande = new CommandeFournisseur($db);
|
||||
$commande->fetch($_GET["id"]);
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($commande->soc_id);
|
||||
$soc->fetch($commande->socidp);
|
||||
$result = $commande->valid($user);
|
||||
Header("Location: fiche.php?id=".$_GET["id"]);
|
||||
exit;
|
||||
@ -263,7 +263,7 @@ if ($_GET["id"] > 0)
|
||||
if ( $commande->fetch($_GET["id"]) == 0)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($commande->soc_id);
|
||||
$soc->fetch($commande->socidp);
|
||||
$author = new User($db);
|
||||
$author->id = $commande->user_author_id;
|
||||
$author->fetch();
|
||||
@ -633,7 +633,7 @@ if ($_GET["id"] > 0)
|
||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||
|
||||
$proj = new Project($db);
|
||||
$html->select_array("projetid",$proj->liste_array($commande->soc_id));
|
||||
$html->select_array("projetid",$proj->liste_array($commande->socidp));
|
||||
|
||||
print "</td></tr>";
|
||||
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Send").'"></td></tr></table></form>';
|
||||
|
||||
@ -51,7 +51,7 @@ if ($_GET["id"] > 0)
|
||||
|
||||
if ( $commande->fetch($_GET["id"]) == 0)
|
||||
{
|
||||
$soc->fetch($commande->soc_id);
|
||||
$soc->fetch($commande->socidp);
|
||||
|
||||
$addons[0][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id;
|
||||
$addons[0][1] = $soc->nom;
|
||||
|
||||
@ -190,7 +190,7 @@ function commande_supplier_delete_preview($db, $propalid)
|
||||
$comfourn = new CommandeFournisseur($db,"",$propalid);
|
||||
$comfourn->fetch($propalid);
|
||||
$client = new Societe($db);
|
||||
$client->fetch($comfourn->soc_id);
|
||||
$client->fetch($comfourn->socidp);
|
||||
|
||||
if ($conf->fournisseur->commande->dir_output)
|
||||
{
|
||||
|
||||
@ -728,7 +728,7 @@ class pdf_muscadet extends ModelePDFCommandesSuppliers
|
||||
$pdf->MultiCell(80,5, $langs->trans("BillTo").":");
|
||||
//
|
||||
$client = new Societe($this->db);
|
||||
$client->fetch($com->soc_id);
|
||||
$client->fetch($com->socidp);
|
||||
$com->client = $client;
|
||||
//
|
||||
|
||||
|
||||
@ -73,7 +73,7 @@ if ($_GET["id"] > 0)
|
||||
if ( $commande->fetch($_GET["id"]) == 0)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($commande->soc_id);
|
||||
$soc->fetch($commande->socidp);
|
||||
$author = new User($db);
|
||||
$author->id = $commande->user_author_id;
|
||||
$author->fetch();
|
||||
|
||||
@ -114,7 +114,7 @@ class Fournisseur extends Societe
|
||||
{
|
||||
dolibarr_syslog("Fournisseur::Create_Commande");
|
||||
$comm = new CommandeFournisseur($this->db);
|
||||
$comm->soc_id = $this->id;
|
||||
$comm->socidp = $this->id;
|
||||
|
||||
if ($comm->create($user) > 0)
|
||||
{
|
||||
|
||||
@ -82,7 +82,7 @@ class CommandeFournisseur extends Commande
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->ref;
|
||||
$this->soc_id = $obj->fk_soc;
|
||||
$this->socidp = $obj->fk_soc;
|
||||
$this->fourn_id = $obj->fk_soc;
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
@ -202,7 +202,7 @@ class CommandeFournisseur extends Commande
|
||||
// Recuperation de la nouvelle reference
|
||||
$objMod = new $modName($this->db);
|
||||
$soc = new Societe($this->db);
|
||||
$soc->fetch($this->soc_id);
|
||||
$soc->fetch($this->socidp);
|
||||
$num = $objMod->commande_get_num($soc);
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande_fournisseur SET ref='$num', fk_statut = 1, date_valid=now(), fk_user_valid=$user->id";
|
||||
@ -539,7 +539,7 @@ class CommandeFournisseur extends Commande
|
||||
*/
|
||||
function create($user)
|
||||
{
|
||||
dolibarr_syslog("CommandeFournisseur::Create soc id=".$this->soc_id);
|
||||
dolibarr_syslog("CommandeFournisseur::Create soc id=".$this->socidp);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -547,7 +547,7 @@ class CommandeFournisseur extends Commande
|
||||
$this->brouillon = 1;
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur (fk_soc, date_creation, fk_user_author, fk_statut) ";
|
||||
$sql .= " VALUES (".$this->soc_id.", now(), ".$user->id.",0)";
|
||||
$sql .= " VALUES (".$this->socidp.", now(), ".$user->id.",0)";
|
||||
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
|
||||
@ -62,14 +62,14 @@ class FactureFournisseur extends Facture
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
* \param DB handler accès base de données
|
||||
* \param soc_idp id societe ('' par defaut)
|
||||
* \param facid id facture ('' par defaut)
|
||||
* \param DB Handler accès base de données
|
||||
* \param socidp Id societe ('' par defaut)
|
||||
* \param facid Id facture ('' par defaut)
|
||||
*/
|
||||
function FactureFournisseur($DB, $soc_idp='', $facid='')
|
||||
function FactureFournisseur($DB, $socidp='', $facid='')
|
||||
{
|
||||
$this->db = $DB ;
|
||||
$this->socidp = $soc_idp;
|
||||
$this->socidp = $socidp;
|
||||
$this->products = array();
|
||||
$this->amount = 0;
|
||||
$this->remise = 0;
|
||||
|
||||
@ -307,7 +307,7 @@ class pdf_edison extends ModelePDFCommandes
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','B',12);
|
||||
$client = new Societe($this->db);
|
||||
$client->fetch($com->soc_id);
|
||||
$client->fetch($com->socidp);
|
||||
$com->client = $client;
|
||||
$pdf->SetXY(102,42);
|
||||
$pdf->MultiCell(96,5, $com->client->nom);
|
||||
|
||||
@ -726,7 +726,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$pdf->MultiCell(80,5, $langs->trans("BillTo").":");
|
||||
//
|
||||
$client = new Societe($this->db);
|
||||
$client->fetch($com->soc_id);
|
||||
$client->fetch($com->socidp);
|
||||
$com->client = $client;
|
||||
//
|
||||
|
||||
|
||||
@ -188,7 +188,7 @@ class modFacture extends DolibarrModules
|
||||
$this->export_label[$r]='Factures clients et lignes de facture';
|
||||
$this->export_fields_array[$r]=array('s.idp'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','f.rowid'=>"Id",'f.facnumber'=>"Ref",'f.fk_soc'=>"IdCompany",'f.datec'=>"DateCreation",'f.datef'=>"DateInvoice",'f.amount'=>"Amount",'f.remise_percent'=>"GlobalDiscount",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.paye'=>"BillShortStatusPayed",'f.fk_statut'=>'Status','f.note'=>"Note",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_taux'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd");
|
||||
$this->export_entities_array[$r]=array('s.idp'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.fk_soc'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.amount'=>"invoice",'f.remise_percent'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_taux'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line");
|
||||
$this->export_alias_array[$r]=array('s.idp'=>"soc_id",'s.nom'=>'soc_name','s.address'=>'soc_adres','s.cp'=>'soc_zip','s.ville'=>'soc_ville','s.fk_pays'=>'soc_pays','s.tel'=>'soc_tel','s.siren'=>'soc_siren','s.siret'=>'soc_siret','f.rowid'=>"invoiceid",'f.facnumber'=>"ref",'f.fk_soc'=>"fk_soc",'f.datec'=>"datecreation",'f.datef'=>"dateinvoice",'f.amount'=>"amount",'f.remise_percent'=>"globaldiscount",'f.total'=>"totalht",'f.total_ttc'=>"totalttc",'f.paye'=>"paid",'f.fk_statut'=>'status','f.note'=>"note",'fd.rowid'=>'lineid','fd.description'=>"linedescription",'fd.tva_taux'=>"linevatrate",'fd.qty'=>"lineqty",'fd.date_start'=>"linedatestart",'fd.date_end'=>"linedateend");
|
||||
$this->export_alias_array[$r]=array('s.idp'=>"socidp",'s.nom'=>'soc_name','s.address'=>'soc_adres','s.cp'=>'soc_zip','s.ville'=>'soc_ville','s.fk_pays'=>'soc_pays','s.tel'=>'soc_tel','s.siren'=>'soc_siren','s.siret'=>'soc_siret','f.rowid'=>"invoiceid",'f.facnumber'=>"ref",'f.fk_soc'=>"fk_soc",'f.datec'=>"datecreation",'f.datef'=>"dateinvoice",'f.amount'=>"amount",'f.remise_percent'=>"globaldiscount",'f.total'=>"totalht",'f.total_ttc'=>"totalttc",'f.paye'=>"paid",'f.fk_statut'=>'status','f.note'=>"note",'fd.rowid'=>'lineid','fd.description'=>"linedescription",'fd.tva_taux'=>"linevatrate",'fd.qty'=>"lineqty",'fd.date_start'=>"linedatestart",'fd.date_end'=>"linedateend");
|
||||
$this->export_sql[$r]="select distinct ";
|
||||
$i=0;
|
||||
foreach ($this->export_alias_array[$r] as $key => $value)
|
||||
|
||||
@ -226,7 +226,7 @@ class modFournisseur extends DolibarrModules
|
||||
$this->export_label[$r]='Factures fournisseurs et lignes de facture';
|
||||
$this->export_fields_array[$r]=array('s.idp'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','f.rowid'=>"Id",'f.facnumber'=>"Ref",'f.datec'=>"DateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.paye'=>"BillShortStatusPayed",'f.fk_statut'=>'Status','f.note'=>"Note",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_taux'=>"LineVATRate",'fd.qty'=>"LineQty");
|
||||
$this->export_entities_array[$r]=array('s.idp'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_taux'=>"invoice_line",'fd.qty'=>"invoice_line");
|
||||
$this->export_alias_array[$r]=array('s.idp'=>"soc_id",'s.nom'=>'soc_name','s.address'=>'soc_adres','s.cp'=>'soc_zip','s.ville'=>'soc_ville','s.fk_pays'=>'soc_pays','s.tel'=>'soc_tel','s.siren'=>'soc_siren','s.siret'=>'soc_siret','f.rowid'=>"invoiceid",'f.facnumber'=>"ref",'f.datec'=>"datecreation",'f.datef'=>"dateinvoice",'f.total_ht'=>"totalht",'f.total_ttc'=>"totalttc",'f.paye'=>"paid",'f.fk_statut'=>'status','f.note'=>"note",'fd.rowid'=>'lineid','fd.description'=>"linedescription",'fd.tva_taux'=>"linevatrate",'fd.qty'=>"lineqty");
|
||||
$this->export_alias_array[$r]=array('s.idp'=>"socidp",'s.nom'=>'soc_name','s.address'=>'soc_adres','s.cp'=>'soc_zip','s.ville'=>'soc_ville','s.fk_pays'=>'soc_pays','s.tel'=>'soc_tel','s.siren'=>'soc_siren','s.siret'=>'soc_siret','f.rowid'=>"invoiceid",'f.facnumber'=>"ref",'f.datec'=>"datecreation",'f.datef'=>"dateinvoice",'f.total_ht'=>"totalht",'f.total_ttc'=>"totalttc",'f.paye'=>"paid",'f.fk_statut'=>'status','f.note'=>"note",'fd.rowid'=>'lineid','fd.description'=>"linedescription",'fd.tva_taux'=>"linevatrate",'fd.qty'=>"lineqty");
|
||||
$this->export_sql[$r]="select distinct ";
|
||||
$i=0;
|
||||
foreach ($this->export_alias_array[$r] as $key => $value)
|
||||
|
||||
@ -182,7 +182,7 @@ if ($_GET["action"] == 'create')
|
||||
if ( $commande->fetch($_GET["commande_id"]))
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($commande->soc_id);
|
||||
$soc->fetch($commande->socidp);
|
||||
$author = new User($db);
|
||||
$author->id = $commande->user_author_id;
|
||||
$author->fetch();
|
||||
@ -368,7 +368,7 @@ else
|
||||
$commande->fetch($livraison->commande_id);
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($commande->soc_id);
|
||||
$soc->fetch($commande->socidp);
|
||||
|
||||
$h=0;
|
||||
if ($conf->expedition->enabled)
|
||||
@ -668,7 +668,7 @@ else
|
||||
*/
|
||||
$sql = "SELECT ".$db->pdate("a.datea")." as da, a.note";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql .= " WHERE a.fk_soc = ".$commande->soc_id." AND a.fk_action in (9,10)";
|
||||
$sql .= " WHERE a.fk_soc = ".$commande->socidp." AND a.fk_action in (9,10)";
|
||||
$sql .= " AND a.fk_commande = ".$livraison->id;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
@ -204,9 +204,9 @@ class Livraison extends CommonObject
|
||||
$sql = "SELECT l.rowid, l.date_creation, l.date_valid, l.ref, l.fk_user_author,";
|
||||
$sql .=" l.fk_statut, l.fk_commande, l.fk_expedition, l.fk_user_valid, l.note, l.note_public";
|
||||
$sql .= ", ".$this->db->pdate("l.date_livraison")." as date_livraison, l.fk_adresse_livraison, l.model_pdf";
|
||||
$sql .= ", s.idp as socid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."livraison as l, ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql .= " WHERE l.rowid = $id AND c.rowid = l.fk_commande AND c.fk_soc = s.idp";
|
||||
$sql .= ", c.fk_soc";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."livraison as l, ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql .= " WHERE l.rowid = ".$id." AND c.rowid = l.fk_commande";
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
|
||||
@ -218,7 +218,7 @@ class Livraison extends CommonObject
|
||||
$this->date_creation = $obj->date_creation;
|
||||
$this->date_valid = $obj->date_valid;
|
||||
$this->ref = $obj->ref;
|
||||
$this->soc_id = $obj->socid;
|
||||
$this->socidp = $obj->fk_soc;
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->commande_id = $obj->fk_commande;
|
||||
$this->expedition_id = $obj->fk_expedition;
|
||||
@ -292,7 +292,7 @@ class Livraison extends CommonObject
|
||||
// Recuperation de la nouvelle reference
|
||||
$objMod = new $modName($this->db);
|
||||
$soc = new Societe($this->db);
|
||||
$soc->fetch($this->soc_id);
|
||||
$soc->fetch($this->socidp);
|
||||
|
||||
// on vérifie si le bon de livraison est en numérotation provisoire
|
||||
$livref = substr($this->ref, 1, 4);
|
||||
|
||||
@ -190,7 +190,7 @@ function delivery_order_delete_preview($db, $deliveryid)
|
||||
$delivery = new Livraison($db,"",$deliveryid);
|
||||
$delivery->fetch($deliveryid);
|
||||
$client = new Societe($db);
|
||||
$client->fetch($delivery->soc_id);
|
||||
$client->fetch($delivery->socidp);
|
||||
|
||||
if ($conf->livraison->dir_output)
|
||||
{
|
||||
|
||||
@ -308,7 +308,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','B',12);
|
||||
$client = new Societe($this->db);
|
||||
$client->fetch($delivery->soc_id);
|
||||
$client->fetch($delivery->socidp);
|
||||
$delivery->client = $client;
|
||||
$pdf->SetXY(102,42);
|
||||
$pdf->MultiCell(96,5, $delivery->client->nom);
|
||||
|
||||
@ -732,7 +732,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->MultiCell(80,5, $langs->trans("BillTo").":");
|
||||
//
|
||||
$client = new Societe($this->db);
|
||||
$client->fetch($delivery->soc_id);
|
||||
$client->fetch($delivery->socidp);
|
||||
$delivery->client = $client;
|
||||
//
|
||||
|
||||
|
||||
@ -93,15 +93,15 @@ class Propal extends CommonObject
|
||||
/**
|
||||
* \brief Constructeur
|
||||
* \param DB Handler d'accès base
|
||||
* \param soc_idp Id de la société
|
||||
* \param socidp Id de la société
|
||||
* \param propalid Id de la propal
|
||||
*/
|
||||
function Propal($DB, $soc_idp="", $propalid=0)
|
||||
function Propal($DB, $socidp="", $propalid=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$this->db = $DB ;
|
||||
$this->socidp = $soc_idp;
|
||||
$this->socidp = $socidp;
|
||||
$this->id = $propalid;
|
||||
$this->products = array();
|
||||
$this->remise = 0;
|
||||
@ -131,14 +131,12 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function add_product($idproduct, $qty, $remise_percent=0)
|
||||
{
|
||||
if (! $qty) $qty = 1;
|
||||
|
||||
if ($idproduct > 0)
|
||||
{
|
||||
$i = sizeof($this->products);
|
||||
$this->products[$i] = $idproduct;
|
||||
if (!$qty)
|
||||
{
|
||||
$qty = 1 ;
|
||||
}
|
||||
$this->products_qty[$i] = $qty;
|
||||
$this->products_remise_percent[$i] = $remise_percent;
|
||||
}
|
||||
@ -424,10 +422,10 @@ class Propal extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
// Insertion dans la base
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."propal (fk_soc, fk_soc_contact, price, remise, remise_percent, remise_absolue,";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."propal (fk_soc, price, remise, remise_percent, remise_absolue,";
|
||||
$sql.= " tva, total, datep, datec, ref, fk_user_author, note, note_public, model_pdf, fin_validite,";
|
||||
$sql.= " fk_cond_reglement, fk_mode_reglement, date_livraison, ref_client) ";
|
||||
$sql.= " VALUES ($this->socidp, $this->contactid, 0, $this->remise, $this->remise_percent, $this->remise_absolue,";
|
||||
$sql.= " VALUES ($this->socidp, 0, $this->remise, $this->remise_percent, $this->remise_absolue,";
|
||||
$sql.= " 0,0,".$this->db->idate($this->datep).", now(), '".$this->ref."', ".$this->author.",";
|
||||
$sql.= "'".addslashes($this->note)."',";
|
||||
$sql.= "'".addslashes($this->note_public)."',";
|
||||
@ -456,10 +454,9 @@ class Propal extends CommonObject
|
||||
$price = $prod->multiprices[$soc->price_level];
|
||||
else
|
||||
$price = $prod->price;
|
||||
|
||||
|
||||
$resql = $this->addline(
|
||||
$this->id,
|
||||
$prod->libelle,
|
||||
$prod->description,
|
||||
$price,
|
||||
$this->products_qty[$i],
|
||||
@ -506,6 +503,7 @@ class Propal extends CommonObject
|
||||
// Fin appel triggers
|
||||
|
||||
$this->db->commit();
|
||||
dolibarr_syslog("Propal::Create done id=".$this->id);
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
@ -526,6 +524,8 @@ class Propal extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
dolibarr_syslog("Propal::Create done id=".$this->id);
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
@ -725,12 +725,13 @@ class Propal extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Recupère de la base les caractéristiques d'une propale
|
||||
* \param rowid id de la propal à récupérer
|
||||
* \brief Recupère de la base les caractéristiques d'une propale
|
||||
* \param rowid id de la propal à récupérer
|
||||
* \return int <0 si ko, 0 si non trouvé, >0 si ok
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
$sql = "SELECT ref,total,price,remise,remise_percent,remise_absolue,tva,fk_soc,fk_soc_contact";
|
||||
$sql = "SELECT rowid,ref,total,price,remise,remise_percent,remise_absolue,tva,fk_soc,fk_soc_contact";
|
||||
$sql.= ", ".$this->db->pdate("datep")." as dp";
|
||||
$sql.= ", ".$this->db->pdate("fin_validite")." as dfv";
|
||||
$sql.= ", ".$this->db->pdate("date_livraison")." as date_livraison";
|
||||
@ -742,7 +743,7 @@ class Propal extends CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."propal,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."c_propalst as c";
|
||||
$sql.= " WHERE fk_statut = c.id";
|
||||
$sql.= " AND rowid='".$rowid."';";
|
||||
$sql.= " AND rowid='".$rowid."'";
|
||||
|
||||
dolibarr_syslog("Propal::fecth rowid=".$rowid);
|
||||
|
||||
@ -769,7 +770,6 @@ class Propal extends CommonObject
|
||||
$this->total_tva = $obj->tva;
|
||||
$this->total_ttc = $obj->total;
|
||||
$this->socidp = $obj->fk_soc;
|
||||
$this->soc_id = $obj->fk_soc;
|
||||
$this->projetidp = $obj->fk_projet;
|
||||
$this->contactid = $obj->fk_soc_contact;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
@ -869,19 +869,21 @@ class Propal extends CommonObject
|
||||
|
||||
$this->lignes[$i] = $ligne;
|
||||
//dolibarr_syslog("1 ".$ligne->desc);
|
||||
//print "xx $i ".$this->lignes[$i]->product_desc;
|
||||
//print "xx $i ".$this->lignes[$i]->libelle;
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("Propal::Fetch Erreur lecture des produits sql=$sql");
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("Propal::Fetch Error $this->error, sql=$sql");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1860,7 +1862,6 @@ class Propal extends CommonObject
|
||||
$this->total_tva = $src_propal->total_tva;
|
||||
$this->total_ttc = $src_propal->total_ttc;
|
||||
$this->socidp = $src_propal->socidp;
|
||||
$this->soc_id = $src_propal->soc_id;
|
||||
$this->projetidp = $src_propal->projetidp;
|
||||
$this->contactid = $src_propal->contactid;
|
||||
$this->modelpdf = $src_propal->modelpdf;
|
||||
@ -1916,7 +1917,6 @@ class Propal extends CommonObject
|
||||
{
|
||||
$resql = $this->addline(
|
||||
$this->id,
|
||||
$prod->libelle,
|
||||
$prod->description,
|
||||
$price,
|
||||
$ligne->qty,
|
||||
|
||||
@ -330,7 +330,7 @@ if ($_POST["action"] == 'add')
|
||||
|
||||
if ((strlen(trim($_POST["rib_banque"])) + strlen(trim($_POST["rib_guichet"])) + strlen(trim($_POST["rib_compte"])) + strlen(trim($_POST["rib_cle"])))<> 0 && $verif == 'ok' && !$error)
|
||||
{
|
||||
$rib->soc_id = $soc->id;
|
||||
$rib->socidp = $soc->id;
|
||||
|
||||
if ( $rib->update($user) > 0)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user