dolibarr  7.0.0-beta
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
SupplierProposal Class Reference

Class to manage price ask supplier. More...

+ Inheritance diagram for SupplierProposal:
+ Collaboration diagram for SupplierProposal:

Public Member Functions

 __construct ($db, $socid="", $supplier_proposalid=0)
 Constructor. More...
 
 add_product ($idproduct, $qty, $remise_percent=0)
 Add line into array products $this->client doit etre charge. More...
 
 insert_discount ($idremise)
 Adding line of fixed discount in the proposal in DB. More...
 
 addline ($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='', $array_option=0, $ref_fourn='', $fk_unit='', $origin='', $origin_id=0)
 Add a proposal line into database (linked to product/service or not) Les parametres sont deja cense etre juste et avec valeurs finales a l'appel de cette methode. More...
 
 updateline ($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $array_option=0, $ref_fourn='', $fk_unit='')
 Update a proposal line. More...
 
 deleteline ($lineid)
 Delete detail line. More...
 
 create ($user, $notrigger=0)
 Create commercial proposal into database this->ref can be set or empty. More...
 
 create_from ($user)
 Insert into DB a supplier_proposal object completely defined by its data members (ex, results from copy). More...
 
 createFromClone ($socid=0)
 Load an object from its id and create a new one in database. More...
 
 fetch ($rowid, $ref='')
 Load a proposal from database and its ligne array. More...
 
 valid ($user, $notrigger=0)
 Set status to validated. More...
 
 set_date_livraison ($user, $date_livraison)
 Set delivery date. More...
 
 set_remise_percent ($user, $remise)
 Set an overall discount on the proposal. More...
 
 set_remise_absolue ($user, $remise)
 Set an absolute overall discount on the proposal. More...
 
 reopen ($user, $statut, $note='', $notrigger=0)
 Reopen the commercial proposal. More...
 
 cloture ($user, $statut, $note)
 Close the askprice. More...
 
 updateOrCreatePriceFournisseur ($user)
 Add or update supplier price according to result of proposal. More...
 
 updatePriceFournisseur ($idProductFournPrice, $product, $user)
 Upate ProductFournisseur. More...
 
 createPriceFournisseur ($product, $user)
 Create ProductFournisseur. More...
 
 set_draft ($user)
 Set draft status. More...
 
 liste_array ($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datec', $sortorder='DESC')
 Return list of askprice (eventually filtered on user) into an array. More...
 
 delete ($user, $notrigger=0)
 Delete askprice. More...
 
 info ($id)
 Object SupplierProposal Information. More...
 
 getLibStatut ($mode=0)
 Return label of status of proposal (draft, validated, ...) More...
 
 LibStatut ($statut, $mode=1)
 Return label of a status (draft, validated, ...) More...
 
 load_board ($user, $mode)
 Load indicators for dashboard (this->nbtodo and this->nbtodolate) More...
 
 initAsSpecimen ()
 Initialise an instance with random values. More...
 
 load_state_board ()
 Charge indicateurs this->nb de tableau de bord. More...
 
 getNextNumRef ($soc)
 Returns the reference to the following non used Proposal used depending on the active numbering module defined into SUPPLIER_PROPOSAL_ADDON. More...
 
 getNomUrl ($withpicto=0, $option='', $get_params='', $notooltip=0, $save_lastsearch_value=-1)
 Return clicable link of object (with eventually picto) More...
 
 getLinesArray ()
 Retrieve an array of supplier proposal lines. More...
 
 generateDocument ($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
 Create a document onto disk according to template module. More...
 
- Public Member Functions inherited from CommonObject
 errorsToString ()
 Method to output saved errors. More...
 
 getFullName ($langs, $option=0, $nameorder=-1, $maxlen=0)
 Return full name (civility+' '+name+' '+lastname) More...
 
 getFullAddress ($withcountry=0, $sep="\n")
 Return full address of contact. More...
 
 getBannerAddress ($htmlkey, $object)
 Return full address for banner. More...
 
 getLastMainDocLink ($modulepart, $initsharekey=0)
 Return the link of last main doc file for direct public download. More...
 
 add_contact ($fk_socpeople, $type_contact, $source='external', $notrigger=0)
 Add a link between element $this->element and a contact. More...
 
 copy_linked_contact ($objFrom, $source='internal')
 Copy contact from one element to current. More...
 
 update_contact ($rowid, $statut, $type_contact_id=0, $fk_socpeople=0)
 Update a link to contact line. More...
 
 delete_contact ($rowid, $notrigger=0)
 Delete a link to contact line. More...
 
 delete_linked_contact ($source='', $code='')
 Delete all links between an object $this and all its contacts. More...
 
 liste_contact ($statut=-1, $source='external', $list=0, $code='')
 Get array of all contacts for an object. More...
 
 swapContactStatus ($rowid)
 Update status of a contact linked to object. More...
 
 liste_type_contact ($source='internal', $order='position', $option=0, $activeonly=0, $code='')
 Return array with list of possible values for type of contacts. More...
 
 getIdContact ($source, $code, $status=0)
 Return id of contacts for a source and a contact code. More...
 
 fetch_contact ($contactid=null)
 Load object contact with id=$this->contactid into $this->contact. More...
 
 fetch_thirdparty ($force_thirdparty_id=0)
 Load the third party of object, from id $this->socid or $this->fk_soc, into this->thirdparty. More...
 
 fetchOneLike ($ref)
 Looks for an object with ref matching the wildcard provided It does only work when $this->table_ref_field is set. More...
 
 fetch_barcode ()
 Load data for barcode into properties ->barcode_type* Properties ->barcode_type that is id of barcode. More...
 
 fetch_projet ()
 Charge le projet d'id $this->fk_project dans this->projet. More...
 
 fetch_user ($userid)
 Charge le user d'id userid dans this->user. More...
 
 fetch_origin ()
 Read linked origin object. More...
 
 fetchObjectFrom ($table, $field, $key)
 Load object from specific field. More...
 
 getValueFrom ($table, $id, $field)
 Getter generic. More...
 
 setValueFrom ($field, $value, $table='', $id=null, $format='', $id_field='', $fuser=null, $trigkey='')
 Setter generic. More...
 
 load_previous_next_ref ($filter, $fieldid, $nodbprefix=0)
 Load properties id_previous and id_next by comparing $fieldid with $this->ref. More...
 
 getListContactId ($source='external')
 Return list of id of contacts of project. More...
 
 setProject ($projectid)
 Link element with a project. More...
 
 setPaymentMethods ($id)
 Change the payments methods. More...
 
 setMulticurrencyCode ($code)
 Change the multicurrency code. More...
 
 setMulticurrencyRate ($rate, $mode=1)
 Change the multicurrency rate. More...
 
 setPaymentTerms ($id)
 Change the payments terms. More...
 
 setDeliveryAddress ($id)
 Define delivery address. More...
 
 setShippingMethod ($shipping_method_id)
 Change the shipping method. More...
 
 setWarehouse ($warehouse_id)
 Change the warehouse. More...
 
 setDocModel ($user, $modelpdf)
 Set last model used by doc generator. More...
 
 setBankAccount ($fk_account)
 Change the bank account. More...
 
 line_order ($renum=false, $rowidorder='ASC', $fk_parent_line=true)
 Save a new position (field rang) for details lines. More...
 
 getChildrenOfLine ($id)
 Get children of line. More...
 
 line_up ($rowid, $fk_parent_line=true)
 Update a line to have a lower rank. More...
 
 line_down ($rowid, $fk_parent_line=true)
 Update a line to have a higher rank. More...
 
 updateRangOfLine ($rowid, $rang)
 Update position of line (rang) More...
 
 line_ajaxorder ($rows)
 Update position of line with ajax (rang) More...
 
 updateLineUp ($rowid, $rang)
 Update position of line up (rang) More...
 
 updateLineDown ($rowid, $rang, $max)
 Update position of line down (rang) More...
 
 getRangOfLine ($rowid)
 Get position of line (rang) More...
 
 getIdOfLine ($rang)
 Get rowid of the line relative to its position. More...
 
 line_max ($fk_parent_line=0)
 Get max value used for position of line (rang) More...
 
 update_ref_ext ($ref_ext)
 Update external ref of element. More...
 
 update_note ($note, $suffix='')
 Update note of element. More...
 
 update_note_public ($note)
 Update public note (kept for backward compatibility) More...
 
 update_price ($exclspec=0, $roundingadjust='none', $nodatabaseupdate=0, $seller=null)
 Update total_ht, total_ttc, total_vat, total_localtax1, total_localtax2 for an object (sum of lines). More...
 
 add_object_linked ($origin=null, $origin_id=null)
 Add objects linked in llx_element_element. More...
 
 fetchObjectLinked ($sourceid=null, $sourcetype='', $targetid=null, $targettype='', $clause='OR', $alsosametype=1)
 Fetch array of objects linked to current object. More...
 
 updateObjectLinked ($sourceid=null, $sourcetype='', $targetid=null, $targettype='')
 Update object linked of a current object. More...
 
 deleteObjectLinked ($sourceid=null, $sourcetype='', $targetid=null, $targettype='', $rowid='')
 Delete all links between an object $this. More...
 
 setStatut ($status, $elementId=null, $elementType='')
 Set status of an object. More...
 
 getCanvas ($id=0, $ref='')
 Load type of canvas of an object if it exists. More...
 
 getSpecialCode ($lineid)
 Get special code of a line. More...
 
 isObjectUsed ($id=0)
 Function to check if an object is used by others. More...
 
 hasProductsOrServices ($predefined=-1)
 Function to say how many lines object contains. More...
 
 getTotalDiscount ()
 Function that returns the total amount HT of discounts applied for all lines. More...
 
 getTotalWeightVolume ()
 Return into unit=0, the calculated total of weight and volume of all lines * qty Calculate by adding weight and volume of each product line, so properties ->volume/volume_units/weight/weight_units must be loaded on line. More...
 
 setExtraParameters ()
 Set extra parameters. More...
 
 display_incoterms ()
 Return incoterms informations TODO Use a cache for label get. More...
 
 getIncotermsForPDF ()
 Return incoterms informations for pdf display. More...
 
 setIncoterms ($id_incoterm, $location)
 Define incoterms values of current object. More...
 
 isInEEC ()
 Return if a country is inside the EEC (European Economic Community) More...
 
 formAddObjectLine ($dateSelector, $seller, $buyer)
 Show add free and predefined products/services form. More...
 
 printObjectLines ($action, $seller, $buyer, $selected=0, $dateSelector=0)
 Return HTML table for object lines TODO Move this into an output class file (htmlline.class.php) If lines are into a template, title must also be into a template But for the moment we don't know if it'st possible as we keep a method available on overloaded objects. More...
 
 printObjectLine ($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected=0, $extrafieldsline=0)
 Return HTML content of a detail line TODO Move this into an output class file (htmlline.class.php) More...
 
 printOriginLinesList ($restrictlist='')
 Return HTML table table of source object lines TODO Move this and previous function into output html class file (htmlline.class.php). More...
 
 printOriginLine ($line, $var, $restrictlist='')
 Return HTML with a line of table array of source object lines TODO Move this and previous function into output html class file (htmlline.class.php). More...
 
 add_element_resource ($resource_id, $resource_type, $busy=0, $mandatory=0)
 Add resources to the current object : add entry into llx_element_resources Need $this->element & $this->id. More...
 
 delete_resource ($rowid, $element, $notrigger=0)
 Delete a link to resource line. More...
 
 __clone ()
 Overwrite magic function to solve problem of cloning object that are kept as references. More...
 
 addThumbs ($file)
 Build thumb. More...
 
 getDefaultCreateValueFor ($fieldname, $alternatevalue=null)
 Return the default value to use for a field when showing the create form of object. More...
 
 call_trigger ($trigger_name, $user)
 Call trigger based on this instance. More...
 
 fetch_optionals ($rowid=null, $optionsArray=null)
 Function to get extra fields of an object into $this->array_options This method is in most cases called by method fetch of objects but you can call it separately. More...
 
 deleteExtraFields ()
 Delete all extra fields values for the current object. More...
 
 insertExtraFields ($trigger='', $userused=null)
 Add/Update all extra fields values for the current object. More...
 
 updateExtraField ($key)
 Update an exta field value for the current object. More...
 
 showInputField ($val, $key, $value, $moreparam='', $keysuffix='', $keyprefix='', $showsize=0)
 Return HTML string to put an input field into a page Code very similar with showInputField of extra fields. More...
 
 showOutputField ($val, $key, $value, $moreparam='', $keysuffix='', $keyprefix='', $showsize=0)
 Return HTML string to show a field into a page Code very similar with showOutputField of extra fields. More...
 
 showOptionals ($extrafields, $mode='view', $params=null, $keysuffix='', $keyprefix='')
 Function to show lines of extrafields with output datas. More...
 
 getRights ()
 Returns the rights used for this class. More...
 
 defineBuyPrice ($unitPrice=0.0, $discountPercent=0.0, $fk_product=0)
 Get buy price to use for margin calculation. More...
 
 isDate ($info)
 Function test if type is date. More...
 
 isInt ($info)
 Function test if type is integer. More...
 
 isFloat ($info)
 Function test if type is float. More...
 
 isText ($info)
 Function test if type is text. More...
 
 createCommon (User $user, $notrigger=false)
 Create object into database. More...
 
 fetchCommon ($id, $ref=null)
 Load object in memory from the database. More...
 
 updateCommon (User $user, $notrigger=false)
 Update object into database. More...
 
 deleteCommon (User $user, $notrigger=false)
 Delete object in database. More...
 
 initAsSpecimenCommon ()
 Initialise object with example values Id must be 0 if object instance is a specimen. More...
 
 fetchComments ()
 Load comments linked with current task. More...
 
 getNbComments ()
 Return nb comments already posted. More...
 

Static Public Member Functions

static replaceThirdparty (DoliDB $db, $origin_id, $dest_id)
 Function used to replace a thirdparty id with another one. More...
 
- Static Public Member Functions inherited from CommonObject
static isExistingObject ($element, $id, $ref='', $ref_ext='')
 Check an object id/ref exists If you don't need/want to instantiate object and just need to know if object exists, use this method instead of fetch. More...
 
static commonReplaceThirdparty (DoliDB $db, $origin_id, $dest_id, array $tables, $ignoreerrors=0)
 Function used to replace a thirdparty id with another one. More...
 

Public Attributes

 $author
 
 $datec
 
 $datev
 
 $price
 
 $tva
 
 $total
 
const STATUS_DRAFT = 0
 Draft status.
 
const STATUS_VALIDATED = 1
 Validated status.
 
const STATUS_SIGNED = 2
 Signed quote.
 
const STATUS_NOTSIGNED = 3
 Not signed quote, canceled.
 
const STATUS_CLOSE = 4
 Billed or closed/processed quote.
 
- Public Attributes inherited from CommonObject
 $projet
 
 $note
 

Protected Attributes

 $table_ref_field = 'ref'
 {}
 

Additional Inherited Members

- Protected Member Functions inherited from CommonObject
 commonGenerateDocument ($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams=null)
 Common function for all objects extending CommonObject for generating documents. More...
 
 isArray ($info)
 Function test if type is array. More...
 
 isNull ($info)
 Function test if type is null. More...
 
 isIndex ($info)
 Function test if is indexed. More...
 
 quote ($value, $fieldsentry)
 Add quote to field value if necessary. More...
 

Detailed Description

Class to manage price ask supplier.

Definition at line 45 of file supplier_proposal.class.php.

Constructor & Destructor Documentation

SupplierProposal::__construct (   $db,
  $socid = "",
  $supplier_proposalid = 0 
)

Constructor.

Parameters
DoliDB$dbDatabase handler
int$socidId third party
int$supplier_proposalidId supplier_proposal

Definition at line 183 of file supplier_proposal.class.php.

Member Function Documentation

SupplierProposal::add_product (   $idproduct,
  $qty,
  $remise_percent = 0 
)

Add line into array products $this->client doit etre charge.

Parameters
int$idproductProduct Id to add
int$qtyQuantity
int$remise_percentDiscount effected on Product
Returns
int <0 if KO, >0 if OK

TODO Remplacer les appels a cette fonction par generation objet Ligne insere dans tableau $this->products

Definition at line 221 of file supplier_proposal.class.php.

References $price, dol_syslog(), get_default_npr(), get_default_tva(), and get_localtax().

SupplierProposal::addline (   $desc,
  $pu_ht,
  $qty,
  $txtva,
  $txlocaltax1 = 0,
  $txlocaltax2 = 0,
  $fk_product = 0,
  $remise_percent = 0,
  $price_base_type = 'HT',
  $pu_ttc = 0,
  $info_bits = 0,
  $type = 0,
  $rang = -1,
  $special_code = 0,
  $fk_parent_line = 0,
  $fk_fournprice = 0,
  $pa_ht = 0,
  $label = '',
  $array_option = 0,
  $ref_fourn = '',
  $fk_unit = '',
  $origin = '',
  $origin_id = 0 
)

Add a proposal line into database (linked to product/service or not) Les parametres sont deja cense etre juste et avec valeurs finales a l'appel de cette methode.

Aussi, pour le taux tva, il doit deja avoir ete defini par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,'',produit) et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)

Parameters
string$descDescription de la ligne
double$pu_htPrix unitaire
double$qtyQuantite
double$txtvaTaux de tva
double$txlocaltax1Local tax 1 rate
double$txlocaltax2Local tax 2 rate
int$fk_productId du produit/service predefini
double$remise_percentPourcentage de remise de la ligne
string$price_base_typeHT or TTC
double$pu_ttcPrix unitaire TTC
int$info_bitsBits de type de lignes
int$typeType of line (product, service)
int$rangPosition of line
int$special_codeSpecial code (also used by externals modules!)
int$fk_parent_lineId of parent line
int$fk_fournpriceId supplier price
int$pa_htBuying price without tax
string$label???
array$array_optionextrafields array
string$ref_fournSupplier price reference
int$fk_unitId of the unit to use.
string$origin'order', 'supplier_proposal', ...
int$origin_idId of origin line
Returns
int >0 if OK, <0 if KO
See also
add_product

Definition at line 374 of file supplier_proposal.class.php.

References $price, calcul_price_total(), dol_syslog(), getLocalTaxesFromRate(), CommonObject\line_max(), CommonObject\line_order(), price2num(), and CommonObject\update_price().

Referenced by create().

SupplierProposal::cloture (   $user,
  $statut,
  $note 
)

Close the askprice.

Parameters
User$userObject user that close
int$statutStatut
string$noteComment
Returns
int <0 if KO, >0 if OK

Definition at line 1620 of file supplier_proposal.class.php.

References CommonObject\$note, $resql, CommonObject\call_trigger(), dol_now(), generateDocument(), GETPOST(), and updateOrCreatePriceFournisseur().

SupplierProposal::create (   $user,
  $notrigger = 0 
)

Create commercial proposal into database this->ref can be set or empty.

If empty, we will use "(PROVid)"

Parameters
User$userUser that create
int$notrigger1=Does not execute triggers, 0= execute triggers
Returns
int <0 if KO, >=0 if OK

Definition at line 751 of file supplier_proposal.class.php.

References $resql, CommonObject\add_object_linked(), addline(), CommonObject\call_trigger(), dol_now(), dol_print_error(), dol_syslog(), CommonObject\fetch_thirdparty(), MultiCurrency\getIdAndTxFromCode(), CommonObject\insertExtraFields(), and CommonObject\update_price().

Referenced by create_from(), and createFromClone().

SupplierProposal::create_from (   $user)

Insert into DB a supplier_proposal object completely defined by its data members (ex, results from copy).

Parameters
User$userUser that create
Returns
int Id of the new object if ok, <0 if ko
See also
create

Definition at line 1021 of file supplier_proposal.class.php.

References create().

SupplierProposal::createFromClone (   $socid = 0)

Load an object from its id and create a new one in database.

Parameters
int$socidId of thirdparty
Returns
int New id of clone

Definition at line 1034 of file supplier_proposal.class.php.

References CommonObject\call_trigger(), create(), and dol_now().

SupplierProposal::createPriceFournisseur (   $product,
  $user 
)

Create ProductFournisseur.

Parameters
Product$productObject Product
User$userObject user
Returns
int <0 if KO, >0 if OK

Definition at line 1756 of file supplier_proposal.class.php.

References $price, $resql, dol_now(), and price2num().

Referenced by updateOrCreatePriceFournisseur().

SupplierProposal::delete (   $user,
  $notrigger = 0 
)

Delete askprice.

Parameters
User$userObject user that delete
int$notrigger1=Does not execute triggers, 0= execute triggers
Returns
int 1 if ok, otherwise if error

Definition at line 1894 of file supplier_proposal.class.php.

References CommonObject\call_trigger(), CommonObject\deleteExtraFields(), CommonObject\deleteObjectLinked(), dol_delete_dir_recursive(), dol_delete_file(), dol_delete_preview(), dol_sanitizeFileName(), and dol_syslog().

SupplierProposal::deleteline (   $lineid)

Delete detail line.

Parameters
int$lineidId of line to delete
Returns
int >0 if OK, <0 if KO

Definition at line 716 of file supplier_proposal.class.php.

References CommonObject\update_price().

SupplierProposal::fetch (   $rowid,
  $ref = '' 
)

Load a proposal from database and its ligne array.

Parameters
int$rowidid of object to load
string$refRef of proposal
Returns
int >0 if OK, <0 if KO

Definition at line 1131 of file supplier_proposal.class.php.

References $resql, dol_syslog(), CommonObject\fetch_optionals(), getEntity(), and getMarginInfos().

SupplierProposal::generateDocument (   $modele,
  $outputlangs,
  $hidedetails = 0,
  $hidedesc = 0,
  $hideref = 0 
)

Create a document onto disk according to template module.

Parameters
string$modeleForce model to use ('' to not force)
Translate$outputlangsObject langs to use for output
int$hidedetailsHide details of lines
int$hidedescHide description
int$hiderefHide ref
Returns
int 0 if KO, 1 if OK

Definition at line 2530 of file supplier_proposal.class.php.

References CommonObject\commonGenerateDocument(), and dol_strlen().

Referenced by cloture().

SupplierProposal::getLibStatut (   $mode = 0)

Return label of status of proposal (draft, validated, ...)

Parameters
int$mode0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
Returns
string Label

Definition at line 2070 of file supplier_proposal.class.php.

References LibStatut().

SupplierProposal::getLinesArray ( )

Retrieve an array of supplier proposal lines.

Returns
int >0 if OK, <0 if KO

Definition at line 2439 of file supplier_proposal.class.php.

References $resql, dol_syslog(), and getMarginInfos().

SupplierProposal::getNextNumRef (   $soc)

Returns the reference to the following non used Proposal used depending on the active numbering module defined into SUPPLIER_PROPOSAL_ADDON.

Parameters
Societe$socObject thirdparty
Returns
string Reference libre pour la propale

Definition at line 2313 of file supplier_proposal.class.php.

References dol_buildpath(), dol_print_error(), and print.

Referenced by valid().

SupplierProposal::getNomUrl (   $withpicto = 0,
  $option = '',
  $get_params = '',
  $notooltip = 0,
  $save_lastsearch_value = -1 
)

Return clicable link of object (with eventually picto)

Parameters
int$withpictoAdd picto into link
string$optionWhere point the link ('compta', 'expedition', 'document', ...)
string$get_paramsParametres added to url
int$notooltip1=Disable tooltip
int$save_lastsearch_value-1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
Returns
string String with URL

Definition at line 2373 of file supplier_proposal.class.php.

References img_object(), and price().

SupplierProposal::info (   $id)

Object SupplierProposal Information.

Parameters
int$idProposal id
Returns
void

Definition at line 2012 of file supplier_proposal.class.php.

References dol_print_error().

SupplierProposal::initAsSpecimen ( )

Initialise an instance with random values.

Used to build previews or test instances. id must be 0 if object instance is a specimen.

Returns
void

Definition at line 2184 of file supplier_proposal.class.php.

References $resql.

SupplierProposal::insert_discount (   $idremise)

Adding line of fixed discount in the proposal in DB.

Parameters
int$idremiseId of fixed discount
Returns
int >0 if OK, <0 if KO

Definition at line 270 of file supplier_proposal.class.php.

References CommonObject\update_price().

SupplierProposal::LibStatut (   $statut,
  $mode = 1 
)

Return label of a status (draft, validated, ...)

Parameters
int$statutid statut
int$mode0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
Returns
string Label

Definition at line 2082 of file supplier_proposal.class.php.

References img_picto().

Referenced by getLibStatut().

SupplierProposal::liste_array (   $shortlist = 0,
  $draft = 0,
  $notcurrentuser = 0,
  $socid = 0,
  $limit = 0,
  $offset = 0,
  $sortfield = 'p.datec',
  $sortorder = 'DESC' 
)

Return list of askprice (eventually filtered on user) into an array.

Parameters
int$shortlist0=Return array[id]=ref, 1=Return array[](id=>id,ref=>ref,name=>name)
int$draft0=not draft, 1=draft
int$notcurrentuser0=all user, 1=not current user
int$socidId third pary
int$limitFor pagination
int$offsetFor pagination
string$sortfieldSort criteria
string$sortorderSort order
Returns
int -1 if KO, array with result if OK

Definition at line 1824 of file supplier_proposal.class.php.

References dol_print_error().

SupplierProposal::load_board (   $user,
  $mode 
)

Load indicators for dashboard (this->nbtodo and this->nbtodolate)

Parameters
User$userObject user
int$mode"opened" for askprice to close, "signed" for proposal to invoice
Returns
int <0 if KO, >0 if OK

Definition at line 2110 of file supplier_proposal.class.php.

References $resql, dol_now(), and img_object().

SupplierProposal::load_state_board ( )

Charge indicateurs this->nb de tableau de bord.

Returns
int <0 if ko, >0 if ok

Definition at line 2268 of file supplier_proposal.class.php.

References $resql, and dol_print_error().

SupplierProposal::reopen (   $user,
  $statut,
  $note = '',
  $notrigger = 0 
)

Reopen the commercial proposal.

Parameters
User$userObject user that close
int$statutStatut
string$noteComment
int$notrigger1=Does not execute triggers, 0= execute triggers
Returns
int <0 if KO, >0 if OK

Definition at line 1559 of file supplier_proposal.class.php.

References CommonObject\$note, $resql, CommonObject\call_trigger(), and dol_syslog().

static SupplierProposal::replaceThirdparty ( DoliDB  $db,
  $origin_id,
  $dest_id 
)
static

Function used to replace a thirdparty id with another one.

Parameters
DoliDB$dbDatabase handler
int$origin_idOld thirdparty id
int$dest_idNew thirdparty id
Returns
bool

Definition at line 2561 of file supplier_proposal.class.php.

References CommonObject\commonReplaceThirdparty().

SupplierProposal::set_date_livraison (   $user,
  $date_livraison 
)

Set delivery date.

Parameters
User$userObject user that modify
int$date_livraisonDelivery date
Returns
int <0 if ko, >0 if ok

Definition at line 1460 of file supplier_proposal.class.php.

References dol_syslog().

SupplierProposal::set_draft (   $user)

Set draft status.

Parameters
User$userObject user that modify
Returns
int <0 if KO, >0 if OK

Definition at line 1791 of file supplier_proposal.class.php.

SupplierProposal::set_remise_absolue (   $user,
  $remise 
)

Set an absolute overall discount on the proposal.

Parameters
User$userObject user that modify
double$remiseAmount discount
Returns
int <0 if ko, >0 if ok

Definition at line 1522 of file supplier_proposal.class.php.

References price2num(), and CommonObject\update_price().

SupplierProposal::set_remise_percent (   $user,
  $remise 
)

Set an overall discount on the proposal.

Parameters
User$userObject user that modify
double$remiseAmount discount
Returns
int <0 if ko, >0 if ok

Definition at line 1489 of file supplier_proposal.class.php.

References price2num(), and CommonObject\update_price().

SupplierProposal::updateline (   $rowid,
  $pu,
  $qty,
  $remise_percent,
  $txtva,
  $txlocaltax1 = 0,
  $txlocaltax2 = 0,
  $desc = '',
  $price_base_type = 'HT',
  $info_bits = 0,
  $special_code = 0,
  $fk_parent_line = 0,
  $skip_update_total = 0,
  $fk_fournprice = 0,
  $pa_ht = 0,
  $label = '',
  $type = 0,
  $array_option = 0,
  $ref_fourn = '',
  $fk_unit = '' 
)

Update a proposal line.

Parameters
int$rowidId de la ligne
double$puPrix unitaire (HT ou TTC selon price_base_type)
double$qtyQuantity
double$remise_percentRemise effectuee sur le produit
double$txtvaTaux de TVA
double$txlocaltax1Local tax 1 rate
double$txlocaltax2Local tax 2 rate
string$descDescription
double$price_base_typeHT ou TTC
int$info_bitsMiscellaneous informations
int$special_codeSpecial code (also used by externals modules!)
int$fk_parent_lineId of parent line (0 in most cases, used by modules adding sublevels into lines).
int$skip_update_totalKeep fields total_xxx to 0 (used for special lines by some modules)
int$fk_fournpriceId of origin supplier price
int$pa_htPrice (without tax) of product when it was bought
string$label???
int$type0/1=Product/service
array$array_optionextrafields array
string$ref_fournSupplier price reference
int$fk_unitId of the unit to use.
Returns
int 0 if OK, <0 if KO

Definition at line 566 of file supplier_proposal.class.php.

References $price, calcul_price_total(), dol_syslog(), getLocalTaxesFromRate(), CommonObject\line_max(), CommonObject\line_order(), price2num(), and CommonObject\update_price().

SupplierProposal::updateOrCreatePriceFournisseur (   $user)

Add or update supplier price according to result of proposal.

Parameters
User$userObject user
Returns
int > 0 if OK

Definition at line 1701 of file supplier_proposal.class.php.

References createPriceFournisseur(), dol_syslog(), and updatePriceFournisseur().

Referenced by cloture().

SupplierProposal::updatePriceFournisseur (   $idProductFournPrice,
  $product,
  $user 
)

Upate ProductFournisseur.

Parameters
int$idProductFournPriceid of llx_product_fournisseur_price
int$productcontain informations to update
User$userObject user
Returns
int <0 if KO, >0 if OK

Definition at line 1735 of file supplier_proposal.class.php.

References $price, $resql, and price2num().

Referenced by updateOrCreatePriceFournisseur().

SupplierProposal::valid (   $user,
  $notrigger = 0 
)

Set status to validated.

Parameters
User$userObject user that validate
int$notrigger1=Does not execute triggers, 0= execute triggers
Returns
int <0 if KO, >=0 if OK

Definition at line 1346 of file supplier_proposal.class.php.

References $resql, CommonObject\call_trigger(), dol_dir_list(), dol_now(), dol_print_error(), dol_sanitizeFileName(), dol_syslog(), and getNextNumRef().

Member Data Documentation

SupplierProposal::$author
Deprecated:
See also
user_author_id

Definition at line 74 of file supplier_proposal.class.php.

SupplierProposal::$datec
Deprecated:
See also
date_creation

Definition at line 84 of file supplier_proposal.class.php.

SupplierProposal::$datev
Deprecated:
See also
date_validation

Definition at line 96 of file supplier_proposal.class.php.

SupplierProposal::$price
SupplierProposal::$total
Deprecated:
See also
total_ttc

Definition at line 123 of file supplier_proposal.class.php.

SupplierProposal::$tva
Deprecated:
See also
total_tva

Definition at line 118 of file supplier_proposal.class.php.


The documentation for this class was generated from the following file: