diff --git a/doc/developper/Doxyfile b/doc/developper/Doxyfile index 0b2500e64..4bcc02b8f 100644 --- a/doc/developper/Doxyfile +++ b/doc/developper/Doxyfile @@ -5,7 +5,7 @@ #--------------------------------------------------------------------------- PROJECT_NAME = phpcompta PROJECT_NUMBER = 1 -OUTPUT_DIRECTORY = /home/dany/developpement/phpcompta-dev/phpcompta/doc/developper +OUTPUT_DIRECTORY = . CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English USE_WINDOWS_ENCODING = NO @@ -24,8 +24,8 @@ ABBREVIATE_BRIEF = "The $name class" \ the ALWAYS_DETAILED_SEC = NO INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = YES -STRIP_FROM_PATH = /home/dany/tmp/doxygen-1.4.6/bin/ +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = STRIP_FROM_INC_PATH = SHORT_NAMES = NO JAVADOC_AUTOBRIEF = NO @@ -81,7 +81,7 @@ WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = /home/dany/developpement/phpcompta-dev/phpcompta/include /home/dany/developpement/phpcompta-dev/phpcompta/html +INPUT = ../../include ../../html FILE_PATTERNS = *.c \ *.cc \ *.cxx \ @@ -125,7 +125,7 @@ FILE_PATTERNS = *.c \ RECURSIVE = YES EXCLUDE = EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = a?.php b?.php ?.php +EXCLUDE_PATTERNS = a?.php b?.php ?.php test*.php EXAMPLE_PATH = EXAMPLE_PATTERNS = * EXAMPLE_RECURSIVE = NO @@ -137,7 +137,7 @@ FILTER_SOURCE_FILES = NO # configuration options related to source browsing #--------------------------------------------------------------------------- SOURCE_BROWSER = YES -INLINE_SOURCES = NO +INLINE_SOURCES = YES STRIP_CODE_COMMENTS = YES REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES @@ -164,7 +164,7 @@ CHM_FILE = HHC_LOCATION = GENERATE_CHI = NO BINARY_TOC = NO -TOC_EXPAND = NO +TOC_EXPAND = YES DISABLE_INDEX = NO ENUM_VALUES_PER_LINE = 4 GENERATE_TREEVIEW = NO diff --git a/doc/developper/html/ac__common_8php-source.html b/doc/developper/html/ac__common_8php-source.html index dce42e88b..4289b13ad 100644 --- a/doc/developper/html/ac__common_8php-source.html +++ b/doc/developper/html/ac__common_8php-source.html @@ -1,12 +1,12 @@
-00001 <? 00002 00003 /* @@ -193,16 +193,16 @@ 00286 if ( $max==0) return null; 00287 for ($i=0;$i<$max;$i++) { 00288 $row=pg_fetch_row($a); -00289 $r[$i]['value']=$row[0]; +00289 $r[$i]['value']=$row[0]; 00290 $r[$i]['label']=$row[1]; 00291 } 00292 // add a blank item ? 00293 if ( $p_null == 1 ) { 00294 for ($i=$max;$i!=0;$i--) { -00295 $r[$i]['value']= $r[$i-1]['value']; +00295 $r[$i]['value']= $r[$i-1]['value']; 00296 $r[$i]['label']= $r[$i-1]['label']; 00297 } -00298 $r[0]['value']=-1; +00298 $r[0]['value']=-1; 00299 $r[0]['label']=" "; 00300 } // if ( $p_null == 1 ) 00301 @@ -244,7 +244,7 @@ 00375 return $p_html; 00376 } 00377 ?> -
1.4.4
diff --git a/doc/developper/html/ac__common_8php.html b/doc/developper/html/ac__common_8php.html
index 4ef5f00f6..dab4d6bbb 100644
--- a/doc/developper/html/ac__common_8php.html
+++ b/doc/developper/html/ac__common_8php.html
@@ -1,12 +1,12 @@
-@@ -123,7 +123,23 @@ Definition at line 53 References isDate().
-Referenced by VerifData(), and VerifyOperationDate(). +Referenced by VerifData(), and VerifyOperationDate().
00053 { +00054 $l_date=isDate($p_date); +00055 $l2_date=isDate($p_date_oth); +00056 if ($l_date == null || $l2_date == null ) { +00057 echo "erreur date"; +00058 return null; +00059 } +00060 $l_adate=explode(".",$l_date); +00061 $l2_adate=explode(".",$l2_date); +00062 $l_mkdate=mktime(0,0,0,$l_adate[1],$l_adate[0],$l_adate[2]); +00063 $l2_mkdate=mktime(0,0,0,$l2_adate[1],$l2_adate[0],$l2_adate[2]); +00064 // si $p_date > $p_date_oth return > 0 +00065 return $l_mkdate-$l2_mkdate; +00066 } +
@@ -161,7 +177,15 @@ Decode the html for the widegt richtext and remove newline.
-Definition at line 371 of file ac_common.php. +Definition at line 371 of file ac_common.php.
00371 { +00372 $p_html=str_replace('%0D','',$p_html); +00373 $p_html=str_replace('%0A','',$p_html); +00374 $p_html=urldecode($p_html); +00375 return $p_html; +00376 } +
@@ -203,7 +227,15 @@ Definition at line 36 References echo_debug().
-Referenced by AddFiche(), AddForm(), AddModele(), DeleteRapt(), ExecSql(), form_verify_input(), FormAchInput(), FormAchView(), FormatString(), FormFin(), FormODS(), FormVenInput(), FormVenteView(), GetFicheJrn(), getPeriodeName(), GetTvaPoste(), Imp(), InsertRapt(), isValid(), Remove(), Document_modele::Save(), save_upload_document(), fiche::update(), UpdateFiche(), UpdateJrn(), UpdateModele(), VerifData(), and VerifyOperationDate(). +Referenced by AddFiche(), AddForm(), AddModele(), DeleteRapt(), ExecSql(), form_verify_input(), FormAchInput(), FormAchView(), FormatString(), FormFin(), FormODS(), FormVenInput(), FormVenteView(), GetFicheJrn(), getPeriodeName(), GetTvaPoste(), Imp(), InsertRapt(), isValid(), Remove(), Document_modele::Save(), save_upload_document(), fiche::update(), UpdateFiche(), UpdateJrn(), UpdateModele(), VerifData(), and VerifyOperationDate().
00036 { +00037 $fdebug=fopen("/tmp/phpcompta_error.log","a+"); +00038 fwrite($fdebug,date("Ymd H:i:s").$p_log."\n"); +00039 fclose($fdebug); +00040 echo_debug($p_log); +00041 } +
@@ -247,7 +279,12 @@ warns
Definition at line 269 of file ac_common.php.
-Referenced by GetFicheJrn(), and IsFicheOfJrn(). +Referenced by GetFicheJrn(), and IsFicheOfJrn().
+@@ -282,7 +319,13 @@ call cmpDate
Definition at line 120 of file ac_common.php.
-References isDate(). +References isDate().
00120 { +00121 if ( isDate($p_date)== null) return "null"; +00122 return "'".$p_date."'"; +00123 } +
@@ -324,7 +367,21 @@ Definition at line 208
References echo_error().
-Referenced by AddFiche(), AddForm(), AddModele(), action::Confirm(), fiche::CountByDef(), action::Display(), fiche::GetByQCode(), fiche::insert(), InsertJrn(), ListJrn(), RecordFin(), RecordInvoice(), RecordSell(), Remove(), parm_code::Save(), Document_modele::Save(), action::SaveStage2(), ShowActionList(), Supplier::Summary(), Customer::Summary(), contact::Summary(), Admin::Summary(), fiche::update(), action::Update(), UpdateComment(), UpdateFiche(), UpdateForm(), Own::UpdateRow(), and ViewJrn().
+Referenced by AddFiche(), AddForm(), AddModele(), action::Confirm(), fiche::CountByDef(), action::Display(), fiche::GetByQCode(), fiche::insert(), InsertJrn(), ListJrn(), RecordFin(), RecordInvoice(), RecordSell(), Remove(), parm_code::Save(), Document_modele::Save(), action::SaveStage2(), ShowActionList(), Supplier::Summary(), Customer::Summary(), contact::Summary(), Admin::Summary(), fiche::update(), action::Update(), UpdateComment(), UpdateFiche(), UpdateForm(), Own::UpdateRow(), and ViewJrn().
@@ -377,7 +434,20 @@ Return the period corresponding to the date.
Definition at line 355 of file ac_common.php.
-References $a, and ExecSql().
+References $a, and ExecSql().
@@ -429,7 +499,18 @@ Definition at line 335
-Referenced by ParseFormula().
+Referenced by ParseFormula().
@@ -486,7 +567,18 @@ Show the periode which found thanks its id.
Definition at line 315 of file ac_common.php.
-References $a, $ret, and echo_error().
+References $a, $ret, and echo_error().
@@ -518,7 +610,12 @@ Button logout.
-Definition at line 182 of file ac_common.php.
+Definition at line 182 of file ac_common.php.
@@ -575,7 +672,41 @@ Default page header for each page.
Definition at line 133 of file ac_common.php.
-References $cn, $Res, $style, DbConnect(), and ExecSql().
+References $cn, $Res, $style, DbConnect(), and ExecSql().
@@ -606,7 +737,13 @@ end tag
-Definition at line 170 of file ac_common.php.
+Definition at line 170 of file ac_common.php.
@@ -652,7 +789,27 @@ Definition at line 97
References echo_debug().
-Referenced by cmpDate(), action::Confirm(), form_verify_input(), formatDate(), ListJrn(), VerifData(), VerifyOperationDate(), and ViewJrn().
+Referenced by cmpDate(), action::Confirm(), form_verify_input(), formatDate(), ListJrn(), VerifData(), VerifyOperationDate(), and ViewJrn().
@@ -694,7 +851,18 @@ check if the argument is a number
Definition at line 76 of file ac_common.php.
-Referenced by AddFiche(), AddModele(), ComputeTotalVat(), ComputeVat(), DeleteRapt(), form_verify_input(), FormAchInput(), FormAchView(), FormODS(), FormVenInput(), FormVenteView(), fiche::insert(), InsertRapt(), RecordFin(), RecordInvoice(), RecordODS(), RecordSell(), Remove(), Document_modele::Save(), and fiche::update().
+Referenced by AddFiche(), AddModele(), ComputeTotalVat(), ComputeVat(), DeleteRapt(), form_verify_input(), FormAchInput(), FormAchView(), FormODS(), FormVenInput(), FormVenteView(), fiche::insert(), InsertRapt(), RecordFin(), RecordInvoice(), RecordODS(), RecordSell(), Remove(), Document_modele::Save(), and fiche::update().
@@ -750,9 +918,33 @@ make a array with the sql
Definition at line 282 of file ac_common.php.
-References $a, $i, $r, $row, label, and value.
+References $a, $i, $r, $row, label, and value.
-Referenced by action::Confirm(), action::Display(), Document_modele::form(), FormAchInput(), FormVenInput(), FormVenteView(), and ShowFormTransfert().
+Referenced by action::Confirm(), action::Display(), Document_modele::form(), FormAchInput(), FormVenInput(), FormVenteView(), and ShowFormTransfert().
@@ -786,7 +978,18 @@ Echo no access and stop.
Definition at line 192 of file ac_common.php.
-References exit.
+References exit.
@@ -855,10 +1058,42 @@ Definition at line 228
References $ret.
-Referenced by MenuAdmin(), ShowJrn(), ShowMenuAdvanced(), ShowMenuCompta(), ShowMenuDocument(), and ShowMenuParam().
+Referenced by MenuAdmin(), ShowJrn(), ShowMenuAdvanced(), ShowMenuCompta(), ShowMenuDocument(), and ShowMenuParam().
+
-
@@ -14,9 +14,9 @@
Go to the source code of this file.
Definition in file action.inc.php.
Definition at line 38 of file action.inc.php.
-References $a, $act, $fiche, $h_url, $qcode, $r, $retour, $sp, $w, FormatString(), name, qcode, and value.
+
-Definition at line 153 of file action.inc.php.
+Definition at line 154 of file action.inc.php.
Referenced by Document::Replace(), and ShowActionList().
-
@@ -202,9 +281,9 @@ Referenced by action:
-Definition at line 136 of file action.inc.php.
+Definition at line 137 of file action.inc.php.
-Referenced by action::Confirm(), and ShowActionList().
+Referenced by action::Confirm(), and ShowActionList().
@@ -229,9 +308,9 @@ Referenced by action:
-Definition at line 135 of file action.inc.php.
+Definition at line 136 of file action.inc.php.
-Referenced by action::Confirm(), and ShowActionList().
+Referenced by action::Confirm(), and ShowActionList().
@@ -256,10 +335,10 @@ Referenced by action:
-Definition at line 122 of file action.inc.php.
+Definition at line 123 of file action.inc.php.
-
-Definition at line 226 of file action.inc.php.
+Definition at line 229 of file action.inc.php.
-Referenced by action::SaveStage2().
@@ -308,9 +387,9 @@ Referenced by action:
-Definition at line 156 of file action.inc.php.
+Definition at line 157 of file action.inc.php.
-Referenced by action::Confirm(), action::get(), action::SaveStage2(), and action::Update().
+Referenced by action::Confirm(), action::get(), action::SaveStage2(), and action::Update().
@@ -335,18 +414,18 @@ Referenced by action:
-Definition at line 155 of file action.inc.php.
+Definition at line 156 of file action.inc.php.
-Referenced by Document::blank(), action::Display(), Document::get(), Document::Replace(), action::SaveStage2(), action::SaveStage3(), and action::Update().
+Referenced by Document::blank(), action::Display(), Document::get(), Document::Replace(), action::SaveStage2(), action::SaveStage3(), and action::Update().
-
-Definition at line 189 of file action.inc.php.
+Definition at line 192 of file action.inc.php.
-Referenced by action::Display(), action::get(), action::myList(), and action::SaveStage2().
+Referenced by action::Display(), action::get(), action::myList(), and action::SaveStage2().
-Definition at line 177 of file action.inc.php.
+Definition at line 179 of file action.inc.php.
-Referenced by action::Display(), action::get(), and action::myList().
+Referenced by action::Display(), action::get(), and action::myList().
-Definition at line 327 of file action.inc.php.
+Definition at line 333 of file action.inc.php.
@@ -441,18 +520,18 @@ Definition at line 327<
-Definition at line 157 of file action.inc.php.
+Definition at line 158 of file action.inc.php.
-Referenced by action::Confirm(), action::Display(), and action::get().
+Referenced by action::Confirm(), action::Display(), and action::get().
-
-Definition at line 161 of file action.inc.php.
+Definition at line 163 of file action.inc.php.
-Referenced by action::get(), action::myList(), and action::SaveStage2().
+Referenced by action::get(), action::myList(), and action::SaveStage2().
-Definition at line 162 of file action.inc.php.
+Definition at line 164 of file action.inc.php.
-Referenced by Document::blank(), action::Display(), Document::Document(), action::get(), action::myList(), Document::remove(), Document::SaveGenerated(), action::SaveStage3(), and action::Update().
+Referenced by Document::blank(), action::Display(), Document::Document(), action::get(), action::myList(), Document::remove(), Document::SaveGenerated(), action::SaveStage3(), and action::Update().
@@ -522,9 +601,9 @@ Referenced by Docum
-Definition at line 158 of file action.inc.php.
+Definition at line 159 of file action.inc.php.
-Referenced by action::Confirm(), action::Display(), Document::get(), action::get(), and action::SaveStage2().
+Referenced by action::Confirm(), action::Display(), Document::get(), action::get(), and action::SaveStage2().
@@ -551,18 +630,18 @@ class for the table document_type pk document_type
-Definition at line 159 of file action.inc.php.
+Definition at line 160 of file action.inc.php.
-Referenced by action::Confirm(), action::Display(), Document_type::document_type(), Document_modele::form(), Document_type::get(), action::get(), action::SaveStage2(), action::SaveStage3(), and action::Update().
+Referenced by action::Confirm(), action::Display(), Document_type::document_type(), Document_modele::form(), Document_type::get(), action::get(), action::SaveStage2(), action::SaveStage3(), and action::Update().
-
-Definition at line 312 of file action.inc.php.
+Definition at line 318 of file action.inc.php.
-Definition at line 310 of file action.inc.php.
+Definition at line 316 of file action.inc.php.
-Referenced by Document_modele::Document_modele(), Document_modele::myList(), Document_modele::Save(), and action::SaveStage2().
-Referenced by ChangeStock(), cl_user::Check(), cl_user::cl_user(), action::Confirm(), EncodeFiche(), EncodeForm(), EncodeModele(), form_verify_input(), FormAchView(), FormFin(), FormODS(), FormVenteView(), Supplier::GetFromPoste(), Customer::GetFromPoste(), cl_user::GetGlobalPref(), rapport::GetName(), poste::GetName(), jrn::GetName(), fiche::insert(), cl_user::insert_default_global_pref(), widget::IOValue(), jrn_navigation_bar(), MakeListingVat(), new_fiche(), Cpdf::o_font(), Cpdf::openFont(), rapport::rapport(), RecordJrn(), Document_modele::Save(), save_upload_document(), action::SaveStage2(), Cpdf::selectFont(), ShowActionList(), ShowFormTransfert(), contact::Summary(), u_ShowMenuRecherche(), fiche::update(), UpdateJrn(), Document::Upload(), Customer::VatListing(), VerifData(), VerifImport(), ViewFiche(), and ViewImp().
-Definition at line 160 of file action.inc.php.
+Definition at line 162 of file action.inc.php.
-Referenced by action::Display(), action::get(), Document::Replace(), ShowActionList(), and u_ShowMenuRecherche().
+Referenced by action::Display(), and action::get().
+
+
+
+Definition at line 161 of file action.inc.php.
+
+Referenced by action::Display(), and action::get().
-Definition at line 228 of file action.inc.php.
+Definition at line 231 of file action.inc.php.
-Referenced by ChangeStock(), action::Confirm(), widget::debug(), fiche_def_ref::Display(), DisplayDetailModele(), EncodeFiche(), EncodeForm(), Cezpdf::ezTable(), FormFin(), FormODS(), FormVenteView(), jrn::GetDefLine(), fiche::insert(), cl_user::insert_default_global_pref(), widget::IOValue(), jrn_navigation_bar(), fiche_def_ref::LoadAll(), make_array(), new_fiche(), Cpdf::o_fontDescriptor(), Document::ParseDocument(), RecordJrn(), action::SaveStage2(), ShowActionList(), contact::Summary(), u_ShowMenuRecherche(), fiche::update(), cl_user::update_global_pref(), UpdateJrn(), VerifImport(), ViewFiche(), ViewImp(), and widget::widget().
@@ -262,7 +262,7 @@ Referenced by GetNumberLi
Definition at line 119 of file admin_repo.php.
-Referenced by action::Confirm(), action::Display(), and u_ShowDossier().
+Referenced by action::Confirm(), action::Display(), and u_ShowDossier().
@@ -571,7 +571,7 @@ Definition at line 117<
Definition at line 42 of file admin_repo.php.
-
@@ -303,7 +303,7 @@ Definition at line 55251
@@ -156,7 +156,7 @@ Definition at line 35
Definition at line 40 of file bal_csv.php.
-
@@ -73,7 +73,7 @@ Definition in file balance.php
Definition at line 113 of file balance.php.
-Referenced by Cezpdf::alink(), Cpdf::ARC4(), fiche::blank(), Cezpdf::Cezpdf(), ComputeTotalVat(), ComputeVat(), action::Confirm(), fiche::CountByDef(), DbConnect(), fiche::Display(), action::Display(), Cpdf::ellipse(), action::get(), GetDataJrnPdf(), GetFicheJrn(), getFicheNameCode(), rapport::GetName(), GetParent(), getPeriodeFromDate(), getPeriodeFromMonth(), getPeriodeName(), GetRappel(), jrn::GetRow(), Balance::GetRow(), GetTvaPoste(), GetUserProperty(), GetVersion(), isValid(), ListJrn(), make_array(), MakeListingVat(), Document_modele::myList(), RecordJrn(), ShowActionList(), Supplier::Summary(), Customer::Summary(), Cezpdf::uline(), UpdateFiche(), UpdateJrn(), and withStock().
+Referenced by Cezpdf::alink(), Cpdf::ARC4(), fiche::blank(), Cezpdf::Cezpdf(), ComputeTotalVat(), ComputeVat(), action::Confirm(), fiche::CountByDef(), DbConnect(), fiche::Display(), action::Display(), Cpdf::ellipse(), GetDataJrnPdf(), GetFicheJrn(), getFicheNameCode(), rapport::GetName(), GetParent(), getPeriodeFromDate(), getPeriodeFromMonth(), getPeriodeName(), GetRappel(), jrn::GetRow(), Balance::GetRow(), GetTvaPoste(), GetUserProperty(), GetVersion(), isValid(), ListJrn(), make_array(), MakeListingVat(), Document_modele::myList(), RecordJrn(), ShowActionList(), Supplier::Summary(), Customer::Summary(), Cezpdf::uline(), UpdateFiche(), UpdateJrn(), and withStock().
@@ -356,7 +356,7 @@ Definition at line 70 o
Definition at line 36 of file balance.php.
-Referenced by AddFiche(), cl_user::Check(), action::Display(), ExecSql(), ExecuteScript(), FormAchInput(), FormAchView(), FormFin(), FormVenInput(), FormVenteView(), GetFicheJrn(), NoAccess(), Document::ParseDocument(), RecordFin(), RecordInvoice(), RecordODS(), RecordSell(), Document_modele::Save(), and TransferCSV().
+Referenced by AddFiche(), cl_user::Check(), action::Display(), ExecSql(), ExecuteScript(), FormAchInput(), FormAchView(), FormFin(), FormVenInput(), FormVenteView(), GetFicheJrn(), NoAccess(), Document::ParseDocument(), RecordFin(), RecordInvoice(), RecordODS(), RecordSell(), Document_modele::Save(), and TransferCSV().
@@ -413,7 +413,7 @@ Definition at line 71 o
Referenced by fiche::blank(), ListJrn(), Supplier::Summary(), Customer::Summary(), contact::Summary(), Admin::Summary(), VerifImport(), ViewFiche(), ViewRecord(), and widget::widget().
-
@@ -324,7 +324,7 @@ Referenced by Cezpdf::
Definition at line 33 of file bilan.php.
-
@@ -47,10 +47,10 @@ Definition in file cbc_be.inc
Definition at line 28 of file cbc_be.inc.php.
-Referenced by Centralise(), cl_user::cl_user(), Cezpdf::ezTable(), Document::Generate(), parm_code::Get(), fiche_def::Get(), Document_modele::Get(), Document::get(), action::get(), fiche_def::GetAll(), fiche::getAttribut(), fiche_def::GetAttribut(), fiche::GetByDef(), fiche::GetByType(), Supplier::GetFromPoste(), Customer::GetFromPoste(), cl_user::GetGlobalPref(), cl_user::GetPreferences(), ListJrn(), fiche_def_ref::LoadAll(), make_array(), Document_modele::myList(), action::myList(), Cpdf::openFont(), Own::Own(), Document::Send(), ShowDossier(), and fiche::strAttribut().
+Referenced by Centralise(), cl_user::cl_user(), Cezpdf::ezTable(), Document::Generate(), parm_code::Get(), fiche_def::Get(), Document_modele::Get(), Document::get(), action::get(), fiche_def::GetAll(), fiche::getAttribut(), fiche_def::GetAttribut(), fiche::GetByDef(), fiche::GetByType(), Supplier::GetFromPoste(), Customer::GetFromPoste(), cl_user::GetGlobalPref(), cl_user::GetPreferences(), ListJrn(), fiche_def_ref::LoadAll(), make_array(), Document_modele::myList(), action::myList(), Cpdf::openFont(), Own::Own(), Document::Send(), ShowDossier(), and fiche::strAttribut().
-
@@ -102,7 +102,7 @@ Definition at line 35 o
Definition at line 37 of file central.php.
-
@@ -76,7 +76,121 @@ Definition at line 36<
References $MaxJrn, $MaxLine, $Res, $Res2, $Ret, $row, $sql, Commit(), EndSql(), ExecSql(), and StartSql().
-Referenced by ShowMenuAdvanced().
+Referenced by ShowMenuAdvanced().
@@ -124,10 +238,16 @@ p_jnr_id jrn.jr_id gen :
Definition at line 159 of file central_inc.php.
-References $Res, and ExecSql().
+References $Res, and ExecSql().
+
-
@@ -92,7 +92,18 @@ Check if an user is allowed to do an action.
Definition at line 146 of file check_priv.php.
-References $cn, $Res, CheckIsAdmin(), DbConnect(), and ExecSql().
+References $cn, $Res, CheckIsAdmin(), DbConnect(), and ExecSql().
@@ -142,7 +153,23 @@ Check if an user has acces to a folder.
Definition at line 192 of file check_priv.php.
-References $cn, $sql, CheckIsAdmin(), CountSql(), and DbConnect().
+References $cn, $sql, CheckIsAdmin(), CountSql(), and DbConnect().
@@ -188,7 +215,21 @@ Definition at line 167<
References $cn, $sql, CountSql(), and DbConnect().
-Referenced by CheckAction(), CheckDossier(), and CheckJrn().
+Referenced by CheckAction(), CheckDossier(), and CheckJrn().
@@ -252,10 +293,99 @@ Definition at line 46
References $cn, $Res, $Res2, CheckIsAdmin(), CountSql(), DbConnect(), echo_debug(), and ExecSql().
-Referenced by ShowMenuJrnUser().
+Referenced by ShowMenuJrnUser().
+
-
-Definition at line 33 of file class_attribut.php.
+Definition at line 33 of file class_attribut.php.
+
-Definition at line 33 of file class_balance.php.
+Definition at line 33 of file class_balance.php.
+
Definition at line 53 of file class_balance.php.
-References $a, $array, $i, $M, $r, $Res, $sql, ExecSql(), GetPosteLibelle(), and label.
+References $a, $array, $i, $M, $r, $Res, $sql, ExecSql(), GetPosteLibelle(), and label.
+
References $a, $size, Cpdf::Cpdf(), Cpdf::getFirstPageId(), and size.
-Referenced by Creport::Creport().
+Referenced by Creport::Creport().
+
References $a, $i, $start, and start.
-Referenced by ezTable().
+Referenced by ezTable().
@@ -219,7 +367,16 @@ Referenced by ezTable(
-Definition at line 1460 of file class.ezpdf.php.
+Definition at line 1460 of file class.ezpdf.php.
@@ -251,7 +408,41 @@ Definition at line 146
Definition at line 144 of file class.ezpdf.php.
-References Cpdf::$options, and width.
+References Cpdf::$options, and width.
@@ -280,7 +471,18 @@ References Cpdf::$option
-Definition at line 177 of file class.ezpdf.php.
+Definition at line 177 of file class.ezpdf.php.
@@ -309,7 +511,13 @@ Definition at line 177
-Definition at line 266 of file class.ezpdf.php.
+Definition at line 266 of file class.ezpdf.php.
@@ -374,7 +582,127 @@ Definition at line 266
Definition at line 1301 of file class.ezpdf.php.
-References width.
+References width.
@@ -419,7 +747,24 @@ References width. <
-Definition at line 187 of file class.ezpdf.php.
+Definition at line 187 of file class.ezpdf.php.
@@ -452,7 +797,48 @@ Definition at line 204
References Cpdf::newPage(), and width.
-Referenced by ezPrvtTableColumnHeadings(), ezSetDy(), ezSetMargins(), ezSetY(), ezTable(), and ezText().
+Referenced by ezPrvtTableColumnHeadings(), ezSetDy(), ezSetMargins(), ezSetY(), ezTable(), and ezText().
@@ -484,7 +870,13 @@ Referenced by ezPrvtTa
Definition at line 461 of file class.ezpdf.php.
-References ezPRVTcleanUp(), and Cpdf::output().
+References ezPRVTcleanUp(), and Cpdf::output().
@@ -518,7 +910,16 @@ Definition at line 119
References $search.
-Referenced by ezTable(), and ezText().
+Referenced by ezTable(), and ezText().
@@ -551,7 +952,77 @@ Definition at line 377
References $l, $num, $tmp, $w, Cpdf::addText(), Cpdf::closeObject(), ezPRVTpageNumberSearch(), Cpdf::getTextWidth(), Cpdf::reopenObject(), and size.
-Referenced by ezPRVTcleanUp().
+Referenced by ezPRVTcleanUp().
@@ -584,7 +1055,12 @@ Definition at line 448
References ezPRVTaddPageNumbers().
-Referenced by ezOutput(), and ezStream().
+Referenced by ezOutput(), and ezStream().
@@ -627,7 +1103,22 @@ Definition at line 591
References $w, Cpdf::getTextWidth(), Cpdf::line(), and size.
-Referenced by ezTable().
+Referenced by ezTable().
@@ -670,7 +1161,23 @@ Definition at line 360
References $i.
-Referenced by ezPRVTaddPageNumbers().
+Referenced by ezPRVTaddPageNumbers().
@@ -755,7 +1262,71 @@ Definition at line 526
References $ok, Cpdf::$options, $y, ezNewPage(), ezSetY(), ezText(), size, start, and Cpdf::transaction().
-Referenced by ezTable().
+Referenced by ezTable().
@@ -852,7 +1423,35 @@ Definition at line 497
References $n, $x, Cpdf::line(), Cpdf::setLineStyle(), and Cpdf::setStrokeColor().
-Referenced by ezTable().
+Referenced by ezTable().
@@ -905,7 +1504,16 @@ Referenced by ezTable(
Definition at line 134 of file class.ezpdf.php.
-References $right, and ezSetMargins().
+References $right, and ezSetMargins().
@@ -946,7 +1554,24 @@ References $right, an
Definition at line 479 of file class.ezpdf.php.
-References ezNewPage().
+References ezNewPage().
@@ -1001,7 +1626,26 @@ Definition at line 246
References $right, and ezNewPage().
-Referenced by ezSetCmMargins().
+Referenced by ezSetCmMargins().
@@ -1035,7 +1679,17 @@ Definition at line 468
References $y, and ezNewPage().
-Referenced by ezPrvtTableColumnHeadings(), and ezTable().
+Referenced by ezPrvtTableColumnHeadings(), and ezTable().
@@ -1090,7 +1744,32 @@ Definition at line 273
-Referenced by ezWhatPageNumber().
+Referenced by ezWhatPageNumber().
@@ -1137,7 +1816,35 @@ Referenced by ezWhatPa
Definition at line 331 of file class.ezpdf.php.
-References $i.
+References $i.
@@ -1169,7 +1876,13 @@ References $i.
Definition at line 454 of file class.ezpdf.php.
-References ezPRVTcleanUp(), and Cpdf::stream().
+References ezPRVTcleanUp(), and Cpdf::stream().
@@ -1222,7 +1935,595 @@ References ezPRVTclean
Definition at line 607 of file class.ezpdf.php.
-References $height, $ok, Cpdf::$options, $p, $row, $start, $t, $w, $x, $y, Cpdf::addObject(), Cpdf::addText(), Cpdf::addTextWrap(), alink(), Cpdf::closeObject(), ezNewPage(), ezProcessText(), ezPrvtGetTextWidth(), ezPrvtTableColumnHeadings(), ezPrvtTableDrawLines(), ezSetY(), Cpdf::filledRectangle(), Cpdf::getFontDecender(), Cpdf::getFontHeight(), Cpdf::getTextWidth(), Cpdf::line(), Cpdf::newPage(), Cpdf::openObject(), Cpdf::reopenObject(), Cpdf::restoreState(), Cpdf::saveState(), Cpdf::setColor(), Cpdf::setLineStyle(), Cpdf::setStrokeColor(), start, Cpdf::transaction(), value, and width.
+References $height, $ok, Cpdf::$options, $p, $row, $start, $t, $w, $x, $y, Cpdf::addObject(), Cpdf::addText(), Cpdf::addTextWrap(), alink(), Cpdf::closeObject(), ezNewPage(), ezProcessText(), ezPrvtGetTextWidth(), ezPrvtTableColumnHeadings(), ezPrvtTableDrawLines(), ezSetY(), Cpdf::filledRectangle(), Cpdf::getFontDecender(), Cpdf::getFontHeight(), Cpdf::getTextWidth(), Cpdf::line(), Cpdf::newPage(), Cpdf::openObject(), Cpdf::reopenObject(), Cpdf::restoreState(), Cpdf::saveState(), Cpdf::setColor(), Cpdf::setLineStyle(), Cpdf::setStrokeColor(), start, Cpdf::transaction(), value, and width.
@@ -1277,7 +2578,102 @@ Definition at line 120
References $height, Cpdf::$options, $right, $size, $start, Cpdf::addTextWrap(), ezNewPage(), ezProcessText(), Cpdf::getFontHeight(), Cpdf::line(), size, and start.
-Referenced by ezPrvtTableColumnHeadings().
+Referenced by ezPrvtTableColumnHeadings().
@@ -1320,7 +2716,38 @@ Definition at line 299
References $num, $start, Cpdf::addMessage(), and ezStartPageNumbers().
-Referenced by Creport::rf().
+Referenced by Creport::rf().
@@ -1350,7 +2777,12 @@ Referenced by Creport::rf()<
-Definition at line 1469 of file class.ezpdf.php.
+Definition at line 1469 of file class.ezpdf.php.
@@ -1382,7 +2814,43 @@ Definition at line 146
Definition at line 1423 of file class.ezpdf.php.
-References $code.
+References $code.
@@ -1414,7 +2882,42 @@ References $code.
Definition at line 1518 of file class.ezpdf.php.
-References $a, $i, $start, and start.
+References $a, $i, $start, and start.
+
References newDocument(), and setFontFamily().
-Referenced by Cezpdf::Cezpdf().
+Referenced by Cezpdf::Cezpdf().
+
private
-Definition at line 1648 of file class.pdf.php.
+Definition at line 1648 of file class.pdf.php.
@@ -370,7 +385,19 @@ create a labelled destination within the document
Definition at line 2969 of file class.pdf.php.
-Referenced by Creport::rf().
+Referenced by Creport::rf().
@@ -433,7 +460,64 @@ Referenced by Creport::rf()<
add an image into the document, from a GD object this function is not all that reliable, and I would probably encourage people to use the file based functions
-Definition at line 2870 of file class.pdf.php.
+Definition at line 2870 of file class.pdf.php.
@@ -472,7 +556,22 @@ Definition at line 2870<
add content to the documents info object
-Definition at line 2590 of file class.pdf.php.
+Definition at line 2590 of file class.pdf.php.
@@ -531,7 +630,14 @@ add a link in the document to an internal destination (ie. within the document)
Definition at line 1173 of file class.pdf.php.
-References label.
+References label.
@@ -588,7 +694,48 @@ References label.
add a JPEG image into the document, from a file
-Definition at line 2825 of file class.pdf.php.
+Definition at line 2825 of file class.pdf.php.
@@ -664,7 +811,23 @@ Definition at line 2825<
common code used by the two JPEG adding functions
private
-Definition at line 2931 of file class.pdf.php.
+Definition at line 2931 of file class.pdf.php.
@@ -721,7 +884,14 @@ Definition at line 2931<
add a link in the document to an external URL
-Definition at line 1164 of file class.pdf.php.
+Definition at line 1164 of file class.pdf.php.
@@ -753,7 +923,12 @@ used to add messages for use in debugging
Definition at line 3022 of file class.pdf.php.
-Referenced by Cezpdf::ezWhatPageNumber(), and o_font().
+Referenced by Cezpdf::ezWhatPageNumber(), and o_font().
@@ -794,7 +969,51 @@ after an object has been created, it wil only show if it has been added, using t
Definition at line 2544 of file class.pdf.php.
-Referenced by Cezpdf::ezTable().
+Referenced by Cezpdf::ezTable().
@@ -851,7 +1070,193 @@ Referenced by Cezpdf::
add a PNG image into the document, from a file this should work with remote files
-Definition at line 2637 of file class.pdf.php.
+Definition at line 2637 of file class.pdf.php.
@@ -916,7 +1321,96 @@ add text to the document, at a specified location, size and angle on the page
Definition at line 2156 of file class.pdf.php.
-Referenced by Creport::dots(), Cezpdf::ezPRVTaddPageNumbers(), and Cezpdf::ezTable().
+Referenced by Creport::dots(), Cezpdf::ezPRVTaddPageNumbers(), and Cezpdf::ezTable().
@@ -993,7 +1487,118 @@ add text to the page, but ensure that it fits within a certain width if it does
Definition at line 2331 of file class.pdf.php.
-Referenced by Cezpdf::ezTable(), and Cezpdf::ezText().
+Referenced by Cezpdf::ezTable(), and Cezpdf::ezText().
@@ -1025,7 +1630,27 @@ ARC4 encrypt a text string
Definition at line 1138 of file class.pdf.php.
-References $a, $b, $c, and $t.
+References $a, $b, $c, and $t.
@@ -1057,7 +1682,31 @@ initialize the ARC4 encryption
Definition at line 1112 of file class.pdf.php.
-References $i, and $t.
+References $i, and $t.
@@ -1086,7 +1735,11 @@ References $i, and
should be used for internal checks, not implemented as yet
-Definition at line 1214 of file class.pdf.php.
+Definition at line 1214 of file class.pdf.php.
@@ -1117,7 +1770,20 @@ close an object
Definition at line 2518 of file class.pdf.php.
-Referenced by Cezpdf::ezPRVTaddPageNumbers(), and Cezpdf::ezTable().
+Referenced by Cezpdf::ezPRVTaddPageNumbers(), and Cezpdf::ezTable().
@@ -1192,7 +1858,15 @@ Referenced by Cezpdf::
draw a bezier curve based on 4 control points
-Definition at line 1682 of file class.pdf.php.
+Definition at line 1682 of file class.pdf.php.
@@ -1282,7 +1956,71 @@ draws an ellipse in the current line style centered at $x0,$y0, radii $r1,$r2 if
Definition at line 1713 of file class.pdf.php.
-References $a, $c1, $i, and $tmp.
+References $a, $c1, $i, and $tmp.
@@ -1314,7 +2052,19 @@ initialize the encryption for processing a particular object
Definition at line 1098 of file class.pdf.php.
-References $tmp.
+References $tmp.
@@ -1389,7 +2139,12 @@ References $
draw a filled ellipse
-Definition at line 1699 of file class.pdf.php.
+Definition at line 1699 of file class.pdf.php.
@@ -1444,7 +2199,12 @@ Definition at line 1835<
References width.
-Referenced by Cezpdf::ezTable().
+Referenced by Cezpdf::ezTable().
@@ -1477,7 +2237,21 @@ private
Definition at line 1958 of file class.pdf.php.
-Referenced by o_info().
+Referenced by o_info().
@@ -1508,7 +2282,12 @@ function for the user to find out what the ID is of the first page that was crea
Definition at line 1639 of file class.pdf.php.
-Referenced by Cezpdf::Cezpdf().
+Referenced by Cezpdf::Cezpdf().
@@ -1542,7 +2321,17 @@ Definition at line 1943<
-Referenced by Cezpdf::ezTable().
+Referenced by Cezpdf::ezTable().
@@ -1576,7 +2365,17 @@ Definition at line 1929<
-Referenced by Cezpdf::ezTable(), and Cezpdf::ezText().
+Referenced by Cezpdf::ezTable(), and Cezpdf::ezText().
@@ -1617,7 +2416,55 @@ calculate how wide a given text string will be on a page, at a given size. this
Definition at line 2248 of file class.pdf.php.
-Referenced by Cezpdf::ezPRVTaddPageNumbers(), Cezpdf::ezPrvtGetTextWidth(), and Cezpdf::ezTable().
+Referenced by Cezpdf::ezPRVTaddPageNumbers(), Cezpdf::ezPrvtGetTextWidth(), and Cezpdf::ezTable().
@@ -1670,7 +2517,12 @@ draw a line from one set of coordinates to another
Definition at line 1675 of file class.pdf.php.
-Referenced by Creport::dots(), Cezpdf::ezPrvtGetTextWidth(), Cezpdf::ezPrvtTableDrawLines(), Cezpdf::ezTable(), and Cezpdf::ezText().
+Referenced by Creport::dots(), Cezpdf::ezPrvtGetTextWidth(), Cezpdf::ezPrvtTableDrawLines(), Cezpdf::ezTable(), and Cezpdf::ezText().
@@ -1702,7 +2554,17 @@ calculate the 16 byte version of the 128 bit md5 digest of the string
Definition at line 1086 of file class.pdf.php.
-References $tmp.
+References $tmp.
@@ -1735,7 +2597,38 @@ private
Definition at line 1267 of file class.pdf.php.
-Referenced by Cpdf().
+Referenced by Cpdf().
@@ -1784,7 +2677,52 @@ Definition at line 1851<
References $opt.
-Referenced by Cezpdf::ezNewPage(), and Cezpdf::ezTable().
+Referenced by Cezpdf::ezNewPage(), and Cezpdf::ezTable().
@@ -1831,7 +2769,47 @@ an action object, used to link to URLS initially
Definition at line 726 of file class.pdf.php.
-References $o, $res, and label.
+References $o, $res, and label.
@@ -1878,7 +2856,57 @@ an annotation object, this will add an annotation to the current page. initially
Definition at line 769 of file class.pdf.php.
-References $label, $o, $res, and label.
+References $label, $o, $res, and label.
@@ -1927,7 +2955,55 @@ Definition at line 297
References $action, $o, $options, $res, o_viewerPreferences(), and openHere().
-Referenced by o_outlines(), and o_pages().
+Referenced by o_outlines(), and o_pages().
@@ -1974,7 +3050,55 @@ the contents objects hold all of the content which appears on pages
Definition at line 890 of file class.pdf.php.
-References $o, $res, and $tmp.
+References $o, $res, and $tmp.
@@ -2021,7 +3145,40 @@ destination object, used to specify the location for the user to jump to, presen
Definition at line 224 of file class.pdf.php.
-References $action, $o, $options, $res, and $tmp.
+References $action, $o, $options, $res, and $tmp.
@@ -2068,7 +3225,71 @@ encryption object.
Definition at line 1015 of file class.pdf.php.
-References $action, $o, $res, and $tmp.
+References $action, $o, $res, and $tmp.
@@ -2115,7 +3336,89 @@ an object to hold the font description
Definition at line 475 of file class.pdf.php.
-References $o, $options, $res, addMessage(), name, o_fontEncoding(), and o_pages().
+References $o, $options, $res, addMessage(), name, o_fontEncoding(), and o_pages().
@@ -2162,7 +3465,56 @@ a font descriptor, needed for including additional fonts
Definition at line 559 of file class.pdf.php.
-References $o, $res, label, and value.
+References $o, $res, label, and value.
@@ -2211,7 +3563,42 @@ Definition at line 610
References $label, $num, $o, $res, and label.
-Referenced by o_font().
+Referenced by o_font().
@@ -2258,7 +3645,80 @@ an image object, will be an XObject in the document, includes description and da
Definition at line 940 of file class.pdf.php.
-References $action, $o, $res, $tmp, and label.
+References $action, $o, $res, $tmp, and label.
@@ -2305,7 +3765,49 @@ define the document information
Definition at line 682 of file class.pdf.php.
-References $o, $res, and filterText().
+References $o, $res, and filterText().
@@ -2352,7 +3854,35 @@ define the outlines in the doc, empty for now
Definition at line 445 of file class.pdf.php.
-References $o, $options, $res, and o_catalog().
+References $o, $options, $res, and o_catalog().
@@ -2399,7 +3929,74 @@ a page object, it also creates a contents object to hold its contents
Definition at line 821 of file class.pdf.php.
-References $count, $o, and $res.
+References $count, $o, and $res.
@@ -2448,7 +4045,103 @@ Definition at line 347
References $i, $o, $options, $res, $tmp, label, and o_catalog().
-Referenced by o_font(), and o_procset().
+Referenced by o_font(), and o_procset().
@@ -2495,7 +4188,40 @@ the document procset, solves some problems with printing to old PS printers
Definition at line 647 of file class.pdf.php.
-References $o, $options, $res, label, and o_pages().
+References $o, $options, $res, label, and o_pages().
@@ -2544,7 +4270,43 @@ Definition at line 259
-Referenced by o_catalog().
+Referenced by o_catalog().
@@ -2577,7 +4339,111 @@ private
Definition at line 1306 of file class.pdf.php.
-References $bits, $data, $file, $i, $row, $tmp, and name.
+References $bits, $data, $file, $i, $row, $tmp, and name.
@@ -2630,7 +4496,25 @@ specify where the document should open when it first starts
Definition at line 2949 of file class.pdf.php.
-Referenced by o_catalog().
+Referenced by o_catalog().
@@ -2661,7 +4545,20 @@ make a loose object, the output will go into this object, until it is closed, th
Definition at line 2490 of file class.pdf.php.
-Referenced by Cezpdf::ezTable().
+Referenced by Cezpdf::ezTable().
@@ -2695,7 +4592,48 @@ Definition at line 1220<
References $tmp.
-Referenced by Cezpdf::ezOutput().
+Referenced by Cezpdf::ezOutput().
@@ -2770,7 +4708,12 @@ Referenced by Cezpdf::
draw a part of an ellipse
-Definition at line 1692 of file class.pdf.php.
+Definition at line 1692 of file class.pdf.php.
@@ -2815,7 +4758,21 @@ Definition at line 1692<
draw a polygon, the syntax for this is similar to the GD polygon command
-Definition at line 1818 of file class.pdf.php.
+Definition at line 1818 of file class.pdf.php.
@@ -2861,7 +4818,18 @@ Definition at line 1818<
extract an integer from a position in a byte stream
private
-Definition at line 2623 of file class.pdf.php.
+Definition at line 2623 of file class.pdf.php.
@@ -2925,7 +4893,33 @@ Definition at line 2623<
do a part of the calculation for sorting out the justification of the text
private
-Definition at line 2300 of file class.pdf.php.
+Definition at line 2300 of file class.pdf.php.
@@ -2971,7 +4965,14 @@ Definition at line 2300<
wrapper function for PRVTcheckTextDirective1
private
-Definition at line 1993 of file class.pdf.php.
+Definition at line 1993 of file class.pdf.php.
@@ -3053,7 +5054,153 @@ Definition at line 1993<
checks if the text stream contains a control directive if so then makes some changes and returns the number of characters involved in the directive this has been re-worked to include everything neccesary to fins the current writing point, so that the location can be sent to the callback function if required if the directive does not require a font change, then $f should be set to 0
private
-Definition at line 2008 of file class.pdf.php.
+Definition at line 2008 of file class.pdf.php.
@@ -3117,7 +5264,19 @@ Definition at line 2008<
given a start position and information about how text is to be laid out, calculate where on the page the text will end
private
-Definition at line 1977 of file class.pdf.php.
+Definition at line 1977 of file class.pdf.php.
@@ -3170,7 +5329,12 @@ draw a rectangle, note that it is the width and height of the rectangle which ar
Definition at line 1843 of file class.pdf.php.
-References width.
+References width.
@@ -3202,7 +5366,18 @@ open an existing object for editing
Definition at line 2505 of file class.pdf.php.
-Referenced by Cezpdf::ezPRVTaddPageNumbers(), and Cezpdf::ezTable().
+Referenced by Cezpdf::ezPRVTaddPageNumbers(), and Cezpdf::ezTable().
@@ -3234,7 +5409,21 @@ restore a previously saved state
Definition at line 2471 of file class.pdf.php.
-Referenced by Creport::dots(), and Cezpdf::ezTable().
+Referenced by Creport::dots(), and Cezpdf::ezTable().
@@ -3266,7 +5455,29 @@ this will be called at a new page to return the state to what it was on the end
Definition at line 2447 of file class.pdf.php.
-Referenced by Creport::dots(), and Cezpdf::ezTable().
+Referenced by Creport::dots(), and Cezpdf::ezTable().
@@ -3313,7 +5524,190 @@ if the font is not loaded then load it and make the required object else just ma
Definition at line 1417 of file class.pdf.php.
-References $d, $data, $i, $list, $num, $tmp, extra, name, and width.
+References $d, $data, $i, $list, $num, $tmp, extra, name, and width.
@@ -3366,7 +5760,15 @@ sets the colour for fill operations
Definition at line 1655 of file class.pdf.php.
-Referenced by Cezpdf::ezTable().
+Referenced by Cezpdf::ezTable().
@@ -3397,7 +5799,32 @@ sets up the current font, based on the font families, and the current text state
private
-Definition at line 1611 of file class.pdf.php.
+Definition at line 1611 of file class.pdf.php.
@@ -3444,7 +5871,35 @@ set the encryption of the document can be used to turn it on and/or set the pass
Definition at line 1184 of file class.pdf.php.
-References $p, and print.
+References $p, and print.
@@ -3485,7 +5940,42 @@ define font families, this is used to initialize the font families for the defau
Definition at line 2985 of file class.pdf.php.
-Referenced by Cpdf().
+Referenced by Cpdf().
@@ -3546,7 +6036,34 @@ Definition at line 1789<
References width.
-Referenced by Creport::dots(), Cezpdf::ezPrvtTableDrawLines(), and Cezpdf::ezTable().
+Referenced by Creport::dots(), Cezpdf::ezPrvtTableDrawLines(), and Cezpdf::ezTable().
@@ -3585,7 +6102,19 @@ Referenced by Creport::dots(
set the viewer preferences of the document, it is up to the browser to obey these.
-Definition at line 2607 of file class.pdf.php.
+Definition at line 2607 of file class.pdf.php.
@@ -3638,7 +6167,15 @@ sets the colour for stroke operations
Definition at line 1665 of file class.pdf.php.
-Referenced by Cezpdf::ezPrvtTableDrawLines(), and Cezpdf::ezTable().
+Referenced by Cezpdf::ezPrvtTableDrawLines(), and Cezpdf::ezTable().
@@ -3668,7 +6205,16 @@ Referenced by Cezpdf::
stop an object from appearing on pages from this point on
-Definition at line 2533 of file class.pdf.php.
+Definition at line 2533 of file class.pdf.php.
@@ -3702,7 +6248,35 @@ Definition at line 1899<
References $tmp.
-Referenced by Cezpdf::ezStream().
+Referenced by Cezpdf::ezStream().
@@ -3734,7 +6308,52 @@ a few functions which should allow the document to be treated transactionally.
Definition at line 3029 of file class.pdf.php.
-Referenced by Cezpdf::ezPrvtTableColumnHeadings(), and Cezpdf::ezTable().
+Referenced by Cezpdf::ezPrvtTableColumnHeadings(), and Cezpdf::ezTable().
+
Definition at line 28 of file readme.php.
-References Cezpdf::Cezpdf().
+References Cezpdf::Cezpdf().
+
Definition at line 43 of file readme.php.
-References $size, $tmp, $xpos, Cpdf::addText(), Cpdf::line(), Cpdf::restoreState(), Cpdf::saveState(), Cpdf::setLineStyle(), and size.
+References $size, $tmp, $xpos, Cpdf::addText(), Cpdf::line(), Cpdf::restoreState(), Cpdf::saveState(), Cpdf::setLineStyle(), and size.
@@ -133,7 +166,19 @@ References $size,
Definition at line 32 of file readme.php.
-References $num, $tmp, Cpdf::addDestination(), and Cezpdf::ezWhatPageNumber().
+References $num, $tmp, Cpdf::addDestination(), and Cezpdf::ezWhatPageNumber().
+
Definition at line 49 of file class_customer.php.
-References fiche::fiche().
+References fiche::fiche().
+
Definition at line 57 of file class_customer.php.
-References $Res, $row, $sql, ExecSql(), f_id, and name.
+References $Res, $row, $sql, ExecSql(), f_id, and name.
-Referenced by VatListing().
+Referenced by VatListing().
@@ -160,7 +184,80 @@ parm :
Definition at line 195 of file class_customer.php.
-References $a, $bar, $e, $offset, $page, $r, $search, $url, fiche::CountByDef(), FormatString(), fiche::GetAll(), jrn_navigation_bar(), poste, and table.
+References $a, $bar, $e, $offset, $page, $r, $search, $url, fiche::CountByDef(), FormatString(), fiche::GetAll(), jrn_navigation_bar(), poste, and table.
@@ -201,7 +298,110 @@ Get all the info for making a vat listing for the vat administration.
Definition at line 84 of file class_customer.php.
-References $a_Res, $c, $customer, $e, $Res, $Res2, $sql, $t, ExecSql(), GetFromPoste(), and name.
+References $a_Res, $c, $customer, $e, $Res, $Res2, $sql, $t, ExecSql(), GetFromPoste(), and name.
+
Definition at line 42 of file class_document.php.
-References d_id.
+References d_id.
-Referenced by SaveGenerated().
+Referenced by SaveGenerated().
+
Definition at line 326 of file class_document.php.
-References $r.
+References $r.
@@ -180,7 +195,20 @@ insert a minimal document and set the d_id
Definition at line 49 of file class_document.php.
-References $sql, ag_id, d_id, ExecSql(), and NextSequence().
+References $sql, ag_id, d_id, ExecSql(), and NextSequence().
@@ -220,7 +248,70 @@ Generate the document, Call $this->Replace to replace tag by value.
Definition at line 71 of file class_document.php.
-References $Res, $ret, $row, Commit(), echo_debug(), ExecSql(), md_type, NextSequence(), ParseDocument(), SaveGenerated(), and StartSql().
+References $Res, $ret, $row, Commit(), echo_debug(), ExecSql(), md_type, NextSequence(), ParseDocument(), SaveGenerated(), and StartSql().
@@ -253,7 +344,24 @@ Get complete all the data member thx info from the database.
Definition at line 375 of file class_document.php.
-References $ret, $row, $sql, ag_id, and d_state.
+References $ret, $row, $sql, ag_id, and d_state.
@@ -292,7 +400,17 @@ Move a document from the table document into the concerned row the document is n
Definition at line 733 of file class_document.php.
-References $sql, and ExecSql().
+References $sql, and ExecSql().
@@ -352,9 +470,90 @@ ParseDocument
Definition at line 145 of file class_document.php.
-References $h, echo_debug(), exit, Replace(), and value.
+References $h, echo_debug(), exit, Replace(), and value.
-Referenced by Generate().
+Referenced by Generate().
@@ -387,7 +586,13 @@ remove a row from the table document, the lob object is not deleted because can
Definition at line 722 of file class_document.php.
-References $sql, d_id, and ExecSql().
+References $sql, d_id, and ExecSql().
@@ -433,9 +638,297 @@ replace the TAG by the real value, this value can be into the database or in $_P
Definition at line 423 of file class_document.php.
-References $act, $my, $p, $poste, $qcode, $r, ag_id, break, fiche, GetTvaRate(), MY_COMMUNE, MY_CP, MY_FAX, MY_NAME, MY_NUMBER, MY_PAYS, MY_STREET, MY_TEL, MY_TVA, and qcode.
+References $act, $my, $p, $poste, $qcode, $r, ag_id, break, fiche, GetTvaRate(), MY_COMMUNE, MY_CP, MY_FAX, MY_NAME, MY_NUMBER, MY_PAYS, MY_STREET, MY_TEL, and MY_TVA.
-Referenced by ParseDocument().
+Referenced by ParseDocument().
@@ -475,9 +968,36 @@ SaveGenerated
Definition at line 238 of file class_document.php.
-References $doc, $sql, Commit(), d_id, Document(), echo_debug(), ExecSql(), GetSequence(), Rollback(), and StartSql().
+References $doc, $sql, Commit(), d_id, Document(), echo_debug(), ExecSql(), GetSequence(), Rollback(), and StartSql().
-Referenced by Generate().
+Referenced by Generate().
@@ -508,7 +1028,44 @@ Referenced by Gener
Definition at line 337 of file class_document.php.
-References $file, $ret, $row, $tmp, Commit(), ExecSql(), and StartSql().
+References $file, $ret, $row, $tmp, Commit(), ExecSql(), and StartSql().
@@ -543,7 +1100,58 @@ Upload
Definition at line 271 of file class_document.php.
-References $old_oid, $r, $ret, $sql, Commit(), ExecSql(), name, Rollback(), and StartSql().
+References $old_oid, $r, $ret, $sql, Commit(), ExecSql(), name, Rollback(), and StartSql().
+
-References $p_id, and md_id.
+References $p_id, and md_id.
+
Definition at line 179 of file class_document_modele.php.
-References $r, $res, $sql, Commit(), ExecSql(), and StartSql().
+References $r, $res, $sql, Commit(), ExecSql(), and StartSql().
@@ -164,9 +189,40 @@ show the form for loading a template
Definition at line 252 of file class_document_modele.php.
-References $h, $r, $start, $t, $w, dt_id, and make_array().
+References $h, $r, $start, $t, $w, dt_id, and make_array().
-Referenced by myList().
+Referenced by myList().
@@ -215,7 +271,47 @@ Parse and remplace the tag in the invoice By the value found in quant_sold.
Definition at line 204 of file class_document_modele.php.
-References $file, $ret, $row, $tmp, Commit(), ExecSql(), and StartSql().
+References $file, $ret, $row, $tmp, Commit(), ExecSql(), and StartSql().
@@ -249,7 +345,47 @@ References $
Definition at line 49 of file class_document_modele.php.
-References $a, $all, $c, $r, $Res, $row, $sql, ExecSql(), form(), md_id, and md_name.
+References $a, $all, $c, $r, $Res, $row, $sql, ExecSql(), form(), md_id, and md_name.
@@ -286,7 +422,80 @@ none
Definition at line 103 of file class_document_modele.php.
-References $old_oid, $r, $ret, $Ret, $sql, Commit(), echo_debug(), echo_error(), ExecSql(), exit, FormatString(), isNumber(), md_id, name, NextSequence(), Rollback(), start, and StartSql().
+References $old_oid, $r, $ret, $Ret, $sql, Commit(), echo_debug(), echo_error(), ExecSql(), exit, FormatString(), isNumber(), md_id, name, NextSequence(), Rollback(), start, and StartSql().
+
Definition at line 35 of file class_document_type.php.
-References dt_id.
+References dt_id.
@@ -90,12 +96,21 @@ Get all the data for this dt_id.
Definition at line 43 of file class_document_type.php.
-References $r, $sql, dt_id, and ExecSql().
+References $r, $sql, dt_id, and ExecSql().
+
-References $Res, $row, and ExecSql().
+References $Res, $row, and ExecSql().
+
Definition at line 62 of file class_own.php.
-References MY_COMMUNE, MY_CP, MY_FAX, MY_NAME, MY_NUMBER, MY_PAYS, MY_STREET, MY_TEL, and MY_TVA.
+References MY_COMMUNE, MY_CP, MY_FAX, MY_NAME, MY_NUMBER, MY_PAYS, MY_STREET, MY_TEL, and MY_TVA.
@@ -131,7 +159,13 @@ Update a row.
Definition at line 51 of file class_own.php.
-References FormatString().
+References FormatString().
+
Go to the source code of this file.
Go to the source code of this file.
The table document_type are the possible actions
-Definition in file class_action.php.
@@ -67,10 +67,25 @@ Definition at line
-Referenced by fiche::getAttribut().
+Referenced by fiche::getAttribut().
+
-
@@ -23,7 +23,7 @@ Class for manipulating data to print the balance of account.
-Definition in file class_balance.php.
@@ -23,7 +23,7 @@ class for the contact, contact are derived from ficheContact are a card which ar
-Definition in file class_contact.php.
@@ -23,7 +23,7 @@ Derived from class fiche Customer ar
-Definition in file class_customer.php.
@@ -23,7 +23,7 @@ Class Document corresponds to the ta
-Definition in file class_document.php.
@@ -23,7 +23,7 @@ Class for the document template.
-Definition in file class_document_modele.php.
@@ -22,7 +22,7 @@ class for the table document_type
-Definition in file class_document_type.php.
@@ -26,7 +26,7 @@ define Class fiche and fiche def, those class are using class attribut
-Definition in file class_fiche.php.
@@ -23,7 +23,7 @@
-Definition in file class_fiche_def.php.
Go to the source code of this file.
@@ -23,7 +23,7 @@ Class to manage the company parameter (address, name...).
-Definition in file class_own.php.
@@ -23,7 +23,7 @@ Manage the table parm_code which c
-Definition in file class_parm_code.php.
@@ -23,7 +23,7 @@ Manage the account.
-Definition in file class_poste.php.
@@ -23,7 +23,7 @@ Create, view, modify and parse report.
-Definition in file class_rapport.php.
@@ -23,7 +23,7 @@ Data & function about connected users.
-Definition in file class_user.php.
@@ -23,7 +23,7 @@ This class is used to create all the HTML INPUT TYPE.
-Definition in file class_widget.php.
-Definition at line 76 of file class_action.php.
+Definition at line 78 of file class_action.php.
-References f_id.
+References f_id.
+
-Definition at line 325 of file class_action.php.
+Definition at line 358 of file class_action.php.
-References $a, $desc, $f_id, $h_url, $r, $retour, ag_comment, ag_timestamp, d_state, dt_id, echo_debug(), ExecSql(), f_id, fiche, FormatString(), isDate(), make_array(), name, and value.
+References $a, $desc, $f_id, $h_url, $r, $retour, ag_comment, ag_timestamp, d_state, dt_id, echo_debug(), ExecSql(), f_id, fiche, FormatString(), isDate(), make_array(), name, and value.
@@ -197,11 +329,217 @@ Display
-Definition at line 99 of file class_action.php.
+Definition at line 101 of file class_action.php.
-References $a, $d_id, $desc, $doc, $r, $sp, $w, ag_id, ag_ref, ag_ref_ag_id, ag_timestamp, CountSql(), d_id, d_state, dt_id, echo_debug(), exit, f_id, fiche, FormatString(), GetAgRef(), getDbValue(), make_array(), myList(), and qcode.
+References $a, $d_id, $desc, $doc, $r, $sp, $w, ag_id, ag_ref, ag_ref_ag_id, ag_timestamp, CountSql(), d_id, d_state, dt_id, echo_debug(), exit, f_id, fiche, FormatString(), getDbValue(), make_array(), qcode_dest, and qcode_exp.
-Referenced by SaveStage2().
+Referenced by SaveStage2().
@@ -232,53 +570,53 @@ This function shows the detail of an action thanks the ag_id.
-Definition at line 280 of file class_action.php.
+Definition at line 309 of file class_action.php.
+
+References $r, $row, $sql, ag_comment, ag_ref, ag_ref_ag_id, ag_timestamp, ag_title, d_id, d_state, dt_id, echo_debug(), ExecSql(), fiche, qcode_dest, and qcode_exp.
-References $a, $r, $row, $sql, ag_comment, ag_ref, ag_ref_ag_id, ag_timestamp, ag_title, d_id, d_state, dt_id, echo_debug(), ExecSql(), f_id, fiche, and qcode.
-
-
-
-
-GetAgRef returns the ag_ref value of the ag_id or ag_ref_ag_id passed as parameter. This function doesn't change the current object.
-
-
-Definition at line 750 of file class_action.php.
-
-References $sql.
-
-Referenced by Display().
-Definition at line 572 of file class_action.php.
+Definition at line 626 of file class_action.php.
-References $_SESSION, $bar, $doc, $limit, $offset, $page, $qcode, $r, $Res, $row, $sql, $step, ag_ref, ag_ref_ag_id, ag_title, CountSql(), d_id, ExecSql(), f_id, fiche, and jrn_navigation_bar().
+References $_SESSION, $bar, $doc, $limit, $offset, $page, $r, $Res, $row, $sql, $step, ag_ref, ag_ref_ag_id, ag_title, CountSql(), d_id, ExecSql(), fiche, and jrn_navigation_bar().
-Referenced by Display().
+
@@ -361,9 +808,102 @@ SaveStage2
-Definition at line 444 of file class_action.php.
+Definition at line 493 of file class_action.php.
-References $d, $doc, $r, $sql, $str_file, $upload, ag_comment, ag_id, ag_ref, ag_title, d_state, Display(), dt_id, echo_debug(), ExecSql(), fiche, FormatString(), md_id, name, NextSequence(), and value.
+References $d, $doc, $r, $sql, $str_file, $upload, ag_comment, ag_id, ag_ref, ag_title, d_state, Display(), dt_id, echo_debug(), ExecSql(), fiche, FormatString(), md_id, name, NextSequence(), and value.
@@ -400,9 +940,35 @@ SaveStage3
-Definition at line 538 of file class_action.php.
+Definition at line 592 of file class_action.php.
-References $d_id, $doc, ag_id, d_id, dt_id, and echo_debug().
+References $d_id, $doc, ag_id, d_id, dt_id, and echo_debug().
@@ -434,9 +1000,88 @@ Update the data into the database.
-Definition at line 669 of file class_action.php.
+Definition at line 741 of file class_action.php.
-References $doc, $sql, ag_comment, ag_id, d_id, dt_id, echo_debug(), ExecSql(), f_id, fiche, FormatString(), and return.
+References $doc, $sql, ag_comment, ag_id, d_id, dt_id, echo_debug(), ExecSql(), f_id, fiche, FormatString(), and return.
+
description (ag_gestion.ag_comment)
-Definition at line 62 of file class_action.php.
+Definition at line 64 of file class_action.php.
@@ -471,7 +1116,7 @@ Definition at line 62
-concern previous action
+
-Definition at line 71 of file class_action.php.
@@ -513,7 +1159,7 @@ Definition at line 71
document date (ag_gestion.ag_timestamp)
-Definition at line 63 of file class_action.php.
+Definition at line 65 of file class_action.php.
@@ -522,7 +1168,7 @@ Definition at line 63
title document
-Definition at line 69 of file class_action.php.
+Definition at line 71 of file class_action.php.
@@ -563,7 +1209,7 @@ Definition at line 69
filename's document
-Definition at line 67 of file class_action.php.
+Definition at line 69 of file class_action.php.
@@ -588,7 +1234,7 @@ Definition at line 67
document's filename
-Definition at line 68 of file class_action.php.
+Definition at line 70 of file class_action.php.
@@ -613,7 +1259,7 @@ Definition at line 68
number of the document
-Definition at line 66 of file class_action.php.
+Definition at line 68 of file class_action.php.
@@ -638,7 +1284,7 @@ Definition at line 66
stage of the document (printed, send to client...)
-Definition at line 65 of file class_action.php.
+Definition at line 67 of file class_action.php.
@@ -663,7 +1309,7 @@ Definition at line 65
database connexion
-Definition at line 61 of file class_action.php.
+Definition at line 63 of file class_action.php.
@@ -688,7 +1334,7 @@ Definition at line 61
type of the document (00209 {
+00210 if ( !isset ($p_string) ) {
+00211 echo_error("ac_common.php FormatString p_string empty");
+00212 return null;
+00213 }
+00214 $p_string=trim($p_string);
+00215 if (strlen($p_string) == 0 ) return null;
+00216 $p_string=str_replace("\'","'",$p_string);
+00217 $p_string=str_replace("''","'",$p_string);
+00218 $p_string=str_replace("'","\'",$p_string);
+00219 return $p_string;
+00220 }
+
00355 {
+00356 $R=ExecSql($p_cn,"select p_id from parm_periode where
+00357 p_start <= to_date('$p_date','DD.MM.YYYY')
+00358 and p_end >= to_date('$p_date','DD.MM.YYYY')
+00359 ");
+00360 if ( pg_NumRows($R) == 0 )
+00361 return -1;
+00362 $a=pg_fetch_array($R,0);
+00363
+00364 return $a['p_id'];
+00365 }
+
00335 {
+00336 $R=ExecSql($p_cn,"select p_id from parm_periode where
+00337 to_char(p_start,'DD.MM.YYYY') = '01.$p_date'");
+00338 if ( pg_NumRows($R) == 0 )
+00339 return -1;
+00340 $a=pg_fetch_array($R,0);
+00341
+00342 return $a['p_id'];
+00343 }
+
00315 {
+00316 if ( $pos != 'p_start' and
+00317 $pos != 'p_end')
+00318 echo_error('ac_common.php'."-".__LINE__.' UNDEFINED PERIODE');
+00319 $ret=execSql($p_cn,"select to_char($pos,'Mon YYYY') as t from parm_periode where p_id=$p_id");
+00320 if (pg_NumRows($ret) == 0) return null;
+00321 $a=pg_fetch_array($ret,0);
+00322 return $a['t'];
+00323 }
+
00134 {
+00135 include_once ("postgres.php");
+00136 ini_set('magic_quotes_gpc','Off');
+00137
+00138 $cn=DbConnect();
+00139 if ( $p_theme != "") {
+00140 $Res=ExecSql($cn,"select the_filestyle from theme
+00141 where the_name='".$p_theme."'");
+00142 if (pg_NumRows($Res)==0)
+00143 $style="style.css";
+00144 else {
+00145 $s=pg_fetch_array($Res,0);
+00146 $style=$s['the_filestyle'];
+00147 }
+00148 }else {
+00149 $style="style.css";
+00150 } // end if
+00151 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 FINAL//EN">';
+00152 echo "<HTML>";
+00153
+00154 if ( $p_script2 != "" )
+00155 $p_script2='<script src="'.$p_script2.'" type="text/javascript"></script>';
+00156
+00157 echo "<HEAD>
+00158 <TITLE>PhpCompta</TITLE>
+00159 <META http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">
+00160 <LINK REL=\"stylesheet\" type=\"text/css\" href=\"$style\" media=\"screen\">
+00161 <link rel=\"stylesheet\" type=\"text/css\" href=\"style-print.css\" media=\"print\">".
+00162 $p_script2. "
+00163 </HEAD><script src=\"scripts.js\" type=\"text/javascript\"></script>";
+00164 echo "<BODY $p_script>";
+00165 }
+
00097 {
+00098 if ( strlen (trim($p_date)) == 0 ) return null;
+00099 if (! ereg ("^[0-9]{1,2}\.[0-9]{1,2}\.20[0-9]{2}",$p_date) ) {
+00100
+00101 return null;
+00102 } else {
+00103 $l_date=explode(".",$p_date);
+00104 if ( $l_date[2] > 2020 ) {
+00105 return null;
+00106 }
+00107 echo_debug('ac_common.php',__LINE__,' date = '.var_export($l_date,true));
+00108 if ( checkdate ($l_date[1],$l_date[0],$l_date[2]) == false) {
+00109 return null;
+00110 }
+00111
+00112 }// !ereg
+00113 return $p_date;
+00114 }
+
00076 {
+00077 if ( strlen (trim($p_int)) == 0 ) return 0;
+00078 $p_int=trim($p_int);
+00079 if (! ereg ("^-{0,1}[0-9]+.{0,1}[0-9]*$",$p_int) ) {
+00080 return 0;
+00081 } else {
+00082 return 1;
+00083 }// !ereg
+00084 }
+
00282 {
+00283
+00284 $a=pg_exec($p_cn,$p_sql);
+00285 $max=pg_NumRows($a);
+00286 if ( $max==0) return null;
+00287 for ($i=0;$i<$max;$i++) {
+00288 $row=pg_fetch_row($a);
+00289 $r[$i]['value']=$row[0];
+00290 $r[$i]['label']=$row[1];
+00291 }
+00292 // add a blank item ?
+00293 if ( $p_null == 1 ) {
+00294 for ($i=$max;$i!=0;$i--) {
+00295 $r[$i]['value']= $r[$i-1]['value'];
+00296 $r[$i]['label']= $r[$i-1]['label'];
+00297 }
+00298 $r[0]['value']=-1;
+00299 $r[0]['label']=" ";
+00300 } // if ( $p_null == 1 )
+00301
+00302 return $r;
+00303 }
+
00192 {
+00193 echo "<BR><BR><BR><BR><BR><BR>";
+00194 echo "<P ALIGN=center><BLINK>
+00195 <FONT size=+12 COLOR=RED>
+00196 You haven't access
+00197 </FONT></BLINK></P></BODY></HTML>";
+00198
+00199 exit -1;
+00200 }
+
00229 {
+00230 $ret="<TABLE $p_extra>";
+00231 // direction Vertical
+00232 if ( $p_dir == 'V') {
+00233 foreach ($p_array as $all=>$href){
+00234 $title="";
+00235 if ( isset ($href[2] ))
+00236 $title=$href[2];
+00237 $ret.='<TR><TD CLASS="'.$class.'"><A class="'.$class_ref.'" HREF="'.$href[0].'" title="'.$title.'">'.$href[1].'</A></TD></TR>';
+00238 }
+00239 }
+00240 //direction Horizontal
+00241 else if ( $p_dir == 'H' ) {
+00242 $ret.="<TR>";
+00243 foreach ($p_array as $all=>$href){
+00244 $title="";
+00245 if ( isset ($href[2] ))
+00246 $title=$href[2];
+00247 if ( $default== $href[0]) {
+00248 $ret.='<TD CLASS="selectedcell">'.$href[1].'</TD>';
+00249
+00250 } else {
+00251 $ret.='<TD CLASS="'.$class.'"><A class="'.$class_ref.'" HREF="'.$href[0].'" title="'.$title.'">'.$href[1].'</A></TD>';
+00252 }
+00253 }
+00254 $ret.="</TR>";
+00255 }
+00256 $ret.="</TABLE>";
+00257 return $ret;
+00258 }
+
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/action_8inc_8php-source.html b/doc/developper/html/action_8inc_8php-source.html
index de47fcc12..000ec1fcd 100644
--- a/doc/developper/html/action_8inc_8php-source.html
+++ b/doc/developper/html/action_8inc_8php-source.html
@@ -1,12 +1,12 @@
-action.inc.php
Go to the documentation of this file.00001 <?
00002 /*
00003 * This file is part of PhpCompta.
@@ -34,7 +34,7 @@
00028 require_once("class_widget.php");
00029 require_once("class_action.php");
00030
-00038 function ShowActionList($cn,$retour,$h_url)
+00038 function ShowActionList($cn,$retour,$h_url)
00039 {
00040 // show the search menu
00041 ?>
@@ -45,297 +45,305 @@
00046 $a=(isset($_GET['query']))?$_GET['query']:"";
00047 printf ('<span>Titre ou référence: <input type="text" name="query" value="%s"></span>',
00048 $a);
-00049 $qcode=(isset($_GET['qcode']))?$_GET['qcode']:"";
+00049 $qcode=(isset($_GET['qcode']))?$_GET['qcode']:"";
00050 echo JS_SEARCH_CARD;
00051 $w=new widget('js_search_only');
-00052 $w->name='qcode';
+00052 $w->name='qcode_query';
00053 $w->value=$qcode;
00054 $w->label='Quick Code';
00055 $w->extra='4,9,14,16,8';
00056 $w->table=0;
00057 $sp= new widget("span");
-00058 echo $sp->IOValue("qcode_label","",$qcode);
-00059 echo $w->IOValue();
-00060
-00061
-00062 ?>
-00063 <input type="submit" name="submit_query" value="recherche">
-00064 <input type="hidden" name="sa" value="list">
-00065 <input type="hidden" name="p_action" value="suivi_courrier">
-00066 </form>
-00067 </span>
-00068
-00069 <?
-00070 ?>
-00071 <form method="get" action="commercial.php">
-00072 <input type="submit" name="submit_query" value="Ajout Action">
-00073 <input type="hidden" name="p_action" value="suivi_courrier">
-00074 <input type="hidden" name="sa" value="add_action">
-00075 <input type="hidden" name="tiers" value=<? echo '"'.$qcode.'"';?>>
-00076 <? // if called from another menu, url is set
-00077 echo $h_url;
-00078 echo $retour; ?>
-00079 </form>
+00058
+00059 echo $sp->IOValue("qcode_query_label","",$qcode);
+00060 echo $w->IOValue();
+00061 ?>
+00062 <input type="submit" name="submit_query" value="recherche">
+00063 <input type="hidden" name="sa" value="list">
+00064 <input type="hidden" name="p_action" value="suivi_courrier">
+00065 </form>
+00066 </span>
+00067
+00068 <?
+00069 ?>
+00070 <form method="get" action="commercial.php">
+00071 <input type="submit" name="submit_query" value="Ajout Action">
+00072 <input type="hidden" name="p_action" value="suivi_courrier">
+00073 <input type="hidden" name="sa" value="add_action">
+00074 <input type="hidden" name="tiers" value=<? echo '"'.$qcode_dest.'"';?>>
+00075 <? // if called from another menu, url is set
+00076 echo $h_url;
+00077 echo $retour; ?>
+00078 </form>
+00079
00080
-00081
-00082 <?
-00083 // show the action in
-00084 $act=new action($cn);
-00088 $query="";
-00089
-00090 if ( isset($_REQUEST['query']) )
-00091 {
-00092
-00093 // if a query is request build the sql stmt
-00094 $query="and (ag_title ~* '".FormatString($_REQUEST['query'])."' ".
-00095 "or ag_ref ='".trim(FormatString($_REQUEST['query']))."'".
-00096 ")";
-00097 }
-00098
-00099 $str="";
-00100 if ( isset($_GET['qcode'] ))
-00101 {
-00102
-00103 // verify that qcode is not empty
-00104 if ( strlen(trim($_REQUEST['qcode'] )) != 0 )
-00105 {
-00106
-00107 $fiche=new Fiche($cn);
-00108 $fiche->GetByQCode($_REQUEST['qcode']);
-00109 $str=" and f_id= ".$fiche->id;
-00110 }
-00111 }
-00112
-00113 $r=$act->myList(ACTION,$query.$str);
-00114 echo $r;
-00115 }
-00116
-00117 // We need a sub action (3rd level)
-00118 // show a list of already taken action
-00119 // propose to add one
-00120 // permit also a search
-00121 // show detail
-00122 $sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"";
-00123
-00124 if ( $sub_action == "" ) $sub_action="list";
-00125
-00126 // if correction is asked go to directly to add_action
-00127 if (isset($_POST['corr'] ))
-00128 {
-00129 $ag_comment=urldecode($_POST['ag_comment']);
-00130 $sub_action="add_action";
-00131 }
-00132 // if this page is called from another menu (customer, supplier,...)
-00133 // a button back is added
-00134 // TODO add function for generating url, hidden tags...
-00135 $retour='<A HREF="commercial.php?p_action=suivi_courrier"><input type="button" value="Retour"></A>';
-00136 $h_url="";
-00137
-00138 if ( isset ($_REQUEST['url']))
-00139 {
-00140 $retour=sprintf('<A HREF="%s"><input type="button" value="Retour"></A>',urldecode($_REQUEST['url']));
-00141 $h_url=sprintf('<input type="hidden" name="url" value="%s">',urldecode($_REQUEST['url']));
-00142 }
-00143 //----------------------------------------------------------------------
-00144 // Update the detail
-00145 // Add a new action related to this one or update
-00146 //----------------------------------------------------------------------
-00147 if ( $sub_action=="update" )
-00148 {
-00149 // Update the modification
-00150 if ( isset($_POST['save']))
-00151 {
-00152 $act=new action($cn);
-00153 $act=new action($cn);
-00154
-00155 $act->ag_id=$_POST['ag_id'];
-00156 $act->ag_comment=$_POST['ag_comment'];
-00157 $act->ag_timestamp=$_POST['ag_timestamp'];
-00158 $act->d_state=$_POST['d_state'];
-00159 $act->dt_id=(isset($_POST['dt_id']))?$_POST['dt_id']:0;
-00160 $act->qcode=$_POST['qcode'];
-00161 $act->ag_title=$_POST['ag_title'];
-00162 $act->d_id=(isset($_POST['d_id']))?$_POST['d_id']:0;
-00163 if ( $act->Update() == false ) {
-00164 $sub_action="detail";
-00165 }
-00166 else
-00167 {
-00168 ShowActionList($cn,$retour,$h_url);
-00169 }
-00170 }
-00171 //----------------------------------------------------------------------
-00172 // Add a related action
+00081 <?
+00082 // show the action in
+00083 $act=new action($cn);
+00087 $query="";
+00088
+00089 if ( isset($_REQUEST['query']) )
+00090 {
+00091
+00092 // if a query is request build the sql stmt
+00093 $query="and (ag_title ~* '".FormatString($_REQUEST['query'])."' ".
+00094 "or ag_ref ='".trim(FormatString($_REQUEST['query']))."'".
+00095 ")";
+00096 }
+00097
+00098 $str="";
+00099 if ( isset($_GET['qcode_query'] ))
+00100 {
+00101
+00102 // verify that qcode is not empty
+00103 if ( strlen(trim($_REQUEST['qcode_query'] )) != 0 )
+00104 {
+00105
+00106 $fiche=new Fiche($cn);
+00107 $fiche->GetByQCode($_REQUEST['qcode_query']);
+00108 $str=" and (f_id_exp= ".$fiche->id." or ".
+00109 "f_id_dest".$fiche->id.")";
+00110
+00111 }
+00112 }
+00113
+00114 $r=$act->myList(ACTION,$query.$str);
+00115 echo $r;
+00116 }
+00117
+00118 // We need a sub action (3rd level)
+00119 // show a list of already taken action
+00120 // propose to add one
+00121 // permit also a search
+00122 // show detail
+00123 $sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"";
+00124
+00125 if ( $sub_action == "" ) $sub_action="list";
+00126
+00127 // if correction is asked go to directly to add_action
+00128 if (isset($_POST['corr'] ))
+00129 {
+00130 $ag_comment=urldecode($_POST['ag_comment']);
+00131 $sub_action="add_action";
+00132 }
+00133 // if this page is called from another menu (customer, supplier,...)
+00134 // a button back is added
+00135 // TODO add function for generating url, hidden tags...
+00136 $retour='<A HREF="commercial.php?p_action=suivi_courrier"><input type="button" value="Retour"></A>';
+00137 $h_url="";
+00138
+00139 if ( isset ($_REQUEST['url']))
+00140 {
+00141 $retour=sprintf('<A HREF="%s"><input type="button" value="Retour"></A>',urldecode($_REQUEST['url']));
+00142 $h_url=sprintf('<input type="hidden" name="url" value="%s">',urldecode($_REQUEST['url']));
+00143 }
+00144 //----------------------------------------------------------------------
+00145 // Update the detail
+00146 // Add a new action related to this one or update
+00147 //----------------------------------------------------------------------
+00148 if ( $sub_action=="update" )
+00149 {
+00150 // Update the modification
+00151 if ( isset($_POST['save']))
+00152 {
+00153 $act=new action($cn);
+00154 $act=new action($cn);
+00155
+00156 $act->ag_id=$_POST['ag_id'];
+00157 $act->ag_comment=$_POST['ag_comment'];
+00158 $act->ag_timestamp=$_POST['ag_timestamp'];
+00159 $act->d_state=$_POST['d_state'];
+00160 $act->dt_id=(isset($_POST['dt_id']))?$_POST['dt_id']:0;
+00161 $act->qcode_exp=$_POST['qcode_exp'];
+00162 $act->qcode_dest=$_POST['qcode_dest'];
+00163 $act->ag_title=$_POST['ag_title'];
+00164 $act->d_id=(isset($_POST['d_id']))?$_POST['d_id']:0;
+00165 if ( $act->Update() == false ) {
+00166 $sub_action="detail";
+00167 }
+00168 else
+00169 {
+00170 ShowActionList($cn,$retour,$h_url);
+00171 }
+00172 }
00173 //----------------------------------------------------------------------
-00174 if ( isset ($_POST['add_action_here']) )
-00175 {
-00176 $act=new action($cn);
-00177 $act->ag_ref_ag_id=$_POST['ag_id'];
-00178
-00179 //----------------------------------------
-00180 // puis comme ajout normal (copier / coller )
-00181 echo $retour;
-00182 $act->ag_id=0;
-00183 $act->ag_ref_ag_id=$_POST['ag_id'];
-00184 $act->ag_timestamp=(isset($_POST['ag_timestamp']))?$_POST['ag_timestamp']:"";
-00185 $act->qcode=isset($_POST['tiers'])?$_REQUEST['tiers']:"";
-00186 $act->d_id=0;
-00187 $act->dt_id=isset($_POST['dt_id'])?$_REQUEST['dt_id']:"";
-00188 $act->d_state=(isset($_POST['d_state']))?$_POST['d_state']:"";
-00189 $act->ag_ref="";
-00190 $act->ag_title=(isset($_POST['ag_title']))?$_POST['ag_title']:"";
-00191 echo '<div class="u_redcontent">';
-00192 echo JS_SEARCH_CARD;
-00193 // Add hidden tag
-00194 echo '<form name="RTEDemo" action="commercial.php?p_action=suivi_courrier" method="post" onsubmit="return submitForm();">';
-00195
-00196 $act->ag_comment=(isset($_POST['ag_comment']))?Decode($_POST['ag_comment']):"";
-00197 echo $act->Display('NEW',false);
+00174 // Add a related action
+00175 //----------------------------------------------------------------------
+00176 if ( isset ($_POST['add_action_here']) )
+00177 {
+00178 $act=new action($cn);
+00179 $act->ag_ref_ag_id=$_POST['ag_id'];
+00180
+00181 //----------------------------------------
+00182 // puis comme ajout normal (copier / coller )
+00183 echo $retour;
+00184 $act->ag_id=0;
+00185 $act->ag_ref_ag_id=$_POST['ag_id'];
+00186 $act->ag_timestamp=(isset($_POST['ag_timestamp']))?$_POST['ag_timestamp']:"";
+00187 $act->qcode_dest=isset($_POST['tiers'])?$_REQUEST['tiers']:"";
+00188 $act->qcode_exp=isset($_POST['qcode_exp'])?$_REQUEST['qcode_exp']:"";
+00189 $act->d_id=0;
+00190 $act->dt_id=isset($_POST['dt_id'])?$_REQUEST['dt_id']:"";
+00191 $act->d_state=(isset($_POST['d_state']))?$_POST['d_state']:"";
+00192 $act->ag_ref="";
+00193 $act->ag_title=(isset($_POST['ag_title']))?$_POST['ag_title']:"";
+00194 echo '<div class="u_redcontent">';
+00195 echo JS_SEARCH_CARD;
+00196 // Add hidden tag
+00197 echo '<form name="RTEDemo" action="commercial.php?p_action=suivi_courrier" method="post" onsubmit="return submitForm();">';
00198
-00199 echo '<input type="hidden" name="p_action" value="suivi_courrier">';
-00200 echo '<input type="hidden" name="sa" value="save_action_st1">';
+00199 $act->ag_comment=(isset($_POST['ag_comment']))?Decode($_POST['ag_comment']):"";
+00200 echo $act->Display('NEW',false);
00201
-00202 echo $h_url;
-00203 echo '<input type="submit" name="save_action_st1" value="Sauver"></p>'.
-00204 '</form>'.
-00205 '</div>';
-00206
-00207 }
-00208
-00209
-00210 }
-00211 //--------------------------------------------------------------------------------
-00212 // Show the detail of an action
-00213 // permit the update
-00214 if ( $sub_action=='detail' )
-00215 {
-00216 echo '<div class="u_redcontent">';
-00217 $act=new action($cn);
-00218 $act->ag_id=$_REQUEST['ag_id'];
-00219 echo $act->get();
-00220 $act->ag_comment=Decode($act->ag_comment);
-00221 echo '<form name="RTEDemo" action="commercial.php" enctype="multipart/form-data" method="post" onsubmit="return submitForm();" >';
-00222 echo JS_SEARCH_CARD;
-00223 echo $act->display('UPD',false);
-00224 echo '<input type="hidden" name="p_action" value="suivi_courrier">';
-00225 echo '<input type="hidden" name="sa" value="update">';
-00226 $upload=new widget("file");
-00227 $upload->name="file_upload";
-00228 $upload->value="";
-00229 echo "Enregistrer le fichier ".$upload->IOValue();
-00230 echo $upload->Submit("save","Sauve");
-00231 echo $upload->Submit("add_action_here","Ajoute une action à celle-ci");
-00232 echo '</form>';
-00234 echo $retour;
-00235 echo '</div>';
-00236 }
-00237 //--------------------------------------------------------------------------------
-00238 // Show a list of the action
-00239 if ( $sub_action == "list" )
-00240 ShowActionList($cn,$retour,$h_url);
-00241
-00242 //--------------------------------------------------------------------------------
-00243 // Add an action
-00244 if ( $sub_action == "add_action" )
-00245 {
-00246 echo $retour;
-00247 $act=new action($cn);
-00248 $act->ag_id=0;
-00249 $act->ag_ref_ag_id=(isset($_POST['ag_ref_ag_id']))?$_POST['ag_ref_ag_id']:"0";
-00250 $act->ag_timestamp=(isset($_POST['ag_timestamp']))?$_POST['ag_timestamp']:"";
-00251 $act->qcode=isset($_POST['tiers'])?$_REQUEST['tiers']:"";
-00252 $act->d_id=0;
-00253 $act->dt_id=isset($_POST['dt_id'])?$_REQUEST['dt_id']:"";
-00254 $act->d_state=(isset($_POST['d_state']))?$_POST['d_state']:"";
-00255 $act->ag_ref="";
-00256 $act->ag_title=(isset($_POST['ag_title']))?$_POST['ag_title']:"";
-00257 echo '<div class="u_redcontent">';
-00258 echo JS_SEARCH_CARD;
-00259 // Add hidden tag
-00260 echo '<form name="RTEDemo" action="commercial.php?p_action=suivi_courrier" method="post" onsubmit="return submitForm();">';
-00261
-00262 $act->ag_comment=(isset($_POST['ag_comment']))?Decode($_POST['ag_comment']):"";
-00263 echo $act->Display('NEW',false);
-00264
-00265 echo '<input type="hidden" name="p_action" value="suivi_courrier">';
-00266 echo '<input type="hidden" name="sa" value="save_action_st1">';
-00267
-00268 echo $h_url;
-00269 echo '<input type="submit" name="save_action_st1" value="Sauver"></p>'.
-00270 '</form>'.
-00271 '</div>';
-00272
-00273 }
-00274 //--------------------------------------------------------------------------------
-00275 // Save Action
-00276 // Stage 1 : show the result and confirm
-00277 //--------------------------------------------------------------------------------
-00278 if ( $sub_action == "save_action_st1" )
-00279 {
-00280 $act=new action($cn);
-00281 $act->ag_timestamp=$_POST['ag_timestamp'];
-00282 $act->ag_comment=$_POST['ag_comment'];
-00283 $act->ag_timestamp=$_POST['ag_timestamp'];
-00284 $act->d_state=$_POST['d_state'];
-00285 $act->dt_id=$_POST['dt_id'];
-00286 $act->qcode=$_POST['qcode'];
-00287 $act->ag_title=$_POST['ag_title'];
-00288 $act->d_id=0;
-00289 $act->ag_id=$_POST['ag_id'];
-00290 $act->ag_ref_ag_id=(isset($_POST['ag_ref_ag_id']))?$_POST['ag_ref_ag_id']:0;
-00291
-00292 echo $act->Confirm();
-00293 }
-00294 //--------------------------------------------------------------------------------
-00295 // Save Action
-00296 // Stage 2 : Save the action and propose to save a file
-00297 //--------------------------------------------------------------------------------
-00298 if ( $sub_action == "save_action_st2" )
-00299 {
-00300 $act=new action($cn);
-00301
-00302 $act->ag_comment=$_POST['ag_comment'];
-00303 $act->ag_timestamp=$_POST['ag_timestamp'];
-00304 $act->d_state=$_POST['d_state'];
-00305 $act->dt_id=$_POST['dt_id'];
-00306 $act->qcode=$_POST['tiers'];
-00307 $act->ag_title=$_POST['ag_title'];
-00308 $act->d_id=0;
-00309 $act->ag_ref_ag_id=(isset($_POST['ag_ref_ag_id']))?$_POST['ag_ref_ag_id']:0;
-00310 $act->md_id=(isset($_POST['gen_doc']))?$_POST['gen_doc']:0;
-00311
-00312 $act->gen=isset($_POST['p_gen'])?'on':'off';
-00313 // insert into action_gestion
-00314 echo $act->SaveStage2();
-00315 echo '<A HREF="commercial.php?p_action=suivi_courrier"><INPUT TYPE="BUTTON" VALUE="Retour Liste"></A>';
-00316 }
+00202 echo '<input type="hidden" name="p_action" value="suivi_courrier">';
+00203 echo '<input type="hidden" name="sa" value="save_action_st1">';
+00204
+00205 echo $h_url;
+00206 echo '<input type="submit" name="save_action_st1" value="Sauver"></p>'.
+00207 '</form>'.
+00208 '</div>';
+00209
+00210 }
+00211
+00212
+00213 }
+00214 //--------------------------------------------------------------------------------
+00215 // Show the detail of an action
+00216 // permit the update
+00217 if ( $sub_action=='detail' )
+00218 {
+00219 echo '<div class="u_redcontent">';
+00220 $act=new action($cn);
+00221 $act->ag_id=$_REQUEST['ag_id'];
+00222 echo $act->get();
+00223 $act->ag_comment=Decode($act->ag_comment);
+00224 echo '<form name="RTEDemo" action="commercial.php" enctype="multipart/form-data" method="post" onsubmit="return submitForm();" >';
+00225 echo JS_SEARCH_CARD;
+00226 echo $act->display('UPD',false);
+00227 echo '<input type="hidden" name="p_action" value="suivi_courrier">';
+00228 echo '<input type="hidden" name="sa" value="update">';
+00229 $upload=new widget("file");
+00230 $upload->name="file_upload";
+00231 $upload->value="";
+00232 echo "Enregistrer le fichier ".$upload->IOValue();
+00233 echo $upload->Submit("save","Sauve");
+00234 echo $upload->Submit("add_action_here","Ajoute une action à celle-ci");
+00235 echo '</form>';
+00237 echo $retour;
+00238 echo '</div>';
+00239 }
+00240 //--------------------------------------------------------------------------------
+00241 // Show a list of the action
+00242 if ( $sub_action == "list" )
+00243 ShowActionList($cn,$retour,$h_url);
+00244
+00245 //--------------------------------------------------------------------------------
+00246 // Add an action
+00247 if ( $sub_action == "add_action" )
+00248 {
+00249 echo $retour;
+00250 $act=new action($cn);
+00251 $act->ag_id=0;
+00252 $act->ag_ref_ag_id=(isset($_POST['ag_ref_ag_id']))?$_POST['ag_ref_ag_id']:"0";
+00253 $act->ag_timestamp=(isset($_POST['ag_timestamp']))?$_POST['ag_timestamp']:"";
+00254 $act->qcode_dest=isset($_POST['tiers'])?$_REQUEST['tiers']:"";
+00255 $act->qcode_exp=isset($_POST['qcode_exp'])?$_REQUEST['qcode_exp']:"";
+00256 $act->d_id=0;
+00257 $act->dt_id=isset($_POST['dt_id'])?$_REQUEST['dt_id']:"";
+00258 $act->d_state=(isset($_POST['d_state']))?$_POST['d_state']:"";
+00259 $act->ag_ref="";
+00260 $act->ag_title=(isset($_POST['ag_title']))?$_POST['ag_title']:"";
+00261 echo '<div class="u_redcontent">';
+00262 echo JS_SEARCH_CARD;
+00263 // Add hidden tag
+00264 echo '<form name="RTEDemo" action="commercial.php?p_action=suivi_courrier" method="post" onsubmit="return submitForm();">';
+00265
+00266 $act->ag_comment=(isset($_POST['ag_comment']))?Decode($_POST['ag_comment']):"";
+00267 echo $act->Display('NEW',false);
+00268
+00269 echo '<input type="hidden" name="p_action" value="suivi_courrier">';
+00270 echo '<input type="hidden" name="sa" value="save_action_st1">';
+00271
+00272 echo $h_url;
+00273 echo '<input type="submit" name="save_action_st1" value="Sauver"></p>'.
+00274 '</form>'.
+00275 '</div>';
+00276
+00277 }
+00278 //--------------------------------------------------------------------------------
+00279 // Save Action
+00280 // Stage 1 : show the result and confirm
+00281 //--------------------------------------------------------------------------------
+00282 if ( $sub_action == "save_action_st1" )
+00283 {
+00284 $act=new action($cn);
+00285 $act->ag_timestamp=$_POST['ag_timestamp'];
+00286 $act->ag_comment=$_POST['ag_comment'];
+00287 $act->ag_timestamp=$_POST['ag_timestamp'];
+00288 $act->d_state=$_POST['d_state'];
+00289 $act->dt_id=$_POST['dt_id'];
+00290 $act->qcode_exp=$_POST['qcode_exp'];
+00291 $act->qcode_dest=$_POST['qcode_dest'];
+00292 $act->ag_title=$_POST['ag_title'];
+00293 $act->d_id=0;
+00294 $act->ag_id=$_POST['ag_id'];
+00295 $act->ag_ref_ag_id=(isset($_POST['ag_ref_ag_id']))?$_POST['ag_ref_ag_id']:0;
+00296
+00297 echo $act->Confirm();
+00298 }
+00299 //--------------------------------------------------------------------------------
+00300 // Save Action
+00301 // Stage 2 : Save the action and propose to save a file
+00302 //--------------------------------------------------------------------------------
+00303 if ( $sub_action == "save_action_st2" )
+00304 {
+00305 $act=new action($cn);
+00306
+00307 $act->ag_comment=$_POST['ag_comment'];
+00308 $act->ag_timestamp=$_POST['ag_timestamp'];
+00309 $act->d_state=$_POST['d_state'];
+00310 $act->dt_id=$_POST['dt_id'];
+00311 $act->qcode_dest=$_POST['tiers'];
+00312 $act->qcode_exp=$_POST['qcode_exp'];
+00313 $act->ag_title=$_POST['ag_title'];
+00314 $act->d_id=0;
+00315 $act->ag_ref_ag_id=(isset($_POST['ag_ref_ag_id']))?$_POST['ag_ref_ag_id']:0;
+00316 $act->md_id=(isset($_POST['gen_doc']))?$_POST['gen_doc']:0;
00317
-00318 //--------------------------------------------------------------------------------
-00319 // Save Document
-00320 // Stage 3 : Save the document
-00321 //--------------------------------------------------------------------------------
-00322 if ( $sub_action == "save_action_st3" )
-00323 {
-00324 echo_debug("action.inc.php",__LINE__,'Stage 3');
-00325 $act=new action($cn);
-00326 $act->ag_id=$_POST['ag_id'];
-00327 $act->ag_ref_ag_idid=$_POST['ag_ref_ag_id'];
-00328 $act->ag_comment=$_POST['ag_comment'];
-00329 $act->ag_timestamp=$_POST['ag_timestamp'];
-00330 $act->d_state=$_POST['d_state'];
-00331 $act->dt_id=$_POST['dt_id'];
-00332 $act->qcode=$_POST['qcode'];
-00333 $act->ag_title=$_POST['ag_title'];
-00334 $d_id=(isset($_POST['d_id']))?$_POST['d_id']:0;
-00335 $act->ag_ref_ag_id=(isset($_POST['ag_ref_ag_id']))?$_POST['ag_ref_ag_id']:0;
-00336 echo $act->SaveStage3($d_id);
-00337
-00338 ShowActionList($cn,$retour,$h_url);
-00339
-00340 }
-00341 //---------------------------------------------------------------------
-00342
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+00318 $act->gen=isset($_POST['p_gen'])?'on':'off';
+00319 // insert into action_gestion
+00320 echo $act->SaveStage2();
+00321 echo '<A HREF="commercial.php?p_action=suivi_courrier"><INPUT TYPE="BUTTON" VALUE="Retour Liste"></A>';
+00322 }
+00323
+00324 //--------------------------------------------------------------------------------
+00325 // Save Document
+00326 // Stage 3 : Save the document
+00327 //--------------------------------------------------------------------------------
+00328 if ( $sub_action == "save_action_st3" )
+00329 {
+00330 echo_debug("action.inc.php",__LINE__,'Stage 3');
+00331 $act=new action($cn);
+00332 $act->ag_id=$_POST['ag_id'];
+00333 $act->ag_ref_ag_idid=$_POST['ag_ref_ag_id'];
+00334 $act->ag_comment=$_POST['ag_comment'];
+00335 $act->ag_timestamp=$_POST['ag_timestamp'];
+00336 $act->d_state=$_POST['d_state'];
+00337 $act->dt_id=$_POST['dt_id'];
+00338 $act->qcode_dest=$_POST['qcode_dest'];
+00339 $act->qcode_exp=$_POST['qcode_exp'];
+00340
+00341 $act->ag_title=$_POST['ag_title'];
+00342 $d_id=(isset($_POST['d_id']))?$_POST['d_id']:0;
+00343 $act->ag_ref_ag_id=(isset($_POST['ag_ref_ag_id']))?$_POST['ag_ref_ag_id']:0;
+00344 echo $act->SaveStage3($d_id);
+00345
+00346 ShowActionList($cn,$retour,$h_url);
+00347
+00348 }
+00349 //---------------------------------------------------------------------
+00350
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/action_8inc_8php.html b/doc/developper/html/action_8inc_8php.html
index 84f94040c..936d2abf7 100644
--- a/doc/developper/html/action_8inc_8php.html
+++ b/doc/developper/html/action_8inc_8php.html
@@ -1,12 +1,12 @@
-action.inc.php File Reference
Page who manage the different action (meeting, letter). More...
-Functions
+ ShowActionList ($cn, $retour, $h_url)
- ShowActionList ($cn, $retour, $h_url)
+ Show the list of action, this code should be common to several webpage. But for the moment we keep like that because it is used only by this file. Show the list of action, this code should be common to several webpage. But for the moment we keep like that because it is used only by this file. Variables
@@ -37,29 +37,31 @@
$sub_action = (isset($_REQUEST['sa']))?$_REQUEST['sa']:"" $act dt_id = (isset($_POST['dt_id']))?$_POST['dt_id']:0
- class for the table document_type pk document_type
+$act qcode = $_POST['qcode']
-$act qcode_exp = $_POST['qcode_exp']
+$act ag_title = $_POST['ag_title']
-$act qcode_dest = $_POST['qcode_dest']
+$act d_id = (isset($_POST['d_id']))?$_POST['d_id']:0
-$act ag_title = $_POST['ag_title']
+$act ag_ref_ag_id = $_POST['ag_id']
-$act d_id = (isset($_POST['d_id']))?$_POST['d_id']:0
+$act ag_ref = ""
-$act ag_ref_ag_id = $_POST['ag_id']
+ $upload = new widget("file")
-$act ag_ref = ""
+$upload name = "file_upload"
- $upload = new widget("file")
+$upload value = ""
-$upload name = "file_upload"
+$act md_id = (isset($_POST['gen_doc']))?$_POST['gen_doc']:0
-$upload value = ""
+$act gen = isset($_POST['p_gen'])?'on':'off'
-$act md_id = (isset($_POST['gen_doc']))?$_POST['gen_doc']:0
+$act ag_ref_ag_idid = $_POST['ag_ref_ag_id']
-$act gen = isset($_POST['p_gen'])?'on':'off'
+ $d_id = (isset($_POST['d_id']))?$_POST['d_id']:0
+
+$act ag_ref_ag_idid = $_POST['ag_ref_ag_id'] $d_id = (isset($_POST['d_id']))?$_POST['d_id']:0 Detailed Description
@@ -68,7 +70,7 @@ Page who manage the different action (meeting, letter).
Function Documentation
-
@@ -122,7 +124,84 @@ Show the list of action, this code should be common to several webpage. But for
+References $a, $act, $fiche, $h_url, $qcode, $r, $retour, $sp, $w, FormatString(), name, and value.00039 {
+00040 // show the search menu
+00041 ?>
+00042 <div class="u_content">
+00043 <span>
+00044 <form method="get" action="commercial.php">
+00045 <?
+00046 $a=(isset($_GET['query']))?$_GET['query']:"";
+00047 printf ('<span>Titre ou référence: <input type="text" name="query" value="%s"></span>',
+00048 $a);
+00049 $qcode=(isset($_GET['qcode']))?$_GET['qcode']:"";
+00050 echo JS_SEARCH_CARD;
+00051 $w=new widget('js_search_only');
+00052 $w->name='qcode_query';
+00053 $w->value=$qcode;
+00054 $w->label='Quick Code';
+00055 $w->extra='4,9,14,16,8';
+00056 $w->table=0;
+00057 $sp= new widget("span");
+00058
+00059 echo $sp->IOValue("qcode_query_label","",$qcode);
+00060 echo $w->IOValue();
+00061 ?>
+00062 <input type="submit" name="submit_query" value="recherche">
+00063 <input type="hidden" name="sa" value="list">
+00064 <input type="hidden" name="p_action" value="suivi_courrier">
+00065 </form>
+00066 </span>
+00067
+00068 <?
+00069 ?>
+00070 <form method="get" action="commercial.php">
+00071 <input type="submit" name="submit_query" value="Ajout Action">
+00072 <input type="hidden" name="p_action" value="suivi_courrier">
+00073 <input type="hidden" name="sa" value="add_action">
+00074 <input type="hidden" name="tiers" value=<? echo '"'.$qcode_dest.'"';?>>
+00075 <? // if called from another menu, url is set
+00076 echo $h_url;
+00077 echo $retour; ?>
+00078 </form>
+00079
+00080
+00081 <?
+00082 // show the action in
+00083 $act=new action($cn);
+00087 $query="";
+00088
+00089 if ( isset($_REQUEST['query']) )
+00090 {
+00091
+00092 // if a query is request build the sql stmt
+00093 $query="and (ag_title ~* '".FormatString($_REQUEST['query'])."' ".
+00094 "or ag_ref ='".trim(FormatString($_REQUEST['query']))."'".
+00095 ")";
+00096 }
+00097
+00098 $str="";
+00099 if ( isset($_GET['qcode_query'] ))
+00100 {
+00101
+00102 // verify that qcode is not empty
+00103 if ( strlen(trim($_REQUEST['qcode_query'] )) != 0 )
+00104 {
+00105
+00106 $fiche=new Fiche($cn);
+00107 $fiche->GetByQCode($_REQUEST['qcode_query']);
+00108 $str=" and (f_id_exp= ".$fiche->id." or ".
+00109 "f_id_dest".$fiche->id.")";
+00110
+00111 }
+00112 }
+00113
+00114 $r=$act->myList(ACTION,$query.$str);
+00115 echo $r;
+00116 }
+
Variable Documentation
@@ -148,18 +227,18 @@ References $a,
@@ -281,9 +360,9 @@ Definition at line 122<
+Referenced by action::SaveStage2().
-
@@ -362,18 +441,18 @@ Referenced by Docum
-
act ag_ref = ""
+ act ag_ref = ""
-
@@ -389,18 +468,18 @@ Referenced by action:
-
act ag_ref_ag_id = $_POST['ag_id']
+ act ag_ref_ag_id = $_POST['ag_id']
@@ -416,7 +495,7 @@ Referenced by action:
-
$act ag_ref_ag_idid = $_POST['ag_ref_ag_id']
+ $act ag_ref_ag_idid = $_POST['ag_ref_ag_id']
-
@@ -468,18 +547,18 @@ Referenced by action:
-
act ag_title = $_POST['ag_title']
+ act ag_title = $_POST['ag_title']
@@ -495,9 +574,9 @@ Referenced by action:
-
act d_id = (isset($_POST['d_id']))?$_POST['d_id']:0
+ act d_id = (isset($_POST['d_id']))?$_POST['d_id']:0
-
@@ -578,10 +657,10 @@ Referenced by action:
-
$act gen = isset($_POST['p_gen'])?'on':'off'
+ $act gen = isset($_POST['p_gen'])?'on':'off'
-
@@ -603,12 +682,12 @@ Definition at line 312<
+Referenced by Document_modele::Document_modele(), Document_modele::myList(), Document_modele::Save(), and action::SaveStage2().
-
@@ -630,18 +709,18 @@ Referenced by 227 of file action.inc.php.
+Definition at line 230 of file action.inc.php.
+Referenced by ChangeStock(), cl_user::Check(), cl_user::cl_user(), action::Confirm(), EncodeFiche(), EncodeForm(), EncodeModele(), form_verify_input(), FormAchView(), FormFin(), FormODS(), FormVenteView(), Supplier::GetFromPoste(), Customer::GetFromPoste(), cl_user::GetGlobalPref(), rapport::GetName(), poste::GetName(), jrn::GetName(), fiche::insert(), cl_user::insert_default_global_pref(), widget::IOValue(), jrn_navigation_bar(), MakeListingVat(), new_fiche(), Cpdf::o_font(), Cpdf::openFont(), rapport::rapport(), RecordJrn(), Document_modele::Save(), save_upload_document(), action::SaveStage2(), Cpdf::selectFont(), ShowActionList(), ShowFormTransfert(), contact::Summary(), u_ShowMenuRecherche(), fiche::update(), UpdateJrn(), Document::Upload(), Customer::VatListing(), VerifData(), VerifImport(), ViewFiche(), and ViewImp().
-
@@ -657,12 +736,39 @@ Referenced by ChangeStoc
-
act qcode = $_POST['qcode']
+ act qcode_dest = $_POST['qcode_dest']
+
+
+
+
+
+
+
+
+
+ act qcode_exp = $_POST['qcode_exp']
+
+
+
+
+
+
+
+
+
+
+
-
@@ -684,12 +790,12 @@ Referenced by action:
+Referenced by ChangeStock(), action::Confirm(), widget::debug(), fiche_def_ref::Display(), DisplayDetailModele(), EncodeFiche(), EncodeForm(), Cezpdf::ezTable(), FormFin(), FormODS(), FormVenteView(), jrn::GetDefLine(), fiche::insert(), cl_user::insert_default_global_pref(), widget::IOValue(), jrn_navigation_bar(), fiche_def_ref::LoadAll(), make_array(), new_fiche(), Cpdf::o_fontDescriptor(), Document::ParseDocument(), RecordJrn(), action::SaveStage2(), ShowActionList(), contact::Summary(), u_ShowMenuRecherche(), fiche::update(), cl_user::update_global_pref(), UpdateJrn(), VerifImport(), ViewFiche(), ViewImp(), and widget::widget().
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/admin__repo_8php-source.html b/doc/developper/html/admin__repo_8php-source.html
index 77220321d..a88adb7fa 100644
--- a/doc/developper/html/admin__repo_8php-source.html
+++ b/doc/developper/html/admin__repo_8php-source.html
@@ -1,12 +1,12 @@
-admin_repo.php
Go to the documentation of this file.00001 <?
00002
00003 /*
@@ -318,7 +318,7 @@
00314
00315 html_page_stop();
00316 ?>
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/admin__repo_8php.html b/doc/developper/html/admin__repo_8php.html
index ac98195fb..0f1ce01a2 100644
--- a/doc/developper/html/admin__repo_8php.html
+++ b/doc/developper/html/admin__repo_8php.html
@@ -1,12 +1,12 @@
-admin_repo.php File Reference
Administration of the repository : creation of user, folder, security, templates... Accessible only by the administrator. More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/annotated.html b/doc/developper/html/annotated.html
index b1f752cd8..4dfe3c97b 100644
--- a/doc/developper/html/annotated.html
+++ b/doc/developper/html/annotated.html
@@ -32,7 +32,7 @@
Supplier Class Supplier are a specific kind of card
-widget Class widget This class is used to create all the HTML INPUT TYPE and some specials which works with javascript like js_search
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:23 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/annulation_8php-source.html b/doc/developper/html/annulation_8php-source.html
index 1273f7687..957f222d3 100644
--- a/doc/developper/html/annulation_8php-source.html
+++ b/doc/developper/html/annulation_8php-source.html
@@ -1,12 +1,12 @@
-annulation.php
Go to the documentation of this file.00001 <?
00002 /*
00003 * This file is part of PhpCompta.
@@ -84,16 +84,16 @@
00078 <span>
00079 <FORM METHOD="POST" ACTION="annulation.php?p_jrn=<?echo $_GET['p_jrn'];?>&jrn_op=<?echo $_GET['jrn_op'];?>">
00080 <INPUT TYPE="HIDDEN" NAME="annul">
-00081 <INPUT TYPE="HIDDEN" NAME="p_id" value="<? echo $_POST['p_id']; ?>">
-00082 <INPUT TYPE="HIDDEN" NAME="op_date" value="<? echo $_POST['op_date']; ?>">
-00083 <INPUT TYPE="SUBMIT" NAME="confirm" value="Oui">
+00081 <INPUT TYPE="HIDDEN" NAME="p_id" value="<? echo $_POST['p_id']; ?>">
+00082 <INPUT TYPE="HIDDEN" NAME="op_date" value="<? echo $_POST['op_date']; ?>">
+00083 <INPUT TYPE="SUBMIT" NAME="confirm" value="Oui">
00084 </FORM>
00085
00086 <FORM METHOD="GET" ACTION="annulation.php">
-00087 <INPUT TYPE="HIDDEN" NAME="p_jrn" value="<? echo $_REQUEST['p_jrn']; ?>">
-00088 <INPUT TYPE="HIDDEN" NAME="p_id" value="<? echo $_REQUEST['p_id']; ?>">
-00089 <INPUT TYPE="HIDDEN" NAME="jrn_op" value="<? echo $_REQUEST['jrn_op']; ?>">
-00090 <INPUT TYPE="SUBMIT" NAME="not_confirm" value="non">
+00087 <INPUT TYPE="HIDDEN" NAME="p_jrn" value="<? echo $_REQUEST['p_jrn']; ?>">
+00088 <INPUT TYPE="HIDDEN" NAME="p_id" value="<? echo $_REQUEST['p_id']; ?>">
+00089 <INPUT TYPE="HIDDEN" NAME="jrn_op" value="<? echo $_REQUEST['jrn_op']; ?>">
+00090 <INPUT TYPE="SUBMIT" NAME="not_confirm" value="non">
00091 </form>
00092 </span>
00093 <?
@@ -287,14 +287,14 @@
00281
00282 echo '
00283
-00284 <input type="hidden" name="p_id" value="'.$_GET['jrn_op'].'">
-00285 <input type="submit" name="annul" value="Mise à zéro">
-00286 <input type="button" name="cancel" value="Retour" onClick="window.close();">
+00284 <input type="hidden" name="p_id" value="'.$_GET['jrn_op'].'">
+00285 <input type="submit" name="annul" value="Mise à zéro">
+00286 <input type="button" name="cancel" value="Retour" onClick="window.close();">
00287 </form>';
00288
00289 html_page_stop();
00290 ?>
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/annulation_8php.html b/doc/developper/html/annulation_8php.html
index f4030d336..1a4532e51 100644
--- a/doc/developper/html/annulation_8php.html
+++ b/doc/developper/html/annulation_8php.html
@@ -1,12 +1,12 @@
-annulation.php File Reference
in a popup window manage the deletion of the operations More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/bal__csv_8php-source.html b/doc/developper/html/bal__csv_8php-source.html
index f08828a5d..e7d72e76d 100644
--- a/doc/developper/html/bal__csv_8php-source.html
+++ b/doc/developper/html/bal__csv_8php-source.html
@@ -1,12 +1,12 @@
-bal_csv.php
Go to the documentation of this file.
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/bal__csv_8php.html b/doc/developper/html/bal__csv_8php.html
index 1dbab2ecc..470d9fc3c 100644
--- a/doc/developper/html/bal__csv_8php.html
+++ b/doc/developper/html/bal__csv_8php.html
@@ -1,12 +1,12 @@
-bal_csv.php File Reference
Return the balance in CSV format. More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/balance_8php-source.html b/doc/developper/html/balance_8php-source.html
index ee4797251..3c6818478 100644
--- a/doc/developper/html/balance_8php-source.html
+++ b/doc/developper/html/balance_8php-source.html
@@ -1,12 +1,12 @@
-balance.php
Go to the documentation of this file.00001
00002 <?
00003 /*
@@ -92,7 +92,7 @@
00090
00091 //$a=FormPeriodeMult($cn);
00092 //echo $a;
-00093 echo '<input type="submit" name="view" value="ok">';
+00093 echo '<input type="submit" name="view" value="ok">';
00094
00095
00096 //-----------------------------------------------------
@@ -139,7 +139,7 @@
00137 }// end submit
00138 echo "</div>";
00139 ?>
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/balance_8php.html b/doc/developper/html/balance_8php.html
index 8f00ccfb9..be1275938 100644
--- a/doc/developper/html/balance_8php.html
+++ b/doc/developper/html/balance_8php.html
@@ -1,12 +1,12 @@
-balance.php File Reference
Show the balance and let you print it or export to PDF file included by user_impress. More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/bilan_8php-source.html b/doc/developper/html/bilan_8php-source.html
index df7463711..8586a12cd 100644
--- a/doc/developper/html/bilan_8php-source.html
+++ b/doc/developper/html/bilan_8php-source.html
@@ -1,12 +1,12 @@
-bilan.php
Go to the documentation of this file.00001 <?
00002 /*
00003 * This file is part of PhpCompta.
@@ -143,7 +143,7 @@
00137
00138 }// rtf file is read
00139 ?>
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/bilan_8php.html b/doc/developper/html/bilan_8php.html
index 8d5b1d22c..8a8c14838 100644
--- a/doc/developper/html/bilan_8php.html
+++ b/doc/developper/html/bilan_8php.html
@@ -1,12 +1,12 @@
-bilan.php File Reference
send a Bilan in RTF format More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/cbc__be_8inc_8php-source.html b/doc/developper/html/cbc__be_8inc_8php-source.html
index 436c0579b..04accfcae 100644
--- a/doc/developper/html/cbc__be_8inc_8php-source.html
+++ b/doc/developper/html/cbc__be_8inc_8php-source.html
@@ -1,12 +1,12 @@
-cbc_be.inc.php
Go to the documentation of this file.00001 <?
00002 /*
00003 * This file is part of PhpCompta.
@@ -69,7 +69,7 @@
00064 fclose($handle);
00065 echo "Encore rien désolé";
00066 ?>
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/cbc__be_8inc_8php.html b/doc/developper/html/cbc__be_8inc_8php.html
index 0143778aa..566996c14 100644
--- a/doc/developper/html/cbc__be_8inc_8php.html
+++ b/doc/developper/html/cbc__be_8inc_8php.html
@@ -1,12 +1,12 @@
-cbc_be.inc.php File Reference
This file must be included to parse the CVS from the CBC Bank. More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/central_8php-source.html b/doc/developper/html/central_8php-source.html
index 22aa8e97a..da3179949 100644
--- a/doc/developper/html/central_8php-source.html
+++ b/doc/developper/html/central_8php-source.html
@@ -1,12 +1,12 @@
-central.php
Go to the documentation of this file.00001 <?
00002
00003 /*
@@ -81,7 +81,7 @@
00075 if ( $ret != null) {
00076 echo '<FORM METHOD="POST" action="central.php">';
00077 echo $ret;
-00078 echo '<INPUT TYPE="SUBMIT" name="central" VALUE="Centralise">';
+00078 echo '<INPUT TYPE="SUBMIT" name="central" VALUE="Centralise">';
00079 echo '</FORM>';
00080 } else {
00081 echo '<H2 class="info"> Aucune période à centraliser</H2>';
@@ -90,7 +90,7 @@
00084 echo "</DIV>";
00085 html_page_stop();
00086 ?>
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/central_8php.html b/doc/developper/html/central_8php.html
index 5d6496abc..023b92ff9 100644
--- a/doc/developper/html/central_8php.html
+++ b/doc/developper/html/central_8php.html
@@ -1,12 +1,12 @@
-central.php File Reference
concerns the centralisation of the operations More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/central__inc_8php-source.html b/doc/developper/html/central__inc_8php-source.html
index 1622deeef..318e47d20 100644
--- a/doc/developper/html/central__inc_8php-source.html
+++ b/doc/developper/html/central__inc_8php-source.html
@@ -1,12 +1,12 @@
-central_inc.php
Go to the documentation of this file.00001 <?
00002 /*
00003 * This file is part of PhpCompta.
@@ -145,7 +145,7 @@
00162 }
00163
00164 ?>
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/central__inc_8php.html b/doc/developper/html/central__inc_8php.html
index 6a6a8ccf1..df94ad34e 100644
--- a/doc/developper/html/central__inc_8php.html
+++ b/doc/developper/html/central__inc_8php.html
@@ -1,12 +1,12 @@
-central_inc.php File Reference
Concerns the centralization operations. More...
00036 {
+00037 $sql="insert into centralized( c_j_id,
+00038 c_date ,
+00039 c_internal,
+00040 c_montant,
+00041 c_debit,
+00042 c_poste,
+00043 c_description,
+00044 c_grp,
+00045 c_jrn_def,
+00046 c_comment,
+00047 c_rapt,
+00048 c_periode) select j_id,
+00049 j_date,
+00050 jr_internal,
+00051 j_montant,
+00052 j_debit ,
+00053 j_poste ,
+00054 j_text ,
+00055 j_grpt ,
+00056 j_jrn_def,
+00057 jr_comment,
+00058 j_rapt,
+00059 j_tech_per
+00060 from jrnx left join jrn on jr_grpt_id=j_grpt
+00061 where
+00062 j_tech_per =".$p_periode."
+00063 order by j_date,j_grpt,j_debit desc ";
+00064 $Res=StartSql($p_cn);
+00065 $Res=ExecSql($p_cn,$sql);
+00066 if ($Res==false) { rollback($p_cn); EndSql($p_cn); return ERROR;}
+00067 $Res=ExecSql($p_cn,"update jrnx set j_centralized='t' where j_tech_per=".$p_periode);
+00068 if ($Res==false) { rollback($p_cn); EndSql($p_cn); return ERROR;}
+00069 // Set correctly the number of operation id (jr_opid) for each journal
+00070 // get the existing jrn_def_id
+00071 //--
+00072 $Res = ExecSql($p_cn,"select jrn_def_id from jrn_def");
+00073 $MaxJrn=pg_NumRows($Res);
+00074 // for each jrn_def_id
+00075 for ( $i=0; $i < $MaxJrn;$i++) {
+00076 $row=pg_fetch_array($Res,$i);
+00077 // get the op related to that jrn_def_id
+00078 $sql=sprintf("select jr_id from jrn
+00079 where
+00080 jr_tech_per=%d
+00081 and jr_def_id = %d
+00082 order by jr_date,jr_grpt_id desc",
+00083 $p_periode,
+00084 $row['jrn_def_id']
+00085 );
+00086
+00087 $Res2=ExecSql($p_cn,$sql);
+00088 $MaxLine=pg_NumRows($Res2);
+00089 for ($e=0;$e < $MaxLine;$e++) {
+00090 // each line is updated with a sequence
+00091 $line=pg_fetch_array($Res2,$e);
+00092 $jr_id=$line['jr_id'];
+00093 $sql=sprintf ("update jrn set
+00094 jr_opid = (select nextval('s_jrn_%d'))
+00095 where jr_id =%d",
+00096 $row['jrn_def_id'],
+00097 $jr_id);
+00098 $Ret=ExecSql($p_cn,$sql);
+00099 if ($Res==false) { rollback($p_cn); EndSql($p_cn); return ERROR;}
+00100 }
+00101 }
+00102 // Put jr_c_opid in centralized
+00103 // for each jrn_def_id
+00104 // get the op related to that jrn_def_id
+00105 $sql=sprintf("select jr_id from jrn
+00106 where
+00107 jr_tech_per=%d
+00108 order by jr_date,jr_grpt_id desc",
+00109 $p_periode
+00110 );
+00111
+00112 $Res2=ExecSql($p_cn,$sql);
+00113 $MaxLine=pg_NumRows($Res2);
+00114 for ($e=0;$e < $MaxLine;$e++) {
+00115 // each line is updated with a sequence
+00116 $line=pg_fetch_array($Res2,$e);
+00117 $jr_id=$line['jr_id'];
+00118 $sql=sprintf ("update jrn set
+00119 jr_c_opid = (select nextval('s_central'))
+00120 where jr_id =%d",
+00121 $jr_id);
+00122 $Ret=ExecSql($p_cn,$sql);
+00123 if ($Ret==false) { rollback($p_cn); EndSql($p_cn); return ERROR;}
+00124 }
+00125 // Set the order of the jrn
+00126 $Res=ExecSql($p_cn,"select c_id from centralized
+00127 inner join jrn on c_grp = jr_grpt_id
+00128 order by jr_c_opid, c_debit desc");
+00129 for ( $e=0;$e < pg_NumRows($Res);$e++) {
+00130 $row=pg_fetch_array($Res,$e);
+00131 $sql=sprintf ("update centralized set
+00132 c_order = (select nextval('s_central_order'))
+00133 where c_id = %d",$row['c_id']);
+00134 $Res2=ExecSql($p_cn,$sql);
+00135 if ($Res2==false) { rollback($p_cn); EndSql($p_cn); return ERROR;}
+00136
+00137 }
+00138 if ( ExecSql($p_cn,"update parm_periode set p_central=true where p_id=$p_periode") == false)
+00139 { rollback($p_cn); EndSql($p_cn); return ERROR;}
+00140
+00141
+00142
+00143
+00144 Commit($p_cn);
+00145 EndSql($p_cn);
+00146 return NOERROR;
+00147 }
+
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+00159 {
+00160 $Res=ExecSql($p_cn,"select c_id from centralized where c_j_id=$p_jrn_id");
+00161 return pg_NumRows($Res);
+00162 }
+
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/check__priv_8php-source.html b/doc/developper/html/check__priv_8php-source.html
index dad512e74..fd465654f 100644
--- a/doc/developper/html/check__priv_8php-source.html
+++ b/doc/developper/html/check__priv_8php-source.html
@@ -1,12 +1,12 @@
-check_priv.php
Go to the documentation of this file.
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/check__priv_8php.html b/doc/developper/html/check__priv_8php.html
index 46bfe8ef8..4cf847a6e 100644
--- a/doc/developper/html/check__priv_8php.html
+++ b/doc/developper/html/check__priv_8php.html
@@ -1,12 +1,12 @@
-check_priv.php File Reference
Tools for checking the security. More...
00147 {
+00148 if ( CheckIsAdmin ($p_login) ) return 1;
+00149 $cn=DbConnect($p_dossier);
+00150 $Res=ExecSql($cn,"select * from user_sec_act where ua_login='$p_login' and ua_act_id=$p_action_id");
+00151 $Count=pg_NumRows($Res);
+00152 if ( $Count == 0 ) return 0;
+00153 if ( $Count == 1 ) return 1;
+00154 echo "<H2 class=\"error\"> Invalid action !!! $Count select * from user_sec_act where ua_login='$p_login' and ua_act_id=$p_action_id </H2>";
+00155 }
+
00193 {
+00194 if ( CheckIsAdmin ($p_user) ) return 1;
+00195 $cn=DbConnect();
+00196 $sql="select dos_id from ac_users
+00197 natural join jnt_use_dos
+00198 natural join ac_dossier
+00199 join priv_user on ( priv_jnt=jnt_id)
+00200 where use_active=1
+00201 and use_login='$p_user'
+00202 and dos_id='$p_dossier'
+00203 and priv_priv != 'NO'";
+00204 return CountSql($cn,$sql);
+00205
+00206 }
+
00168 {
+00169 if ( $p_user == 'phpcompta') return 1;
+00170 $sql="select use_id from ac_users where use_login='$p_user'
+00171 and use_active=1 and use_admin=1 ";
+00172 $cn=DbConnect();
+00173
+00174 $isAdmin=CountSql($cn,$sql);
+00175
+00176
+00177 return $isAdmin;
+00178
+00179 }
+
00047 {
+00048 if ( CheckIsAdmin( $p_user) == 1 ) return 2;
+00049 $cn=DbConnect($p_dossier);
+00050 // Special
+00051 // p_jrn = 0 ==> grand livre access if there is no uj_prix=X
+00052 // or detail
+00053 if ( $p_jrn == 0 ) {
+00054 if ( $p_detail == false) {
+00055 // $n_jrn=CountSql($cn,"select jrn_def_id from jrn_def");
+00056 $n_for=CountSql($cn,"select jrn_def_id,uj_priv
+00057 from jrn_def left join user_sec_jrn on uj_jrn_id=jrn_def_id
+00058 where uj_login='$p_user' and uj_priv='X'");
+00059 if ( $n_for == 0 )
+00060 return 2;
+00061 else
+00062 return 0;
+00063 } else {
+00064 // For a detail, at least one jrn must be accessible
+00065 $n_for=CountSql($cn, " select jrn_def_id,uj_priv
+00066 from jrn_def left join user_sec_jrn on uj_jrn_id=jrn_def_id
+00067 where uj_login='$p_user' and uj_priv !='X'");
+00068 if ( $n_for == 0 )
+00069 return 0;
+00070 else
+00071 return 2;
+00072 }
+00073
+00074
+00075 }
+00076
+00077 // droit spécifique
+00078 $Res2=ExecSql($cn,"select jrn_def_id,uj_priv
+00079 from jrn_def left join user_sec_jrn on uj_jrn_id=jrn_def_id
+00080 where uj_login='$p_user' and jrn_def_id=$p_jrn");
+00081
+00082 $PrivJrn=pg_NumRows($Res2);
+00083 $cn=DbConnect();
+00084 // droit par défaut
+00085 $Res=ExecSql($cn," select *
+00086 from ac_users left join jnt_use_dos using (use_id)
+00087 left join priv_user on (priv_jnt=jnt_id)
+00088 where use_login='$p_user' and
+00089 dos_id=$p_dossier");
+00090
+00091 $DefRight=pg_NumRows($Res);
+00092 echo_debug ("PrivJrn = $PrivJrn DefRight $DefRight");
+00093 // Si les droits par défaut == 0, alors user n'a pas accès au dossier
+00094 if ( $DefRight == 0 ) return 0;
+00095 $Def=pg_fetch_array($Res,0);
+00096
+00097 // Si les droits par défaut == NO, alors user n'a pas accès au dossier
+00098 if ( $Def['priv_priv'] == "NO" ) return 0;
+00099
+00100 if ( $Def['priv_priv'] == "W") {
+00101 // Si droit pas défaut == écriture
+00102 if ( $PrivJrn == 0 ) {
+00103 // Pas de droit spécifique sur jrn => droit par défaut = W
+00104 return 2;
+00105 }
+00106 $Priv=pg_fetch_array($Res2,0);
+00107
+00108 if ( $Priv['uj_priv'] == "X" ) return 0;
+00109 if ( $Priv['uj_priv'] == "R" ) return 1;
+00110 if ( $Priv['uj_priv'] == "W" ) return 2;
+00111 echo '<H2 class="error"> Undefined right</H2>';
+00112 echo_debug ("Droit Journal $Priv[uj_priv]");
+00113 return 0;
+00114 }
+00115 if ( $Def['priv_priv'] == "R") {
+00116 // Si droit pas défaut == Lire
+00117 if ( $PrivJrn == 0 ) {
+00118 // Pas de droit spécifique sur jrn => droit par défaut = Lire
+00119 return 1;
+00120 }
+00121 $Priv=pg_fetch_array($Res2,0);
+00122
+00123 if ( $Priv['uj_priv'] == "X" ) return 0;
+00124 if ( $Priv['uj_priv'] == "R" ) return 1;
+00125 if ( $Priv['uj_priv'] == "W" ) return 2;
+00126 echo_debug ("Droit Journal $Priv[uj_priv]");
+00127 echo '<H2 class="error"> Undefined right</H2>';
+00128 return 0;
+00129 }
+00130 echo '<H2 class="error"> Undefined default right</H2>';
+00131 return 0;
+00132
+00133 }
+
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/classAttribut.html b/doc/developper/html/classAttribut.html
index c7883074d..26bd0e9dd 100644
--- a/doc/developper/html/classAttribut.html
+++ b/doc/developper/html/classAttribut.html
@@ -56,7 +56,13 @@ Definition at line
Field Documentation
@@ -161,8 +167,8 @@ Definition at line
The documentation for this class was generated from the following file:
-
-
Generated on Thu Jun 29 00:04:09 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:24 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/classBalance.html b/doc/developper/html/classBalance.html
index 907127d5b..b578e69a0 100644
--- a/doc/developper/html/classBalance.html
+++ b/doc/developper/html/classBalance.html
@@ -57,7 +57,13 @@ Definition at line 2
Member Function Documentation
@@ -110,7 +116,70 @@ retrieve all the row from the ledger in the range of a periode
00053 {
+00054 // compute periode
+00055 if ( $p_from_periode==$p_to_periode ) {
+00056 $per_sql=" j_tech_per = $p_from_periode ";
+00057 } else {
+00058 $per_sql = "j_tech_per >= $p_from_periode and j_tech_per <= $p_to_periode ";
+00059 }
+00060
+00061
+00062 // if centralized
+00063 $cent="";
+00064
+00065 if ( $this->central=='Y' ) { $cent="j_centralized = true and "; }
+00066
+00067 // build query
+00068 $sql="select j_poste,sum(deb) as sum_deb, sum(cred) as sum_cred from
+00069 ( select j_poste,
+00070 case when j_debit='t' then j_montant else 0 end as deb,
+00071 case when j_debit='f' then j_montant else 0 end as cred
+00072 from jrnx join tmp_pcmn on j_poste=pcm_val
+00073 where
+00074 $cent
+00075 $per_sql ) as m group by j_poste order by j_poste::text";
+00076
+00077 $Res=ExecSql($this->db,$sql);
+00078
+00079 $tot_cred= 0.0;
+00080 $tot_deb= 0.0;
+00081 $tot_deb_saldo=0.0;
+00082 $tot_cred_saldo=0.0;
+00083 $M=pg_NumRows($Res);
+00084 // Load the array
+00085 for ($i=0; $i <$M;$i++) {
+00086 $r=pg_fetch_array($Res,$i);
+00087 $a['poste']=$r['j_poste'];
+00088 $a['label']=substr(GetPosteLibelle($this->db,$r['j_poste'],1),0,40);
+00089 $a['sum_deb']=round($r['sum_deb'],2);
+00090 $a['sum_cred']=round($r['sum_cred'],2);
+00091 $a['solde_deb']=round(( $a['sum_deb'] >= $a['sum_cred'] )? $a['sum_deb']- $a['sum_cred']:0,2);
+00092 $a['solde_cred']=round(( $a['sum_deb'] <= $a['sum_cred'] )?$a['sum_cred']-$a['sum_deb']:0,2);
+00093 $array[$i]=$a;
+00094 $tot_cred+= $a['sum_cred'];
+00095 $tot_deb+= $a['sum_deb'];
+00096 $tot_deb_saldo+= $a['solde_deb'];
+00097 $tot_cred_saldo+= $a['solde_cred'];
+00098
+00099
+00100 }//for i
+00101 // Add the saldo
+00102 $i+=1;
+00103 $a['poste']="";
+00104 $a['label']="<b> Totaux </b>";
+00105 $a['sum_deb']=$tot_deb;
+00106 $a['sum_cred']=$tot_cred;
+00107 $a['solde_deb']=$tot_deb_saldo;
+00108 $a['solde_cred']=$tot_cred_saldo;
+00109 $array[$i]=$a;
+00110 $this->row=$array;
+00111 return $array;
+00112
+00113 }
+
Field Documentation
@@ -190,8 +259,8 @@ Definition at line 3
The documentation for this class was generated from the following file:
-
-
Generated on Thu Jun 29 00:04:09 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:24 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/classCezpdf.html b/doc/developper/html/classCezpdf.html
index e6d21b54f..9071df63b 100644
--- a/doc/developper/html/classCezpdf.html
+++ b/doc/developper/html/classCezpdf.html
@@ -130,7 +130,111 @@ Definition at line 28<
00028 {
+00029 // Assuming that people don't want to specify the paper size using the absolute coordinates
+00030 // allow a couple of options:
+00031 // orientation can be 'portrait' or 'landscape'
+00032 // or, to actually set the coordinates, then pass an array in as the first parameter.
+00033 // the defaults are as shown.
+00034 //
+00035 // -------------------------
+00036 // 2002-07-24 - Nicola Asuni (info@tecnick.com):
+00037 // Added new page formats (45 standard ISO paper formats and 4 american common formats)
+00038 // paper cordinates are calculated in this way: (inches * 72) where 1 inch = 2.54 cm
+00039 //
+00040 // Now you may also pass a 2 values array containing the page width and height in centimeters
+00041 // -------------------------
+00042
+00043 if (!is_array($paper)){
+00044 switch (strtoupper($paper)){
+00045 case '4A0': {$size = array(0,0,4767.87,6740.79); break;}
+00046 case '2A0': {$size = array(0,0,3370.39,4767.87); break;}
+00047 case 'A0': {$size = array(0,0,2383.94,3370.39); break;}
+00048 case 'A1': {$size = array(0,0,1683.78,2383.94); break;}
+00049 case 'A2': {$size = array(0,0,1190.55,1683.78); break;}
+00050 case 'A3': {$size = array(0,0,841.89,1190.55); break;}
+00051 case 'A4': default: {$size = array(0,0,595.28,841.89); break;}
+00052 case 'A5': {$size = array(0,0,419.53,595.28); break;}
+00053 case 'A6': {$size = array(0,0,297.64,419.53); break;}
+00054 case 'A7': {$size = array(0,0,209.76,297.64); break;}
+00055 case 'A8': {$size = array(0,0,147.40,209.76); break;}
+00056 case 'A9': {$size = array(0,0,104.88,147.40); break;}
+00057 case 'A10': {$size = array(0,0,73.70,104.88); break;}
+00058 case 'B0': {$size = array(0,0,2834.65,4008.19); break;}
+00059 case 'B1': {$size = array(0,0,2004.09,2834.65); break;}
+00060 case 'B2': {$size = array(0,0,1417.32,2004.09); break;}
+00061 case 'B3': {$size = array(0,0,1000.63,1417.32); break;}
+00062 case 'B4': {$size = array(0,0,708.66,1000.63); break;}
+00063 case 'B5': {$size = array(0,0,498.90,708.66); break;}
+00064 case 'B6': {$size = array(0,0,354.33,498.90); break;}
+00065 case 'B7': {$size = array(0,0,249.45,354.33); break;}
+00066 case 'B8': {$size = array(0,0,175.75,249.45); break;}
+00067 case 'B9': {$size = array(0,0,124.72,175.75); break;}
+00068 case 'B10': {$size = array(0,0,87.87,124.72); break;}
+00069 case 'C0': {$size = array(0,0,2599.37,3676.54); break;}
+00070 case 'C1': {$size = array(0,0,1836.85,2599.37); break;}
+00071 case 'C2': {$size = array(0,0,1298.27,1836.85); break;}
+00072 case 'C3': {$size = array(0,0,918.43,1298.27); break;}
+00073 case 'C4': {$size = array(0,0,649.13,918.43); break;}
+00074 case 'C5': {$size = array(0,0,459.21,649.13); break;}
+00075 case 'C6': {$size = array(0,0,323.15,459.21); break;}
+00076 case 'C7': {$size = array(0,0,229.61,323.15); break;}
+00077 case 'C8': {$size = array(0,0,161.57,229.61); break;}
+00078 case 'C9': {$size = array(0,0,113.39,161.57); break;}
+00079 case 'C10': {$size = array(0,0,79.37,113.39); break;}
+00080 case 'RA0': {$size = array(0,0,2437.80,3458.27); break;}
+00081 case 'RA1': {$size = array(0,0,1729.13,2437.80); break;}
+00082 case 'RA2': {$size = array(0,0,1218.90,1729.13); break;}
+00083 case 'RA3': {$size = array(0,0,864.57,1218.90); break;}
+00084 case 'RA4': {$size = array(0,0,609.45,864.57); break;}
+00085 case 'SRA0': {$size = array(0,0,2551.18,3628.35); break;}
+00086 case 'SRA1': {$size = array(0,0,1814.17,2551.18); break;}
+00087 case 'SRA2': {$size = array(0,0,1275.59,1814.17); break;}
+00088 case 'SRA3': {$size = array(0,0,907.09,1275.59); break;}
+00089 case 'SRA4': {$size = array(0,0,637.80,907.09); break;}
+00090 case 'LETTER': {$size = array(0,0,612.00,792.00); break;}
+00091 case 'LEGAL': {$size = array(0,0,612.00,1008.00); break;}
+00092 case 'EXECUTIVE': {$size = array(0,0,521.86,756.00); break;}
+00093 case 'FOLIO': {$size = array(0,0,612.00,936.00); break;}
+00094 }
+00095 switch (strtolower($orientation)){
+00096 case 'landscape':
+00097 $a=$size[3];
+00098 $size[3]=$size[2];
+00099 $size[2]=$a;
+00100 break;
+00101 }
+00102 } else {
+00103 if (count($paper)>2) {
+00104 // then an array was sent it to set the size
+00105 $size = $paper;
+00106 }
+00107 else { //size in centimeters has been passed
+00108 $size[0] = 0;
+00109 $size[1] = 0;
+00110 $size[2] = ( $paper[0] / 2.54 ) * 72;
+00111 $size[3] = ( $paper[1] / 2.54 ) * 72;
+00112 }
+00113 }
+00114 $this->Cpdf($size);
+00115 $this->ez['pageWidth']=$size[2];
+00116 $this->ez['pageHeight']=$size[3];
+00117
+00118 // also set the margins to some reasonable defaults
+00119 $this->ez['topMargin']=30;
+00120 $this->ez['bottomMargin']=30;
+00121 $this->ez['leftMargin']=30;
+00122 $this->ez['rightMargin']=30;
+00123
+00124 // set the current writing position to the top of the first page
+00125 $this->y = $this->ez['pageHeight']-$this->ez['topMargin'];
+00126 // and get the ID of the page that was created during the instancing process.
+00127 $this->ezPages[1]=$this->getFirstPageId();
+00128 $this->ezPageCount=1;
+00129 }
+
Member Function Documentation
@@ -174,7 +278,51 @@ Definition at line 147
01473 {
+01474 // a callback function to support the formation of clickable links within the document
+01475 $lineFactor=0.05; // the thickness of the line as a proportion of the height. also the drop of the line.
+01476 switch($info['status']){
+01477 case 'start':
+01478 case 'sol':
+01479 // the beginning of the link
+01480 // this should contain the URl for the link as the 'p' entry, and will also contain the value of 'nCallback'
+01481 if (!isset($this->ez['links'])){
+01482 $this->ez['links']=array();
+01483 }
+01484 $i = $info['nCallback'];
+01485 $this->ez['links'][$i] = array('x'=>$info['x'],'y'=>$info['y'],'angle'=>$info['angle'],'decender'=>$info['decender'],'height'=>$info['height'],'url'=>$info['p']);
+01486 if ($internal==0){
+01487 $this->saveState();
+01488 $this->setColor(0,0,1);
+01489 $this->setStrokeColor(0,0,1);
+01490 $thick = $info['height']*$lineFactor;
+01491 $this->setLineStyle($thick);
+01492 }
+01493 break;
+01494 case 'end':
+01495 case 'eol':
+01496 // the end of the link
+01497 // assume that it is the most recent opening which has closed
+01498 $i = $info['nCallback'];
+01499 $start = $this->ez['links'][$i];
+01500 // add underlining
+01501 if ($internal){
+01502 $this->addInternalLink($start['url'],$start['x'],$start['y']+$start['decender'],$info['x'],$start['y']+$start['decender']+$start['height']);
+01503 } else {
+01504 $a = deg2rad((float)$start['angle']-90.0);
+01505 $drop = $start['height']*$lineFactor*1.5;
+01506 $dropx = cos($a)*$drop;
+01507 $dropy = -sin($a)*$drop;
+01508 $this->line($start['x']-$dropx,$start['y']-$dropy,$info['x']-$dropx,$info['y']-$dropy);
+01509 $this->addLink($start['url'],$start['x'],$start['y']+$start['decender'],$info['x'],$start['y']+$start['decender']+$start['height']);
+01510 $this->restoreState();
+01511 }
+01512 break;
+01513 }
+01514 }
+
01460 {
+01461 // execute the given template on the current document.
+01462 if (!isset($this->ez['templates'][$id])){
+01463 return;
+01464 }
+01465 eval($this->ez['templates'][$id]['code']);
+01466 }
+
00144 {
+00145 // start from the current y-position, make the set number of columne
+00146 if (isset($this->ez['columns']) && $this->ez['columns']==1){
+00147 // if we are already in a column mode then just return.
+00148 return;
+00149 }
+00150 $def=array('gap'=>10,'num'=>2);
+00151 foreach($def as $k=>$v){
+00152 if (!isset($options[$k])){
+00153 $options[$k]=$v;
+00154 }
+00155 }
+00156 // setup the columns
+00157 $this->ez['columns']=array('on'=>1,'colNum'=>1);
+00158
+00159 // store the current margins
+00160 $this->ez['columns']['margins']=array(
+00161 $this->ez['leftMargin']
+00162 ,$this->ez['rightMargin']
+00163 ,$this->ez['topMargin']
+00164 ,$this->ez['bottomMargin']
+00165 );
+00166 // and store the settings for the columns
+00167 $this->ez['columns']['options']=$options;
+00168 // then reset the margins to suit the new columns
+00169 // safe enough to assume the first column here, but start from the current y-position
+00170 $this->ez['topMargin']=$this->ez['pageHeight']-$this->y;
+00171 $width=($this->ez['pageWidth']-$this->ez['leftMargin']-$this->ez['rightMargin']-($options['num']-1)*$options['gap'])/$options['num'];
+00172 $this->ez['columns']['width']=$width;
+00173 $this->ez['rightMargin']=$this->ez['pageWidth']-$this->ez['leftMargin']-$width;
+00174
+00175 }
+
00177 {
+00178 if (isset($this->ez['columns']) && $this->ez['columns']['on']==1){
+00179 $this->ez['columns']['on']=0;
+00180 $this->ez['leftMargin']=$this->ez['columns']['margins'][0];
+00181 $this->ez['rightMargin']=$this->ez['columns']['margins'][1];
+00182 $this->ez['topMargin']=$this->ez['columns']['margins'][2];
+00183 $this->ez['bottomMargin']=$this->ez['columns']['margins'][3];
+00184 }
+00185 }
+
00266 {
+00267 // return the strict numbering (1,2,3,4..) number of the current page
+00268 return $this->ezPageCount;
+00269 }
+
01301 {
+01302 //beta ezimage function
+01303 if (stristr($image,'://'))//copy to temp file
+01304 {
+01305 $fp = @fopen($image,"rb");
+01306 while(!feof($fp))
+01307 {
+01308 $cont.= fread($fp,1024);
+01309 }
+01310 fclose($fp);
+01311 $image = tempnam ("/tmp", "php-pdf");
+01312 $fp2 = @fopen($image,"w");
+01313 fwrite($fp2,$cont);
+01314 fclose($fp2);
+01315 $temp = true;
+01316 }
+01317
+01318 if (!(file_exists($image))) return false; //return immediately if image file does not exist
+01319 $imageInfo = getimagesize($image);
+01320 switch ($imageInfo[2]){
+01321 case 2:
+01322 $type = "jpeg";
+01323 break;
+01324 case 3:
+01325 $type = "png";
+01326 break;
+01327 default:
+01328 return false; //return if file is not jpg or png
+01329 }
+01330 if ($width == 0) $width = $imageInfo[0]; //set width
+01331 $ratio = $imageInfo[0]/$imageInfo[1];
+01332
+01333 //get maximum width of image
+01334 if (isset($this->ez['columns']) && $this->ez['columns']['on'] == 1)
+01335 {
+01336 $bigwidth = $this->ez['columns']['width'] - ($pad * 2);
+01337 }
+01338 else
+01339 {
+01340 $bigwidth = $this->ez['pageWidth'] - ($pad * 2);
+01341 }
+01342 //fix width if larger than maximum or if $resize=full
+01343 if ($resize == 'full' || $resize == 'width' || $width > $bigwidth)
+01344 {
+01345 $width = $bigwidth;
+01346
+01347 }
+01348
+01349 $height = ($width/$ratio); //set height
+01350
+01351 //fix size if runs off page
+01352 if ($height > ($this->y - $this->ez['bottomMargin'] - ($pad * 2)))
+01353 {
+01354 if ($resize != 'full')
+01355 {
+01356 $this->ezNewPage();
+01357 }
+01358 else
+01359 {
+01360 $height = ($this->y - $this->ez['bottomMargin'] - ($pad * 2)); //shrink height
+01361 $width = ($height*$ratio); //fix width
+01362 }
+01363 }
+01364
+01365 //fix x-offset if image smaller than bigwidth
+01366 if ($width < $bigwidth)
+01367 {
+01368 //center if justification=center
+01369 if ($just == 'center')
+01370 {
+01371 $offset = ($bigwidth - $width) / 2;
+01372 }
+01373 //move to right if justification=right
+01374 if ($just == 'right')
+01375 {
+01376 $offset = ($bigwidth - $width);
+01377 }
+01378 //leave at left if justification=left
+01379 if ($just == 'left')
+01380 {
+01381 $offset = 0;
+01382 }
+01383 }
+01384
+01385
+01386 //call appropriate function
+01387 if ($type == "jpeg"){
+01388 $this->addJpegFromFile($image,$this->ez['leftMargin'] + $pad + $offset, $this->y + $this->getFontHeight($this->ez['fontSize']) - $pad - $height,$width);
+01389 }
+01390
+01391 if ($type == "png"){
+01392 $this->addPngFromFile($image,$this->ez['leftMargin'] + $pad + $offset, $this->y + $this->getFontHeight($this->ez['fontSize']) - $pad - $height,$width);
+01393 }
+01394 //draw border
+01395 if ($border != '')
+01396 {
+01397 if (!(isset($border['color'])))
+01398 {
+01399 $border['color']['red'] = .5;
+01400 $border['color']['blue'] = .5;
+01401 $border['color']['green'] = .5;
+01402 }
+01403 if (!(isset($border['width']))) $border['width'] = 1;
+01404 if (!(isset($border['cap']))) $border['cap'] = 'round';
+01405 if (!(isset($border['join']))) $border['join'] = 'round';
+01406
+01407
+01408 $this->setStrokeColor($border['color']['red'],$border['color']['green'],$border['color']['blue']);
+01409 $this->setLineStyle($border['width'],$border['cap'],$border['join']);
+01410 $this->rectangle($this->ez['leftMargin'] + $pad + $offset, $this->y + $this->getFontHeight($this->ez['fontSize']) - $pad - $height,$width,$height);
+01411
+01412 }
+01413 // move y below image
+01414 $this->y = $this->y - $pad - $height;
+01415 //remove tempfile for remote images
+01416 if ($temp == true) unlink($image);
+01417
+01418 }
+
00187 {
+00188 // puts the document into insert mode. new pages are inserted until this is re-called with status=0
+00189 // by default pages wil be inserted at the start of the document
+00190 switch($status){
+00191 case '1':
+00192 if (isset($this->ezPages[$pageNum])){
+00193 $this->ez['insertMode']=1;
+00194 $this->ez['insertOptions']=array('id'=>$this->ezPages[$pageNum],'pos'=>$pos);
+00195 }
+00196 break;
+00197 case '0':
+00198 $this->ez['insertMode']=0;
+00199 break;
+00200 }
+00201 }
+
00204 {
+00205 $pageRequired=1;
+00206 if (isset($this->ez['columns']) && $this->ez['columns']['on']==1){
+00207 // check if this is just going to a new column
+00208 // increment the column number
+00209 //echo 'HERE<br>';
+00210 $this->ez['columns']['colNum']++;
+00211 //echo $this->ez['columns']['colNum'].'<br>';
+00212 if ($this->ez['columns']['colNum'] <= $this->ez['columns']['options']['num']){
+00213 // then just reset to the top of the next column
+00214 $pageRequired=0;
+00215 } else {
+00216 $this->ez['columns']['colNum']=1;
+00217 $this->ez['topMargin']=$this->ez['columns']['margins'][2];
+00218 }
+00219
+00220 $width = $this->ez['columns']['width'];
+00221 $this->ez['leftMargin']=$this->ez['columns']['margins'][0]+($this->ez['columns']['colNum']-1)*($this->ez['columns']['options']['gap']+$width);
+00222 $this->ez['rightMargin']=$this->ez['pageWidth']-$this->ez['leftMargin']-$width;
+00223 }
+00224 //echo 'left='.$this->ez['leftMargin'].' right='.$this->ez['rightMargin'].'<br>';
+00225
+00226 if ($pageRequired){
+00227 // make a new page, setting the writing point back to the top
+00228 $this->y = $this->ez['pageHeight']-$this->ez['topMargin'];
+00229 // make the new page with a call to the basic class.
+00230 $this->ezPageCount++;
+00231 if (isset($this->ez['insertMode']) && $this->ez['insertMode']==1){
+00232 $id = $this->ezPages[$this->ezPageCount] = $this->newPage(1,$this->ez['insertOptions']['id'],$this->ez['insertOptions']['pos']);
+00233 // then manipulate the insert options so that inserted pages follow each other
+00234 $this->ez['insertOptions']['id']=$id;
+00235 $this->ez['insertOptions']['pos']='after';
+00236 } else {
+00237 $this->ezPages[$this->ezPageCount] = $this->newPage();
+00238 }
+00239 } else {
+00240 $this->y = $this->ez['pageHeight']-$this->ez['topMargin'];
+00241 }
+00242 }
+
00461 {
+00462 $this->ezPRVTcleanUp();
+00463 return $this->output($options);
+00464 }
+
01195 {
+01196 // this function will intially be used to implement underlining support, but could be used for a range of other
+01197 // purposes
+01198 $search = array('<u>','<U>','</u>','</U>');
+01199 $replace = array('<c:uline>','<c:uline>','</c:uline>','</c:uline>');
+01200 return str_replace($search,$replace,$text);
+01201 }
+
00377 {
+00378 // this will go through the pageNumbering array and add the page numbers are required
+00379 if (isset($this->ez['pageNumbering'])){
+00380 $totalPages1 = $this->ezPageCount;
+00381 $tmp1=$this->ez['pageNumbering'];
+00382 $status=0;
+00383 foreach($tmp1 as $i=>$tmp){
+00384 // do each of the page numbering systems
+00385 // firstly, find the total pages for this one
+00386 $k = $this->ezPRVTpageNumberSearch('stopt',$tmp);
+00387 if ($k && $k>0){
+00388 $totalPages = $k-1;
+00389 } else {
+00390 $l = $this->ezPRVTpageNumberSearch('stoptn',$tmp);
+00391 if ($l && $l>0){
+00392 $totalPages = $l;
+00393 } else {
+00394 $totalPages = $totalPages1;
+00395 }
+00396 }
+00397 foreach ($this->ezPages as $pageNum=>$id){
+00398 if (isset($tmp[$pageNum])){
+00399 if (is_array($tmp[$pageNum])){
+00400 // then this must be starting page numbers
+00401 $status=1;
+00402 $info = $tmp[$pageNum];
+00403 $info['dnum']=$info['num']-$pageNum;
+00404 // also check for the special case of the numbering stopping and starting on the same page
+00405 if (isset($info['stopn']) || isset($info['stoptn']) ){
+00406 $status=2;
+00407 }
+00408 } else if ($tmp[$pageNum]=='stop' || $tmp[$pageNum]=='stopt'){
+00409 // then we are stopping page numbers
+00410 $status=0;
+00411 } else if ($status==1 && ($tmp[$pageNum]=='stoptn' || $tmp[$pageNum]=='stopn')){
+00412 // then we are stopping page numbers
+00413 $status=2;
+00414 }
+00415 }
+00416 if ($status){
+00417 // then add the page numbering to this page
+00418 if (strlen($info['num'])){
+00419 $num=$pageNum+$info['dnum'];
+00420 } else {
+00421 $num=$pageNum;
+00422 }
+00423 $total = $totalPages+$num-$pageNum;
+00424 $pat = str_replace('{PAGENUM}',$num,$info['pattern']);
+00425 $pat = str_replace('{TOTALPAGENUM}',$total,$pat);
+00426 $this->reopenObject($id);
+00427 switch($info['pos']){
+00428 case 'right':
+00429 $this->addText($info['x'],$info['y'],$info['size'],$pat);
+00430 break;
+00431 default:
+00432 $w=$this->getTextWidth($info['size'],$pat);
+00433 $this->addText($info['x']-$w,$info['y'],$info['size'],$pat);
+00434 break;
+00435 }
+00436 $this->closeObject();
+00437 }
+00438 if ($status==2){
+00439 $status=0;
+00440 }
+00441 }
+00442 }
+00443 }
+00444 }
+
00448 {
+00449 $this->ezPRVTaddPageNumbers();
+00450 }
+
00591 {
+00592 // will calculate the maximum width, taking into account that the text may be broken
+00593 // by line breaks.
+00594 $mx=0;
+00595 $lines = explode("\n",$text);
+00596 foreach ($lines as $line){
+00597 $w = $this->getTextWidth($size,$line);
+00598 if ($w>$mx){
+00599 $mx=$w;
+00600 }
+00601 }
+00602 return $mx;
+00603 }
+
00360 {
+00361 foreach($tmp as $i=>$v){
+00362 if (is_array($v)){
+00363 if (isset($v[$lbl])){
+00364 return $i;
+00365 }
+00366 } else {
+00367 if ($v==$lbl){
+00368 return $i;
+00369 }
+00370 }
+00371 }
+00372 return 0;
+00373 }
+
00526 {
+00527 // uses ezText to add the text, and returns the height taken by the largest heading
+00528 // this page will move the headings to a new page if they will not fit completely on this one
+00529 // transaction support will be used to implement this
+00530
+00531 if (isset($optionsAll['cols'])){
+00532 $options = $optionsAll['cols'];
+00533 } else {
+00534 $options = array();
+00535 }
+00536
+00537 $mx=0;
+00538 $startPage = $this->ezPageCount;
+00539 $secondGo=0;
+00540
+00541 // $y is the position at which the top of the table should start, so the base
+00542 // of the first text, is $y-$height-$gap-$decender, but ezText starts by dropping $height
+00543
+00544 // the return from this function is the total cell height, including gaps, and $y is adjusted
+00545 // to be the postion of the bottom line
+00546
+00547 // begin the transaction
+00548 $this->transaction('start');
+00549 $ok=0;
+00550 // $y-=$gap-$decender;
+00551 $y-=$gap;
+00552 while ($ok==0){
+00553 foreach($cols as $colName=>$colHeading){
+00554 $this->ezSetY($y);
+00555 if (isset($options[$colName]) && isset($options[$colName]['justification'])){
+00556 $justification = $options[$colName]['justification'];
+00557 } else {
+00558 $justification = 'left';
+00559 }
+00560 $this->ezText($colHeading,$size,array('aleft'=> $pos[$colName],'aright'=>($maxWidth[$colName]+$pos[$colName]),'justification'=>$justification));
+00561 $dy = $y-$this->y;
+00562 if ($dy>$mx){
+00563 $mx=$dy;
+00564 }
+00565 }
+00566 $y = $y - $mx - $gap + $decender;
+00567 // $y -= $mx-$gap+$decender;
+00568
+00569 // now, if this has moved to a new page, then abort the transaction, move to a new page, and put it there
+00570 // do not check on the second time around, to avoid an infinite loop
+00571 if ($this->ezPageCount != $startPage && $secondGo==0){
+00572 $this->transaction('rewind');
+00573 $this->ezNewPage();
+00574 $y = $this->y - $gap-$decender;
+00575 $ok=0;
+00576 $secondGo=1;
+00577 // $y = $store_y;
+00578 $mx=0;
+00579
+00580 } else {
+00581 $this->transaction('commit');
+00582 $ok=1;
+00583 }
+00584 }
+00585
+00586 return $mx+$gap*2-$decender;
+00587 }
+
00497 {
+00498 $x0=1000;
+00499 $x1=0;
+00500 $this->setStrokeColor($col[0],$col[1],$col[2]);
+00501 $cnt=0;
+00502 $n = count($pos);
+00503 foreach($pos as $x){
+00504 $cnt++;
+00505 if ($cnt==1 || $cnt==$n){
+00506 $this->setLineStyle($outer);
+00507 } else {
+00508 $this->setLineStyle($inner);
+00509 }
+00510 $this->line($x-$gap/2,$y0,$x-$gap/2,$y2);
+00511 if ($x>$x1){ $x1=$x; };
+00512 if ($x<$x0){ $x0=$x; };
+00513 }
+00514 $this->setLineStyle($outer);
+00515 $this->line($x0-$gap/2-$outer/2,$y0,$x1-$gap/2+$outer/2,$y0);
+00516 // only do the second line if it is different to the first, AND each row does not have
+00517 // a line on it.
+00518 if ($y0!=$y1 && $opt<2){
+00519 $this->line($x0-$gap/2,$y1,$x1-$gap/2,$y1);
+00520 }
+00521 $this->line($x0-$gap/2-$outer/2,$y2,$x1-$gap/2+$outer/2,$y2);
+00522 }
+
00134 {
+00135 $top = ( $top / 2.54 ) * 72;
+00136 $bottom = ( $bottom / 2.54 ) * 72;
+00137 $left = ( $left / 2.54 ) * 72;
+00138 $right = ( $right / 2.54 ) * 72;
+00139 $this->ezSetMargins($top,$bottom,$left,$right);
+00140 }
+
00479 {
+00480 // used to change the vertical position of the writing point.
+00481 // changes up by a positive increment, so enter a negative number to go
+00482 // down the page
+00483 // if $mod is set to 'makeSpace' and a new page is forced, then the pointed will be moved
+00484 // down on the new page, this will allow space to be reserved for graphics etc.
+00485 $this->y += $dy;
+00486 if ( $this->y < $this->ez['bottomMargin']){
+00487 // then make a new page
+00488 $this->ezNewPage();
+00489 if ($mod=='makeSpace'){
+00490 $this->y += $dy;
+00491 }
+00492 }
+00493 }
+
00246 {
+00247 // sets the margins to new values
+00248 $this->ez['topMargin']=$top;
+00249 $this->ez['bottomMargin']=$bottom;
+00250 $this->ez['leftMargin']=$left;
+00251 $this->ez['rightMargin']=$right;
+00252 // check to see if this means that the current writing position is outside the
+00253 // writable area
+00254 if ($this->y > $this->ez['pageHeight']-$top){
+00255 // then move y down
+00256 $this->y = $this->ez['pageHeight']-$top;
+00257 }
+00258 if ( $this->y < $bottom){
+00259 // then make a new page
+00260 $this->ezNewPage();
+00261 }
+00262 }
+
00468 {
+00469 // used to change the vertical position of the writing point.
+00470 $this->y = $y;
+00471 if ( $this->y < $this->ez['bottomMargin']){
+00472 // then make a new page
+00473 $this->ezNewPage();
+00474 }
+00475 }
+
00273 {PAGENUM} of {TOTALPAGENUM}',$num=''){
+00274 // put page numbers on the pages from here.
+00275 // place then on the 'pos' side of the coordinates (x,y).
+00276 // pos can be 'left' or 'right'
+00277 // use the given 'pattern' for display, where (PAGENUM} and {TOTALPAGENUM} are replaced
+00278 // as required.
+00279 // if $num is set, then make the first page this number, the number of total pages will
+00280 // be adjusted to account for this.
+00281 // Adjust this function so that each time you 'start' page numbers then you effectively start a different batch
+00282 // return the number of the batch, so that they can be stopped in a different order if required.
+00283 if (!$pos || !strlen($pos)){
+00284 $pos='left';
+00285 }
+00286 if (!$pattern || !strlen($pattern)){
+00287 $pattern='{PAGENUM} of {TOTALPAGENUM}';
+00288 }
+00289 if (!isset($this->ez['pageNumbering'])){
+00290 $this->ez['pageNumbering']=array();
+00291 }
+00292 $i = count($this->ez['pageNumbering']);
+00293 $this->ez['pageNumbering'][$i][$this->ezPageCount]=array('x'=>$x,'y'=>$y,'pos'=>$pos,'pattern'=>$pattern,'num'=>$num,'size'=>$size);
+00294 return $i;
+00295 }
+
00331 {
+00332 // if stopTotal=1 then the totalling of pages for this number will stop too
+00333 // if $next=1, then do this page, but not the next, else do not do this page either
+00334 // if $i is set, then stop that particular pagenumbering sequence.
+00335 if (!isset($this->ez['pageNumbering'])){
+00336 $this->ez['pageNumbering']=array();
+00337 }
+00338 if ($next && isset($this->ez['pageNumbering'][$i][$this->ezPageCount]) && is_array($this->ez['pageNumbering'][$i][$this->ezPageCount])){
+00339 // then this has only just been started, this will over-write the start, and nothing will appear
+00340 // add a special command to the start block, telling it to stop as well
+00341 if ($stopTotal){
+00342 $this->ez['pageNumbering'][$i][$this->ezPageCount]['stoptn']=1;
+00343 } else {
+00344 $this->ez['pageNumbering'][$i][$this->ezPageCount]['stopn']=1;
+00345 }
+00346 } else {
+00347 if ($stopTotal){
+00348 $this->ez['pageNumbering'][$i][$this->ezPageCount]='stopt';
+00349 } else {
+00350 $this->ez['pageNumbering'][$i][$this->ezPageCount]='stop';
+00351 }
+00352 if ($next){
+00353 $this->ez['pageNumbering'][$i][$this->ezPageCount].='n';
+00354 }
+00355 }
+00356 }
+
00454 {
+00455 $this->ezPRVTcleanUp();
+00456 $this->stream($options);
+00457 }
+
00607 {
+00608 // add a table of information to the pdf document
+00609 // $data is a two dimensional array
+00610 // $cols (optional) is an associative array, the keys are the names of the columns from $data
+00611 // to be presented (and in that order), the values are the titles to be given to the columns
+00612 // $title (optional) is the title to be put on the top of the table
+00613 //
+00614 // $options is an associative array which can contain:
+00615 // 'showLines'=> 0,1,2, default is 1 (show outside and top lines only), 2=> lines on each row
+00616 // 'showHeadings' => 0 or 1
+00617 // 'shaded'=> 0,1,2,3 default is 1 (1->alternate lines are shaded, 0->no shading, 2-> both shaded, second uses shadeCol2)
+00618 // 'shadeCol' => (r,g,b) array, defining the colour of the shading, default is (0.8,0.8,0.8)
+00619 // 'shadeCol2' => (r,g,b) array, defining the colour of the shading of the other blocks, default is (0.7,0.7,0.7)
+00620 // 'fontSize' => 10
+00621 // 'textCol' => (r,g,b) array, text colour
+00622 // 'titleFontSize' => 12
+00623 // 'rowGap' => 2 , the space added at the top and bottom of each row, between the text and the lines
+00624 // 'colGap' => 5 , the space on the left and right sides of each cell
+00625 // 'lineCol' => (r,g,b) array, defining the colour of the lines, default, black.
+00626 // 'xPos' => 'left','right','center','centre',or coordinate, reference coordinate in the x-direction
+00627 // 'xOrientation' => 'left','right','center','centre', position of the table w.r.t 'xPos'
+00628 // 'width'=> <number> which will specify the width of the table, if it turns out to not be this
+00629 // wide, then it will stretch the table to fit, if it is wider then each cell will be made
+00630 // proportionalty smaller, and the content may have to wrap.
+00631 // 'maxWidth'=> <number> similar to 'width', but will only make table smaller than it wants to be
+00632 // 'options' => array(<colname>=>array('justification'=>'left','width'=>100,'link'=>linkDataName),<colname>=>....)
+00633 // allow the setting of other paramaters for the individual columns
+00634 // 'minRowSpace'=> the minimum space between the bottom of each row and the bottom margin, in which a new row will be started
+00635 // if it is less, then a new page would be started, default=-100
+00636 // 'innerLineThickness'=>1
+00637 // 'outerLineThickness'=>1
+00638 // 'splitRows'=>0, 0 or 1, whether or not to allow the rows to be split across page boundaries
+00639 // 'protectRows'=>number, the number of rows to hold with the heading on page, ie, if there less than this number of
+00640 // rows on the page, then move the whole lot onto the next page, default=1
+00641 //
+00642 // note that the user will have had to make a font selection already or this will not
+00643 // produce a valid pdf file.
+00644
+00645 if (!is_array($data)){
+00646 return;
+00647 }
+00648
+00649 if (!is_array($cols)){
+00650 // take the columns from the first row of the data set
+00651 reset($data);
+00652 list($k,$v)=each($data);
+00653 if (!is_array($v)){
+00654 return;
+00655 }
+00656 $cols=array();
+00657 foreach($v as $k1=>$v1){
+00658 $cols[$k1]=$k1;
+00659 }
+00660 }
+00661
+00662 if (!is_array($options)){
+00663 $options=array();
+00664 }
+00665
+00666 $defaults = array(
+00667 'shaded'=>1,'showLines'=>1,'shadeCol'=>array(0.8,0.8,0.8),'shadeCol2'=>array(0.7,0.7,0.7),'fontSize'=>10,'titleFontSize'=>12
+00668 ,'titleGap'=>5,'lineCol'=>array(0,0,0),'gap'=>5,'xPos'=>'centre','xOrientation'=>'centre'
+00669 ,'showHeadings'=>1,'textCol'=>array(0,0,0),'width'=>0,'maxWidth'=>0,'cols'=>array(),'minRowSpace'=>-100,'rowGap'=>2,'colGap'=>5
+00670 ,'innerLineThickness'=>1,'outerLineThickness'=>1,'splitRows'=>0,'protectRows'=>1
+00671 );
+00672
+00673 foreach($defaults as $key=>$value){
+00674 if (is_array($value)){
+00675 if (!isset($options[$key]) || !is_array($options[$key])){
+00676 $options[$key]=$value;
+00677 }
+00678 } else {
+00679 if (!isset($options[$key])){
+00680 $options[$key]=$value;
+00681 }
+00682 }
+00683 }
+00684 $options['gap']=2*$options['colGap'];
+00685
+00686 $middle = ($this->ez['pageWidth']-$this->ez['rightMargin'])/2+($this->ez['leftMargin'])/2;
+00687 // figure out the maximum widths of the text within each column
+00688 $maxWidth=array();
+00689 foreach($cols as $colName=>$colHeading){
+00690 $maxWidth[$colName]=0;
+00691 }
+00692 // find the maximum cell widths based on the data
+00693 foreach($data as $row){
+00694 foreach($cols as $colName=>$colHeading){
+00695 $w = $this->ezPrvtGetTextWidth($options['fontSize'],(string)$row[$colName])*1.01;
+00696 if ($w > $maxWidth[$colName]){
+00697 $maxWidth[$colName]=$w;
+00698 }
+00699 }
+00700 }
+00701 // and the maximum widths to fit in the headings
+00702 foreach($cols as $colName=>$colTitle){
+00703 $w = $this->ezPrvtGetTextWidth($options['fontSize'],(string)$colTitle)*1.01;
+00704 if ($w > $maxWidth[$colName]){
+00705 $maxWidth[$colName]=$w;
+00706 }
+00707 }
+00708
+00709 // calculate the start positions of each of the columns
+00710 $pos=array();
+00711 $x=0;
+00712 $t=$x;
+00713 $adjustmentWidth=0;
+00714 $setWidth=0;
+00715 foreach($maxWidth as $colName => $w){
+00716 $pos[$colName]=$t;
+00717 // if the column width has been specified then set that here, also total the
+00718 // width avaliable for adjustment
+00719 if (isset($options['cols'][$colName]) && isset($options['cols'][$colName]['width']) && $options['cols'][$colName]['width']>0){
+00720 $t=$t+$options['cols'][$colName]['width'];
+00721 $maxWidth[$colName] = $options['cols'][$colName]['width']-$options['gap'];
+00722 $setWidth += $options['cols'][$colName]['width'];
+00723 } else {
+00724 $t=$t+$w+$options['gap'];
+00725 $adjustmentWidth += $w;
+00726 $setWidth += $options['gap'];
+00727 }
+00728 }
+00729 $pos['_end_']=$t;
+00730
+00731 // if maxWidth is specified, and the table is too wide, and the width has not been set,
+00732 // then set the width.
+00733 if ($options['width']==0 && $options['maxWidth'] && ($t-$x)>$options['maxWidth']){
+00734 // then need to make this one smaller
+00735 $options['width']=$options['maxWidth'];
+00736 }
+00737
+00738 if ($options['width'] && $adjustmentWidth>0 && $setWidth<$options['width']){
+00739 // first find the current widths of the columns involved in this mystery
+00740 $cols0 = array();
+00741 $cols1 = array();
+00742 $xq=0;
+00743 $presentWidth=0;
+00744 $last='';
+00745 foreach($pos as $colName=>$p){
+00746 if (!isset($options['cols'][$last]) || !isset($options['cols'][$last]['width']) || $options['cols'][$last]['width']<=0){
+00747 if (strlen($last)){
+00748 $cols0[$last]=$p-$xq -$options['gap'];
+00749 $presentWidth += ($p-$xq - $options['gap']);
+00750 }
+00751 } else {
+00752 $cols1[$last]=$p-$xq;
+00753 }
+00754 $last=$colName;
+00755 $xq=$p;
+00756 }
+00757 // $cols0 contains the widths of all the columns which are not set
+00758 $neededWidth = $options['width']-$setWidth;
+00759 // if needed width is negative then add it equally to each column, else get more tricky
+00760 if ($presentWidth<$neededWidth){
+00761 foreach($cols0 as $colName=>$w){
+00762 $cols0[$colName]+= ($neededWidth-$presentWidth)/count($cols0);
+00763 }
+00764 } else {
+00765
+00766 $cnt=0;
+00767 while ($presentWidth>$neededWidth && $cnt<100){
+00768 $cnt++; // insurance policy
+00769 // find the widest columns, and the next to widest width
+00770 $aWidest = array();
+00771 $nWidest=0;
+00772 $widest=0;
+00773 foreach($cols0 as $colName=>$w){
+00774 if ($w>$widest){
+00775 $aWidest=array($colName);
+00776 $nWidest = $widest;
+00777 $widest=$w;
+00778 } else if ($w==$widest){
+00779 $aWidest[]=$colName;
+00780 }
+00781 }
+00782 // then figure out what the width of the widest columns would have to be to take up all the slack
+00783 $newWidestWidth = $widest - ($presentWidth-$neededWidth)/count($aWidest);
+00784 if ($newWidestWidth > $nWidest){
+00785 // then there is space to set them to this
+00786 foreach($aWidest as $colName){
+00787 $cols0[$colName] = $newWidestWidth;
+00788 }
+00789 $presentWidth=$neededWidth;
+00790 } else {
+00791 // there is not space, reduce the size of the widest ones down to the next size down, and we
+00792 // will go round again
+00793 foreach($aWidest as $colName){
+00794 $cols0[$colName] = $nWidest;
+00795 }
+00796 $presentWidth=$presentWidth-($widest-$nWidest)*count($aWidest);
+00797 }
+00798 }
+00799 }
+00800 // $cols0 now contains the new widths of the constrained columns.
+00801 // now need to update the $pos and $maxWidth arrays
+00802 $xq=0;
+00803 foreach($pos as $colName=>$p){
+00804 $pos[$colName]=$xq;
+00805 if (!isset($options['cols'][$colName]) || !isset($options['cols'][$colName]['width']) || $options['cols'][$colName]['width']<=0){
+00806 if (isset($cols0[$colName])){
+00807 $xq += $cols0[$colName] + $options['gap'];
+00808 $maxWidth[$colName]=$cols0[$colName];
+00809 }
+00810 } else {
+00811 if (isset($cols1[$colName])){
+00812 $xq += $cols1[$colName];
+00813 }
+00814 }
+00815 }
+00816
+00817 $t=$x+$options['width'];
+00818 $pos['_end_']=$t;
+00819 }
+00820
+00821 // now adjust the table to the correct location across the page
+00822 switch ($options['xPos']){
+00823 case 'left':
+00824 $xref = $this->ez['leftMargin'];
+00825 break;
+00826 case 'right':
+00827 $xref = $this->ez['pageWidth'] - $this->ez['rightMargin'];
+00828 break;
+00829 case 'centre':
+00830 case 'center':
+00831 $xref = $middle;
+00832 break;
+00833 default:
+00834 $xref = $options['xPos'];
+00835 break;
+00836 }
+00837 switch ($options['xOrientation']){
+00838 case 'left':
+00839 $dx = $xref-$t;
+00840 break;
+00841 case 'right':
+00842 $dx = $xref;
+00843 break;
+00844 case 'centre':
+00845 case 'center':
+00846 $dx = $xref-$t/2;
+00847 break;
+00848 }
+00849
+00850
+00851 foreach($pos as $k=>$v){
+00852 $pos[$k]=$v+$dx;
+00853 }
+00854 $x0=$x+$dx;
+00855 $x1=$t+$dx;
+00856
+00857 $baseLeftMargin = $this->ez['leftMargin'];
+00858 $basePos = $pos;
+00859 $baseX0 = $x0;
+00860 $baseX1 = $x1;
+00861
+00862 // ok, just about ready to make me a table
+00863 $this->setColor($options['textCol'][0],$options['textCol'][1],$options['textCol'][2]);
+00864 $this->setStrokeColor($options['shadeCol'][0],$options['shadeCol'][1],$options['shadeCol'][2]);
+00865
+00866 $middle = ($x1+$x0)/2;
+00867
+00868 // start a transaction which will be used to regress the table, if there are not enough rows protected
+00869 if ($options['protectRows']>0){
+00870 $this->transaction('start');
+00871 $movedOnce=0;
+00872 }
+00873 $abortTable = 1;
+00874 while ($abortTable){
+00875 $abortTable=0;
+00876
+00877 $dm = $this->ez['leftMargin']-$baseLeftMargin;
+00878 foreach($basePos as $k=>$v){
+00879 $pos[$k]=$v+$dm;
+00880 }
+00881 $x0=$baseX0+$dm;
+00882 $x1=$baseX1+$dm;
+00883 $middle = ($x1+$x0)/2;
+00884
+00885
+00886 // if the title is set, then do that
+00887 if (strlen($title)){
+00888 $w = $this->getTextWidth($options['titleFontSize'],$title);
+00889 $this->y -= $this->getFontHeight($options['titleFontSize']);
+00890 if ($this->y < $this->ez['bottomMargin']){
+00891 $this->ezNewPage();
+00892 // margins may have changed on the newpage
+00893 $dm = $this->ez['leftMargin']-$baseLeftMargin;
+00894 foreach($basePos as $k=>$v){
+00895 $pos[$k]=$v+$dm;
+00896 }
+00897 $x0=$baseX0+$dm;
+00898 $x1=$baseX1+$dm;
+00899 $middle = ($x1+$x0)/2;
+00900 $this->y -= $this->getFontHeight($options['titleFontSize']);
+00901 }
+00902 $this->addText($middle-$w/2,$this->y,$options['titleFontSize'],$title);
+00903 $this->y -= $options['titleGap'];
+00904 }
+00905
+00906 // margins may have changed on the newpage
+00907 $dm = $this->ez['leftMargin']-$baseLeftMargin;
+00908 foreach($basePos as $k=>$v){
+00909 $pos[$k]=$v+$dm;
+00910 }
+00911 $x0=$baseX0+$dm;
+00912 $x1=$baseX1+$dm;
+00913
+00914 $y=$this->y; // to simplify the code a bit
+00915
+00916 // make the table
+00917 $height = $this->getFontHeight($options['fontSize']);
+00918 $decender = $this->getFontDecender($options['fontSize']);
+00919
+00920
+00921
+00922 $y0=$y+$decender;
+00923 $dy=0;
+00924 if ($options['showHeadings']){
+00925 // this function will move the start of the table to a new page if it does not fit on this one
+00926 $headingHeight = $this->ezPrvtTableColumnHeadings($cols,$pos,$maxWidth,$height,$decender,$options['rowGap'],$options['fontSize'],$y,$options);
+00927 $y0 = $y+$headingHeight;
+00928 $y1 = $y;
+00929
+00930
+00931 $dm = $this->ez['leftMargin']-$baseLeftMargin;
+00932 foreach($basePos as $k=>$v){
+00933 $pos[$k]=$v+$dm;
+00934 }
+00935 $x0=$baseX0+$dm;
+00936 $x1=$baseX1+$dm;
+00937
+00938 } else {
+00939 $y1 = $y0;
+00940 }
+00941 $firstLine=1;
+00942
+00943
+00944 // open an object here so that the text can be put in over the shading
+00945 if ($options['shaded']){
+00946 $this->saveState();
+00947 $textObjectId = $this->openObject();
+00948 $this->closeObject();
+00949 $this->addObject($textObjectId);
+00950 $this->reopenObject($textObjectId);
+00951 }
+00952
+00953 $cnt=0;
+00954 $newPage=0;
+00955 foreach($data as $row){
+00956 $cnt++;
+00957 // the transaction support will be used to prevent rows being split
+00958 if ($options['splitRows']==0){
+00959 $pageStart = $this->ezPageCount;
+00960 if (isset($this->ez['columns']) && $this->ez['columns']['on']==1){
+00961 $columnStart = $this->ez['columns']['colNum'];
+00962 }
+00963 $this->transaction('start');
+00964 $row_orig = $row;
+00965 $y_orig = $y;
+00966 $y0_orig = $y0;
+00967 $y1_orig = $y1;
+00968 }
+00969 $ok=0;
+00970 $secondTurn=0;
+00971 while(!$abortTable && $ok == 0){
+00972
+00973 $mx=0;
+00974 $newRow=1;
+00975 while(!$abortTable && ($newPage || $newRow)){
+00976
+00977 $y-=$height;
+00978 if ($newPage || $y<$this->ez['bottomMargin'] || (isset($options['minRowSpace']) && $y<($this->ez['bottomMargin']+$options['minRowSpace'])) ){
+00979 // check that enough rows are with the heading
+00980 if ($options['protectRows']>0 && $movedOnce==0 && $cnt<=$options['protectRows']){
+00981 // then we need to move the whole table onto the next page
+00982 $movedOnce = 1;
+00983 $abortTable = 1;
+00984 }
+00985
+00986 $y2=$y-$mx+2*$height+$decender-$newRow*$height;
+00987 if ($options['showLines']){
+00988 if (!$options['showHeadings']){
+00989 $y0=$y1;
+00990 }
+00991 $this->ezPrvtTableDrawLines($pos,$options['gap'],$x0,$x1,$y0,$y1,$y2,$options['lineCol'],$options['innerLineThickness'],$options['outerLineThickness'],$options['showLines']);
+00992 }
+00993 if ($options['shaded']){
+00994 $this->closeObject();
+00995 $this->restoreState();
+00996 }
+00997 $this->ezNewPage();
+00998 // and the margins may have changed, this is due to the possibility of the columns being turned on
+00999 // as the columns are managed by manipulating the margins
+01000
+01001 $dm = $this->ez['leftMargin']-$baseLeftMargin;
+01002 foreach($basePos as $k=>$v){
+01003 $pos[$k]=$v+$dm;
+01004 }
+01005 // $x0=$x0+$dm;
+01006 // $x1=$x1+$dm;
+01007 $x0=$baseX0+$dm;
+01008 $x1=$baseX1+$dm;
+01009
+01010 if ($options['shaded']){
+01011 $this->saveState();
+01012 $textObjectId = $this->openObject();
+01013 $this->closeObject();
+01014 $this->addObject($textObjectId);
+01015 $this->reopenObject($textObjectId);
+01016 }
+01017 $this->setColor($options['textCol'][0],$options['textCol'][1],$options['textCol'][2],1);
+01018 $y = $this->ez['pageHeight']-$this->ez['topMargin'];
+01019 $y0=$y+$decender;
+01020 $mx=0;
+01021 if ($options['showHeadings']){
+01022 $this->ezPrvtTableColumnHeadings($cols,$pos,$maxWidth,$height,$decender,$options['rowGap'],$options['fontSize'],$y,$options);
+01023 $y1=$y;
+01024 } else {
+01025 $y1=$y0;
+01026 }
+01027 $firstLine=1;
+01028 $y -= $height;
+01029 }
+01030 $newRow=0;
+01031 // write the actual data
+01032 // if these cells need to be split over a page, then $newPage will be set, and the remaining
+01033 // text will be placed in $leftOvers
+01034 $newPage=0;
+01035 $leftOvers=array();
+01036
+01037 foreach($cols as $colName=>$colTitle){
+01038 $this->ezSetY($y+$height);
+01039 $colNewPage=0;
+01040 if (isset($row[$colName])){
+01041 if (isset($options['cols'][$colName]) && isset($options['cols'][$colName]['link']) && strlen($options['cols'][$colName]['link'])){
+01042
+01043 $lines = explode("\n",$row[$colName]);
+01044 if (isset($row[$options['cols'][$colName]['link']]) && strlen($row[$options['cols'][$colName]['link']])){
+01045 foreach($lines as $k=>$v){
+01046 $lines[$k]='<c:alink:'.$row[$options['cols'][$colName]['link']].'>'.$v.'</c:alink>';
+01047 }
+01048 }
+01049 } else {
+01050 $lines = explode("\n",$row[$colName]);
+01051 }
+01052 } else {
+01053 $lines = array();
+01054 }
+01055 $this->y -= $options['rowGap'];
+01056 foreach ($lines as $line){
+01057 $line = $this->ezProcessText($line);
+01058 $start=1;
+01059
+01060 while (strlen($line) || $start){
+01061 $start=0;
+01062 if (!$colNewPage){
+01063 $this->y=$this->y-$height;
+01064 }
+01065 if ($this->y < $this->ez['bottomMargin']){
+01066 // $this->ezNewPage();
+01067 $newPage=1; // whether a new page is required for any of the columns
+01068 $colNewPage=1; // whether a new page is required for this column
+01069 }
+01070 if ($colNewPage){
+01071 if (isset($leftOvers[$colName])){
+01072 $leftOvers[$colName].="\n".$line;
+01073 } else {
+01074 $leftOvers[$colName] = $line;
+01075 }
+01076 $line='';
+01077 } else {
+01078 if (isset($options['cols'][$colName]) && isset($options['cols'][$colName]['justification']) ){
+01079 $just = $options['cols'][$colName]['justification'];
+01080 } else {
+01081 $just='left';
+01082 }
+01083
+01084 $line=$this->addTextWrap($pos[$colName],$this->y,$maxWidth[$colName],$options['fontSize'],$line,$just);
+01085 }
+01086 }
+01087 }
+01088
+01089 $dy=$y+$height-$this->y+$options['rowGap'];
+01090 if ($dy-$height*$newPage>$mx){
+01091 $mx=$dy-$height*$newPage;
+01092 }
+01093 }
+01094 // set $row to $leftOvers so that they will be processed onto the new page
+01095 $row = $leftOvers;
+01096 // now add the shading underneath
+01097 if ($options['shaded'] && $cnt%2==0){
+01098 $this->closeObject();
+01099 $this->setColor($options['shadeCol'][0],$options['shadeCol'][1],$options['shadeCol'][2],1);
+01100 $this->filledRectangle($x0-$options['gap']/2,$y+$decender+$height-$mx,$x1-$x0,$mx);
+01101 $this->reopenObject($textObjectId);
+01102 }
+01103
+01104 if ($options['shaded']==2 && $cnt%2==1){
+01105 $this->closeObject();
+01106 $this->setColor($options['shadeCol2'][0],$options['shadeCol2'][1],$options['shadeCol2'][2],1);
+01107 $this->filledRectangle($x0-$options['gap']/2,$y+$decender+$height-$mx,$x1-$x0,$mx);
+01108 $this->reopenObject($textObjectId);
+01109 }
+01110
+01111 if ($options['showLines']>1){
+01112 // then draw a line on the top of each block
+01113 // $this->closeObject();
+01114 $this->saveState();
+01115 $this->setStrokeColor($options['lineCol'][0],$options['lineCol'][1],$options['lineCol'][2],1);
+01116 // $this->line($x0-$options['gap']/2,$y+$decender+$height-$mx,$x1-$x0,$mx);
+01117 if ($firstLine){
+01118 $this->setLineStyle($options['outerLineThickness']);
+01119 $firstLine=0;
+01120 } else {
+01121 $this->setLineStyle($options['innerLineThickness']);
+01122 }
+01123 $this->line($x0-$options['gap']/2,$y+$decender+$height,$x1-$options['gap']/2,$y+$decender+$height);
+01124 $this->restoreState();
+01125 // $this->reopenObject($textObjectId);
+01126 }
+01127 } // end of while
+01128 $y=$y-$mx+$height;
+01129
+01130 // checking row split over pages
+01131 if ($options['splitRows']==0){
+01132 if ( ( ($this->ezPageCount != $pageStart) || (isset($this->ez['columns']) && $this->ez['columns']['on']==1 && $columnStart != $this->ez['columns']['colNum'] )) && $secondTurn==0){
+01133 // then we need to go back and try that again !
+01134 $newPage=1;
+01135 $secondTurn=1;
+01136 $this->transaction('rewind');
+01137 $row = $row_orig;
+01138 $y = $y_orig;
+01139 $y0 = $y0_orig;
+01140 $y1 = $y1_orig;
+01141 $ok=0;
+01142
+01143 $dm = $this->ez['leftMargin']-$baseLeftMargin;
+01144 foreach($basePos as $k=>$v){
+01145 $pos[$k]=$v+$dm;
+01146 }
+01147 $x0=$baseX0+$dm;
+01148 $x1=$baseX1+$dm;
+01149
+01150 } else {
+01151 $this->transaction('commit');
+01152 $ok=1;
+01153 }
+01154 } else {
+01155 $ok=1; // don't go round the loop if splitting rows is allowed
+01156 }
+01157
+01158 } // end of while to check for row splitting
+01159 if ($abortTable){
+01160 if ($ok==0){
+01161 $this->transaction('abort');
+01162 }
+01163 // only the outer transaction should be operational
+01164 $this->transaction('rewind');
+01165 $this->ezNewPage();
+01166 break;
+01167 }
+01168
+01169 } // end of foreach ($data as $row)
+01170
+01171 } // end of while ($abortTable)
+01172
+01173 // table has been put on the page, the rows guarded as required, commit.
+01174 $this->transaction('commit');
+01175
+01176 $y2=$y+$decender;
+01177 if ($options['showLines']){
+01178 if (!$options['showHeadings']){
+01179 $y0=$y1;
+01180 }
+01181 $this->ezPrvtTableDrawLines($pos,$options['gap'],$x0,$x1,$y0,$y1,$y2,$options['lineCol'],$options['innerLineThickness'],$options['outerLineThickness'],$options['showLines']);
+01182 }
+01183
+01184 // close the object for drawing the text on top
+01185 if ($options['shaded']){
+01186 $this->closeObject();
+01187 $this->restoreState();
+01188 }
+01189
+01190 $this->y=$y;
+01191 return $y;
+01192 }
+
01205 {
+01206 // this will add a string of text to the document, starting at the current drawing
+01207 // position.
+01208 // it will wrap to keep within the margins, including optional offsets from the left
+01209 // and the right, if $size is not specified, then it will be the last one used, or
+01210 // the default value (12 I think).
+01211 // the text will go to the start of the next line when a return code "\n" is found.
+01212 // possible options are:
+01213 // 'left'=> number, gap to leave from the left margin
+01214 // 'right'=> number, gap to leave from the right margin
+01215 // 'aleft'=> number, absolute left position (overrides 'left')
+01216 // 'aright'=> number, absolute right position (overrides 'right')
+01217 // 'justification' => 'left','right','center','centre','full'
+01218
+01219 // only set one of the next two items (leading overrides spacing)
+01220 // 'leading' => number, defines the total height taken by the line, independent of the font height.
+01221 // 'spacing' => a real number, though usually set to one of 1, 1.5, 2 (line spacing as used in word processing)
+01222
+01223 // if $test is set then this should just check if the text is going to flow onto a new page or not, returning true or false
+01224
+01225 // apply the filtering which will make the underlining function.
+01226 $text = $this->ezProcessText($text);
+01227
+01228 $newPage=false;
+01229 $store_y = $this->y;
+01230
+01231 if (is_array($options) && isset($options['aleft'])){
+01232 $left=$options['aleft'];
+01233 } else {
+01234 $left = $this->ez['leftMargin'] + ((is_array($options) && isset($options['left']))?$options['left']:0);
+01235 }
+01236 if (is_array($options) && isset($options['aright'])){
+01237 $right=$options['aright'];
+01238 } else {
+01239 $right = $this->ez['pageWidth'] - $this->ez['rightMargin'] - ((is_array($options) && isset($options['right']))?$options['right']:0);
+01240 }
+01241 if ($size<=0){
+01242 $size = $this->ez['fontSize'];
+01243 } else {
+01244 $this->ez['fontSize']=$size;
+01245 }
+01246
+01247 if (is_array($options) && isset($options['justification'])){
+01248 $just = $options['justification'];
+01249 } else {
+01250 $just = 'left';
+01251 }
+01252
+01253 // modifications to give leading and spacing based on those given by Craig Heydenburg 1/1/02
+01254 if (is_array($options) && isset($options['leading'])) { ## use leading instead of spacing
+01255 $height = $options['leading'];
+01256 } else if (is_array($options) && isset($options['spacing'])) {
+01257 $height = $this->getFontHeight($size) * $options['spacing'];
+01258 } else {
+01259 $height = $this->getFontHeight($size);
+01260 }
+01261
+01262
+01263 $lines = explode("\n",$text);
+01264 foreach ($lines as $line){
+01265 $start=1;
+01266 while (strlen($line) || $start){
+01267 $start=0;
+01268 $this->y=$this->y-$height;
+01269 if ($this->y < $this->ez['bottomMargin']){
+01270 if ($test){
+01271 $newPage=true;
+01272 } else {
+01273 $this->ezNewPage();
+01274 // and then re-calc the left and right, in case they have changed due to columns
+01275 }
+01276 }
+01277 if (is_array($options) && isset($options['aleft'])){
+01278 $left=$options['aleft'];
+01279 } else {
+01280 $left = $this->ez['leftMargin'] + ((is_array($options) && isset($options['left']))?$options['left']:0);
+01281 }
+01282 if (is_array($options) && isset($options['aright'])){
+01283 $right=$options['aright'];
+01284 } else {
+01285 $right = $this->ez['pageWidth'] - $this->ez['rightMargin'] - ((is_array($options) && isset($options['right']))?$options['right']:0);
+01286 }
+01287 $line=$this->addTextWrap($left,$this->y,$right-$left,$size,$line,$just,0,$test);
+01288 }
+01289 }
+01290
+01291 if ($test){
+01292 $this->y=$store_y;
+01293 return $newPage;
+01294 } else {
+01295 return $this->y;
+01296 }
+01297 }
+
00299 {
+00300 // given a particular generic page number (ie, document numbered sequentially from beginning),
+00301 // return the page number under a particular page numbering scheme ($i)
+00302 $num=0;
+00303 $start=1;
+00304 $startNum=1;
+00305 if (!isset($this->ez['pageNumbering']))
+00306 {
+00307 $this->addMessage('WARNING: page numbering called for and wasn\'t started with ezStartPageNumbers');
+00308 return 0;
+00309 }
+00310 foreach($this->ez['pageNumbering'][$i] as $k=>$v){
+00311 if ($k<=$pageNum){
+00312 if (is_array($v)){
+00313 // start block
+00314 if (strlen($v['num'])){
+00315 // a start was specified
+00316 $start=$v['num'];
+00317 $startNum=$k;
+00318 $num=$pageNum-$startNum+$start;
+00319 }
+00320 } else {
+00321 // stop block
+00322 $num=0;
+00323 }
+00324 }
+00325 }
+00326 return $num;
+00327 }
+
01469 {
+01470 $this->alink($info,1);
+01471 }
+
01423 {
+01424 // this function will load the requested template ($file includes full or relative pathname)
+01425 // the code for the template will be modified to make it name safe, and then stored in
+01426 // an array for later use
+01427 // The id of the template will be returned for the user to operate on it later
+01428 if (!file_exists($templateFile)){
+01429 return -1;
+01430 }
+01431
+01432 $code = implode('',file($templateFile));
+01433 if (!strlen($code)){
+01434 return;
+01435 }
+01436
+01437 $code = trim($code);
+01438 if (substr($code,0,5)=='<?php'){
+01439 $code = substr($code,5);
+01440 }
+01441 if (substr($code,-2)=='?>'){
+01442 $code = substr($code,0,strlen($code)-2);
+01443 }
+01444 if (isset($this->ez['numTemplates'])){
+01445 $newNum = $this->ez['numTemplates'];
+01446 $this->ez['numTemplates']++;
+01447 } else {
+01448 $newNum=0;
+01449 $this->ez['numTemplates']=1;
+01450 $this->ez['templates']=array();
+01451 }
+01452
+01453 $this->ez['templates'][$newNum]['code']=$code;
+01454
+01455 return $newNum;
+01456 }
+
01518 {
+01519 // a callback function to support underlining
+01520 $lineFactor=0.05; // the thickness of the line as a proportion of the height. also the drop of the line.
+01521 switch($info['status']){
+01522 case 'start':
+01523 case 'sol':
+01524
+01525 // the beginning of the underline zone
+01526 if (!isset($this->ez['links'])){
+01527 $this->ez['links']=array();
+01528 }
+01529 $i = $info['nCallback'];
+01530 $this->ez['links'][$i] = array('x'=>$info['x'],'y'=>$info['y'],'angle'=>$info['angle'],'decender'=>$info['decender'],'height'=>$info['height']);
+01531 $this->saveState();
+01532 $thick = $info['height']*$lineFactor;
+01533 $this->setLineStyle($thick);
+01534 break;
+01535 case 'end':
+01536 case 'eol':
+01537 // the end of the link
+01538 // assume that it is the most recent opening which has closed
+01539 $i = $info['nCallback'];
+01540 $start = $this->ez['links'][$i];
+01541 // add underlining
+01542 $a = deg2rad((float)$start['angle']-90.0);
+01543 $drop = $start['height']*$lineFactor*1.5;
+01544 $dropx = cos($a)*$drop;
+01545 $dropy = -sin($a)*$drop;
+01546 $this->line($start['x']-$dropx,$start['y']-$dropy,$info['x']-$dropx,$info['y']-$dropy);
+01547 $this->restoreState();
+01548 break;
+01549 }
+01550 }
+
Field Documentation
@@ -1521,8 +3024,8 @@ Referenced by ezPrvtTa
The documentation for this class was generated from the following file:
-
-
Generated on Thu Jun 29 00:04:09 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:24 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/classCpdf.html b/doc/developper/html/classCpdf.html
index 3d1f10b46..8e83da64b 100644
--- a/doc/developper/html/classCpdf.html
+++ b/doc/developper/html/classCpdf.html
@@ -279,7 +279,17 @@ Definition at line 197
00197 {
+00198 $this->newDocument($pageSize);
+00199
+00200 // also initialize the font families that are known about already
+00201 $this->setFontFamily('init');
+00202 // $this->fileIdentifier = md5('xxxxxxxx'.time());
+00203
+00204 }
+
Member Function Documentation
@@ -311,7 +321,12 @@ Referenced by Cezpdf::
add content to the currently active object02969 {
+02970 // associates the given label with the destination, it is done this way so that a destination can be specified after
+02971 // it has been linked to
+02972 // styles are the same as the 'openHere' function
+02973 $this->numObj++;
+02974 $this->o_destination($this->numObj,'new',array('page'=>$this->currentPage,'type'=>$style,'p1'=>$a,'p2'=>$b,'p3'=>$c));
+02975 $id = $this->numObj;
+02976 // store the label->idf relationship, note that this means that labels can be used only once
+02977 $this->destinations["$label"]=$id;
+02978 }
+
02870 {
+02871 // add a new image into the current location, as an external object
+02872 // add the image at $x,$y, and with width and height as defined by $w & $h
+02873
+02874 // note that this will only work with full colour images and makes them jpg images for display
+02875 // later versions could present lossless image formats if there is interest.
+02876
+02877 // there seems to be some problem here in that images that have quality set above 75 do not appear
+02878 // not too sure why this is, but in the meantime I have restricted this to 75.
+02879 if ($quality>75){
+02880 $quality=75;
+02881 }
+02882
+02883 // if the width or height are set to zero, then set the other one based on keeping the image
+02884 // height/width ratio the same, if they are both zero, then give up :)
+02885 $imageWidth=imagesx($img);
+02886 $imageHeight=imagesy($img);
+02887
+02888 if ($w<=0 && $h<=0){
+02889 return;
+02890 }
+02891 if ($w==0){
+02892 $w=$h/$imageHeight*$imageWidth;
+02893 }
+02894 if ($h==0){
+02895 $h=$w*$imageHeight/$imageWidth;
+02896 }
+02897
+02898 // gotta get the data out of the img..
+02899
+02900 // so I write to a temp file, and then read it back.. soo ugly, my apologies.
+02901 $tmpDir='/tmp';
+02902 $tmpName=tempnam($tmpDir,'img');
+02903 imagejpeg($img,$tmpName,$quality);
+02904 $fp=fopen($tmpName,'rb');
+02905
+02906 $tmp = get_magic_quotes_runtime();
+02907 set_magic_quotes_runtime(0);
+02908 $fp = @fopen($tmpName,'rb');
+02909 if ($fp){
+02910 $data='';
+02911 while(!feof($fp)){
+02912 $data .= fread($fp,1024);
+02913 }
+02914 fclose($fp);
+02915 } else {
+02916 $error = 1;
+02917 $errormsg = 'trouble opening file';
+02918 }
+02919 // $data = fread($fp,filesize($tmpName));
+02920 set_magic_quotes_runtime($tmp);
+02921 // fclose($fp);
+02922 unlink($tmpName);
+02923 $this->addJpegImage_common($data,$x,$y,$w,$h,$imageWidth,$imageHeight);
+02924 }
+
02590 {
+02591 // this will only work if the label is one of the valid ones.
+02592 // modify this so that arrays can be passed as well.
+02593 // if $label is an array then assume that it is key=>value pairs
+02594 // else assume that they are both scalar, anything else will probably error
+02595 if (is_array($label)){
+02596 foreach ($label as $l=>$v){
+02597 $this->o_info($this->infoObject,$l,$v);
+02598 }
+02599 } else {
+02600 $this->o_info($this->infoObject,$label,$value);
+02601 }
+02602 }
+
01173 {
+01174 $this->numObj++;
+01175 $info = array('type'=>'ilink','label'=>$label,'rect'=>array($x0,$y0,$x1,$y1));
+01176 $this->o_annotation($this->numObj,'new',$info);
+01177 }
+
02825 {
+02826 // attempt to add a jpeg image straight from a file, using no GD commands
+02827 // note that this function is unable to operate on a remote file.
+02828
+02829 if (!file_exists($img)){
+02830 return;
+02831 }
+02832
+02833 $tmp=getimagesize($img);
+02834 $imageWidth=$tmp[0];
+02835 $imageHeight=$tmp[1];
+02836
+02837 if (isset($tmp['channels'])){
+02838 $channels = $tmp['channels'];
+02839 } else {
+02840 $channels = 3;
+02841 }
+02842
+02843 if ($w<=0 && $h<=0){
+02844 $w=$imageWidth;
+02845 }
+02846 if ($w==0){
+02847 $w=$h/$imageHeight*$imageWidth;
+02848 }
+02849 if ($h==0){
+02850 $h=$w*$imageHeight/$imageWidth;
+02851 }
+02852
+02853 $fp=fopen($img,'rb');
+02854
+02855 $tmp = get_magic_quotes_runtime();
+02856 set_magic_quotes_runtime(0);
+02857 $data = fread($fp,filesize($img));
+02858 set_magic_quotes_runtime($tmp);
+02859
+02860 fclose($fp);
+02861
+02862 $this->addJpegImage_common($data,$x,$y,$w,$h,$imageWidth,$imageHeight,$channels);
+02863 }
+
02931 {
+02932 // note that this function is not to be called externally
+02933 // it is just the common code between the GD and the file options
+02934 $this->numImages++;
+02935 $im=$this->numImages;
+02936 $label='I'.$im;
+02937 $this->numObj++;
+02938 $this->o_image($this->numObj,'new',array('label'=>$label,'data'=>$data,'iw'=>$imageWidth,'ih'=>$imageHeight,'channels'=>$channels));
+02939
+02940 $this->objects[$this->currentContents]['c'].="\nq";
+02941 $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3f',$w)." 0 0 ".sprintf('%.3f',$h)." ".sprintf('%.3f',$x)." ".sprintf('%.3f',$y)." cm";
+02942 $this->objects[$this->currentContents]['c'].="\n/".$label.' Do';
+02943 $this->objects[$this->currentContents]['c'].="\nQ";
+02944 }
+
01164 {
+01165 $this->numObj++;
+01166 $info = array('type'=>'link','url'=>$url,'rect'=>array($x0,$y0,$x1,$y1));
+01167 $this->o_annotation($this->numObj,'new',$info);
+01168 }
+
02544 {
+02545 // add the specified object to the page
+02546 if (isset($this->looseObjects[$id]) && $this->currentContents!=$id){
+02547 // then it is a valid object, and it is not being added to itself
+02548 switch($options){
+02549 case 'all':
+02550 // then this object is to be added to this page (done in the next block) and
+02551 // all future new pages.
+02552 $this->addLooseObjects[$id]='all';
+02553 case 'add':
+02554 if (isset($this->objects[$this->currentContents]['onPage'])){
+02555 // then the destination contents is the primary for the page
+02556 // (though this object is actually added to that page)
+02557 $this->o_page($this->objects[$this->currentContents]['onPage'],'content',$id);
+02558 }
+02559 break;
+02560 case 'even':
+02561 $this->addLooseObjects[$id]='even';
+02562 $pageObjectId=$this->objects[$this->currentContents]['onPage'];
+02563 if ($this->objects[$pageObjectId]['info']['pageNum']%2==0){
+02564 $this->addObject($id); // hacky huh :)
+02565 }
+02566 break;
+02567 case 'odd':
+02568 $this->addLooseObjects[$id]='odd';
+02569 $pageObjectId=$this->objects[$this->currentContents]['onPage'];
+02570 if ($this->objects[$pageObjectId]['info']['pageNum']%2==1){
+02571 $this->addObject($id); // hacky huh :)
+02572 }
+02573 break;
+02574 case 'next':
+02575 $this->addLooseObjects[$id]='all';
+02576 break;
+02577 case 'nexteven':
+02578 $this->addLooseObjects[$id]='even';
+02579 break;
+02580 case 'nextodd':
+02581 $this->addLooseObjects[$id]='odd';
+02582 break;
+02583 }
+02584 }
+02585 }
+
02637 {
+02638 // read in a png file, interpret it, then add to the system
+02639 $error=0;
+02640 $tmp = get_magic_quotes_runtime();
+02641 set_magic_quotes_runtime(0);
+02642 $fp = @fopen($file,'rb');
+02643 if ($fp){
+02644 $data='';
+02645 while(!feof($fp)){
+02646 $data .= fread($fp,1024);
+02647 }
+02648 fclose($fp);
+02649 } else {
+02650 $error = 1;
+02651 $errormsg = 'trouble opening file: '.$file;
+02652 }
+02653 set_magic_quotes_runtime($tmp);
+02654
+02655 if (!$error){
+02656 $header = chr(137).chr(80).chr(78).chr(71).chr(13).chr(10).chr(26).chr(10);
+02657 if (substr($data,0,8)!=$header){
+02658 $error=1;
+02659 $errormsg = 'this file does not have a valid header';
+02660 }
+02661 }
+02662
+02663 if (!$error){
+02664 // set pointer
+02665 $p = 8;
+02666 $len = strlen($data);
+02667 // cycle through the file, identifying chunks
+02668 $haveHeader=0;
+02669 $info=array();
+02670 $idata='';
+02671 $pdata='';
+02672 while ($p<$len){
+02673 $chunkLen = $this->PRVT_getBytes($data,$p,4);
+02674 $chunkType = substr($data,$p+4,4);
+02675 // echo $chunkType.' - '.$chunkLen.'<br>';
+02676
+02677 switch($chunkType){
+02678 case 'IHDR':
+02679 // this is where all the file information comes from
+02680 $info['width']=$this->PRVT_getBytes($data,$p+8,4);
+02681 $info['height']=$this->PRVT_getBytes($data,$p+12,4);
+02682 $info['bitDepth']=ord($data[$p+16]);
+02683 $info['colorType']=ord($data[$p+17]);
+02684 $info['compressionMethod']=ord($data[$p+18]);
+02685 $info['filterMethod']=ord($data[$p+19]);
+02686 $info['interlaceMethod']=ord($data[$p+20]);
+02687 //print_r($info);
+02688 $haveHeader=1;
+02689 if ($info['compressionMethod']!=0){
+02690 $error=1;
+02691 $errormsg = 'unsupported compression method';
+02692 }
+02693 if ($info['filterMethod']!=0){
+02694 $error=1;
+02695 $errormsg = 'unsupported filter method';
+02696 }
+02697 break;
+02698 case 'PLTE':
+02699 $pdata.=substr($data,$p+8,$chunkLen);
+02700 break;
+02701 case 'IDAT':
+02702 $idata.=substr($data,$p+8,$chunkLen);
+02703 break;
+02704 case 'tRNS':
+02705 //this chunk can only occur once and it must occur after the PLTE chunk and before IDAT chunk
+02706 //print "tRNS found, color type = ".$info['colorType']."<BR>";
+02707 $transparency = array();
+02708 if ($info['colorType'] == 3) { // indexed color, rbg
+02709 /* corresponding to entries in the plte chunk
+02710 Alpha for palette index 0: 1 byte
+02711 Alpha for palette index 1: 1 byte
+02712 ...etc...
+02713 */
+02714 // there will be one entry for each palette entry. up until the last non-opaque entry.
+02715 // set up an array, stretching over all palette entries which will be o (opaque) or 1 (transparent)
+02716 $transparency['type']='indexed';
+02717 $numPalette = strlen($pdata)/3;
+02718 $trans=0;
+02719 for ($i=$chunkLen;$i>=0;$i--){
+02720 if (ord($data[$p+8+$i])==0){
+02721 $trans=$i;
+02722 }
+02723 }
+02724 $transparency['data'] = $trans;
+02725
+02726 } elseif($info['colorType'] == 0) { // grayscale
+02727 /* corresponding to entries in the plte chunk
+02728 Gray: 2 bytes, range 0 .. (2^bitdepth)-1
+02729 */
+02730 // $transparency['grayscale']=$this->PRVT_getBytes($data,$p+8,2); // g = grayscale
+02731 $transparency['type']='indexed';
+02732 $transparency['data'] = ord($data[$p+8+1]);
+02733
+02734 } elseif($info['colorType'] == 2) { // truecolor
+02735 /* corresponding to entries in the plte chunk
+02736 Red: 2 bytes, range 0 .. (2^bitdepth)-1
+02737 Green: 2 bytes, range 0 .. (2^bitdepth)-1
+02738 Blue: 2 bytes, range 0 .. (2^bitdepth)-1
+02739 */
+02740 $transparency['r']=$this->PRVT_getBytes($data,$p+8,2); // r from truecolor
+02741 $transparency['g']=$this->PRVT_getBytes($data,$p+10,2); // g from truecolor
+02742 $transparency['b']=$this->PRVT_getBytes($data,$p+12,2); // b from truecolor
+02743
+02744 } else {
+02745 //unsupported transparency type
+02746 }
+02747 // KS End new code
+02748 break;
+02749 default:
+02750 break;
+02751 }
+02752
+02753 $p += $chunkLen+12;
+02754 }
+02755
+02756 if(!$haveHeader){
+02757 $error = 1;
+02758 $errormsg = 'information header is missing';
+02759 }
+02760 if (isset($info['interlaceMethod']) && $info['interlaceMethod']){
+02761 $error = 1;
+02762 $errormsg = 'There appears to be no support for interlaced images in pdf.';
+02763 }
+02764 }
+02765
+02766 if (!$error && $info['bitDepth'] > 8){
+02767 $error = 1;
+02768 $errormsg = 'only bit depth of 8 or less is supported';
+02769 }
+02770
+02771 if (!$error){
+02772 if ($info['colorType']!=2 && $info['colorType']!=0 && $info['colorType']!=3){
+02773 $error = 1;
+02774 $errormsg = 'transparancey alpha channel not supported, transparency only supported for palette images.';
+02775 } else {
+02776 switch ($info['colorType']){
+02777 case 3:
+02778 $color = 'DeviceRGB';
+02779 $ncolor=1;
+02780 break;
+02781 case 2:
+02782 $color = 'DeviceRGB';
+02783 $ncolor=3;
+02784 break;
+02785 case 0:
+02786 $color = 'DeviceGray';
+02787 $ncolor=1;
+02788 break;
+02789 }
+02790 }
+02791 }
+02792 if ($error){
+02793 $this->addMessage('PNG error - ('.$file.') '.$errormsg);
+02794 return;
+02795 }
+02796 if ($w==0){
+02797 $w=$h/$info['height']*$info['width'];
+02798 }
+02799 if ($h==0){
+02800 $h=$w*$info['height']/$info['width'];
+02801 }
+02802 //print_r($info);
+02803 // so this image is ok... add it in.
+02804 $this->numImages++;
+02805 $im=$this->numImages;
+02806 $label='I'.$im;
+02807 $this->numObj++;
+02808 // $this->o_image($this->numObj,'new',array('label'=>$label,'data'=>$idata,'iw'=>$w,'ih'=>$h,'type'=>'png','ic'=>$info['width']));
+02809 $options = array('label'=>$label,'data'=>$idata,'bitsPerComponent'=>$info['bitDepth'],'pdata'=>$pdata
+02810 ,'iw'=>$info['width'],'ih'=>$info['height'],'type'=>'png','color'=>$color,'ncolor'=>$ncolor);
+02811 if (isset($transparency)){
+02812 $options['transparency']=$transparency;
+02813 }
+02814 $this->o_image($this->numObj,'new',$options);
+02815
+02816 $this->objects[$this->currentContents]['c'].="\nq";
+02817 $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3f',$w)." 0 0 ".sprintf('%.3f',$h)." ".sprintf('%.3f',$x)." ".sprintf('%.3f',$y)." cm";
+02818 $this->objects[$this->currentContents]['c'].="\n/".$label.' Do';
+02819 $this->objects[$this->currentContents]['c'].="\nQ";
+02820 }
+
02156 {
+02157 if (!$this->numFonts){$this->selectFont('./fonts/Helvetica');}
+02158
+02159 // if there are any open callbacks, then they should be called, to show the start of the line
+02160 if ($this->nCallback>0){
+02161 for ($i=$this->nCallback;$i>0;$i--){
+02162 // call each function
+02163 $info = array('x'=>$x,'y'=>$y,'angle'=>$angle,'status'=>'sol','p'=>$this->callback[$i]['p'],'nCallback'=>$this->callback[$i]['nCallback'],'height'=>$this->callback[$i]['height'],'decender'=>$this->callback[$i]['decender']);
+02164 $func = $this->callback[$i]['f'];
+02165 $this->$func($info);
+02166 }
+02167 }
+02168 if ($angle==0){
+02169 $this->objects[$this->currentContents]['c'].="\n".'BT '.sprintf('%.3f',$x).' '.sprintf('%.3f',$y).' Td';
+02170 } else {
+02171 $a = deg2rad((float)$angle);
+02172 $tmp = "\n".'BT ';
+02173 $tmp .= sprintf('%.3f',cos($a)).' '.sprintf('%.3f',(-1.0*sin($a))).' '.sprintf('%.3f',sin($a)).' '.sprintf('%.3f',cos($a)).' ';
+02174 $tmp .= sprintf('%.3f',$x).' '.sprintf('%.3f',$y).' Tm';
+02175 $this->objects[$this->currentContents]['c'] .= $tmp;
+02176 }
+02177 if ($wordSpaceAdjust!=0 || $wordSpaceAdjust != $this->wordSpaceAdjust){
+02178 $this->wordSpaceAdjust=$wordSpaceAdjust;
+02179 $this->objects[$this->currentContents]['c'].=' '.sprintf('%.3f',$wordSpaceAdjust).' Tw';
+02180 }
+02181 $len=strlen($text);
+02182 $start=0;
+02183 for ($i=0;$i<$len;$i++){
+02184 $f=1;
+02185 $directive = $this->PRVTcheckTextDirective($text,$i,$f);
+02186 if ($directive){
+02187 // then we should write what we need to
+02188 if ($i>$start){
+02189 $part = substr($text,$start,$i-$start);
+02190 $this->objects[$this->currentContents]['c'].=' /F'.$this->currentFontNum.' '.sprintf('%.1f',$size).' Tf ';
+02191 $this->objects[$this->currentContents]['c'].=' ('.$this->filterText($part).') Tj';
+02192 }
+02193 if ($f){
+02194 // then there was nothing drastic done here, restore the contents
+02195 $this->setCurrentFont();
+02196 } else {
+02197 $this->objects[$this->currentContents]['c'] .= ' ET';
+02198 $f=1;
+02199 $xp=$x;
+02200 $yp=$y;
+02201 $directive = $this->PRVTcheckTextDirective1($text,$i,$f,1,$xp,$yp,$size,$angle,$wordSpaceAdjust);
+02202
+02203 // restart the text object
+02204 if ($angle==0){
+02205 $this->objects[$this->currentContents]['c'].="\n".'BT '.sprintf('%.3f',$xp).' '.sprintf('%.3f',$yp).' Td';
+02206 } else {
+02207 $a = deg2rad((float)$angle);
+02208 $tmp = "\n".'BT ';
+02209 $tmp .= sprintf('%.3f',cos($a)).' '.sprintf('%.3f',(-1.0*sin($a))).' '.sprintf('%.3f',sin($a)).' '.sprintf('%.3f',cos($a)).' ';
+02210 $tmp .= sprintf('%.3f',$xp).' '.sprintf('%.3f',$yp).' Tm';
+02211 $this->objects[$this->currentContents]['c'] .= $tmp;
+02212 }
+02213 if ($wordSpaceAdjust!=0 || $wordSpaceAdjust != $this->wordSpaceAdjust){
+02214 $this->wordSpaceAdjust=$wordSpaceAdjust;
+02215 $this->objects[$this->currentContents]['c'].=' '.sprintf('%.3f',$wordSpaceAdjust).' Tw';
+02216 }
+02217 }
+02218 // and move the writing point to the next piece of text
+02219 $i=$i+$directive-1;
+02220 $start=$i+1;
+02221 }
+02222
+02223 }
+02224 if ($start<$len){
+02225 $part = substr($text,$start);
+02226 $this->objects[$this->currentContents]['c'].=' /F'.$this->currentFontNum.' '.sprintf('%.1f',$size).' Tf ';
+02227 $this->objects[$this->currentContents]['c'].=' ('.$this->filterText($part).') Tj';
+02228 }
+02229 $this->objects[$this->currentContents]['c'].=' ET';
+02230
+02231 // if there are any open callbacks, then they should be called, to show the end of the line
+02232 if ($this->nCallback>0){
+02233 for ($i=$this->nCallback;$i>0;$i--){
+02234 // call each function
+02235 $tmp = $this->PRVTgetTextPosition($x,$y,$angle,$size,$wordSpaceAdjust,$text);
+02236 $info = array('x'=>$tmp[0],'y'=>$tmp[1],'angle'=>$angle,'status'=>'eol','p'=>$this->callback[$i]['p'],'nCallback'=>$this->callback[$i]['nCallback'],'height'=>$this->callback[$i]['height'],'decender'=>$this->callback[$i]['decender']);
+02237 $func = $this->callback[$i]['f'];
+02238 $this->$func($info);
+02239 }
+02240 }
+02241
+02242 }
+
02331 {
+02332 // this will display the text, and if it goes beyond the width $width, will backtrack to the
+02333 // previous space or hyphen, and return the remainder of the text.
+02334
+02335 // $justification can be set to 'left','right','center','centre','full'
+02336
+02337 // need to store the initial text state, as this will change during the width calculation
+02338 // but will need to be re-set before printing, so that the chars work out right
+02339 $store_currentTextState = $this->currentTextState;
+02340
+02341 if (!$this->numFonts){$this->selectFont('./fonts/Helvetica');}
+02342 if ($width<=0){
+02343 // error, pretend it printed ok, otherwise risking a loop
+02344 return '';
+02345 }
+02346 $w=0;
+02347 $break=0;
+02348 $breakWidth=0;
+02349 $len=strlen($text);
+02350 $cf = $this->currentFont;
+02351 $tw = $width/$size*1000;
+02352 for ($i=0;$i<$len;$i++){
+02353 $f=1;
+02354 $directive = $this->PRVTcheckTextDirective($text,$i,$f);
+02355 if ($directive){
+02356 if ($f){
+02357 $this->setCurrentFont();
+02358 $cf = $this->currentFont;
+02359 }
+02360 $i=$i+$directive-1;
+02361 } else {
+02362 $cOrd = ord($text[$i]);
+02363 if (isset($this->fonts[$cf]['differences'][$cOrd])){
+02364 // then this character is being replaced by another
+02365 $cOrd2 = $this->fonts[$cf]['differences'][$cOrd];
+02366 } else {
+02367 $cOrd2 = $cOrd;
+02368 }
+02369
+02370 if (isset($this->fonts[$cf]['C'][$cOrd2]['WX'])){
+02371 $w+=$this->fonts[$cf]['C'][$cOrd2]['WX'];
+02372 }
+02373 if ($w>$tw){
+02374 // then we need to truncate this line
+02375 if ($break>0){
+02376 // then we have somewhere that we can split :)
+02377 if ($text[$break]==' '){
+02378 $tmp = substr($text,0,$break);
+02379 } else {
+02380 $tmp = substr($text,0,$break+1);
+02381 }
+02382 $adjust=0;
+02383 $this->PRVTadjustWrapText($tmp,$breakWidth,$width,$x,$adjust,$justification);
+02384
+02385 // reset the text state
+02386 $this->currentTextState = $store_currentTextState;
+02387 $this->setCurrentFont();
+02388 if (!$test){
+02389 $this->addText($x,$y,$size,$tmp,$angle,$adjust);
+02390 }
+02391 return substr($text,$break+1);
+02392 } else {
+02393 // just split before the current character
+02394 $tmp = substr($text,0,$i);
+02395 $adjust=0;
+02396 $ctmp=ord($text[$i]);
+02397 if (isset($this->fonts[$cf]['differences'][$ctmp])){
+02398 $ctmp=$this->fonts[$cf]['differences'][$ctmp];
+02399 }
+02400 $tmpw=($w-$this->fonts[$cf]['C'][$ctmp]['WX'])*$size/1000;
+02401 $this->PRVTadjustWrapText($tmp,$tmpw,$width,$x,$adjust,$justification);
+02402 // reset the text state
+02403 $this->currentTextState = $store_currentTextState;
+02404 $this->setCurrentFont();
+02405 if (!$test){
+02406 $this->addText($x,$y,$size,$tmp,$angle,$adjust);
+02407 }
+02408 return substr($text,$i);
+02409 }
+02410 }
+02411 if ($text[$i]=='-'){
+02412 $break=$i;
+02413 $breakWidth = $w*$size/1000;
+02414 }
+02415 if ($text[$i]==' '){
+02416 $break=$i;
+02417 $ctmp=ord($text[$i]);
+02418 if (isset($this->fonts[$cf]['differences'][$ctmp])){
+02419 $ctmp=$this->fonts[$cf]['differences'][$ctmp];
+02420 }
+02421 $breakWidth = ($w-$this->fonts[$cf]['C'][$ctmp]['WX'])*$size/1000;
+02422 }
+02423 }
+02424 }
+02425 // then there was no need to break this line
+02426 if ($justification=='full'){
+02427 $justification='left';
+02428 }
+02429 $adjust=0;
+02430 $tmpw=$w*$size/1000;
+02431 $this->PRVTadjustWrapText($text,$tmpw,$width,$x,$adjust,$justification);
+02432 // reset the text state
+02433 $this->currentTextState = $store_currentTextState;
+02434 $this->setCurrentFont();
+02435 if (!$test){
+02436 $this->addText($x,$y,$size,$text,$angle,$adjust,$angle);
+02437 }
+02438 return '';
+02439 }
+
01138 {
+01139 $len=strlen($text);
+01140 $a=0;
+01141 $b=0;
+01142 $c = $this->arc4;
+01143 $out='';
+01144 for ($i=0;$i<$len;$i++){
+01145 $a = ($a+1)%256;
+01146 $t= $c[$a];
+01147 $b = ($b+ord($t))%256;
+01148 $c[$a]=$c[$b];
+01149 $c[$b]=$t;
+01150 $k = ord($c[(ord($c[$a])+ord($c[$b]))%256]);
+01151 $out.=chr(ord($text[$i]) ^ $k);
+01152 }
+01153
+01154 return $out;
+01155 }
+
01112 {
+01113 $this->arc4 = '';
+01114 // setup the control array
+01115 if (strlen($key)==0){
+01116 return;
+01117 }
+01118 $k = '';
+01119 while(strlen($k)<256){
+01120 $k.=$key;
+01121 }
+01122 $k=substr($k,0,256);
+01123 for ($i=0;$i<256;$i++){
+01124 $this->arc4 .= chr($i);
+01125 }
+01126 $j=0;
+01127 for ($i=0;$i<256;$i++){
+01128 $t = $this->arc4[$i];
+01129 $j = ($j + ord($t) + ord($k[$i]))%256;
+01130 $this->arc4[$i]=$this->arc4[$j];
+01131 $this->arc4[$j]=$t;
+01132 }
+01133 }
+
02518 {
+02519 // close the object, as long as there was one open in the first place, which will be indicated by
+02520 // an objectId on the stack.
+02521 if ($this->nStack>0){
+02522 $this->currentContents=$this->stack[$this->nStack]['c'];
+02523 $this->currentPage=$this->stack[$this->nStack]['p'];
+02524 $this->nStack--;
+02525 // easier to probably not worry about removing the old entries, they will be overwritten
+02526 // if there are new ones.
+02527 }
+02528 }
+
01682 {
+01683 // in the current line style, draw a bezier curve from (x0,y0) to (x3,y3) using the other two points
+01684 // as the control points for the curve.
+01685 $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3f',$x0).' '.sprintf('%.3f',$y0).' m '.sprintf('%.3f',$x1).' '.sprintf('%.3f',$y1);
+01686 $this->objects[$this->currentContents]['c'].= ' '.sprintf('%.3f',$x2).' '.sprintf('%.3f',$y2).' '.sprintf('%.3f',$x3).' '.sprintf('%.3f',$y3).' c S';
+01687 }
+
01713 {
+01714 if ($r1==0){
+01715 return;
+01716 }
+01717 if ($r2==0){
+01718 $r2=$r1;
+01719 }
+01720 if ($nSeg<2){
+01721 $nSeg=2;
+01722 }
+01723
+01724 $astart = deg2rad((float)$astart);
+01725 $afinish = deg2rad((float)$afinish);
+01726 $totalAngle =$afinish-$astart;
+01727
+01728 $dt = $totalAngle/$nSeg;
+01729 $dtm = $dt/3;
+01730
+01731 if ($angle != 0){
+01732 $a = -1*deg2rad((float)$angle);
+01733 $tmp = "\n q ";
+01734 $tmp .= sprintf('%.3f',cos($a)).' '.sprintf('%.3f',(-1.0*sin($a))).' '.sprintf('%.3f',sin($a)).' '.sprintf('%.3f',cos($a)).' ';
+01735 $tmp .= sprintf('%.3f',$x0).' '.sprintf('%.3f',$y0).' cm';
+01736 $this->objects[$this->currentContents]['c'].= $tmp;
+01737 $x0=0;
+01738 $y0=0;
+01739 }
+01740
+01741 $t1 = $astart;
+01742 $a0 = $x0+$r1*cos($t1);
+01743 $b0 = $y0+$r2*sin($t1);
+01744 $c0 = -$r1*sin($t1);
+01745 $d0 = $r2*cos($t1);
+01746
+01747 $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3f',$a0).' '.sprintf('%.3f',$b0).' m ';
+01748 for ($i=1;$i<=$nSeg;$i++){
+01749 // draw this bit of the total curve
+01750 $t1 = $i*$dt+$astart;
+01751 $a1 = $x0+$r1*cos($t1);
+01752 $b1 = $y0+$r2*sin($t1);
+01753 $c1 = -$r1*sin($t1);
+01754 $d1 = $r2*cos($t1);
+01755 $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3f',($a0+$c0*$dtm)).' '.sprintf('%.3f',($b0+$d0*$dtm));
+01756 $this->objects[$this->currentContents]['c'].= ' '.sprintf('%.3f',($a1-$c1*$dtm)).' '.sprintf('%.3f',($b1-$d1*$dtm)).' '.sprintf('%.3f',$a1).' '.sprintf('%.3f',$b1).' c';
+01757 $a0=$a1;
+01758 $b0=$b1;
+01759 $c0=$c1;
+01760 $d0=$d1;
+01761 }
+01762 if ($fill){
+01763 $this->objects[$this->currentContents]['c'].=' f';
+01764 } else {
+01765 if ($close){
+01766 $this->objects[$this->currentContents]['c'].=' s'; // small 's' signifies closing the path as well
+01767 } else {
+01768 $this->objects[$this->currentContents]['c'].=' S';
+01769 }
+01770 }
+01771 if ($angle !=0){
+01772 $this->objects[$this->currentContents]['c'].=' Q';
+01773 }
+01774 }
+
01098 {
+01099 $tmp = $this->encryptionKey;
+01100 $hex = dechex($id);
+01101 if (strlen($hex)<6){
+01102 $hex = substr('000000',0,6-strlen($hex)).$hex;
+01103 }
+01104 $tmp.= chr(hexdec(substr($hex,4,2))).chr(hexdec(substr($hex,2,2))).chr(hexdec(substr($hex,0,2))).chr(0).chr(0);
+01105 $key = $this->md5_16($tmp);
+01106 $this->ARC4_init(substr($key,0,10));
+01107 }
+
01699 {
+01700 return $this->ellipse($x0,$y0,$r1,$r2=0,$angle,$nSeg,$astart,$afinish,1,1);
+01701 }
+
01835 {
+01836 $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3f',$x1).' '.sprintf('%.3f',$y1).' '.sprintf('%.3f',$width).' '.sprintf('%.3f',$height).' re f';
+01837 }
+
01958 {
+01959 $text = str_replace('\\','\\\\',$text);
+01960 $text = str_replace('(','\(',$text);
+01961 $text = str_replace(')','\)',$text);
+01962 $text = str_replace('<','<',$text);
+01963 $text = str_replace('>','>',$text);
+01964 $text = str_replace(''','\'',$text);
+01965 $text = str_replace('"','"',$text);
+01966 $text = str_replace('&','&',$text);
+01967
+01968 return $text;
+01969 }
+
01943 {
+01944 // note that this will most likely return a negative value
+01945 if (!$this->numFonts){
+01946 $this->selectFont('./fonts/Helvetica');
+01947 }
+01948 $h = $this->fonts[$this->currentFont]['FontBBox'][1];
+01949 return $size*$h/1000;
+01950 }
+
01929 {
+01930 if (!$this->numFonts){
+01931 $this->selectFont('./fonts/Helvetica');
+01932 }
+01933 // for the current font, and the given size, what is the height of the font in user units
+01934 $h = $this->fonts[$this->currentFont]['FontBBox'][3]-$this->fonts[$this->currentFont]['FontBBox'][1];
+01935 return $size*$h/1000;
+01936 }
+
02248 {
+02249 // this function should not change any of the settings, though it will need to
+02250 // track any directives which change during calculation, so copy them at the start
+02251 // and put them back at the end.
+02252 $store_currentTextState = $this->currentTextState;
+02253
+02254 if (!$this->numFonts){
+02255 $this->selectFont('./fonts/Helvetica');
+02256 }
+02257
+02258 // converts a number or a float to a string so it can get the width
+02259 $text = "$text";
+02260
+02261 // hmm, this is where it all starts to get tricky - use the font information to
+02262 // calculate the width of each character, add them up and convert to user units
+02263 $w=0;
+02264 $len=strlen($text);
+02265 $cf = $this->currentFont;
+02266 for ($i=0;$i<$len;$i++){
+02267 $f=1;
+02268 $directive = $this->PRVTcheckTextDirective($text,$i,$f);
+02269 if ($directive){
+02270 if ($f){
+02271 $this->setCurrentFont();
+02272 $cf = $this->currentFont;
+02273 }
+02274 $i=$i+$directive-1;
+02275 } else {
+02276 $char=ord($text[$i]);
+02277 if (isset($this->fonts[$cf]['differences'][$char])){
+02278 // then this character is being replaced by another
+02279 $name = $this->fonts[$cf]['differences'][$char];
+02280 if (isset($this->fonts[$cf]['C'][$name]['WX'])){
+02281 $w+=$this->fonts[$cf]['C'][$name]['WX'];
+02282 }
+02283 } else if (isset($this->fonts[$cf]['C'][$char]['WX'])){
+02284 $w+=$this->fonts[$cf]['C'][$char]['WX'];
+02285 }
+02286 }
+02287 }
+02288
+02289 $this->currentTextState = $store_currentTextState;
+02290 $this->setCurrentFont();
+02291
+02292 return $w*$size/1000;
+02293 }
+
01675 {
+01676 $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3f',$x1).' '.sprintf('%.3f',$y1).' m '.sprintf('%.3f',$x2).' '.sprintf('%.3f',$y2).' l S';
+01677 }
+
01086 {
+01087 $tmp = md5($string);
+01088 $out='';
+01089 for ($i=0;$i<=30;$i=$i+2){
+01090 $out.=chr(hexdec(substr($tmp,$i,2)));
+01091 }
+01092 return $out;
+01093 }
+
01267 {
+01268 $this->numObj=0;
+01269 $this->objects = array();
+01270
+01271 $this->numObj++;
+01272 $this->o_catalog($this->numObj,'new');
+01273
+01274 $this->numObj++;
+01275 $this->o_outlines($this->numObj,'new');
+01276
+01277 $this->numObj++;
+01278 $this->o_pages($this->numObj,'new');
+01279
+01280 $this->o_pages($this->numObj,'mediaBox',$pageSize);
+01281 $this->currentNode = 3;
+01282
+01283 $this->numObj++;
+01284 $this->o_procset($this->numObj,'new');
+01285
+01286 $this->numObj++;
+01287 $this->o_info($this->numObj,'new');
+01288
+01289 $this->numObj++;
+01290 $this->o_page($this->numObj,'new');
+01291
+01292 // need to store the first page id as there is no way to get it to the user during
+01293 // startup
+01294 $this->firstPageId = $this->currentContents;
+01295 }
+
01851 {
+01852
+01853 // if there is a state saved, then go up the stack closing them
+01854 // then on the new page, re-open them with the right setings
+01855
+01856 if ($this->nStateStack){
+01857 for ($i=$this->nStateStack;$i>=1;$i--){
+01858 $this->restoreState($i);
+01859 }
+01860 }
+01861
+01862 $this->numObj++;
+01863 if ($insert){
+01864 // the id from the ezPdf class is the od of the contents of the page, not the page object itself
+01865 // query that object to find the parent
+01866 $rid = $this->objects[$id]['onPage'];
+01867 $opt= array('rid'=>$rid,'pos'=>$pos);
+01868 $this->o_page($this->numObj,'new',$opt);
+01869 } else {
+01870 $this->o_page($this->numObj,'new');
+01871 }
+01872 // if there is a stack saved, then put that onto the page
+01873 if ($this->nStateStack){
+01874 for ($i=1;$i<=$this->nStateStack;$i++){
+01875 $this->saveState($i);
+01876 }
+01877 }
+01878 // and if there has been a stroke or fill colour set, then transfer them
+01879 if ($this->currentColour['r']>=0){
+01880 $this->setColor($this->currentColour['r'],$this->currentColour['g'],$this->currentColour['b'],1);
+01881 }
+01882 if ($this->currentStrokeColour['r']>=0){
+01883 $this->setStrokeColor($this->currentStrokeColour['r'],$this->currentStrokeColour['g'],$this->currentStrokeColour['b'],1);
+01884 }
+01885
+01886 // if there is a line style set, then put this in too
+01887 if (strlen($this->currentLineStyle)){
+01888 $this->objects[$this->currentContents]['c'].="\n".$this->currentLineStyle;
+01889 }
+01890
+01891 // the call to the o_page object set currentContents to the present page, so this can be returned as the page id
+01892 return $this->currentContents;
+01893 }
+
00726 {
+00727 if ($action!='new'){
+00728 $o =& $this->objects[$id];
+00729 }
+00730 switch ($action){
+00731 case 'new':
+00732 if (is_array($options)){
+00733 $this->objects[$id]=array('t'=>'action','info'=>$options,'type'=>$options['type']);
+00734 } else {
+00735 // then assume a URI action
+00736 $this->objects[$id]=array('t'=>'action','info'=>$options,'type'=>'URI');
+00737 }
+00738 break;
+00739 case 'out':
+00740 if ($this->encrypted){
+00741 $this->encryptInit($id);
+00742 }
+00743 $res="\n".$id." 0 obj\n<< /Type /Action";
+00744 switch($o['type']){
+00745 case 'ilink':
+00746 // there will be an 'label' setting, this is the name of the destination
+00747 $res.="\n/S /GoTo\n/D ".$this->destinations[(string)$o['info']['label']]." 0 R";
+00748 break;
+00749 case 'URI':
+00750 $res.="\n/S /URI\n/URI (";
+00751 if ($this->encrypted){
+00752 $res.=$this->filterText($this->ARC4($o['info']));
+00753 } else {
+00754 $res.=$this->filterText($o['info']);
+00755 }
+00756 $res.=")";
+00757 break;
+00758 }
+00759 $res.="\n>>\nendobj";
+00760 return $res;
+00761 break;
+00762 }
+00763 }
+
00769 {
+00770 if ($action!='new'){
+00771 $o =& $this->objects[$id];
+00772 }
+00773 switch ($action){
+00774 case 'new':
+00775 // add the annotation to the current page
+00776 $pageId = $this->currentPage;
+00777 $this->o_page($pageId,'annot',$id);
+00778 // and add the action object which is going to be required
+00779 switch($options['type']){
+00780 case 'link':
+00781 $this->objects[$id]=array('t'=>'annotation','info'=>$options);
+00782 $this->numObj++;
+00783 $this->o_action($this->numObj,'new',$options['url']);
+00784 $this->objects[$id]['info']['actionId']=$this->numObj;
+00785 break;
+00786 case 'ilink':
+00787 // this is to a named internal link
+00788 $label = $options['label'];
+00789 $this->objects[$id]=array('t'=>'annotation','info'=>$options);
+00790 $this->numObj++;
+00791 $this->o_action($this->numObj,'new',array('type'=>'ilink','label'=>$label));
+00792 $this->objects[$id]['info']['actionId']=$this->numObj;
+00793 break;
+00794 }
+00795 break;
+00796 case 'out':
+00797 $res="\n".$id." 0 obj\n<< /Type /Annot";
+00798 switch($o['info']['type']){
+00799 case 'link':
+00800 case 'ilink':
+00801 $res.= "\n/Subtype /Link";
+00802 break;
+00803 }
+00804 $res.="\n/A ".$o['info']['actionId']." 0 R";
+00805 $res.="\n/Border [0 0 0]";
+00806 $res.="\n/H /I";
+00807 $res.="\n/Rect [ ";
+00808 foreach($o['info']['rect'] as $v){
+00809 $res.= sprintf("%.4f ",$v);
+00810 }
+00811 $res.="]";
+00812 $res.="\n>>\nendobj";
+00813 return $res;
+00814 break;
+00815 }
+00816 }
+
00297 {
+00298 if ($action!='new'){
+00299 $o =& $this->objects[$id];
+00300 }
+00301 switch ($action){
+00302 case 'new':
+00303 $this->objects[$id]=array('t'=>'catalog','info'=>array());
+00304 $this->catalogId=$id;
+00305 break;
+00306 case 'outlines':
+00307 case 'pages':
+00308 case 'openHere':
+00309 $o['info'][$action]=$options;
+00310 break;
+00311 case 'viewerPreferences':
+00312 if (!isset($o['info']['viewerPreferences'])){
+00313 $this->numObj++;
+00314 $this->o_viewerPreferences($this->numObj,'new');
+00315 $o['info']['viewerPreferences']=$this->numObj;
+00316 }
+00317 $vp = $o['info']['viewerPreferences'];
+00318 $this->o_viewerPreferences($vp,'add',$options);
+00319 break;
+00320 case 'out':
+00321 $res="\n".$id." 0 obj\n".'<< /Type /Catalog';
+00322 foreach($o['info'] as $k=>$v){
+00323 switch($k){
+00324 case 'outlines':
+00325 $res.="\n".'/Outlines '.$v.' 0 R';
+00326 break;
+00327 case 'pages':
+00328 $res.="\n".'/Pages '.$v.' 0 R';
+00329 break;
+00330 case 'viewerPreferences':
+00331 $res.="\n".'/ViewerPreferences '.$o['info']['viewerPreferences'].' 0 R';
+00332 break;
+00333 case 'openHere':
+00334 $res.="\n".'/OpenAction '.$o['info']['openHere'].' 0 R';
+00335 break;
+00336 }
+00337 }
+00338 $res.=" >>\nendobj";
+00339 return $res;
+00340 break;
+00341 }
+00342 }
+
00890 {
+00891 if ($action!='new'){
+00892 $o =& $this->objects[$id];
+00893 }
+00894 switch ($action){
+00895 case 'new':
+00896 $this->objects[$id]=array('t'=>'contents','c'=>'','info'=>array());
+00897 if (strlen($options) && intval($options)){
+00898 // then this contents is the primary for a page
+00899 $this->objects[$id]['onPage']=$options;
+00900 } else if ($options=='raw'){
+00901 // then this page contains some other type of system object
+00902 $this->objects[$id]['raw']=1;
+00903 }
+00904 break;
+00905 case 'add':
+00906 // add more options to the decleration
+00907 foreach ($options as $k=>$v){
+00908 $o['info'][$k]=$v;
+00909 }
+00910 case 'out':
+00911 $tmp=$o['c'];
+00912 $res= "\n".$id." 0 obj\n";
+00913 if (isset($this->objects[$id]['raw'])){
+00914 $res.=$tmp;
+00915 } else {
+00916 $res.= "<<";
+00917 if (function_exists('gzcompress') && $this->options['compression']){
+00918 // then implement ZLIB based compression on this content stream
+00919 $res.=" /Filter /FlateDecode";
+00920 $tmp = gzcompress($tmp);
+00921 }
+00922 if ($this->encrypted){
+00923 $this->encryptInit($id);
+00924 $tmp = $this->ARC4($tmp);
+00925 }
+00926 foreach($o['info'] as $k=>$v){
+00927 $res .= "\n/".$k.' '.$v;
+00928 }
+00929 $res.="\n/Length ".strlen($tmp)." >>\nstream\n".$tmp."\nendstream";
+00930 }
+00931 $res.="\nendobj\n";
+00932 return $res;
+00933 break;
+00934 }
+00935 }
+
00224 {
+00225 if ($action!='new'){
+00226 $o =& $this->objects[$id];
+00227 }
+00228 switch($action){
+00229 case 'new':
+00230 $this->objects[$id]=array('t'=>'destination','info'=>array());
+00231 $tmp = '';
+00232 switch ($options['type']){
+00233 case 'XYZ':
+00234 case 'FitR':
+00235 $tmp = ' '.$options['p3'].$tmp;
+00236 case 'FitH':
+00237 case 'FitV':
+00238 case 'FitBH':
+00239 case 'FitBV':
+00240 $tmp = ' '.$options['p1'].' '.$options['p2'].$tmp;
+00241 case 'Fit':
+00242 case 'FitB':
+00243 $tmp = $options['type'].$tmp;
+00244 $this->objects[$id]['info']['string']=$tmp;
+00245 $this->objects[$id]['info']['page']=$options['page'];
+00246 }
+00247 break;
+00248 case 'out':
+00249 $tmp = $o['info'];
+00250 $res="\n".$id." 0 obj\n".'['.$tmp['page'].' 0 R /'.$tmp['string']."]\nendobj\n";
+00251 return $res;
+00252 break;
+00253 }
+00254 }
+
01015 {
+01016 if ($action!='new'){
+01017 $o =& $this->objects[$id];
+01018 }
+01019 switch($action){
+01020 case 'new':
+01021 // make the new object
+01022 $this->objects[$id]=array('t'=>'encryption','info'=>$options);
+01023 $this->arc4_objnum=$id;
+01024 // figure out the additional paramaters required
+01025 $pad = chr(0x28).chr(0xBF).chr(0x4E).chr(0x5E).chr(0x4E).chr(0x75).chr(0x8A).chr(0x41).chr(0x64).chr(0x00).chr(0x4E).chr(0x56).chr(0xFF).chr(0xFA).chr(0x01).chr(0x08).chr(0x2E).chr(0x2E).chr(0x00).chr(0xB6).chr(0xD0).chr(0x68).chr(0x3E).chr(0x80).chr(0x2F).chr(0x0C).chr(0xA9).chr(0xFE).chr(0x64).chr(0x53).chr(0x69).chr(0x7A);
+01026 $len = strlen($options['owner']);
+01027 if ($len>32){
+01028 $owner = substr($options['owner'],0,32);
+01029 } else if ($len<32){
+01030 $owner = $options['owner'].substr($pad,0,32-$len);
+01031 } else {
+01032 $owner = $options['owner'];
+01033 }
+01034 $len = strlen($options['user']);
+01035 if ($len>32){
+01036 $user = substr($options['user'],0,32);
+01037 } else if ($len<32){
+01038 $user = $options['user'].substr($pad,0,32-$len);
+01039 } else {
+01040 $user = $options['user'];
+01041 }
+01042 $tmp = $this->md5_16($owner);
+01043 $okey = substr($tmp,0,5);
+01044 $this->ARC4_init($okey);
+01045 $ovalue=$this->ARC4($user);
+01046 $this->objects[$id]['info']['O']=$ovalue;
+01047 // now make the u value, phew.
+01048 $tmp = $this->md5_16($user.$ovalue.chr($options['p']).chr(255).chr(255).chr(255).$this->fileIdentifier);
+01049 $ukey = substr($tmp,0,5);
+01050
+01051 $this->ARC4_init($ukey);
+01052 $this->encryptionKey = $ukey;
+01053 $this->encrypted=1;
+01054 $uvalue=$this->ARC4($pad);
+01055
+01056 $this->objects[$id]['info']['U']=$uvalue;
+01057 $this->encryptionKey=$ukey;
+01058
+01059 // initialize the arc4 array
+01060 break;
+01061 case 'out':
+01062 $res= "\n".$id." 0 obj\n<<";
+01063 $res.="\n/Filter /Standard";
+01064 $res.="\n/V 1";
+01065 $res.="\n/R 2";
+01066 $res.="\n/O (".$this->filterText($o['info']['O']).')';
+01067 $res.="\n/U (".$this->filterText($o['info']['U']).')';
+01068 // and the p-value needs to be converted to account for the twos-complement approach
+01069 $o['info']['p'] = (($o['info']['p']^255)+1)*-1;
+01070 $res.="\n/P ".($o['info']['p']);
+01071 $res.="\n>>\nendobj\n";
+01072
+01073 return $res;
+01074 break;
+01075 }
+01076 }
+
00475 {
+00476 if ($action!='new'){
+00477 $o =& $this->objects[$id];
+00478 }
+00479 switch ($action){
+00480 case 'new':
+00481 $this->objects[$id]=array('t'=>'font','info'=>array('name'=>$options['name'],'SubType'=>'Type1'));
+00482 $fontNum=$this->numFonts;
+00483 $this->objects[$id]['info']['fontNum']=$fontNum;
+00484 // deal with the encoding and the differences
+00485 if (isset($options['differences'])){
+00486 // then we'll need an encoding dictionary
+00487 $this->numObj++;
+00488 $this->o_fontEncoding($this->numObj,'new',$options);
+00489 $this->objects[$id]['info']['encodingDictionary']=$this->numObj;
+00490 } else if (isset($options['encoding'])){
+00491 // we can specify encoding here
+00492 switch($options['encoding']){
+00493 case 'WinAnsiEncoding':
+00494 case 'MacRomanEncoding':
+00495 case 'MacExpertEncoding':
+00496 $this->objects[$id]['info']['encoding']=$options['encoding'];
+00497 break;
+00498 case 'none':
+00499 break;
+00500 default:
+00501 $this->objects[$id]['info']['encoding']='WinAnsiEncoding';
+00502 break;
+00503 }
+00504 } else {
+00505 $this->objects[$id]['info']['encoding']='WinAnsiEncoding';
+00506 }
+00507 // also tell the pages node about the new font
+00508 $this->o_pages($this->currentNode,'font',array('fontNum'=>$fontNum,'objNum'=>$id));
+00509 break;
+00510 case 'add':
+00511 foreach ($options as $k=>$v){
+00512 switch ($k){
+00513 case 'BaseFont':
+00514 $o['info']['name'] = $v;
+00515 break;
+00516 case 'FirstChar':
+00517 case 'LastChar':
+00518 case 'Widths':
+00519 case 'FontDescriptor':
+00520 case 'SubType':
+00521 $this->addMessage('o_font '.$k." : ".$v);
+00522 $o['info'][$k] = $v;
+00523 break;
+00524 }
+00525 }
+00526 break;
+00527 case 'out':
+00528 $res="\n".$id." 0 obj\n<< /Type /Font\n/Subtype /".$o['info']['SubType']."\n";
+00529 $res.="/Name /F".$o['info']['fontNum']."\n";
+00530 $res.="/BaseFont /".$o['info']['name']."\n";
+00531 if (isset($o['info']['encodingDictionary'])){
+00532 // then place a reference to the dictionary
+00533 $res.="/Encoding ".$o['info']['encodingDictionary']." 0 R\n";
+00534 } else if (isset($o['info']['encoding'])){
+00535 // use the specified encoding
+00536 $res.="/Encoding /".$o['info']['encoding']."\n";
+00537 }
+00538 if (isset($o['info']['FirstChar'])){
+00539 $res.="/FirstChar ".$o['info']['FirstChar']."\n";
+00540 }
+00541 if (isset($o['info']['LastChar'])){
+00542 $res.="/LastChar ".$o['info']['LastChar']."\n";
+00543 }
+00544 if (isset($o['info']['Widths'])){
+00545 $res.="/Widths ".$o['info']['Widths']." 0 R\n";
+00546 }
+00547 if (isset($o['info']['FontDescriptor'])){
+00548 $res.="/FontDescriptor ".$o['info']['FontDescriptor']." 0 R\n";
+00549 }
+00550 $res.=">>\nendobj";
+00551 return $res;
+00552 break;
+00553 }
+00554 }
+
00559 {
+00560 if ($action!='new'){
+00561 $o =& $this->objects[$id];
+00562 }
+00563 switch ($action){
+00564 case 'new':
+00565 $this->objects[$id]=array('t'=>'fontDescriptor','info'=>$options);
+00566 break;
+00567 case 'out':
+00568 $res="\n".$id." 0 obj\n<< /Type /FontDescriptor\n";
+00569 foreach ($o['info'] as $label => $value){
+00570 switch ($label){
+00571 case 'Ascent':
+00572 case 'CapHeight':
+00573 case 'Descent':
+00574 case 'Flags':
+00575 case 'ItalicAngle':
+00576 case 'StemV':
+00577 case 'AvgWidth':
+00578 case 'Leading':
+00579 case 'MaxWidth':
+00580 case 'MissingWidth':
+00581 case 'StemH':
+00582 case 'XHeight':
+00583 case 'CharSet':
+00584 if (strlen($value)){
+00585 $res.='/'.$label.' '.$value."\n";
+00586 }
+00587 break;
+00588 case 'FontFile':
+00589 case 'FontFile2':
+00590 case 'FontFile3':
+00591 $res.='/'.$label.' '.$value." 0 R\n";
+00592 break;
+00593 case 'FontBBox':
+00594 $res.='/'.$label.' ['.$value[0].' '.$value[1].' '.$value[2].' '.$value[3]."]\n";
+00595 break;
+00596 case 'FontName':
+00597 $res.='/'.$label.' /'.$value."\n";
+00598 break;
+00599 }
+00600 }
+00601 $res.=">>\nendobj";
+00602 return $res;
+00603 break;
+00604 }
+00605 }
+
00610 {
+00611 if ($action!='new'){
+00612 $o =& $this->objects[$id];
+00613 }
+00614 switch ($action){
+00615 case 'new':
+00616 // the options array should contain 'differences' and maybe 'encoding'
+00617 $this->objects[$id]=array('t'=>'fontEncoding','info'=>$options);
+00618 break;
+00619 case 'out':
+00620 $res="\n".$id." 0 obj\n<< /Type /Encoding\n";
+00621 if (!isset($o['info']['encoding'])){
+00622 $o['info']['encoding']='WinAnsiEncoding';
+00623 }
+00624 if ($o['info']['encoding']!='none'){
+00625 $res.="/BaseEncoding /".$o['info']['encoding']."\n";
+00626 }
+00627 $res.="/Differences \n[";
+00628 $onum=-100;
+00629 foreach($o['info']['differences'] as $num=>$label){
+00630 if ($num!=$onum+1){
+00631 // we cannot make use of consecutive numbering
+00632 $res.= "\n".$num." /".$label;
+00633 } else {
+00634 $res.= " /".$label;
+00635 }
+00636 $onum=$num;
+00637 }
+00638 $res.="\n]\n>>\nendobj";
+00639 return $res;
+00640 break;
+00641 }
+00642 }
+
00940 {
+00941 if ($action!='new'){
+00942 $o =& $this->objects[$id];
+00943 }
+00944 switch($action){
+00945 case 'new':
+00946 // make the new object
+00947 $this->objects[$id]=array('t'=>'image','data'=>$options['data'],'info'=>array());
+00948 $this->objects[$id]['info']['Type']='/XObject';
+00949 $this->objects[$id]['info']['Subtype']='/Image';
+00950 $this->objects[$id]['info']['Width']=$options['iw'];
+00951 $this->objects[$id]['info']['Height']=$options['ih'];
+00952 if (!isset($options['type']) || $options['type']=='jpg'){
+00953 if (!isset($options['channels'])){
+00954 $options['channels']=3;
+00955 }
+00956 switch($options['channels']){
+00957 case 1:
+00958 $this->objects[$id]['info']['ColorSpace']='/DeviceGray';
+00959 break;
+00960 default:
+00961 $this->objects[$id]['info']['ColorSpace']='/DeviceRGB';
+00962 break;
+00963 }
+00964 $this->objects[$id]['info']['Filter']='/DCTDecode';
+00965 $this->objects[$id]['info']['BitsPerComponent']=8;
+00966 } else if ($options['type']=='png'){
+00967 $this->objects[$id]['info']['Filter']='/FlateDecode';
+00968 $this->objects[$id]['info']['DecodeParms']='<< /Predictor 15 /Colors '.$options['ncolor'].' /Columns '.$options['iw'].' /BitsPerComponent '.$options['bitsPerComponent'].'>>';
+00969 if (strlen($options['pdata'])){
+00970 $tmp = ' [ /Indexed /DeviceRGB '.(strlen($options['pdata'])/3-1).' ';
+00971 $this->numObj++;
+00972 $this->o_contents($this->numObj,'new');
+00973 $this->objects[$this->numObj]['c']=$options['pdata'];
+00974 $tmp.=$this->numObj.' 0 R';
+00975 $tmp .=' ]';
+00976 $this->objects[$id]['info']['ColorSpace'] = $tmp;
+00977 if (isset($options['transparency'])){
+00978 switch($options['transparency']['type']){
+00979 case 'indexed':
+00980 $tmp=' [ '.$options['transparency']['data'].' '.$options['transparency']['data'].'] ';
+00981 $this->objects[$id]['info']['Mask'] = $tmp;
+00982 break;
+00983 }
+00984 }
+00985 } else {
+00986 $this->objects[$id]['info']['ColorSpace']='/'.$options['color'];
+00987 }
+00988 $this->objects[$id]['info']['BitsPerComponent']=$options['bitsPerComponent'];
+00989 }
+00990 // assign it a place in the named resource dictionary as an external object, according to
+00991 // the label passed in with it.
+00992 $this->o_pages($this->currentNode,'xObject',array('label'=>$options['label'],'objNum'=>$id));
+00993 // also make sure that we have the right procset object for it.
+00994 $this->o_procset($this->procsetObjectId,'add','ImageC');
+00995 break;
+00996 case 'out':
+00997 $tmp=$o['data'];
+00998 $res= "\n".$id." 0 obj\n<<";
+00999 foreach($o['info'] as $k=>$v){
+01000 $res.="\n/".$k.' '.$v;
+01001 }
+01002 if ($this->encrypted){
+01003 $this->encryptInit($id);
+01004 $tmp = $this->ARC4($tmp);
+01005 }
+01006 $res.="\n/Length ".strlen($tmp)." >>\nstream\n".$tmp."\nendstream\nendobj\n";
+01007 return $res;
+01008 break;
+01009 }
+01010 }
+
00682 {
+00683 if ($action!='new'){
+00684 $o =& $this->objects[$id];
+00685 }
+00686 switch ($action){
+00687 case 'new':
+00688 $this->infoObject=$id;
+00689 $date='D:'.date('Ymd');
+00690 $this->objects[$id]=array('t'=>'info','info'=>array('Creator'=>'R and OS php pdf writer, http://www.ros.co.nz','CreationDate'=>$date));
+00691 break;
+00692 case 'Title':
+00693 case 'Author':
+00694 case 'Subject':
+00695 case 'Keywords':
+00696 case 'Creator':
+00697 case 'Producer':
+00698 case 'CreationDate':
+00699 case 'ModDate':
+00700 case 'Trapped':
+00701 $o['info'][$action]=$options;
+00702 break;
+00703 case 'out':
+00704 if ($this->encrypted){
+00705 $this->encryptInit($id);
+00706 }
+00707 $res="\n".$id." 0 obj\n<<\n";
+00708 foreach ($o['info'] as $k=>$v){
+00709 $res.='/'.$k.' (';
+00710 if ($this->encrypted){
+00711 $res.=$this->filterText($this->ARC4($v));
+00712 } else {
+00713 $res.=$this->filterText($v);
+00714 }
+00715 $res.=")\n";
+00716 }
+00717 $res.=">>\nendobj";
+00718 return $res;
+00719 break;
+00720 }
+00721 }
+
00445 {
+00446 if ($action!='new'){
+00447 $o =& $this->objects[$id];
+00448 }
+00449 switch ($action){
+00450 case 'new':
+00451 $this->objects[$id]=array('t'=>'outlines','info'=>array('outlines'=>array()));
+00452 $this->o_catalog($this->catalogId,'outlines',$id);
+00453 break;
+00454 case 'outline':
+00455 $o['info']['outlines'][]=$options;
+00456 break;
+00457 case 'out':
+00458 if (count($o['info']['outlines'])){
+00459 $res="\n".$id." 0 obj\n<< /Type /Outlines /Kids [";
+00460 foreach($o['info']['outlines'] as $k=>$v){
+00461 $res.=$v." 0 R ";
+00462 }
+00463 $res.="] /Count ".count($o['info']['outlines'])." >>\nendobj";
+00464 } else {
+00465 $res="\n".$id." 0 obj\n<< /Type /Outlines /Count 0 >>\nendobj";
+00466 }
+00467 return $res;
+00468 break;
+00469 }
+00470 }
+
00821 {
+00822 if ($action!='new'){
+00823 $o =& $this->objects[$id];
+00824 }
+00825 switch ($action){
+00826 case 'new':
+00827 $this->numPages++;
+00828 $this->objects[$id]=array('t'=>'page','info'=>array('parent'=>$this->currentNode,'pageNum'=>$this->numPages));
+00829 if (is_array($options)){
+00830 // then this must be a page insertion, array shoudl contain 'rid','pos'=[before|after]
+00831 $options['id']=$id;
+00832 $this->o_pages($this->currentNode,'page',$options);
+00833 } else {
+00834 $this->o_pages($this->currentNode,'page',$id);
+00835 }
+00836 $this->currentPage=$id;
+00837 //make a contents object to go with this page
+00838 $this->numObj++;
+00839 $this->o_contents($this->numObj,'new',$id);
+00840 $this->currentContents=$this->numObj;
+00841 $this->objects[$id]['info']['contents']=array();
+00842 $this->objects[$id]['info']['contents'][]=$this->numObj;
+00843 $match = ($this->numPages%2 ? 'odd' : 'even');
+00844 foreach($this->addLooseObjects as $oId=>$target){
+00845 if ($target=='all' || $match==$target){
+00846 $this->objects[$id]['info']['contents'][]=$oId;
+00847 }
+00848 }
+00849 break;
+00850 case 'content':
+00851 $o['info']['contents'][]=$options;
+00852 break;
+00853 case 'annot':
+00854 // add an annotation to this page
+00855 if (!isset($o['info']['annot'])){
+00856 $o['info']['annot']=array();
+00857 }
+00858 // $options should contain the id of the annotation dictionary
+00859 $o['info']['annot'][]=$options;
+00860 break;
+00861 case 'out':
+00862 $res="\n".$id." 0 obj\n<< /Type /Page";
+00863 $res.="\n/Parent ".$o['info']['parent']." 0 R";
+00864 if (isset($o['info']['annot'])){
+00865 $res.="\n/Annots [";
+00866 foreach($o['info']['annot'] as $aId){
+00867 $res.=" ".$aId." 0 R";
+00868 }
+00869 $res.=" ]";
+00870 }
+00871 $count = count($o['info']['contents']);
+00872 if ($count==1){
+00873 $res.="\n/Contents ".$o['info']['contents'][0]." 0 R";
+00874 } else if ($count>1){
+00875 $res.="\n/Contents [\n";
+00876 foreach ($o['info']['contents'] as $cId){
+00877 $res.=$cId." 0 R\n";
+00878 }
+00879 $res.="]";
+00880 }
+00881 $res.="\n>>\nendobj";
+00882 return $res;
+00883 break;
+00884 }
+00885 }
+
00347 {
+00348 if ($action!='new'){
+00349 $o =& $this->objects[$id];
+00350 }
+00351 switch ($action){
+00352 case 'new':
+00353 $this->objects[$id]=array('t'=>'pages','info'=>array());
+00354 $this->o_catalog($this->catalogId,'pages',$id);
+00355 break;
+00356 case 'page':
+00357 if (!is_array($options)){
+00358 // then it will just be the id of the new page
+00359 $o['info']['pages'][]=$options;
+00360 } else {
+00361 // then it should be an array having 'id','rid','pos', where rid=the page to which this one will be placed relative
+00362 // and pos is either 'before' or 'after', saying where this page will fit.
+00363 if (isset($options['id']) && isset($options['rid']) && isset($options['pos'])){
+00364 $i = array_search($options['rid'],$o['info']['pages']);
+00365 if (isset($o['info']['pages'][$i]) && $o['info']['pages'][$i]==$options['rid']){
+00366 // then there is a match
+00367 // make a space
+00368 switch ($options['pos']){
+00369 case 'before':
+00370 $k = $i;
+00371 break;
+00372 case 'after':
+00373 $k=$i+1;
+00374 break;
+00375 default:
+00376 $k=-1;
+00377 break;
+00378 }
+00379 if ($k>=0){
+00380 for ($j=count($o['info']['pages'])-1;$j>=$k;$j--){
+00381 $o['info']['pages'][$j+1]=$o['info']['pages'][$j];
+00382 }
+00383 $o['info']['pages'][$k]=$options['id'];
+00384 }
+00385 }
+00386 }
+00387 }
+00388 break;
+00389 case 'procset':
+00390 $o['info']['procset']=$options;
+00391 break;
+00392 case 'mediaBox':
+00393 $o['info']['mediaBox']=$options; // which should be an array of 4 numbers
+00394 break;
+00395 case 'font':
+00396 $o['info']['fonts'][]=array('objNum'=>$options['objNum'],'fontNum'=>$options['fontNum']);
+00397 break;
+00398 case 'xObject':
+00399 $o['info']['xObjects'][]=array('objNum'=>$options['objNum'],'label'=>$options['label']);
+00400 break;
+00401 case 'out':
+00402 if (count($o['info']['pages'])){
+00403 $res="\n".$id." 0 obj\n<< /Type /Pages\n/Kids [";
+00404 foreach($o['info']['pages'] as $k=>$v){
+00405 $res.=$v." 0 R\n";
+00406 }
+00407 $res.="]\n/Count ".count($this->objects[$id]['info']['pages']);
+00408 if ((isset($o['info']['fonts']) && count($o['info']['fonts'])) || isset($o['info']['procset'])){
+00409 $res.="\n/Resources <<";
+00410 if (isset($o['info']['procset'])){
+00411 $res.="\n/ProcSet ".$o['info']['procset']." 0 R";
+00412 }
+00413 if (isset($o['info']['fonts']) && count($o['info']['fonts'])){
+00414 $res.="\n/Font << ";
+00415 foreach($o['info']['fonts'] as $finfo){
+00416 $res.="\n/F".$finfo['fontNum']." ".$finfo['objNum']." 0 R";
+00417 }
+00418 $res.=" >>";
+00419 }
+00420 if (isset($o['info']['xObjects']) && count($o['info']['xObjects'])){
+00421 $res.="\n/XObject << ";
+00422 foreach($o['info']['xObjects'] as $finfo){
+00423 $res.="\n/".$finfo['label']." ".$finfo['objNum']." 0 R";
+00424 }
+00425 $res.=" >>";
+00426 }
+00427 $res.="\n>>";
+00428 if (isset($o['info']['mediaBox'])){
+00429 $tmp=$o['info']['mediaBox'];
+00430 $res.="\n/MediaBox [".sprintf('%.3f',$tmp[0]).' '.sprintf('%.3f',$tmp[1]).' '.sprintf('%.3f',$tmp[2]).' '.sprintf('%.3f',$tmp[3]).']';
+00431 }
+00432 }
+00433 $res.="\n >>\nendobj";
+00434 } else {
+00435 $res="\n".$id." 0 obj\n<< /Type /Pages\n/Count 0\n>>\nendobj";
+00436 }
+00437 return $res;
+00438 break;
+00439 }
+00440 }
+
00647 {
+00648 if ($action!='new'){
+00649 $o =& $this->objects[$id];
+00650 }
+00651 switch ($action){
+00652 case 'new':
+00653 $this->objects[$id]=array('t'=>'procset','info'=>array('PDF'=>1,'Text'=>1));
+00654 $this->o_pages($this->currentNode,'procset',$id);
+00655 $this->procsetObjectId=$id;
+00656 break;
+00657 case 'add':
+00658 // this is to add new items to the procset list, despite the fact that this is considered
+00659 // obselete, the items are required for printing to some postscript printers
+00660 switch ($options) {
+00661 case 'ImageB':
+00662 case 'ImageC':
+00663 case 'ImageI':
+00664 $o['info'][$options]=1;
+00665 break;
+00666 }
+00667 break;
+00668 case 'out':
+00669 $res="\n".$id." 0 obj\n[";
+00670 foreach ($o['info'] as $label=>$val){
+00671 $res.='/'.$label.' ';
+00672 }
+00673 $res.="]\nendobj";
+00674 return $res;
+00675 break;
+00676 }
+00677 }
+
00259 {
+00260 if ($action!='new'){
+00261 $o =& $this->objects[$id];
+00262 }
+00263 switch ($action){
+00264 case 'new':
+00265 $this->objects[$id]=array('t'=>'viewerPreferences','info'=>array());
+00266 break;
+00267 case 'add':
+00268 foreach($options as $k=>$v){
+00269 switch ($k){
+00270 case 'HideToolbar':
+00271 case 'HideMenubar':
+00272 case 'HideWindowUI':
+00273 case 'FitWindow':
+00274 case 'CenterWindow':
+00275 case 'NonFullScreenPageMode':
+00276 case 'Direction':
+00277 $o['info'][$k]=$v;
+00278 break;
+00279 }
+00280 }
+00281 break;
+00282 case 'out':
+00283
+00284 $res="\n".$id." 0 obj\n".'<< ';
+00285 foreach($o['info'] as $k=>$v){
+00286 $res.="\n/".$k.' '.$v;
+00287 }
+00288 $res.="\n>>\n";
+00289 return $res;
+00290 break;
+00291 }
+00292 }
+
01306 {
+01307 // assume that $font contains both the path and perhaps the extension to the file, split them
+01308 $pos=strrpos($font,'/');
+01309 if ($pos===false){
+01310 $dir = './';
+01311 $name = $font;
+01312 } else {
+01313 $dir=substr($font,0,$pos+1);
+01314 $name=substr($font,$pos+1);
+01315 }
+01316
+01317 if (substr($name,-4)=='.afm'){
+01318 $name=substr($name,0,strlen($name)-4);
+01319 }
+01320 $this->addMessage('openFont: '.$font.' - '.$name);
+01321 if (file_exists($dir.'php_'.$name.'.afm')){
+01322 $this->addMessage('openFont: php file exists '.$dir.'php_'.$name.'.afm');
+01323 $tmp = file($dir.'php_'.$name.'.afm');
+01324 $this->fonts[$font]=unserialize($tmp[0]);
+01325 if (!isset($this->fonts[$font]['_version_']) || $this->fonts[$font]['_version_']<1){
+01326 // if the font file is old, then clear it out and prepare for re-creation
+01327 $this->addMessage('openFont: clear out, make way for new version.');
+01328 unset($this->fonts[$font]);
+01329 }
+01330 }
+01331 if (!isset($this->fonts[$font]) && file_exists($dir.$name.'.afm')){
+01332 // then rebuild the php_<font>.afm file from the <font>.afm file
+01333 $this->addMessage('openFont: build php file from '.$dir.$name.'.afm');
+01334 $data = array();
+01335 $file = file($dir.$name.'.afm');
+01336 foreach ($file as $rowA){
+01337 $row=trim($rowA);
+01338 $pos=strpos($row,' ');
+01339 if ($pos){
+01340 // then there must be some keyword
+01341 $key = substr($row,0,$pos);
+01342 switch ($key){
+01343 case 'FontName':
+01344 case 'FullName':
+01345 case 'FamilyName':
+01346 case 'Weight':
+01347 case 'ItalicAngle':
+01348 case 'IsFixedPitch':
+01349 case 'CharacterSet':
+01350 case 'UnderlinePosition':
+01351 case 'UnderlineThickness':
+01352 case 'Version':
+01353 case 'EncodingScheme':
+01354 case 'CapHeight':
+01355 case 'XHeight':
+01356 case 'Ascender':
+01357 case 'Descender':
+01358 case 'StdHW':
+01359 case 'StdVW':
+01360 case 'StartCharMetrics':
+01361 $data[$key]=trim(substr($row,$pos));
+01362 break;
+01363 case 'FontBBox':
+01364 $data[$key]=explode(' ',trim(substr($row,$pos)));
+01365 break;
+01366 case 'C':
+01367 //C 39 ; WX 222 ; N quoteright ; B 53 463 157 718 ;
+01368 $bits=explode(';',trim($row));
+01369 $dtmp=array();
+01370 foreach($bits as $bit){
+01371 $bits2 = explode(' ',trim($bit));
+01372 if (strlen($bits2[0])){
+01373 if (count($bits2)>2){
+01374 $dtmp[$bits2[0]]=array();
+01375 for ($i=1;$i<count($bits2);$i++){
+01376 $dtmp[$bits2[0]][]=$bits2[$i];
+01377 }
+01378 } else if (count($bits2)==2){
+01379 $dtmp[$bits2[0]]=$bits2[1];
+01380 }
+01381 }
+01382 }
+01383 if ($dtmp['C']>=0){
+01384 $data['C'][$dtmp['C']]=$dtmp;
+01385 $data['C'][$dtmp['N']]=$dtmp;
+01386 } else {
+01387 $data['C'][$dtmp['N']]=$dtmp;
+01388 }
+01389 break;
+01390 case 'KPX':
+01391 //KPX Adieresis yacute -40
+01392 $bits=explode(' ',trim($row));
+01393 $data['KPX'][$bits[1]][$bits[2]]=$bits[3];
+01394 break;
+01395 }
+01396 }
+01397 }
+01398 $data['_version_']=1;
+01399 $this->fonts[$font]=$data;
+01400 $fp = fopen($dir.'php_'.$name.'.afm','w');
+01401 fwrite($fp,serialize($data));
+01402 fclose($fp);
+01403 } else if (!isset($this->fonts[$font])){
+01404 $this->addMessage('openFont: no font file found');
+01405 // echo 'Font not Found '.$font;
+01406 }
+01407 }
+
02949 {
+02950 // this function will open the document at a specified page, in a specified style
+02951 // the values for style, and the required paramters are:
+02952 // 'XYZ' left, top, zoom
+02953 // 'Fit'
+02954 // 'FitH' top
+02955 // 'FitV' left
+02956 // 'FitR' left,bottom,right
+02957 // 'FitB'
+02958 // 'FitBH' top
+02959 // 'FitBV' left
+02960 $this->numObj++;
+02961 $this->o_destination($this->numObj,'new',array('page'=>$this->currentPage,'type'=>$style,'p1'=>$a,'p2'=>$b,'p3'=>$c));
+02962 $id = $this->catalogId;
+02963 $this->o_catalog($id,'openHere',$this->numObj);
+02964 }
+
02490 {
+02491 $this->nStack++;
+02492 $this->stack[$this->nStack]=array('c'=>$this->currentContents,'p'=>$this->currentPage);
+02493 // add a new object of the content type, to hold the data flow
+02494 $this->numObj++;
+02495 $this->o_contents($this->numObj,'new');
+02496 $this->currentContents=$this->numObj;
+02497 $this->looseObjects[$this->numObj]=1;
+02498
+02499 return $this->numObj;
+02500 }
+
01220 {
+01221
+01222 if ($debug){
+01223 // turn compression off
+01224 $this->options['compression']=0;
+01225 }
+01226
+01227 if ($this->arc4_objnum){
+01228 $this->ARC4_init($this->encryptionKey);
+01229 }
+01230
+01231 $this->checkAllHere();
+01232
+01233 $xref=array();
+01234 $content="%PDF-1.3\n%âãÏÓ\n";
+01235 // $content="%PDF-1.3\n";
+01236 $pos=strlen($content);
+01237 foreach($this->objects as $k=>$v){
+01238 $tmp='o_'.$v['t'];
+01239 $cont=$this->$tmp($k,'out');
+01240 $content.=$cont;
+01241 $xref[]=$pos;
+01242 $pos+=strlen($cont);
+01243 }
+01244 $content.="\nxref\n0 ".(count($xref)+1)."\n0000000000 65535 f \n";
+01245 foreach($xref as $p){
+01246 $content.=substr('0000000000',0,10-strlen($p)).$p." 00000 n \n";
+01247 }
+01248 $content.="\ntrailer\n << /Size ".(count($xref)+1)."\n /Root 1 0 R\n /Info ".$this->infoObject." 0 R\n";
+01249 // if encryption has been applied to this document then add the marker for this dictionary
+01250 if ($this->arc4_objnum > 0){
+01251 $content .= "/Encrypt ".$this->arc4_objnum." 0 R\n";
+01252 }
+01253 if (strlen($this->fileIdentifier)){
+01254 $content .= "/ID[<".$this->fileIdentifier."><".$this->fileIdentifier.">]\n";
+01255 }
+01256 $content .= " >>\nstartxref\n".$pos."\n%%EOF\n";
+01257 return $content;
+01258 }
+
01692 {
+01693 $this->ellipse($x0,$y0,$r1,$r2,$angle,$nSeg,$astart,$afinish,0);
+01694 }
+
01818 {
+01819 $this->objects[$this->currentContents]['c'].="\n";
+01820 $this->objects[$this->currentContents]['c'].=sprintf('%.3f',$p[0]).' '.sprintf('%.3f',$p[1]).' m ';
+01821 for ($i=2;$i<$np*2;$i=$i+2){
+01822 $this->objects[$this->currentContents]['c'].= sprintf('%.3f',$p[$i]).' '.sprintf('%.3f',$p[$i+1]).' l ';
+01823 }
+01824 if ($f==1){
+01825 $this->objects[$this->currentContents]['c'].=' f';
+01826 } else {
+01827 $this->objects[$this->currentContents]['c'].=' S';
+01828 }
+01829 }
+
02623 {
+02624 // return the integer represented by $num bytes from $pos within $data
+02625 $ret=0;
+02626 for ($i=0;$i<$num;$i++){
+02627 $ret=$ret*256;
+02628 $ret+=ord($data[$pos+$i]);
+02629 }
+02630 return $ret;
+02631 }
+
02300 {
+02301 switch ($justification){
+02302 case 'left':
+02303 return;
+02304 break;
+02305 case 'right':
+02306 $x+=$width-$actual;
+02307 break;
+02308 case 'center':
+02309 case 'centre':
+02310 $x+=($width-$actual)/2;
+02311 break;
+02312 case 'full':
+02313 // count the number of words
+02314 $words = explode(' ',$text);
+02315 $nspaces=count($words)-1;
+02316 if ($nspaces>0){
+02317 $adjust = ($width-$actual)/$nspaces;
+02318 } else {
+02319 $adjust=0;
+02320 }
+02321 break;
+02322 }
+02323 }
+
01993 {
+01994 $x=0;
+01995 $y=0;
+01996 return $this->PRVTcheckTextDirective1($text,$i,$f,0,$x,$y);
+01997 }
+
02008 {
+02009 $directive = 0;
+02010 $j=$i;
+02011 if ($text[$j]=='<'){
+02012 $j++;
+02013 switch($text[$j]){
+02014 case '/':
+02015 $j++;
+02016 if (strlen($text) <= $j){
+02017 return $directive;
+02018 }
+02019 switch($text[$j]){
+02020 case 'b':
+02021 case 'i':
+02022 $j++;
+02023 if ($text[$j]=='>'){
+02024 $p = strrpos($this->currentTextState,$text[$j-1]);
+02025 if ($p !== false){
+02026 // then there is one to remove
+02027 $this->currentTextState = substr($this->currentTextState,0,$p).substr($this->currentTextState,$p+1);
+02028 }
+02029 $directive=$j-$i+1;
+02030 }
+02031 break;
+02032 case 'c':
+02033 // this this might be a callback function
+02034 $j++;
+02035 $k = strpos($text,'>',$j);
+02036 if ($k!==false && $text[$j]==':'){
+02037 // then this will be treated as a callback directive
+02038 $directive = $k-$i+1;
+02039 $f=0;
+02040 // split the remainder on colons to get the function name and the paramater
+02041 $tmp = substr($text,$j+1,$k-$j-1);
+02042 $b1 = strpos($tmp,':');
+02043 if ($b1!==false){
+02044 $func = substr($tmp,0,$b1);
+02045 $parm = substr($tmp,$b1+1);
+02046 } else {
+02047 $func=$tmp;
+02048 $parm='';
+02049 }
+02050 if (!isset($func) || !strlen(trim($func))){
+02051 $directive=0;
+02052 } else {
+02053 // only call the function if this is the final call
+02054 if ($final){
+02055 // need to assess the text position, calculate the text width to this point
+02056 // can use getTextWidth to find the text width I think
+02057 $tmp = $this->PRVTgetTextPosition($x,$y,$angle,$size,$wordSpaceAdjust,substr($text,0,$i));
+02058 $info = array('x'=>$tmp[0],'y'=>$tmp[1],'angle'=>$angle,'status'=>'end','p'=>$parm,'nCallback'=>$this->nCallback);
+02059 $x=$tmp[0];
+02060 $y=$tmp[1];
+02061 $ret = $this->$func($info);
+02062 if (is_array($ret)){
+02063 // then the return from the callback function could set the position, to start with, later will do font colour, and font
+02064 foreach($ret as $rk=>$rv){
+02065 switch($rk){
+02066 case 'x':
+02067 case 'y':
+02068 $$rk=$rv;
+02069 break;
+02070 }
+02071 }
+02072 }
+02073 // also remove from to the stack
+02074 // for simplicity, just take from the end, fix this another day
+02075 $this->nCallback--;
+02076 if ($this->nCallback<0){
+02077 $this->nCallBack=0;
+02078 }
+02079 }
+02080 }
+02081 }
+02082 break;
+02083 }
+02084 break;
+02085 case 'b':
+02086 case 'i':
+02087 $j++;
+02088 if ($text[$j]=='>'){
+02089 $this->currentTextState.=$text[$j-1];
+02090 $directive=$j-$i+1;
+02091 }
+02092 break;
+02093 case 'C':
+02094 $noClose=1;
+02095 case 'c':
+02096 // this this might be a callback function
+02097 $j++;
+02098 $k = strpos($text,'>',$j);
+02099 if ($k!==false && $text[$j]==':'){
+02100 // then this will be treated as a callback directive
+02101 $directive = $k-$i+1;
+02102 $f=0;
+02103 // split the remainder on colons to get the function name and the paramater
+02104 // $bits = explode(':',substr($text,$j+1,$k-$j-1));
+02105 $tmp = substr($text,$j+1,$k-$j-1);
+02106 $b1 = strpos($tmp,':');
+02107 if ($b1!==false){
+02108 $func = substr($tmp,0,$b1);
+02109 $parm = substr($tmp,$b1+1);
+02110 } else {
+02111 $func=$tmp;
+02112 $parm='';
+02113 }
+02114 if (!isset($func) || !strlen(trim($func))){
+02115 $directive=0;
+02116 } else {
+02117 // only call the function if this is the final call, ie, the one actually doing printing, not measurement
+02118 if ($final){
+02119 // need to assess the text position, calculate the text width to this point
+02120 // can use getTextWidth to find the text width I think
+02121 // also add the text height and decender
+02122 $tmp = $this->PRVTgetTextPosition($x,$y,$angle,$size,$wordSpaceAdjust,substr($text,0,$i));
+02123 $info = array('x'=>$tmp[0],'y'=>$tmp[1],'angle'=>$angle,'status'=>'start','p'=>$parm,'f'=>$func,'height'=>$this->getFontHeight($size),'decender'=>$this->getFontDecender($size));
+02124 $x=$tmp[0];
+02125 $y=$tmp[1];
+02126 if (!isset($noClose) || !$noClose){
+02127 // only add to the stack if this is a small 'c', therefore is a start-stop pair
+02128 $this->nCallback++;
+02129 $info['nCallback']=$this->nCallback;
+02130 $this->callback[$this->nCallback]=$info;
+02131 }
+02132 $ret = $this->$func($info);
+02133 if (is_array($ret)){
+02134 // then the return from the callback function could set the position, to start with, later will do font colour, and font
+02135 foreach($ret as $rk=>$rv){
+02136 switch($rk){
+02137 case 'x':
+02138 case 'y':
+02139 $$rk=$rv;
+02140 break;
+02141 }
+02142 }
+02143 }
+02144 }
+02145 }
+02146 }
+02147 break;
+02148 }
+02149 }
+02150 return $directive;
+02151 }
+
01977 {
+01978 // given this information return an array containing x and y for the end position as elements 0 and 1
+01979 $w = $this->getTextWidth($size,$text);
+01980 // need to adjust for the number of spaces in this text
+01981 $words = explode(' ',$text);
+01982 $nspaces=count($words)-1;
+01983 $w += $wa*$nspaces;
+01984 $a = deg2rad((float)$angle);
+01985 return array(cos($a)*$w+$x,-sin($a)*$w+$y);
+01986 }
+
01843 {
+01844 $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3f',$x1).' '.sprintf('%.3f',$y1).' '.sprintf('%.3f',$width).' '.sprintf('%.3f',$height).' re S';
+01845 }
+
02505 {
+02506 $this->nStack++;
+02507 $this->stack[$this->nStack]=array('c'=>$this->currentContents,'p'=>$this->currentPage);
+02508 $this->currentContents=$id;
+02509 // also if this object is the primary contents for a page, then set the current page to its parent
+02510 if (isset($this->objects[$id]['onPage'])){
+02511 $this->currentPage = $this->objects[$id]['onPage'];
+02512 }
+02513 }
+
02471 {
+02472 if (!$pageEnd){
+02473 $n = $this->nStateStack;
+02474 $this->currentColour = $this->stateStack[$n]['col'];
+02475 $this->currentStrokeColour = $this->stateStack[$n]['str'];
+02476 $this->objects[$this->currentContents]['c'].="\n".$this->stateStack[$n]['lin'];
+02477 $this->currentLineStyle = $this->stateStack[$n]['lin'];
+02478 unset($this->stateStack[$n]);
+02479 $this->nStateStack--;
+02480 }
+02481 $this->objects[$this->currentContents]['c'].="\nQ";
+02482 }
+
02447 {
+02448 if ($pageEnd){
+02449 // this will be called at a new page to return the state to what it was on the
+02450 // end of the previous page, before the stack was closed down
+02451 // This is to get around not being able to have open 'q' across pages
+02452 $opt = $this->stateStack[$pageEnd]; // ok to use this as stack starts numbering at 1
+02453 $this->setColor($opt['col']['r'],$opt['col']['g'],$opt['col']['b'],1);
+02454 $this->setStrokeColor($opt['str']['r'],$opt['str']['g'],$opt['str']['b'],1);
+02455 $this->objects[$this->currentContents]['c'].="\n".$opt['lin'];
+02456 // $this->currentLineStyle = $opt['lin'];
+02457 } else {
+02458 $this->nStateStack++;
+02459 $this->stateStack[$this->nStateStack]=array(
+02460 'col'=>$this->currentColour
+02461 ,'str'=>$this->currentStrokeColour
+02462 ,'lin'=>$this->currentLineStyle
+02463 );
+02464 }
+02465 $this->objects[$this->currentContents]['c'].="\nq";
+02466 }
+
01417 {
+01418 if (!isset($this->fonts[$fontName])){
+01419 // load the file
+01420 $this->openFont($fontName);
+01421 if (isset($this->fonts[$fontName])){
+01422 $this->numObj++;
+01423 $this->numFonts++;
+01424 $pos=strrpos($fontName,'/');
+01425 // $dir=substr($fontName,0,$pos+1);
+01426 $name=substr($fontName,$pos+1);
+01427 if (substr($name,-4)=='.afm'){
+01428 $name=substr($name,0,strlen($name)-4);
+01429 }
+01430 $options=array('name'=>$name);
+01431 if (is_array($encoding)){
+01432 // then encoding and differences might be set
+01433 if (isset($encoding['encoding'])){
+01434 $options['encoding']=$encoding['encoding'];
+01435 }
+01436 if (isset($encoding['differences'])){
+01437 $options['differences']=$encoding['differences'];
+01438 }
+01439 } else if (strlen($encoding)){
+01440 // then perhaps only the encoding has been set
+01441 $options['encoding']=$encoding;
+01442 }
+01443 $fontObj = $this->numObj;
+01444 $this->o_font($this->numObj,'new',$options);
+01445 $this->fonts[$fontName]['fontNum']=$this->numFonts;
+01446 // if this is a '.afm' font, and there is a '.pfa' file to go with it ( as there
+01447 // should be for all non-basic fonts), then load it into an object and put the
+01448 // references into the font object
+01449 $basefile = substr($fontName,0,strlen($fontName)-4);
+01450 if (file_exists($basefile.'.pfb')){
+01451 $fbtype = 'pfb';
+01452 } else if (file_exists($basefile.'.ttf')){
+01453 $fbtype = 'ttf';
+01454 } else {
+01455 $fbtype='';
+01456 }
+01457 $fbfile = $basefile.'.'.$fbtype;
+01458
+01459 // $pfbfile = substr($fontName,0,strlen($fontName)-4).'.pfb';
+01460 // $ttffile = substr($fontName,0,strlen($fontName)-4).'.ttf';
+01461 $this->addMessage('selectFont: checking for - '.$fbfile);
+01462 if (substr($fontName,-4)=='.afm' && strlen($fbtype) ){
+01463 $adobeFontName = $this->fonts[$fontName]['FontName'];
+01464 // $fontObj = $this->numObj;
+01465 $this->addMessage('selectFont: adding font file - '.$fbfile.' - '.$adobeFontName);
+01466 // find the array of fond widths, and put that into an object.
+01467 $firstChar = -1;
+01468 $lastChar = 0;
+01469 $widths = array();
+01470 foreach ($this->fonts[$fontName]['C'] as $num=>$d){
+01471 if (intval($num)>0 || $num=='0'){
+01472 if ($lastChar>0 && $num>$lastChar+1){
+01473 for($i=$lastChar+1;$i<$num;$i++){
+01474 $widths[] = 0;
+01475 }
+01476 }
+01477 $widths[] = $d['WX'];
+01478 if ($firstChar==-1){
+01479 $firstChar = $num;
+01480 }
+01481 $lastChar = $num;
+01482 }
+01483 }
+01484 // also need to adjust the widths for the differences array
+01485 if (isset($options['differences'])){
+01486 foreach($options['differences'] as $charNum=>$charName){
+01487 if ($charNum>$lastChar){
+01488 for($i=$lastChar+1;$i<=$charNum;$i++){
+01489 $widths[]=0;
+01490 }
+01491 $lastChar=$charNum;
+01492 }
+01493 if (isset($this->fonts[$fontName]['C'][$charName])){
+01494 $widths[$charNum-$firstChar]=$this->fonts[$fontName]['C'][$charName]['WX'];
+01495 }
+01496 }
+01497 }
+01498 $this->addMessage('selectFont: FirstChar='.$firstChar);
+01499 $this->addMessage('selectFont: LastChar='.$lastChar);
+01500 $this->numObj++;
+01501 $this->o_contents($this->numObj,'new','raw');
+01502 $this->objects[$this->numObj]['c'].='[';
+01503 foreach($widths as $width){
+01504 $this->objects[$this->numObj]['c'].=' '.$width;
+01505 }
+01506 $this->objects[$this->numObj]['c'].=' ]';
+01507 $widthid = $this->numObj;
+01508
+01509 // load the pfb file, and put that into an object too.
+01510 // note that pdf supports only binary format type 1 font files, though there is a
+01511 // simple utility to convert them from pfa to pfb.
+01512 $fp = fopen($fbfile,'rb');
+01513 $tmp = get_magic_quotes_runtime();
+01514 set_magic_quotes_runtime(0);
+01515 $data = fread($fp,filesize($fbfile));
+01516 set_magic_quotes_runtime($tmp);
+01517 fclose($fp);
+01518
+01519 // create the font descriptor
+01520 $this->numObj++;
+01521 $fontDescriptorId = $this->numObj;
+01522 $this->numObj++;
+01523 $pfbid = $this->numObj;
+01524 // determine flags (more than a little flakey, hopefully will not matter much)
+01525 $flags=0;
+01526 if ($this->fonts[$fontName]['ItalicAngle']!=0){ $flags+=pow(2,6); }
+01527 if ($this->fonts[$fontName]['IsFixedPitch']=='true'){ $flags+=1; }
+01528 $flags+=pow(2,5); // assume non-sybolic
+01529
+01530 $list = array('Ascent'=>'Ascender','CapHeight'=>'CapHeight','Descent'=>'Descender','FontBBox'=>'FontBBox','ItalicAngle'=>'ItalicAngle');
+01531 $fdopt = array(
+01532 'Flags'=>$flags
+01533 ,'FontName'=>$adobeFontName
+01534 ,'StemV'=>100 // don't know what the value for this should be!
+01535 );
+01536 foreach($list as $k=>$v){
+01537 if (isset($this->fonts[$fontName][$v])){
+01538 $fdopt[$k]=$this->fonts[$fontName][$v];
+01539 }
+01540 }
+01541
+01542 if ($fbtype=='pfb'){
+01543 $fdopt['FontFile']=$pfbid;
+01544 } else if ($fbtype=='ttf'){
+01545 $fdopt['FontFile2']=$pfbid;
+01546 }
+01547 $this->o_fontDescriptor($fontDescriptorId,'new',$fdopt);
+01548
+01549 // embed the font program
+01550 $this->o_contents($this->numObj,'new');
+01551 $this->objects[$pfbid]['c'].=$data;
+01552 // determine the cruicial lengths within this file
+01553 if ($fbtype=='pfb'){
+01554 $l1 = strpos($data,'eexec')+6;
+01555 $l2 = strpos($data,'00000000')-$l1;
+01556 $l3 = strlen($data)-$l2-$l1;
+01557 $this->o_contents($this->numObj,'add',array('Length1'=>$l1,'Length2'=>$l2,'Length3'=>$l3));
+01558 } else if ($fbtype=='ttf'){
+01559 $l1 = strlen($data);
+01560 $this->o_contents($this->numObj,'add',array('Length1'=>$l1));
+01561 }
+01562
+01563
+01564 // tell the font object about all this new stuff
+01565 $tmp = array('BaseFont'=>$adobeFontName,'Widths'=>$widthid
+01566 ,'FirstChar'=>$firstChar,'LastChar'=>$lastChar
+01567 ,'FontDescriptor'=>$fontDescriptorId);
+01568 if ($fbtype=='ttf'){
+01569 $tmp['SubType']='TrueType';
+01570 }
+01571 $this->addMessage('adding extra info to font.('.$fontObj.')');
+01572 foreach($tmp as $fk=>$fv){
+01573 $this->addMessage($fk." : ".$fv);
+01574 }
+01575 $this->o_font($fontObj,'add',$tmp);
+01576
+01577 } else {
+01578 $this->addMessage('selectFont: pfb or ttf file not found, ok if this is one of the 14 standard fonts');
+01579 }
+01580
+01581
+01582 // also set the differences here, note that this means that these will take effect only the
+01583 //first time that a font is selected, else they are ignored
+01584 if (isset($options['differences'])){
+01585 $this->fonts[$fontName]['differences']=$options['differences'];
+01586 }
+01587 }
+01588 }
+01589 if ($set && isset($this->fonts[$fontName])){
+01590 // so if for some reason the font was not set in the last one then it will not be selected
+01591 $this->currentBaseFont=$fontName;
+01592 // the next line means that if a new font is selected, then the current text state will be
+01593 // applied to it as well.
+01594 $this->setCurrentFont();
+01595 }
+01596 return $this->currentFontNum;
+01597 }
+
01655 {
+01656 if ($r>=0 && ($force || $r!=$this->currentColour['r'] || $g!=$this->currentColour['g'] || $b!=$this->currentColour['b'])){
+01657 $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3f',$r).' '.sprintf('%.3f',$g).' '.sprintf('%.3f',$b).' rg';
+01658 $this->currentColour=array('r'=>$r,'g'=>$g,'b'=>$b);
+01659 }
+01660 }
+
01611 {
+01612 if (strlen($this->currentBaseFont)==0){
+01613 // then assume an initial font
+01614 $this->selectFont('./fonts/Helvetica.afm');
+01615 }
+01616 $cf = substr($this->currentBaseFont,strrpos($this->currentBaseFont,'/')+1);
+01617 if (strlen($this->currentTextState)
+01618 && isset($this->fontFamilies[$cf])
+01619 && isset($this->fontFamilies[$cf][$this->currentTextState])){
+01620 // then we are in some state or another
+01621 // and this font has a family, and the current setting exists within it
+01622 // select the font, then return it
+01623 $nf = substr($this->currentBaseFont,0,strrpos($this->currentBaseFont,'/')+1).$this->fontFamilies[$cf][$this->currentTextState];
+01624 $this->selectFont($nf,'',0);
+01625 $this->currentFont = $nf;
+01626 $this->currentFontNum = $this->fonts[$nf]['fontNum'];
+01627 } else {
+01628 // the this font must not have the right family member for the current state
+01629 // simply assume the base font
+01630 $this->currentFont = $this->currentBaseFont;
+01631 $this->currentFontNum = $this->fonts[$this->currentFont]['fontNum'];
+01632 }
+01633 }
+
01184 {
+01185 $p=bindec(11000000);
+01186
+01187 $options = array(
+01188 'print'=>4
+01189 ,'modify'=>8
+01190 ,'copy'=>16
+01191 ,'add'=>32
+01192 );
+01193 foreach($pc as $k=>$v){
+01194 if ($v && isset($options[$k])){
+01195 $p+=$options[$k];
+01196 } else if (isset($options[$v])){
+01197 $p+=$options[$v];
+01198 }
+01199 }
+01200 // implement encryption on the document
+01201 if ($this->arc4_objnum == 0){
+01202 // then the block does not exist already, add it.
+01203 $this->numObj++;
+01204 if (strlen($ownerPass)==0){
+01205 $ownerPass=$userPass;
+01206 }
+01207 $this->o_encryption($this->numObj,'new',array('user'=>$userPass,'owner'=>$ownerPass,'p'=>$p));
+01208 }
+01209 }
+
02985 {
+02986 if (!is_array($options)){
+02987 if ($family=='init'){
+02988 // set the known family groups
+02989 // these font families will be used to enable bold and italic markers to be included
+02990 // within text streams. html forms will be used... <b></b> <i></i>
+02991 $this->fontFamilies['Helvetica.afm']=array(
+02992 'b'=>'Helvetica-Bold.afm'
+02993 ,'i'=>'Helvetica-Oblique.afm'
+02994 ,'bi'=>'Helvetica-BoldOblique.afm'
+02995 ,'ib'=>'Helvetica-BoldOblique.afm'
+02996 );
+02997 $this->fontFamilies['Courier.afm']=array(
+02998 'b'=>'Courier-Bold.afm'
+02999 ,'i'=>'Courier-Oblique.afm'
+03000 ,'bi'=>'Courier-BoldOblique.afm'
+03001 ,'ib'=>'Courier-BoldOblique.afm'
+03002 );
+03003 $this->fontFamilies['Times-Roman.afm']=array(
+03004 'b'=>'Times-Bold.afm'
+03005 ,'i'=>'Times-Italic.afm'
+03006 ,'bi'=>'Times-BoldItalic.afm'
+03007 ,'ib'=>'Times-BoldItalic.afm'
+03008 );
+03009 }
+03010 } else {
+03011 // the user is trying to set a font family
+03012 // note that this can also be used to set the base ones to something else
+03013 if (strlen($family)){
+03014 $this->fontFamilies[$family] = $options;
+03015 }
+03016 }
+03017 }
+
01789 {
+01790
+01791 // this is quite inefficient in that it sets all the parameters whenever 1 is changed, but will fix another day
+01792 $string = '';
+01793 if ($width>0){
+01794 $string.= $width.' w';
+01795 }
+01796 $ca = array('butt'=>0,'round'=>1,'square'=>2);
+01797 if (isset($ca[$cap])){
+01798 $string.= ' '.$ca[$cap].' J';
+01799 }
+01800 $ja = array('miter'=>0,'round'=>1,'bevel'=>2);
+01801 if (isset($ja[$join])){
+01802 $string.= ' '.$ja[$join].' j';
+01803 }
+01804 if (is_array($dash)){
+01805 $string.= ' [';
+01806 foreach ($dash as $len){
+01807 $string.=' '.$len;
+01808 }
+01809 $string.= ' ] '.$phase.' d';
+01810 }
+01811 $this->currentLineStyle = $string;
+01812 $this->objects[$this->currentContents]['c'].="\n".$string;
+01813 }
+
02607 {
+02608 // this will only work if the label is one of the valid ones.
+02609 if (is_array($label)){
+02610 foreach ($label as $l=>$v){
+02611 $this->o_catalog($this->catalogId,'viewerPreferences',array($l=>$v));
+02612 }
+02613 } else {
+02614 $this->o_catalog($this->catalogId,'viewerPreferences',array($label=>$value));
+02615 }
+02616 }
+
01665 {
+01666 if ($r>=0 && ($force || $r!=$this->currentStrokeColour['r'] || $g!=$this->currentStrokeColour['g'] || $b!=$this->currentStrokeColour['b'])){
+01667 $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3f',$r).' '.sprintf('%.3f',$g).' '.sprintf('%.3f',$b).' RG';
+01668 $this->currentStrokeColour=array('r'=>$r,'g'=>$g,'b'=>$b);
+01669 }
+01670 }
+
02533 {
+02534 // if an object has been appearing on pages up to now, then stop it, this page will
+02535 // be the last one that could contian it.
+02536 if (isset($this->addLooseObjects[$id])){
+02537 $this->addLooseObjects[$id]='';
+02538 }
+02539 }
+
01899 {
+01900 // setting the options allows the adjustment of the headers
+01901 // values at the moment are:
+01902 // 'Content-Disposition'=>'filename' - sets the filename, though not too sure how well this will
+01903 // work as in my trial the browser seems to use the filename of the php file with .pdf on the end
+01904 // 'Accept-Ranges'=>1 or 0 - if this is not set to 1, then this header is not included, off by default
+01905 // this header seems to have caused some problems despite tha fact that it is supposed to solve
+01906 // them, so I am leaving it off by default.
+01907 // 'compress'=> 1 or 0 - apply content stream compression, this is on (1) by default
+01908 if (!is_array($options)){
+01909 $options=array();
+01910 }
+01911 if ( isset($options['compress']) && $options['compress']==0){
+01912 $tmp = $this->output(1);
+01913 } else {
+01914 $tmp = $this->output();
+01915 }
+01916 header("Content-type: application/pdf");
+01917 header("Content-Length: ".strlen(ltrim($tmp)));
+01918 $fileName = (isset($options['Content-Disposition'])?$options['Content-Disposition']:'file.pdf');
+01919 header("Content-Disposition: inline; filename=".$fileName);
+01920 if (isset($options['Accept-Ranges']) && $options['Accept-Ranges']==1){
+01921 header("Accept-Ranges: ".strlen(ltrim($tmp)));
+01922 }
+01923 echo ltrim($tmp);
+01924 }
+
03029 {
+03030 switch ($action){
+03031 case 'start':
+03032 // store all the data away into the checkpoint variable
+03033 $data = get_object_vars($this);
+03034 $this->checkpoint = $data;
+03035 unset($data);
+03036 break;
+03037 case 'commit':
+03038 if (is_array($this->checkpoint) && isset($this->checkpoint['checkpoint'])){
+03039 $tmp = $this->checkpoint['checkpoint'];
+03040 $this->checkpoint = $tmp;
+03041 unset($tmp);
+03042 } else {
+03043 $this->checkpoint='';
+03044 }
+03045 break;
+03046 case 'rewind':
+03047 // do not destroy the current checkpoint, but move us back to the state then, so that we can try again
+03048 if (is_array($this->checkpoint)){
+03049 // can only abort if were inside a checkpoint
+03050 $tmp = $this->checkpoint;
+03051 foreach ($tmp as $k=>$v){
+03052 if ($k != 'checkpoint'){
+03053 $this->$k=$v;
+03054 }
+03055 }
+03056 unset($tmp);
+03057 }
+03058 break;
+03059 case 'abort':
+03060 if (is_array($this->checkpoint)){
+03061 // can only abort if were inside a checkpoint
+03062 $tmp = $this->checkpoint;
+03063 foreach ($tmp as $k=>$v){
+03064 $this->$k=$v;
+03065 }
+03066 unset($tmp);
+03067 }
+03068 break;
+03069 }
+03070
+03071 }
+
Field Documentation
@@ -4716,8 +7335,8 @@ Definition at line 134
The documentation for this class was generated from the following file:
-
-
Generated on Thu Jun 29 00:04:09 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:25 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/classCreport.html b/doc/developper/html/classCreport.html
index 457a6e3aa..811473225 100644
--- a/doc/developper/html/classCreport.html
+++ b/doc/developper/html/classCreport.html
@@ -68,7 +68,12 @@ Definition at line 24 of
00028 {
+00029 $this->Cezpdf($p,$o);
+00030 }
+
Member Function Documentation
@@ -101,7 +106,35 @@ References Cezpdf::Cez
00043 {
+00044 // draw a dotted line over to the right and put on a page number
+00045 $tmp = $info['p'];
+00046 $lvl = $tmp[0];
+00047 $lbl = substr($tmp,1);
+00048 $xpos = 520;
+00049
+00050 switch($lvl){
+00051 case '1':
+00052 $size=16;
+00053 $thick=1;
+00054 break;
+00055 case '2':
+00056 $size=12;
+00057 $thick=0.5;
+00058 break;
+00059 }
+00060
+00061 $this->saveState();
+00062 $this->setLineStyle($thick,'round','',array(0,10));
+00063 $this->line($xpos,$info['y'],$info['x']+5,$info['y']);
+00064 $this->restoreState();
+00065 $this->addText($xpos+5,$info['y'],$size,$lbl);
+00066
+00067
+00068 }
+
00032 {
+00033 // this callback records all of the table of contents entries, it also places a destination marker there
+00034 // so that it can be linked too
+00035 $tmp = $info['p'];
+00036 $lvl = $tmp[0];
+00037 $lbl = rawurldecode(substr($tmp,1));
+00038 $num=$this->ezWhatPageNumber($this->ezGetCurrentPageNumber());
+00039 $this->reportContents[] = array($lbl,$num,$lvl );
+00040 $this->addDestination('toc'.(count($this->reportContents)-1),'FitH',$info['y']+$info['height']);
+00041 }
+
Field Documentation
@@ -163,8 +208,8 @@ Definition at line 26 of
The documentation for this class was generated from the following file:
-
-
Generated on Thu Jun 29 00:04:09 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:25 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/classCustomer.html b/doc/developper/html/classCustomer.html
index 5af32d445..9a4123387 100644
--- a/doc/developper/html/classCustomer.html
+++ b/doc/developper/html/classCustomer.html
@@ -87,7 +87,14 @@ Constructor /* only a db connection is needed.
00049 {
+00050 $this->fiche_def_ref=FICHE_TYPE_CLIENT;
+00051 fiche::fiche($p_cn,$p_id) ;
+00052
+00053 }
+
Member Function Documentation
@@ -122,9 +129,26 @@ Get all info contains in the view thanks to the poste elt (account).
00057 {
+00058 $this->poste=($p_poste==0)?$this->poste:$p_poste;
+00059 $sql="select * from vw_client where poste_comptable=".$this->poste;
+00060 $Res=ExecSql($this->cn,$sql);
+00061 if ( pg_NumRows($Res) == 0) return null;
+00062 // There is only _one_ row by customer
+00063 $row=pg_fetch_array($Res,0);
+00064 $this->name=$row['name'];
+00065 $this->id=$row['f_id'];
+00066 $this->street=$row['rue'];
+00067 $this->cp=$row['code_postal'];
+00068 $this->country=$row['pays'];
+00069 $this->vat_number=$row['tva_num'];
+00070
+00071 }
+
+00196 {
+00197 $p_search=FormatString($p_search);
+00198 $url=urlencode($_SERVER['REQUEST_URI']);
+00199 $script=$_SERVER['SCRIPT_NAME'];
+00200 // Creation of the nav bar
+00201 // Get the max numberRow
+00202 $all_client=$this->CountByDef($this->fiche_def_ref,$p_search);
+00203 // Get offset and page variable
+00204 $offset=( isset ($_REQUEST['offset'] )) ?$_REQUEST['offset']:0;
+00205 $page=(isset($_REQUEST['page']))?$_REQUEST['page']:1;
+00206 $bar=jrn_navigation_bar($offset,$all_client,$_SESSION['g_pagesize'],$page);
+00207 // set a filter ?
+00208 $search="";
+00209 if ( trim($p_search) != "" )
+00210 {
+00211 $search=" and f_id in
+00212 (select f_id from jnt_fic_att_value
+00213 join fiche using (f_id)
+00214 join attr_value using (jft_id)
+00215 where
+00216 ad_id=1 and av_text ~* '$p_search')";
+00217 }
+00218 // Get The result Array
+00219 $step_client=$this->GetAll($offset,$search);
+00220 if ( $all_client == 0 ) return "";
+00221 $r=$bar;
+00222 $r.='<table>
+00223 <TR style="background-color:lightgrey;">
+00224 <TH>Quick Code</TH>
+00225 <th>Nom</th>
+00226 <th>Adresse</th>
+00227 <th>Solde</th>
+00228 <th colspan="3">Action </th>
+00229 </TR>';
+00230 if ( sizeof ($step_client ) == 0 )
+00231 return $r;
+00232 foreach ($step_client as $client ) {
+00233 $r.="<TR>";
+00234 $e=sprintf('<A HREF="%s?p_action=client&sa=detail&f_id=%d&url=%s" title="Détail"> ',
+00235 $script,$client->id,$url);
+00236
+00237 $r.="<TD> $e".$client->strAttribut(ATTR_DEF_QUICKCODE)."</A></TD>";
+00238 $r.="<TD>".$client->strAttribut(ATTR_DEF_NAME)."</TD>";
+00239 $r.="<TD>".$client->strAttribut(ATTR_DEF_ADRESS).
+00240 " ".$client->strAttribut(ATTR_DEF_CP).
+00241 " ".$client->strAttribut(ATTR_DEF_PAYS).
+00242 "</TD>";
+00243
+00244 $post=new poste($this->cn,$client->strAttribut(ATTR_DEF_ACCOUNT));
+00245 $a=$post->GetSoldeDetail();
+00246 $r.=sprintf('<TD align="right"> %15.2f€</TD>',$a['solde']);
+00247 $r.="<TD>";
+00248
+00249 $r.=sprintf('<A HREF="%s?p_action=contact&qcode=%s&url=%s" title="Contact">Contact</A></td>',
+00250 $script,$client->strAttribut(ATTR_DEF_QUICKCODE),$url);
+00251 $r.=sprintf('<td><A HREF="%s?p_action=suivi_courrier&sa=list&qcode=%s&url=%s" title="Action">Courrier</A></td> ',
+00252 $script,$client->strAttribut(ATTR_DEF_QUICKCODE) ,$url);
+00253
+00254
+00255
+00256 $r.='<td><A HREF="commercial.php?p_action=facture&sa=list&qcode='.$client->strAttribut(ATTR_DEF_QUICKCODE).'&url='.$url.'" title="Historique Facture">Facture</A></td>';
+00257
+00258 $r.='</TD>';
+00259
+00260 $r.="</TR>";
+00261
+00262 }
+00263 $r.="</TABLE>";
+00264 $r.=$bar;
+00265 return $r;
+00266 }
+
00084 {
+00085 $cond_sql=" and A.j_date = B.j_date
+00086 and extract(year from A.j_date) ='$p_year'";
+00087
+00088 // BASE ACCOUNT
+00089 // for belgium
+00090 $s=new parm_code($this->cn,'VENTE');
+00091 $s->Get();
+00092 $SOLD=$s->p_value;
+00093
+00094 $c=new parm_code($this->cn,'CUSTOMER');
+00095 $c->Get();
+00096 $CUSTOMER=$c->p_value;
+00097
+00098 $t=new parm_code($this->cn,'COMPTE_TVA');
+00099 $t->Get();
+00100 $TVA=$t->p_value;
+00101 // Get all the sell operation
+00102 //----
+00103 $sql="select j_grpt
+00104 from
+00105 jrnx as A
+00106 join jrnx as B using (j_grpt)
+00107 where
+00108 A.j_poste like '".$CUSTOMER."%' and
+00109 B.j_poste like '".$SOLD."%'
+00110 $cond_sql
+00111 ";
+00112
+00113 $Res=ExecSql($this->cn,$sql);
+00114 // Foreach operation
+00115 // where 7% or tva account are involved
+00116 // and store the result in an array (a_Res)
+00117 //---
+00118 $a_Res=array();
+00119 for ($i=0; $i < pg_NumRows($Res);$i++) {
+00120 // Get each row
+00121 //---
+00122 $row1=pg_fetch_array($Res,$i);
+00123
+00124 // select the operation
+00125 //----
+00126 $Res2=ExecSql($this->cn,"select j_poste,j_montant,j_debit from jrnx where j_grpt=".$row1['j_grpt']);
+00127 $a_row=array();
+00128 // Store the result in the array
+00129 //---
+00130 for ($e=0;$e < pg_NumRows($Res2);$e++) {
+00131 $a_row[]=pg_fetch_array($Res2,$e);
+00132 }
+00133
+00134 // Seek the customer
+00135 //---
+00136 foreach ($a_row as $e) {
+00137 if ( substr($e['j_poste'],0, strlen($CUSTOMER))==$CUSTOMER) {
+00138 $customer=$e['j_poste'];
+00139 // Retrieve name and vat number
+00140 $this->GetFromPoste($customer);
+00141 $a_Res[$customer]['name']=$this->name;
+00142 $a_Res[$customer]['vat_number']=$this->vat_number;
+00143 break;
+00144
+00145 }
+00146 }// foreach $a
+00147 // Store the amount in the array
+00148 //---
+00149 foreach ($a_row as $e) {
+00150 $amount=0;
+00151 $tva=0;
+00152 if ( substr($e['j_poste'],0, strlen($SOLD))==$SOLD) {
+00153 $amount=($e['j_debit']=='f')?$e['j_montant']:$e['j_montant']*-1;
+00154 }
+00155 if ( substr($e['j_poste'],0, strlen($TVA))==$TVA) {
+00156 $tva=($e['j_debit']=='f')?$e['j_montant']:$e['j_montant']*-1;
+00157 }
+00158 // store sold
+00159 //---
+00160 $a_Res[$customer]['amount']=(isset($a_Res[$customer]['amount']))?$a_Res[$customer]['amount']:0;
+00161 $a_Res[$customer]['amount']+=$amount;
+00162
+00163 // store vat
+00164 //---
+00165 $a_Res[$customer]['tva']=(isset($a_Res[$customer]['tva']))?$a_Res[$customer]['tva']:0;
+00166 $a_Res[$customer]['tva']+=$tva;
+00167
+00168 // store customef info
+00169 //---
+00170 $a_Res[$customer]['customer']=$customer;
+00171
+00172 //if not submitted to VAT, remove from list:
+00173 //STAN: currently commented out because I don't know if it is really what we need.
+00174 //Dany : yes we need it because the decla. concerns only the registered customer at the VAT
+00175 if (!isset($a_Res[$customer]['vat_number']) || strcmp($a_Res[$customer]['vat_number'], "") == 0)
+00176 {
+00177 unset($a_Res[$customer]);
+00178 }
+00179
+00180 }// foreach $a
+00181
+00182 }
+00183 return $a_Res;
+00184 }
+
Field Documentation
@@ -356,8 +556,8 @@ Definition at line
The documentation for this class was generated from the following file:
-
-
Generated on Thu Jun 29 00:04:10 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:25 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/classDocument.html b/doc/developper/html/classDocument.html
index e1aa6ba2f..63ac2e917 100644
--- a/doc/developper/html/classDocument.html
+++ b/doc/developper/html/classDocument.html
@@ -109,9 +109,15 @@ Definition at line
00043 {
+00044 $this->db=$p_cn;
+00045 $this->d_id=$p_d_id;
+00046 }
+
Member Function Documentation
@@ -147,7 +153,16 @@ a_ref00327 {
+00328 if ( $this->d_id == 0 )
+00329 return '';
+00330 $r="";
+00331 $r='<A HREF="show_document.php?d_id='.$this->d_id.'">Document</A>';
+00332 return $r;
+00333 }
+
00050 {
+00051 $this->d_id=NextSequence($this->db,"document_d_id_seq");
+00052 // affect a number
+00053 $this->d_number=NextSequence($this->db,"seq_doc_type_".$this->md_type);
+00054 $sql=sprintf('insert into document(d_id,ag_id,d_number) values(%d,%d,%d)',
+00055 $this->d_id,
+00056 $this->ag_id,
+00057 $this->d_number);
+00058 ExecSql($this->db,$sql);
+00059
+00060 }
+
00072 {
+00073 // create a temp directory in /tmp to unpack file and to parse it
+00074 $dirname=tempnam('/tmp','doc_');
+00075 echo $dirname;
+00076 unlink($dirname);
+00077 mkdir ($dirname);
+00078 echo_debug('class_action',__LINE__,"Dirname is $dirname");
+00079 // Retrieve the lob and save it into $dirname
+00080 StartSql($this->db);
+00081 $dm_info="select md_type,md_lob,md_filename,md_mimetype
+00082 from document_modele where md_id=".$this->md_id;
+00083 $Res=ExecSql($this->db,$dm_info);
+00084
+00085 $row=pg_fetch_array($Res,0);
+00086 $this->d_lob=$row['md_lob'];
+00087 $this->d_filename=$row['md_filename'];
+00088 $this->d_mimetype=$row['md_mimetype'];
+00089
+00090 echo_debug('class_document',__LINE__,"OID is ".$row['md_lob']);
+00092 chdir($dirname);
+00093 $filename=$row['md_filename'];
+00094 pg_lo_export($this->db,$row['md_lob'],$filename);
+00095 $type="n";
+00096 echo_debug('class_document',__LINE__,'The document type is '.$row['md_mimetype']);
+00097 // if the doc is a OOo, we need to unzip it first
+00098 // and the name of the file to change is always content.xml
+00099 if ( strpos($row['md_mimetype'],'vnd.oasis') != 0 )
+00100 {
+00101 echo_debug('class_document',__LINE__,'Unzip the OOo');
+00102 system("unzip ".$filename);
+00103 // Remove the file we do not need anymore
+00104 unlink($filename);
+00105 $file_to_parse="content.xml";
+00106 $type="OOo";
+00107 }
+00108 else
+00109 $file_to_parse=$filename;
+00110 // affect a number
+00111 $this->d_number=NextSequence($this->db,"seq_doc_type_".$row['md_type']);
+00112
+00113
+00114 // parse the document - return the doc number ?
+00115 $this->ParseDocument($dirname,$file_to_parse,$type);
+00116
+00117 Commit($this->db);
+00118 // if the doc is a OOo, we need to re-zip it
+00119 if ( strpos($row['md_mimetype'],'vnd.oasis') != 0 )
+00120 {
+00121 system ("zip -r ".$filename." *");
+00122 $file_to_parse=$filename;
+00123 }
+00124 // Create a directory
+00125 mkdir ($_SERVER['DOCUMENT_ROOT'].$dirname);
+00126
+00127 // we need to rename the new generated file
+00128 rename($dirname."/".$file_to_parse,$_SERVER['DOCUMENT_ROOT'].$dirname.'/'.$file_to_parse);
+00129 $ret=sprintf('<A HREF="%s">Document généré</A>',
+00130 $dirname.'/'.$file_to_parse);
+00131 $this->SaveGenerated($_SERVER['DOCUMENT_ROOT'].$dirname."/".$file_to_parse);
+00132 return $ret;
+00133 }
+
00376 {
+00377 $sql="select * from document where d_id=".$this->d_id;
+00378 $ret=Exec($this->db,$sql);
+00379 if ( pg_num_rows($ret) == 0 )
+00380 return;
+00381 $row=pg_fetch_array($ret,0);
+00382 $this->ag_id=$row['ag_id'];
+00383 $this->d_mimetype=$row['d_mimetype'];
+00384 $this->d_filename=$row['d_filename'];
+00385 $this->d_lob=$row['d_lob'];
+00386 $this->d_number=$row[''];
+00387 $this->d_state=$row['ag_id'];
+00388 $this->d_number=$row['d_number'];
+00389
+00390 }
+
00734 {
+00735
+00736 $sql=sprintf("update jrn set jr_pj=%s,jr_pj_name='%s',jr_pj_type='%s' where jr_internal='%s'",
+00737 $this->d_lob,$this->d_filename,$this->d_mimetype,$p_internal);
+00738 ExecSql($this->db,$sql);
+00739 // clean the table document
+00740 $this->remove();
+00741 }
+
00146 {
+00147
+00148 echo_debug('class_document',__LINE__,'Begin parsing of '.$p_dir.' '.$p_file.'Type = '.$p_type);
+00149
+00156 // open the document
+00157 $infile_name=$p_dir."/".$p_file;
+00158 echo_debug("class_document.php",__LINE__,"Open the document $p_dir/$p_file");
+00159 $h=fopen($infile_name,"r");
+00160 $output_name=tempnam($_SERVER["DOCUMENT_ROOT"]."/tmp","gen_doc_");
+00161 $output_file=fopen($output_name,"w+");
+00162 // check if the opening is sucessfull
+00163 if ( $h == false )
+00164 {
+00165 echo "cannot open $p_dir $p_file ";
+00166 exit();
+00167 }
+00168 if ( $output_file == false)
+00169 {
+00170 echo "ne peut pas ouvrir le fichier de sortie";
+00171 exit();
+00172 }
+00173 // compute the regex
+00174 if ( $p_type=='OOo')
+00175 {
+00176 $regex="<<[A-Z]+_*[A-Z]*_*[A-Z]*_*[0-9]*>>";
+00177 $lt="<";
+00178 $gt=">";
+00179 }
+00180 else
+00181 {
+00182 $regex="<<[A-Z]+_*[A-Z]*_*[A-Z]*_*[0-9]*>>";
+00183 $lt="<";
+00184 $gt=">";
+00185 }
+00186 //read the file
+00187 while(! feof($h))
+00188 {
+00189 // replace the tag
+00190 $buffer=fgets($h);
+00191 // search in the buffer the magic << and >>
+00192 // while ereg finds something to replace
+00193 while ( ereg ($regex,$buffer,$f) )
+00194 {
+00195
+00196 echo_debug('class_document',__LINE__,'var_export '.var_export( $f,true));
+00197 foreach ( $f as $pattern )
+00198 {
+00199 echo_debug('class_document',__LINE__, "pattern");
+00200 echo_debug('class_document',__LINE__, var_export($pattern,true));
+00201 $to_remove=$pattern;
+00202 // we remove the < and > from the pattern
+00203 $pattern=str_replace($lt,'',$pattern);
+00204 $pattern=str_replace($gt,'',$pattern);
+00205
+00206
+00207 // if the pattern if found we replace it
+00208 $value=$this->Replace($pattern);
+00209 // replace into the $buffer
+00210 // take the position in the buffer
+00211 $pos=strpos($buffer,$to_remove);
+00212 // get the length of the string to remove
+00213 $len=strlen($to_remove);
+00214 $buffer=substr_replace($buffer,$value,$pos,$len);
+00215
+00216 // echo_debug('class_document',__LINE__, $buffer);
+00217 // if the pattern if found we replace it
+00218 echo_debug('class_document',__LINE__,"Transform $pattern by $value");
+00219 }
+00220 }
+00221 // write into the output_file
+00222 fwrite($output_file,$buffer);
+00223
+00224 }
+00225 fclose($h);
+00226 fclose($output_file);
+00227 rename ($output_name,$infile_name);
+00228 // Save the document into the database
+00229
+00230 }
+
00723 {
+00724 $sql='delete from document where d_id='.$this->d_id;
+00725 ExecSql($this->db,$sql);
+00726 }
+
00424 {
+00425 $r="Tag inconnu";
+00426 static $counter=0;
+00427 switch ($p_tag)
+00428 {
+00429 case 'DATE':
+00430 $r=' Date inconnue ';
+00431 // Date are in $_REQUEST['ag_date']
+00432 // or $_POST['e_date']
+00433 if ( isset ($_REQUEST['ag_date']))
+00434 $r=$_REQUEST['ag_date'];
+00435 if ( isset ($_REQUEST['e_date']))
+00436 $r=$_REQUEST['e_date'];
+00437
+00438 break;
+00439 //
+00440 // the company priv
+00441
+00442 case 'MY_NAME':
+00443 $my=new own($this->db);
+00444 $r=$my->MY_NAME;
+00445 break;
+00446 case 'MY_CP':
+00447 $my=new own($this->db);
+00448 $r=$my->MY_CP;
+00449 break;
+00450 case 'MY_COMMUNE':
+00451 $my=new own($this->db);
+00452 $r=$my->MY_COMMUNE;
+00453 break;
+00454 case 'MY_TVA':
+00455 $my=new own($this->db);
+00456 $r=$my->MY_TVA;
+00457 break;
+00458 case 'MY_STREET':
+00459 $my=new own($this->db);
+00460 $r=$my->MY_STREET;
+00461 break;
+00462 case 'MY_NUMBER':
+00463 $my=new own($this->db);
+00464 $r=$my->MY_NUMBER;
+00465 break;
+00466 case 'MY_TEL':
+00467 $my=new own($this->db);
+00468 $r=$my->MY_TEL;
+00469 break;
+00470 case 'MY_FAX':
+00471 $my=new own($this->db);
+00472 $r=$my->MY_FAX;
+00473 break;
+00474 case 'MY_PAYS':
+00475 $my=new own($this->db);
+00476 $r=$my->MY_PAYS;
+00477 break;
+00478
+00479 // customer
+00480 /*\note The CUST_* are retrieved thx the $_REQUEST['tiers']
+00481 * which contains the quick_code
+00482 */
+00483 case 'SOLDE':
+00484 $tiers=new fiche($this->db);
+00485 $qcode=isset($_REQUEST['tiers'])?$_REQUEST['tiers']:$_REQUEST['e_client'];
+00486 $tiers->Getbyqcode($qcode,false);
+00487 $p=$tiers->strAttribut(ATTR_DEF_ACCOUNT);
+00488 $poste=new Poste($this->db,$p);
+00489 $r=$poste->GetSolde(' true' );
+00490 break;
+00491 case 'CUST_NAME':
+00492 $tiers=new fiche($this->db);
+00493 $qcode=isset($_REQUEST['tiers'])?$_REQUEST['tiers']:$_REQUEST['e_client'];
+00494 $tiers->getByQcode($qcode,false);
+00495 $r=$tiers->strAttribut(ATTR_DEF_NAME);
+00496 break;
+00497 case 'CUST_ADDR_1':
+00498 $tiers=new fiche($this->db);
+00499 $qcode=isset($_REQUEST['tiers'])?$_REQUEST['tiers']:$_REQUEST['e_client'];
+00500 $tiers->getByQcode($qcode,false);
+00501 $r=$tiers->strAttribut(ATTR_DEF_ADRESS);
+00502
+00503 break ;
+00504 case 'CUST_CP':
+00505 $tiers=new fiche($this->db);
+00506 $qcode=isset($_REQUEST['tiers'])?$_REQUEST['tiers']:$_REQUEST['e_client'];
+00507 $tiers->getByQcode($qcode,false);
+00508 $r=$tiers->strAttribut(ATTR_DEF_CP);
+00509
+00510 break;
+00511 case 'CUST_CO':
+00512 $tiers=new fiche($this->db);
+00513 $qcode=isset($_REQUEST['tiers'])?$_REQUEST['tiers']:$_REQUEST['e_client'];
+00514 $tiers->getByQcode($qcode,false);
+00515 $r=$tiers->strAttribut(ATTR_DEF_PAYS);
+00516
+00517 break;
+00518 case 'CUST_VAT':
+00519 $tiers=new fiche($this->db);
+00520 $qcode=isset($_REQUEST['tiers'])?$_REQUEST['tiers']:$_REQUEST['e_client'];
+00521 $tiers->getByQcode($qcode,false);
+00522 $r=$tiers->strAttribut(ATTR_DEF_NUMTVA);
+00523 break;
+00524 // Marchandise in $_POST['e_march*']
+00525 // \see user_form_achat.php or user_form_ven.php
+00526 case 'NUMBER':
+00527 $r=$this->d_number;
+00528 break;
+00529 case 'REFERENCE':
+00530 $act=new action($this->db);
+00531 $act->ag_id=$this->ag_id;
+00532 $act->get();
+00533 $r=$act->ag_ref;
+00534 break;
+00535
+00536 /*
+00537 * - [VEN_ART_NAME]
+00538 * - [VEN_ART_PRICE]
+00539 * - [VEN_ART_QUANT]
+00540 * - [VEN_ART_TVA_CODE]
+00541 * - [VEN_ART_TVA_AMOUNT]
+00542 * - [VEN_ART_STOCK_CODE]
+00543 * - [VEN_HTVA]
+00544 * - [VEN_TVAC]
+00545 * - [VEN_TVA]
+00546 * - [TOTAL_VEN_HTVA]
+00547 */
+00548 case 'MARCH_NEXT':
+00549 $counter++;
+00550 $r='';
+00551 break;
+00552
+00553 case 'VEN_ART_NAME':
+00554 extract ($_POST);
+00555 $id='e_march'.$counter;
+00556 // check if the march exists
+00557 if ( ! isset (${$id})) return "";
+00558 // check that something is sold
+00559 if ( ${'e_march'.$counter.'_sell'} != 0 && ${'e_quant'.$counter} != 0 )
+00560 {
+00561 $f=new fiche($this->db);
+00562 $f->GetByQCode(${$id},false);
+00563 $r=$f->strAttribut(ATTR_DEF_NAME);
+00564 } else $r = "";
+00565 break;
+00566
+00567 case 'VEN_ART_PRICE':
+00568 extract ($_POST);
+00569 $id='e_march'.$counter.'_sell' ;
+00570 if ( !isset (${$id}) ) return "";
+00571 $r=${$id};
+00572 break;
+00573
+00574 case 'TVA_CODE':
+00575 extract ($_POST);
+00576 $id='e_march'.$counter.'_tva_id';
+00577 if ( !isset (${$id}) ) return "";
+00578 if ( ${$id} == -1 ) return "";
+00579 $qt='e_quant'.$counter;
+00580 $price='e_march'.$counter.'_sell' ;
+00581 if ( ${$price} == 0 || ${$qt} == 0
+00582 || strlen(trim( $price )) ==0
+00583 || strlen(trim($qt)) ==0)
+00584 return "";
+00585
+00586 $r=${$id};
+00587 break;
+00588
+00589 case 'TVA_LABEL':
+00590 extract ($_POST);
+00591 $id='e_march'.$counter.'_tva_id';
+00592 if ( !isset (${$id}) ) return "";
+00593 $tva=GetTvaRate($this->db,${$id});
+00594 if ( $tva == null || $tva==0 ) return "";
+00595 $r=$tva['tva_label'];
+00596 break;
+00597
+00598
+00599 case 'TVA_AMOUNT':
+00600 extract ($_POST);
+00601 $qt='e_quant'.$counter;
+00602 $price='e_march'.$counter.'_sell' ;
+00603 $tva='e_march'.$counter.'_tva_id';
+00604 if ( !isset (${'e_march'.$counter}) ) return "";
+00605 // check that something is sold
+00606 if ( ${$price} == 0 || ${$qt} == 0
+00607 || strlen(trim( $price )) ==0
+00608 || strlen(trim($qt)) ==0)
+00609 return "";
+00610 $a_tva=GetTvaRate($this->db,${$tva});
+00611 echo_debug('class_document',__LINE__,'Tva :'.var_export($a_tva,true));
+00612 // if no vat returns 0
+00613 if ( sizeof($a_tva) == 0 ) return "";
+00614 $r=round(${$price},2)*${$qt}*$a_tva['tva_rate'];
+00615 $r=round($r,2);
+00616 break;
+00617
+00618 case 'VEN_ART_QUANT':
+00619 extract ($_POST);
+00620 $id='e_quant'.$counter;
+00621 if ( !isset (${$id}) ) return "";
+00622 // check that something is sold
+00623 if ( ${'e_march'.$counter.'_sell'} == 0
+00624 || ${'e_quant'.$counter} == 0
+00625 || strlen(trim( ${'e_march'.$counter.'_sell'} )) ==0
+00626 || strlen(trim(${'e_quant'.$counter})) ==0 )
+00627 return "";
+00628 $r=${$id};
+00629 break;
+00630
+00631 case 'VEN_HTVA':
+00632 extract ($_POST);
+00633 $id='e_march'.$counter.'_sell' ;
+00634 $quant='e_quant'.$counter;
+00635 if ( !isset (${$id}) ) return "";
+00636
+00637 // check that something is sold
+00638 if ( ${'e_march'.$counter.'_sell'} == 0 || ${'e_quant'.$counter} == 0
+00639 || strlen(trim( ${'e_march'.$counter.'_sell'} )) ==0
+00640 || strlen(trim(${'e_quant'.$counter})) ==0)
+00641 return "";
+00647 $r=round(${$id}*${$quant},2);
+00648 break;
+00649
+00650 case 'VEN_TVAC':
+00651 extract ($_POST);
+00652 $id='e_march'.$counter.'_sell' ;
+00653 $quant='e_quant'.$counter;
+00654 // if it is exist
+00655 if ( ! isset(${$id}))
+00656 return "";
+00657 // check that something is sold
+00658 if ( ${'e_march'.$counter.'_sell'} == 0 || ${'e_quant'.$counter} == 0 )
+00659 return "";
+00664 $r=${$id}*${$quant};
+00665 $tva=GetTvaRate($this->db,${'e_march'.$counter.'_tva_id'});
+00666 // if there is no vat we return now
+00667 if ( $tva == null || $tva == 0 ) return $r;
+00668 // we compute with the vat included
+00669 $r=$r+$r*$tva['tva_rate'];
+00670 $r=round($r,2);
+00671 break;
+00672 case 'TOTAL_VEN_HTVA':
+00673 extract($_POST);
+00674 echo_debug('class_document',__LINE__,'TOTAL_VEN_TVA item :'.$nb_item);
+00675
+00676 $sum=0.0;
+00677 for ($i=0;$i<$nb_item;$i++)
+00678 {
+00679 $sell='e_march'.$i.'_sell';
+00680 $qt='e_quant'.$i;
+00681 echo_debug('class_document',__LINE__,'sell :'.$sell.' qt = '.$qt);
+00682
+00683 echo_debug('class_document',__LINE__,'counter :'.$i.' sur '.$nb_item);
+00684 if ( ! isset (${$sell}) ) break;
+00685 echo_debug('class_document',__LINE__,'sell :'.${$sell}.' qt = '.${$qt});
+00686
+00687 if ( strlen(trim(${$sell})) == 0 ||
+00688 strlen(trim(${$qt})) == 0 ||
+00689 ${$qt}==0 || ${$sell}==0)
+00690 continue;
+00691 $sum+=${$sell}*${$qt};
+00692 echo_debug('class_document',__LINE__,'sum :'.$sum);
+00693
+00694 }
+00695 $r=round($sum,2);
+00696 break;
+00697 case 'TOTAL_VEN_TVAC':
+00698 extract($_POST);
+00699 $sum=0.0;
+00700 for ($i=0;$i<$nb_item;$i++)
+00701 {
+00702 $tva=GetTvaRate($this->db,${'e_march'.$i.'_tva_id'});
+00703 $tva_rate=( $tva == null || $tva == 0 )?0.0:$tva['tva_rate'];
+00704 echo_debug('class_document',__LINE__,' :'.$i.' sur '.$nb_item);
+00705 $sell=${'e_march'.$i.'_sell'};
+00706 $qt=${'e_quant'.$i};
+00707 echo_debug('class_document',__LINE__,'sell :'.$sell.' qt = '.$qt);
+00708
+00709 $sum+=$sell*$qt*(1+$tva_rate);
+00710 // $sum+=${'e_march'.$i.'_sell'}*${'e_quant'.$i}*(1+$tva_rate);
+00711 }
+00712 $r=round($sum,2);
+00713
+00714 break;
+00715
+00716 }
+00717 return $r;
+00718 }
+
00239 {
+00240 echo_debug('class_document',__LINE__,'Save generated');
+00241 // We save the generated file
+00242 $doc=new Document($this->db);
+00243 StartSql($this->db);
+00244 $this->d_lob=pg_lo_import($this->db,$p_file);
+00245 if ( $this->d_lob == false ) {
+00246 Rollback($this->db); echo_debug('class_document',__LINE__,"can't save file $p_file");
+00247 return 1; }
+00248
+00249 $sql=sprintf("insert into document(ag_id,d_lob,d_number,d_filename,d_mimetype,d_state)
+00250 values (%d,%s,%d,'%s','%s',%d)",
+00251 $this->ag_id,
+00252 $this->d_lob,
+00253 $this->d_number,
+00254 $this->d_filename,
+00255 $this->d_mimetype,
+00256 $this->d_state
+00257 );
+00258 ExecSql($this->db,$sql);
+00259 $this->d_id=GetSequence($this->db,"document_d_id_seq");
+00260 echo_debug('class_document',__LINE__,'document sauvé : d_id'.$this->d_id);
+00261 Commit($this->db);
+00262 return 0;
+00263 }
+
00338 {
+00339 // retrieve the template and generate document
+00340 StartSql($this->db);
+00341 $ret=ExecSql($this->db,
+00342 "select d_id,d_lob,d_filename,d_mimetype from document where d_id=".$this->d_id );
+00343 if ( pg_num_rows ($ret) == 0 )
+00344 return;
+00345 $row=pg_fetch_array($ret,0);
+00346 //the document is saved into file $tmp
+00347 $tmp=tempnam('/tmp/','document_');
+00348 pg_lo_export($this->db,$row['d_lob'],$tmp);
+00349 $this->d_mimetype=$row['d_mimetype'];
+00350 $this->d_filename=$row['d_filename'];
+00351
+00352 // send it to stdout
+00353 ini_set('zlib.output_compression','Off');
+00354 header("Pragma: public");
+00355 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+00356 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+00357 header("Cache-Control: must-revalidate");
+00358 header('Content-type: "'.$this->d_mimetype.'"');
+00359 header('Content-Disposition: attachment;filename="'.$this->d_filename.'"',FALSE);
+00360 header("Accept-Ranges: bytes");
+00361 $file=fopen($tmp,'r');
+00362 while ( !feof ($file) )
+00363 {
+00364 echo fread($file,8192);
+00365 }
+00366 fclose($file);
+00367
+00368 unlink ($tmp);
+00369
+00370 Commit($this->db);
+00371
+00372 }
+
00272 {
+00273
+00274 // nothing to save
+00275 if ( sizeof($_FILES) == 0 ) return;
+00276
+00277 // Start Transaction
+00278 StartSql($this->db);
+00279 $new_name=tempnam('/tmp','doc_');
+00280
+00281
+00282 // check if a file is submitted
+00283 if ( strlen($_FILES['file_upload']['tmp_name']) != 0 )
+00284 {
+00285 // upload the file and move it to temp directory
+00286 if ( move_uploaded_file($_FILES['file_upload']['tmp_name'],$new_name))
+00287 {
+00288 $oid=pg_lo_import($this->db,$new_name);
+00289 // check if the lob is in the database
+00290 if ( $oid == false )
+00291 {
+00292 Rollback($this->db);
+00293 return 1;
+00294 }
+00295 }
+00296 // the upload in the database is successfull
+00297 $this->d_lob=$oid;
+00298 $this->d_filename=$_FILES['file_upload']['name'];
+00299 $this->d_mimetype=$_FILES['file_upload']['type'];
+00300 // now we have to update the col.
+00301 // We retrieve the row to remove a possible existing lob (replace)
+00302 $sql="select d_lob from document where d_id=".$this->d_id;
+00303 $ret=ExecSql($this->db,$sql);
+00304
+00305 if (pg_num_rows($ret) != 0)
+00306 {
+00307 // a result is found, the old oid is keept in order to
+00308 // remove it later
+00309 $r=pg_fetch_array($ret,0) ;
+00310 $old_oid=$r['d_lob'] ;
+00311 if (strlen($old_oid) != 0) { pg_lo_unlink ($this->db,$old_oid);}
+00312 }
+00313 // Update the table
+00314 $sql=sprintf("update document set d_lob=%s,d_filename='%s',d_mimetype='%s' where d_id=%d",
+00315 $this->d_lob,$this->d_filename,$this->d_mimetype,$this->d_id);
+00316 ExecSql($this->db,$sql);
+00317 }
+00318 Commit($this->db);
+00319
+00320 }
+
Field Documentation
@@ -748,8 +1356,8 @@ Definition at line
The documentation for this class was generated from the following file:
-
-
Generated on Thu Jun 29 00:04:10 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:25 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/classDocument__modele.html b/doc/developper/html/classDocument__modele.html
index 24a273ea2..06b97f959 100644
--- a/doc/developper/html/classDocument__modele.html
+++ b/doc/developper/html/classDocument__modele.html
@@ -88,7 +88,13 @@ Definition at line 37 of file class_document_modele.php.
Member Function Documentation
@@ -123,7 +129,26 @@ Remove a template.
00180 {
+00181 StartSql($this->cn);
+00182 // first we unlink the document
+00183 $sql="select md_lob from document_modele where md_id=".$this->md_id;
+00184 $res=ExecSql($this->cn,$sql);
+00185 $r=pg_fetch_array($res,0);
+00186 // if a lob is found
+00187 if ( strlen ($r['md_lob']) != 0 )
+00188 {
+00189 // we remove it first
+00190 pg_lo_unlink($r['md_lob']);
+00191 }
+00192 // now we can delete the row
+00193 $sql="delete from document_modele where md_id =".$this->md_id;
+00194 $sql=ExecSql($this->cn,$sql);
+00195 Commit($this->cn);
+00196 }
+
00253 {
+00254 $r="<p>";
+00255 $r.='<form enctype="multipart/form-data" action="'.$p_action.'" method="post">';
+00256 $t=new widget("text");
+00257 $t->name="md_name";
+00258 $r.=" Nom ".$t->IOValue()."";
+00259 $r.="Type de document ";
+00260 $w=new widget("select");
+00261 $w->name="md_type";
+00262 $w->value=make_array($this->cn,'select dt_id,dt_value from document_type');
+00263 $r.=$w->IOValue();
+00264 $r.="</p><p>";
+00265 $f=new widget("file");
+00266 $f->name="doc";
+00267 $r.="fichier ".$f->IOValue()."";
+00268 // we need to add the sub action as hidden
+00269 $h=new widget("hidden");
+00270 $h->name="sa";
+00271 $h->value="add_document";
+00272 $r.=$h->IOValue();
+00273 $start=new widget("text");
+00274 $start->name="start_seq";
+00275 $start->size=9;
+00276 $start->value="0";
+00277 $r.=" Numerotation commence a ".$start->IOValue()."";
+00278 $r.=$w->Submit('add_document','Ajout');
+00279 $r.="</form></p>";
+00280 return $r;
+00281 }
+
00205 {
+00206 // retrieve info from the table invoice
+00207
+00208 // retrieve the template and generate document
+00209 StartSql($this->cn);
+00210 $ret=ExecSql($cn,"select iv_name,iv_file from invoice where iv_id".$this->iv_id);
+00211 if ( pg_num_rows ($ret) == 0 )
+00212 return;
+00213 $row=pg_fetch_array($ret,0);
+00214 //the template is saved into file $tmp
+00215 $tmp=tempnam('/tmp/','invoice_');
+00216 pg_lo_export($cn,$row['iv_file'],$tmp);
+00217 // Parse the file
+00218
+00219
+00220
+00221
+00222 // send it to stdout
+00223 ini_set('zlib.output_compression','Off');
+00224 header("Pragma: public");
+00225 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+00226 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+00227 header("Cache-Control: must-revalidate");
+00228 header('Content-type: rtf/x-application');
+00229 header('Content-Disposition: attachment;filename="invoice'.$p_internal.'.rtf"',FALSE);
+00230 header("Accept-Ranges: bytes");
+00231 $file=fopen($tmp,'r');
+00232 while ( !feof ($file) )
+00233 {
+00234 echo fread($file,8192);
+00235 }
+00236 fclose($file);
+00237
+00238 unlink ($tmp);
+00239
+00240 Commit($cn);
+00241
+00242 }
+
00049 {
+00050 $sql="select md_id,md_name,dt_value from document_modele join document_type on(dt_id=md_type)";
+00051 $Res=ExecSql($this->cn,$sql);
+00052 $all=pg_fetch_all($Res);
+00053 if ( pg_NumRows($Res) == 0 ) return "";
+00054 $r='<p><form method="post">';
+00055 $r.="<table>";
+00056 $r.="<tr> <th> Nom </th> <th>Type</Th><th>Fichier</th><th> Effacer</th>";
+00057 $r.="</tr>";
+00058 foreach ( $all as $row) {
+00059 $r.="<tr>";
+00060 $r.="<td>";
+00061 $r.=$row['md_name'];
+00062 $r.="</td>";
+00063 $r.="<td>";
+00064 $r.=$row['dt_value'];
+00065 $r.="</td>";
+00066 $r.="<td>";
+00067 $r.='<A HREF="show_document_modele.php?md_id='.$row['md_id'].'">Document</a>';
+00068 $r.="</td>";
+00069 $r.="<TD>";
+00070 $c=new widget("checkbox");
+00071 $c->name="dm_remove_".$row['md_id'];
+00072 $r.=$c->IOValue();
+00073 $r.="</td>";
+00074 $r.="</tr>";
+00075 }
+00076 $r.="</table>";
+00077
+00078 // need hidden parameter for subaction
+00079 $a=new widget("hidden");
+00080 $a->name="sa";
+00081 $a->value="rm_template";
+00082 $r.=$a->IOValue();
+00083 $r.=$a->Submit("rm_template","Effacer la sélection");
+00084 $r.="</form></p>";
+00085 return $r;
+00086 }
+
00104 {
+00105 // if name is empty return immediately
+00106 if ( trim(strlen($this->md_name))==0)
+00107 return;
+00108 // Start transaction
+00109 StartSql($this->cn);
+00110 // Save data into the table invoice
+00111 // if $this->md_id == -1 it means it is a new document model
+00112 // so first we have to insert it
+00113 // the name and the type must be set before calling save
+00114 if ( $this->md_id == -1)
+00115 {
+00116
+00117 // insert into the table document_modele
+00118 $this->name=FormatString($this->md_name);
+00119 $this->md_id=NextSequence($this->cn,'document_modele_md_id_seq');
+00120 $sql=sprintf("insert into document_modele(md_id,md_name,md_type)
+00121 values (%d,'%s',%d)",
+00122 $this->md_id,$this->name,$this->md_type);
+00123 $Ret=ExecSql($this->cn,$sql);
+00124 // create the sequence for this modele of document
+00125 $this->md_sequence="document_".NextSequence($this->cn,"document_seq");
+00126 // if start is not equal to 0 and he's a number than the user
+00127 // request a number change
+00128 echo_debug('class_document_modele',__LINE__, "this->start ".$this->start." a number ".isNumber($this->start));
+00129
+00130 if ( $this->start != 0 && isNumber($this->start) == 1 )
+00131 {
+00132 $sql="alter sequence seq_doc_type_".$this->md_type." restart ".$this->start;
+00133 ExecSql($this->cn,$sql);
+00134 }
+00135
+00136 }
+00137 // Save the file
+00138 $new_name=tempnam('/tmp','document_');
+00139 echo_debug('class_document_modele.php',__LINE__,"new name=".$new_name);
+00140 if ( strlen ($_FILES['doc']['tmp_name']) != 0 )
+00141 {
+00142 if (move_uploaded_file($_FILES['doc']['tmp_name'],
+00143 $new_name))
+00144 {
+00145 // echo "Image saved";
+00146 $oid= pg_lo_import($this->cn,$new_name);
+00147 if ( $oid == false )
+00148 {
+00149 echo_error('class_document_modele.php',__LINE__,"cannot upload document");
+00150 Rollback($cn);
+00151 return;
+00152 }
+00153 echo_debug('class_document_modele.php',__LINE__,"Loading document");
+00154 // Remove old document
+00155 $ret=ExecSql($this->cn,"select md_lob from document_modele where md_id=".$this->md_id);
+00156 if (pg_num_rows($ret) != 0)
+00157 {
+00158 $r=pg_fetch_array($ret,0);
+00159 $old_oid=$r['md_lob'];
+00160 if (strlen($old_oid) != 0)
+00161 pg_lo_unlink($this->cn,$old_oid);
+00162 }
+00163 // Load new document
+00164 ExecSql($this->cn,"update document_modele set md_lob=".$oid.", md_mimetype='".$_FILES['doc']['type']."' ,md_filename='".$_FILES['doc']['name']."' where md_id=".$this->md_id);
+00165 Commit($this->cn);
+00166 }
+00167 else
+00168 {
+00169 echo "<H1>Error</H1>";
+00170 Rollback($this->cn);
+00171 exit;
+00172 }
+00173 }
+00174 }
+
Field Documentation
@@ -466,8 +675,8 @@ Definition at line class_document_modele.php
-
Generated on Thu Jun 29 00:04:10 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:25 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/classDocument__type.html b/doc/developper/html/classDocument__type.html
index a92bf4386..be9194287 100644
--- a/doc/developper/html/classDocument__type.html
+++ b/doc/developper/html/classDocument__type.html
@@ -57,7 +57,13 @@ document_type 00036 {
+00037 $this->db=$p_cn;
+00038 $this->dt_id=-1;
+00039 }
+
00044 {
+00045 $sql="select * from document_type where dt_id=".$this->dt_id;
+00046 $R=ExecSql($this->db,$sql);
+00047 $r=pg_fetch_array($R,0);
+00048 $this->dt_id=$r['dt_id'];
+00049 $this->dt_value=$r['dt_value'];
+00050 }
+
The documentation for this class was generated from the following file:
-
-
Generated on Thu Jun 29 00:04:10 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:25 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/classOwn.html b/doc/developper/html/classOwn.html
index 0a88bfea6..72447fa3c 100644
--- a/doc/developper/html/classOwn.html
+++ b/doc/developper/html/classOwn.html
@@ -58,7 +58,21 @@ Definition at line 28
Definition at line 31 of file class_own.php.
00031 {
+00032 $this->db=$p_cn;
+00033 $Res=ExecSql($p_cn,"select * from parameter where pr_id like 'MY_%'");
+00034 for ($i = 0;$i < pg_NumRows($Res);$i++) {
+00035 $row=pg_fetch_array($Res,$i);
+00036 $key=$row['pr_id'];
+00037 $elt=$row['pr_value'];
+00038 // store value here
+00039 $this->{"$key"}=$elt;
+00040 }
+00041
+00042 }
+
Member Function Documentation
@@ -92,7 +106,21 @@ save data
00062 {
+00063 $this->UpdateRow('MY_NAME');
+00064 $this->UpdateRow('MY_TVA');
+00065 $this->UpdateRow('MY_STREET');
+00066 $this->UpdateRow('MY_NUMBER');
+00067 $this->UpdateRow('MY_CP');
+00068 $this->UpdateRow('MY_TEL');
+00069 $this->UpdateRow('MY_PAYS');
+00070 $this->UpdateRow('MY_COMMUNE');
+00071 $this->UpdateRow('MY_FAX');
+00072
+00073 }
+
00051 {
+00052 $value=FormatString($this->{"$p_attr"});
+00053 $Res=ExecSql($this->db,"update parameter set pr_value='$value' where pr_id='$p_attr'");
+00054 }
+
Field Documentation
@@ -161,8 +195,8 @@ Definition at line 29
The documentation for this class was generated from the following file:
-
-
Generated on Thu Jun 29 00:04:10 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:25 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class_8ezpdf_8php-source.html b/doc/developper/html/class_8ezpdf_8php-source.html
index 9fa43ebec..2d2e9e54e 100644
--- a/doc/developper/html/class_8ezpdf_8php-source.html
+++ b/doc/developper/html/class_8ezpdf_8php-source.html
@@ -1,12 +1,12 @@
-class.ezpdf.php
Go to the documentation of this file.00001 <?php
00002
00003 include_once('class.pdf.php');
@@ -679,8 +679,8 @@
00670 ,'innerLineThickness'=>1,'outerLineThickness'=>1,'splitRows'=>0,'protectRows'=>1
00671 );
00672
-00673 foreach($defaults as $key=>$value){
-00674 if (is_array($value)){
+00673 foreach($defaults as $key=>$value){
+00674 if (is_array($value)){
00675 if (!isset($options[$key]) || !is_array($options[$key])){
00676 $options[$key]=$value;
00677 }
@@ -1562,7 +1562,7 @@
01553
01554 }
01555 ?>
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class_8ezpdf_8php.html b/doc/developper/html/class_8ezpdf_8php.html
index e56eb4e7f..7dc159ded 100644
--- a/doc/developper/html/class_8ezpdf_8php.html
+++ b/doc/developper/html/class_8ezpdf_8php.html
@@ -1,12 +1,12 @@
-class.ezpdf.php File Reference
@@ -15,7 +15,7 @@
-class Cezpdf
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class_8pdf_8php-source.html b/doc/developper/html/class_8pdf_8php-source.html
index e4719448b..90ea71538 100644
--- a/doc/developper/html/class_8pdf_8php-source.html
+++ b/doc/developper/html/class_8pdf_8php-source.html
@@ -1,12 +1,12 @@
-class.pdf.php
Go to the documentation of this file.00001 <?php
00023 class Cpdf {
00024
@@ -300,7 +300,7 @@
00478 }
00479 switch ($action){
00480 case 'new':
-00481 $this->objects[$id]=array('t'=>'font','info'=>array('name'=>$options['name'],'SubType'=>'Type1'));
+00481 $this->objects[$id]=array('t'=>'font','info'=>array('name'=>$options['name'],'SubType'=>'Type1'));
00482 $fontNum=$this->numFonts;
00483 $this->objects[$id]['info']['fontNum']=$fontNum;
00484 // deal with the encoding and the differences
@@ -385,7 +385,7 @@
00566 break;
00567 case 'out':
00568 $res="\n".$id." 0 obj\n<< /Type /FontDescriptor\n";
-00569 foreach ($o['info'] as $label => $value){
+00569 foreach ($o['info'] as $label => $value){
00570 switch ($label){
00571 case 'Ascent':
00572 case 'CapHeight':
@@ -400,7 +400,7 @@
00581 case 'StemH':
00582 case 'XHeight':
00583 case 'CharSet':
-00584 if (strlen($value)){
+00584 if (strlen($value)){
00585 $res.='/'.$label.' '.$value."\n";
00586 }
00587 break;
@@ -1051,8 +1051,8 @@
01314 $name=substr($font,$pos+1);
01315 }
01316
-01317 if (substr($name,-4)=='.afm'){
-01318 $name=substr($name,0,strlen($name)-4);
+01317 if (substr($name,-4)=='.afm'){
+01318 $name=substr($name,0,strlen($name)-4);
01319 }
01320 $this->addMessage('openFont: '.$font.' - '.$name);
01321 if (file_exists($dir.'php_'.$name.'.afm')){
@@ -1153,10 +1153,10 @@
01424 $pos=strrpos($fontName,'/');
01425 // $dir=substr($fontName,0,$pos+1);
01426 $name=substr($fontName,$pos+1);
-01427 if (substr($name,-4)=='.afm'){
-01428 $name=substr($name,0,strlen($name)-4);
+01427 if (substr($name,-4)=='.afm'){
+01428 $name=substr($name,0,strlen($name)-4);
01429 }
-01430 $options=array('name'=>$name);
+01430 $options=array('name'=>$name);
01431 if (is_array($encoding)){
01432 // then encoding and differences might be set
01433 if (isset($encoding['encoding'])){
@@ -2597,7 +2597,7 @@
03073 } // end of class
03074
03075 ?>
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class_8pdf_8php.html b/doc/developper/html/class_8pdf_8php.html
index 4c9bc6eaa..f440edaaa 100644
--- a/doc/developper/html/class_8pdf_8php.html
+++ b/doc/developper/html/class_8pdf_8php.html
@@ -1,12 +1,12 @@
-class.pdf.php File Reference
@@ -18,7 +18,7 @@
-class Cpdf
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__action_8php-source.html b/doc/developper/html/class__action_8php-source.html
index a5ca79224..fb52870f6 100644
--- a/doc/developper/html/class__action_8php-source.html
+++ b/doc/developper/html/class__action_8php-source.html
@@ -1,12 +1,12 @@
-class_action.php
Go to the documentation of this file.00001 <?
00002 /*
00003 * This file is part of PhpCompta.
@@ -34,645 +34,717 @@
00025 require_once("user_common.php");
00046 class action
00047 {
-00061 var $db;
-00062 var $ag_comment;
-00063 var $ag_timestamp;
-00064 var $dt_id;
-00065 var $d_state;
-00066 var $d_number;
-00067 var $d_filename;
-00068 var $d_mimetype;
-00069 var $ag_title;
-00070 var $f_id;
-00071 var $ag_ref_ag_id;
-00076 function action ($p_cn)
-00077 {
-00078 $this->db=$p_cn;
-00079 $this->f_id=0;
-00080
-00081 }
-00082 //----------------------------------------------------------------------
-00099 function Display($p_view,$p_gen)
-00100 {
-00101 echo_debug('class_action',__LINE__,'Display() :'.var_export($_POST,true));
-00102 echo_debug('class_action',__LINE__,'Display $this :'.var_export($this,true));
-00103
-00104
-00105 if ( $p_view=='UPD')
-00106 {
-00107 $upd=true;
-00108 $readonly=false;
-00109 }
-00110 elseif ($p_view=="NEW")
-00111 {
-00112 $upd=false;
-00113 $readonly=false;
-00114 }
-00115 elseif ($p_view=='READ')
-00116 {
-00117 $upd=true;
-00118 $readonly=true;
-00119 }
-00120 else
-00121 {
-00122 exit('class_action'.__LINE__.'action::Display error unknown parameter'.$p_view);
-00123
-00124 }
-00125 // Compute the widget
-00126 // Date
-00127 $date=new widget("text");
-00128 $date->readonly=$readonly;
-00129 $date->name="ag_timestamp";
-00130 $date->value=$this->ag_timestamp;
-00131
-00132
-00133 // for insert mode only
-00134 if ( $upd == false )
-00135 {
-00136 // Doc Type
-00137 $doc_type=new widget("select");
-00138 $doc_type->name="dt_id";
-00139 $doc_type->value=make_array($this->db,"select dt_id,dt_value from document_type where dt_id in (".ACTION.")");
-00140 $doc_type->selected=$this->dt_id;
-00141 $doc_type->readonly=false;
-00142 $str_doc_type=$doc_type->IOValue();
-00143 echo_debug('class_action',__LINE__,var_export($doc_type,true));
-00144 }
-00145 else {
-00146 // Doc Type
-00147 $doc_type=new widget("hidden");
-00148 $doc_type->name="dt_id";
-00149 $doc_type->value=$this->dt_id;
-00150 $str_doc_type=$doc_type->IOValue()." ".getDbValue($this->db,"select dt_value from document_type where dt_id=".$this->dt_id);
-00151 }
-00152
-00153 // Description
-00154 $desc=new widget('RICHTEXT');
-00155 $desc->width=500;
-00156 $desc->heigh=250;
-00157 $desc->name="ag_comment";
-00158 $desc->readonly=$readonly;
-00159 $desc->value=urldecode($this->ag_comment);
-00160
-00161 // state
-00162 // Retrieve the value
-00163 if ( $p_view != 'READ' )
-00164 {
-00165 $a=make_array($this->db,"select s_id,s_value from document_state ");
-00166 $state=new widget("select");
-00167 $state->readonly=$readonly;
-00168 $state->name="d_state";
-00169 $state->value=$a;
-00170 $state->selected=$this->d_state;
-00171 $str_state=$state->IOValue();
-00172 } else {
-00173 $str_state=getDbValue($this->db,"select s_value from document_state where s_id=".$this->d_state);
-00174 $g=new widget("hidden");
-00175 $str_state.=$g->IOValue('d_state',$this->d_state);
-00176 }
-00177 // Retrieve the value if there is an attached doc
-00178 $doc_ref="";
-00179 // Document id
-00180
-00181 $h2=new widget("hidden");
-00182 $h2->name="d_id";
-00183 $h2->value=$this->d_id;
-00184
-00185 if ( $this->d_id != 0 && $this->d_id != "" )
-00186 {
-00187 $h2->readonly=($p_view=='NEW')?false:true;
-00188 $doc=new Document($this->db,$this->d_id);
-00189 $d_id=new widget("hidden");
-00190 $doc_ref="<p> Document ".$doc->a_ref().'</p>';
-00191 $doc_ref.=$h2->IOValue().$d_id->IOValue('d_id',$this->d_id);
-00192
-00193 }
-00194
-00195
-00196 // title
-00197 $title=new widget("text");
-00198 $title->readonly=$readonly;
-00199 $title->name="ag_title";
-00200 $title->value=FormatString($this->ag_title);
-00201
-00202 // ag_ref
-00203 // Always false for update
-00204 $ag_ref=new widget("text");
-00205 $ag_ref->readonly=true;
-00206 $ag_ref->name="ag_ref";
-00207 $ag_ref->value=FormatString($this->ag_ref);
-00208 $client_label=new widget("span");
-00209
-00210 // f_id
-00211 if ( $this->qcode != '- ERROR -' && trim($this->qcode) != "")
-00212 {
-00213 $tiers=new fiche($this->db);
-00214 $tiers->GetByQCode($this->qcode);
-00215 $qcode_label=$tiers->strAttribut(1);
-00216 } else {
-00217 echo "f_id $this->f_id";
-00218 $qcode_label=($this->f_id==0 || trim($this->qcode)=="")?'Interne ':'Error';
-00219 }
-00220 $h_ag_id=new widget("hidden");
-00221 // if concerns another action : show the link otherwise nothing
-00222 $lag_ref_ag_id="";
-00223
-00224 if ( $this->ag_ref_ag_id != 0 )
-00225 {
-00226 $lag_ref_ag_id='<a class="mtitle" href="commercial.php?p_action=suivi_courrier&sa=detail&ag_id='.
-00227 $this->ag_ref_ag_id.'">'.
-00228 $this->GetAgRef("ag_ref_ag_id")."</A>";
-00229 }
-00230
-00231 $w=new widget('js_search_only');
-00232 $w->readonly=$readonly;
-00233 $w->name='qcode';
-00234 $w->value=($this->f_id != 0)?$this->qcode:"";
-00235 $w->label="";
-00236 $w->extra='4,8,9,14,16';
-00237 $sp= new widget("span");
-00238 $h_agrefid=new widget('hidden');
-00239
-00240 // Preparing the return string
-00241 $r="";
-00242 $r.=JS_SEARCH_CARD;
-00243 $r.= "<p>Date : ".$date->IOValue()." Reference ". $this->ag_ref."</p>";
-00244 $r.="<p>Concerne :".$lag_ref_ag_id."</p>";
-00245 $r.= '<p>Type d\' action';
-00246 echo_debug('class_action',__LINE__,"str_doc_type $str_doc_type");
-00247 $r.= $str_doc_type."</p>";
-00248
-00249 // state
-00250 $r.="<p>Etat :".$str_state;
-00251
-00252
-00253 $r.= "</p><p> ";
-00254 $r.=$w->IOValue();
-00255 $r.=$sp->IOValue('qcode_label',$qcode_label)."</TD></TR>";
-00256
-00257 $r.="</p>";
-00258 echo_debug('class_action',__LINE__,' ag_id is '.$this->ag_id);
-00259
-00260 $r.= "<p> Titre : ".$title->IOValue().' Ref :'.$ag_ref->IOValue();
-00261 $r.= $doc_ref;
-00262 $r.= "<p>Description :".$desc->IOValue()."</p>";
-00263
-00264 //hidden
-00265 $r.="<p>";
-00266 $r.=$h2->IOValue();
-00267 $r.=$h_agrefid->IOValue("ag_ref_ag_id",$this->ag_ref_ag_id);
-00268 $r.=$h_ag_id->IOValue('ag_id',$this->ag_id);
-00269 $r.="</p>";
-00270
-00271 // show the list of the concern operation
-00272 if ( CountSql($this->db,'select * from action_gestion where ag_ref_ag_id!=0 and ag_ref_ag_id='.$this->ag_id.' limit 5') >0 )
-00273 $r.=$this->myList(ACTION," and ag_ref_ag_id=".$this->ag_id);
-00274 return $r;
-00275
-00276 }
-00277 //----------------------------------------------------------------------
-00280 function get()
-00281 {
-00282 echo_debug('class_action',__LINE__,'Action::Get() ');
-00283 $sql="select ag_id, ag_comment,to_char (ag_timestamp,'DD-MM-YYYY') as ag_timestamp,".
-00284 " f_id,ag_title,ag_comment,ag_ref,d_id,ag_type,d_state, ".
-00285 " ag_ref_ag_id ".
-00286 " from action_gestion left join document using (ag_id) where ag_id=".$this->ag_id;
-00287 $r=ExecSql($this->db,$sql);
-00288 $row=pg_fetch_all($r);
-00289 if ( $row==false) return;
-00290 $this->ag_comment=$row[0]['ag_comment'];
-00291 $this->ag_timestamp=$row[0]['ag_timestamp'];
-00292 $this->f_id=$row[0]['f_id'];
-00293 $this->ag_title=$row[0]['ag_title'];
-00294 $this->ag_type=$row[0]['ag_type'];
-00295 $this->ag_ref=$row[0]['ag_ref'];
-00296 $this->ag_ref_ag_id=$row[0]['ag_ref_ag_id'];
-00297 $this->d_id=$row[0]['d_id'];
-00298 //
-00299 echo_debug('class_action',__LINE__,' Document id = '.$this->d_id);
-00300 // if there is no document set 0 to d_id
-00301 if ( $this->d_id == "" )
-00302 $this->d_id=0;
-00303 // if there is a document fill the object
-00304 if ($this->d_id != 0 )
-00305 {
-00306 $this->state=$row['0']['d_state'];
-00307 $this->d_state=$row[0]['d_state'];
-00308 }
-00309 echo_debug('class_action',__LINE__,' After test Document id = '.$this->d_id);
-00310 $this->dt_id=$this->ag_type;
-00311 $a=new fiche($this->db,$this->f_id);
-00312 $this->qcode=$a->strAttribut(ATTR_DEF_QUICKCODE);
-00313 echo_debug('class_action',__LINE__,'Detail end () :'.var_export($_POST,true));
-00314 echo_debug('class_action',__LINE__,'Detail $this :'.var_export($this,true));
-00315
-00316 }
-00325 function Confirm()
-00326 {
-00327 echo_debug('class_action',__LINE__,'confirm() :'.var_export($_POST,true));
-00328 echo_debug('class_action',__LINE__,'confirm $this :'.var_export($this,true));
-00330 if ( isDate($this->ag_timestamp) == null )
-00331 {
-00332 // if the date is invalid, default date is today
-00333 $this->ag_timestamp=date("d.m.Y");
-00334 }
-00335 // Compute the widget
-00336 // Date
-00337 $date=new widget("text");
-00338 $date->readonly=true;
-00339 $date->name="ag_timestamp";
-00340 $date->value=$this->ag_timestamp;
-00341 // Doc Type
-00342 $doc_type=new widget("hidden");
-00343 $doc_type->name="dt_id";
-00344 $doc_type->value=$this->dt_id;
-00345 $a=ExecSql($this->db,"select dt_value from document_type where dt_id=".$this->dt_id);
-00346 $v=pg_fetch_array($a,0);
-00347 $str_type=$v[0];
-00348 if ( isset ($_REQUEST['url']))
-00349 {
-00350 $retour=sprintf('<A HREF="%s"><input type="button" value="Retour"></A>',urldecode($_REQUEST['url']));
-00351 $h_url=sprintf('<input type="hidden" name="url" value="%s">',urldecode($_REQUEST['url']));
-00352 }
-00353 else
-00354 {
-00355 $retour="";
-00356 $h_url="";
-00357 }
-00358
-00359 // state
-00360 $a=ExecSql($this->db,"select s_value from document_state where s_id=".$this->d_state);
-00361 $v=pg_fetch_array($a,0);
-00362 $str_state=$v[0];
-00363 $state=new widget("hidden");
-00364 $state->name="d_state";
-00365 $state->value=$this->d_state;
-00366
-00367 // title
-00368 $title=new widget("text");
-00369 $title->readonly=true;
-00370 $title->name="ag_title";
-00371 $title->value=FormatString($this->ag_title);
-00372
-00373 // Description
-00374 $desc=new widget('textarea');
-00375 $desc->name="ag_comment";
-00376 $desc->readonly=" disabled ";
-00377 $desc->value=$this->ag_comment;
-00378 // Propose to generate a document
-00379 $gen=new widget ("checkbox");
-00380 $gen->name="p_gen";
-00381 $doc_gen=new widget("select");
-00382 $doc_gen->name="gen_doc";
-00383 $doc_gen->value=make_array($this->db,
-00384 "select md_id,md_name from document_modele where md_type=".$this->dt_id);
-00385
-00386 $h_agrefid=new widget('hidden');
-00387
-00388 // f_id
-00389 if ( trim($this->qcode) =="" && $this->dt_id==1)
-00390 {
-00391 // internal document
-00392 $f_id=0; // internal document
-00393 $name="interne";
-00394 }
-00395 elseif ( trim($this->qcode) !="" && $this->dt_id != 1 )
-00396 {
-00397 $tiers=new fiche($this->db);
-00398 $tiers->GetByQCode($this->qcode);
-00399 $f_id=$tiers->id;
-00400 $name=$tiers->strAttribut(1);
-00401 }
-00402 else {
-00403 $name="ERROR";
-00404 $f_id=-1;
-00405 }
-00406
-00407 // Preparing the return string
-00408 $r=$retour."<form method=\"post\">";
-00409 $r.="<p>Date : ".$date->IOValue()."</p>";
-00410 $r.="<p>Etat $str_state".$state->IOValue()."</p>";
-00411 $r.="<p>Type du document $str_type".$doc_type->IOValue()."</p>";
-00412 $r.="<p> Tiers : ".$this->qcode." ".$name.'</p>';
-00413 $r.="<p> Titre : ".$title->IOValue();
-00414 $r.="<p>Description :".$desc->IOValue()."</p>";
-00415
-00416 // if no document exist for this type then do not display the question
-00417 if ( sizeof($doc_gen->value) != 0)
-00418 $r.="<p> Générer un document ".$gen->IOValue()." ".$doc_gen->IOValue()."</p>";
-00419
+00063 var $db;
+00064 var $ag_comment;
+00065 var $ag_timestamp;
+00066 var $dt_id;
+00067 var $d_state;
+00068 var $d_number;
+00069 var $d_filename;
+00070 var $d_mimetype;
+00071 var $ag_title;
+00072 var $f_id;
+00073 var $ag_ref_ag_id;
+00078 function action ($p_cn)
+00079 {
+00080 $this->db=$p_cn;
+00081 $this->f_id=0;
+00082
+00083 }
+00084 //----------------------------------------------------------------------
+00101 function Display($p_view,$p_gen)
+00102 {
+00103 echo_debug('class_action',__LINE__,'Display() :'.var_export($_POST,true));
+00104 echo_debug('class_action',__LINE__,'Display $this :'.var_export($this,true));
+00105
+00106
+00107 if ( $p_view=='UPD')
+00108 {
+00109 $upd=true;
+00110 $readonly=false;
+00111 }
+00112 elseif ($p_view=="NEW")
+00113 {
+00114 $upd=false;
+00115 $readonly=false;
+00116 }
+00117 elseif ($p_view=='READ')
+00118 {
+00119 $upd=true;
+00120 $readonly=true;
+00121 }
+00122 else
+00123 {
+00124 exit('class_action'.__LINE__.'action::Display error unknown parameter'.$p_view);
+00125
+00126 }
+00127 // Compute the widget
+00128 // Date
+00129 $date=new widget("text");
+00130 $date->readonly=$readonly;
+00131 $date->name="ag_timestamp";
+00132 $date->value=$this->ag_timestamp;
+00133
+00134
+00135 // for insert mode only
+00136 if ( $upd == false )
+00137 {
+00138 // Doc Type
+00139 $doc_type=new widget("select");
+00140 $doc_type->name="dt_id";
+00141 $doc_type->value=make_array($this->db,"select dt_id,dt_value from document_type where dt_id in (".ACTION.")");
+00142 $doc_type->selected=$this->dt_id;
+00143 $doc_type->readonly=false;
+00144 $str_doc_type=$doc_type->IOValue();
+00145 echo_debug('class_action',__LINE__,var_export($doc_type,true));
+00146 }
+00147 else {
+00148 // Doc Type
+00149 $doc_type=new widget("hidden");
+00150 $doc_type->name="dt_id";
+00151 $doc_type->value=$this->dt_id;
+00152 $str_doc_type=$doc_type->IOValue()." ".getDbValue($this->db,"select dt_value from document_type where dt_id=".$this->dt_id);
+00153 }
+00154
+00155 // Description
+00156 $desc=new widget('RICHTEXT');
+00157 $desc->width=500;
+00158 $desc->heigh=250;
+00159 $desc->name="ag_comment";
+00160 $desc->readonly=$readonly;
+00161 $desc->value=urldecode($this->ag_comment);
+00162
+00163 // state
+00164 // Retrieve the value
+00165 if ( $p_view != 'READ' )
+00166 {
+00167 $a=make_array($this->db,"select s_id,s_value from document_state ");
+00168 $state=new widget("select");
+00169 $state->readonly=$readonly;
+00170 $state->name="d_state";
+00171 $state->value=$a;
+00172 $state->selected=$this->d_state;
+00173 $str_state=$state->IOValue();
+00174 } else {
+00175 $str_state=getDbValue($this->db,"select s_value from document_state where s_id=".$this->d_state);
+00176 $g=new widget("hidden");
+00177 $str_state.=$g->IOValue('d_state',$this->d_state);
+00178 }
+00179 // Retrieve the value if there is an attached doc
+00180 $doc_ref="";
+00181 // Document id
+00182
+00183 $h2=new widget("hidden");
+00184 $h2->name="d_id";
+00185 $h2->value=$this->d_id;
+00186
+00187 if ( $this->d_id != 0 && $this->d_id != "" )
+00188 {
+00189 $h2->readonly=($p_view=='NEW')?false:true;
+00190 $doc=new Document($this->db,$this->d_id);
+00191 $d_id=new widget("hidden");
+00192 $doc_ref="<p> Document ".$doc->a_ref().'</p>';
+00193 $doc_ref.=$h2->IOValue().$d_id->IOValue('d_id',$this->d_id);
+00194
+00195 }
+00196
+00197
+00198 // title
+00199 $title=new widget("text");
+00200 $title->readonly=$readonly;
+00201 $title->name="ag_title";
+00202 $title->value=FormatString($this->ag_title);
+00203
+00204 // ag_ref
+00205 // Always false for update
+00206 $ag_ref=new widget("text");
+00207 $ag_ref->readonly=true;
+00208 $ag_ref->name="ag_ref";
+00209 $ag_ref->value=FormatString($this->ag_ref);
+00210 $client_label=new widget("span");
+00211
+00212 // f_id_dest destination
+00213 if ( $this->qcode_dest != '- ERROR -' && trim($this->qcode_dest) != "")
+00214 {
+00215 $tiers=new fiche($this->db);
+00216 $tiers->GetByQCode($this->qcode_dest);
+00217 $qcode_dest_label=$tiers->strAttribut(1);
+00218 } else {
+00219 // echo "f_id $this->f_id";
+00220 $qcode_dest_label=($this->f_id==0 || trim($this->qcode_dest)=="")?'Interne ':'Error';
+00221 }
+00222 // f_id_exp sender
+00223 if ( $this->qcode_exp != '- ERROR -' && trim($this->qcode_exp) != "")
+00224 {
+00225 $tiers=new fiche($this->db);
+00226 $tiers->GetByQCode($this->qcode_exp);
+00227 $qcode_exp_label=$tiers->strAttribut(1);
+00228 } else {
+00229 echo "f_id $this->f_id";
+00230 $qcode_exp_label=($this->f_id_exp==0 || trim($this->qcode_exp)=="")?'Interne ':'Error';
+00231 }
+00232
+00233 $h_ag_id=new widget("hidden");
+00234 // if concerns another action : show the link otherwise nothing
+00235 $lag_ref_ag_id="";
+00236
+00237 if ( $this->ag_ref_ag_id != 0 )
+00238 {
+00239 // $this->GetAgRef("ag_ref_ag_id")."</A>";
+00240
+00241 $lag_ref_ag_id='<a class="mtitle" href="commercial.php?p_action=suivi_courrier&sa=detail&ag_id='.
+00242 $this->ag_ref_ag_id.'">'.
+00243 $this->getDBValue($this->db,"select ag_ref from action_gestion where ag_id=".$this->ag_ref_ag_id).
+00244 "</A>";
+00245 }
+00246 // sender
+00247 $w=new widget('js_search_only');
+00248 $w->readonly=$readonly;
+00249 $w->name='qcode_exp';
+00250 $w->value=($this->f_id_exp != 0)?$this->qcode_exp:"";
+00251 $w->label="";
+00252 $w->extra='4,8,9,14,16';
+00253 $sp= new widget("span");
+00254 $h_agrefid=new widget('hidden');
+00255 // destination
+00256 $wdest=new widget('js_search_only');
+00257 $wdest->readonly=$readonly;
+00258 $wdest->name='qcode_dest';
+00259 $wdest->value=($this->f_id_dest != 0)?$this->qcode_dest:"";
+00260 $wdest->label="";
+00261 $wdest->extra='4,8,9,14,16';
+00262 $spdest= new widget("span");
+00263 $h_agrefid=new widget('hidden');
+00264
+00265 // Preparing the return string
+00266 $r="";
+00267 $r.=JS_SEARCH_CARD;
+00268 $r.= "<p>Date : ".$date->IOValue()." Reference ". $this->ag_ref."</p>";
+00269 $r.="<p>Concerne :".$lag_ref_ag_id."</p>";
+00270 $r.= '<p>Type d\' action';
+00271 echo_debug('class_action',__LINE__,"str_doc_type $str_doc_type");
+00272 $r.= $str_doc_type."</p>";
+00273
+00274 // state
+00275 $r.="<p>Etat :".$str_state;
+00276
+00277
+00278 $r.= "</p><p> ";
+00279 $r.=$w->IOValue();
+00280 $r.=$sp->IOValue('qcode_exp_label',$qcode_exp_label)."</TD></TR>";
+00281
+00282 $r.=$wdest->IOValue();
+00283 $r.=$spdest->IOValue('qcode_dest_label',$qcode_dest_label)."</TD></TR>";
+00284
+00285
+00286 $r.="</p>";
+00287 echo_debug('class_action',__LINE__,' ag_id is '.$this->ag_id);
+00288
+00289 $r.= "<p> Titre : ".$title->IOValue().' Ref :'.$ag_ref->IOValue();
+00290 $r.= $doc_ref;
+00291 $r.= "<p>Description :".$desc->IOValue()."</p>";
+00292
+00293 //hidden
+00294 $r.="<p>";
+00295 $r.=$h2->IOValue();
+00296 $r.=$h_agrefid->IOValue("ag_ref_ag_id",$this->ag_ref_ag_id);
+00297 $r.=$h_ag_id->IOValue('ag_id',$this->ag_id);
+00298 $r.="</p>";
+00299
+00300 // show the list of the concern operation
+00301 if ( CountSql($this->db,'select * from action_gestion where ag_ref_ag_id!=0 and ag_ref_ag_id='.$this->ag_id);
+00302 $r.=$this->myList(ACTION," and ag_ref_ag_id=".$this->ag_id);
+00303 return $r;
+00304
+00305 }
+00306 //----------------------------------------------------------------------
+00309 function get()
+00310 {
+00311 echo_debug('class_action',__LINE__,'Action::Get() ');
+00312 $sql="select ag_id, ag_comment,to_char (ag_timestamp,'DD-MM-YYYY') as ag_timestamp,".
+00313 " f_id_dest,f_id_exp,ag_title,ag_comment,ag_ref,d_id,ag_type,d_state, ".
+00314 " ag_ref_ag_id ".
+00315 " from action_gestion left join document using (ag_id) where ag_id=".$this->ag_id;
+00316 $r=ExecSql($this->db,$sql);
+00317 $row=pg_fetch_all($r);
+00318 if ( $row==false) return;
+00319 $this->ag_comment=$row[0]['ag_comment'];
+00320 $this->ag_timestamp=$row[0]['ag_timestamp'];
+00321 $this->f_id_dest=$row[0]['f_id_dest'];
+00322 $this->f_id_exp=$row[0]['f_id_exp'];
+00323 $this->ag_title=$row[0]['ag_title'];
+00324 $this->ag_type=$row[0]['ag_type'];
+00325 $this->ag_ref=$row[0]['ag_ref'];
+00326 $this->ag_ref_ag_id=$row[0]['ag_ref_ag_id'];
+00327 $this->d_id=$row[0]['d_id'];
+00328 //
+00329 echo_debug('class_action',__LINE__,' Document id = '.$this->d_id);
+00330 // if there is no document set 0 to d_id
+00331 if ( $this->d_id == "" )
+00332 $this->d_id=0;
+00333 // if there is a document fill the object
+00334 if ($this->d_id != 0 )
+00335 {
+00336 $this->state=$row['0']['d_state'];
+00337 $this->d_state=$row[0]['d_state'];
+00338 }
+00339 echo_debug('class_action',__LINE__,' After test Document id = '.$this->d_id);
+00340 $this->dt_id=$this->ag_type;
+00341 $adest=new fiche($this->db,$this->f_id_dest);
+00342 $this->qcode_dest=$adest->strAttribut(ATTR_DEF_QUICKCODE);
+00343 $aexp=new fiche($this->db,$this->f_id_exp);
+00344 $this->qcode_exp=$aexp->strAttribut(ATTR_DEF_QUICKCODE);
+00345
+00346 echo_debug('class_action',__LINE__,'Detail end () :'.var_export($_POST,true));
+00347 echo_debug('class_action',__LINE__,'Detail $this :'.var_export($this,true));
+00348
+00349 }
+00358 function Confirm()
+00359 {
+00360 echo_debug('class_action',__LINE__,'confirm() :'.var_export($_POST,true));
+00361 echo_debug('class_action',__LINE__,'confirm $this :'.var_export($this,true));
+00363 if ( isDate($this->ag_timestamp) == null )
+00364 {
+00365 // if the date is invalid, default date is today
+00366 $this->ag_timestamp=date("d.m.Y");
+00367 }
+00368 // Compute the widget
+00369 // Date
+00370 $date=new widget("text");
+00371 $date->readonly=true;
+00372 $date->name="ag_timestamp";
+00373 $date->value=$this->ag_timestamp;
+00374 // Doc Type
+00375 $doc_type=new widget("hidden");
+00376 $doc_type->name="dt_id";
+00377 $doc_type->value=$this->dt_id;
+00378 $a=ExecSql($this->db,"select dt_value from document_type where dt_id=".$this->dt_id);
+00379 $v=pg_fetch_array($a,0);
+00380 $str_type=$v[0];
+00381 if ( isset ($_REQUEST['url']))
+00382 {
+00383 $retour=sprintf('<A HREF="%s"><input type="button" value="Retour"></A>',urldecode($_REQUEST['url']));
+00384 $h_url=sprintf('<input type="hidden" name="url" value="%s">',urldecode($_REQUEST['url']));
+00385 }
+00386 else
+00387 {
+00388 $retour="";
+00389 $h_url="";
+00390 }
+00391
+00392 // state
+00393 $a=ExecSql($this->db,"select s_value from document_state where s_id=".$this->d_state);
+00394 $v=pg_fetch_array($a,0);
+00395 $str_state=$v[0];
+00396 $state=new widget("hidden");
+00397 $state->name="d_state";
+00398 $state->value=$this->d_state;
+00399
+00400 // title
+00401 $title=new widget("text");
+00402 $title->readonly=true;
+00403 $title->name="ag_title";
+00404 $title->value=FormatString($this->ag_title);
+00405
+00406 // Description
+00407 $desc=new widget('textarea');
+00408 $desc->name="ag_comment";
+00409 $desc->readonly=" disabled ";
+00410 $desc->value=$this->ag_comment;
+00411 // Propose to generate a document
+00412 $gen=new widget ("checkbox");
+00413 $gen->name="p_gen";
+00414 $doc_gen=new widget("select");
+00415 $doc_gen->name="gen_doc";
+00416 $doc_gen->value=make_array($this->db,
+00417 "select md_id,md_name from document_modele where md_type=".$this->dt_id);
+00418
+00419 $h_agrefid=new widget('hidden');
00420
-00421 // Add the hidden tag
-00422 $r.='<input type="hidden" name="sa" value="save_action_st2">';
-00423 $r.='<input type="hidden" name="p_action" value="suivi_courrier">';
-00424 $r.='<input type="hidden" name="tiers" value="'.$this->qcode.'">';
-00425 $r.= $h_agrefid->IOValue("ag_ref_ag_id",$this->ag_ref_ag_id);
-00426
-00427 // retrieve customer
-00428
-00429
-00430 if ( $f_id != -1 )
-00431 $r.=$desc->Submit("Save","Sauve");
-00432 $r.=$desc->Submit("corr","Corrige");
-00433
-00434 $r.=$h_url."</form>";
-00435 return $r;
-00436 }
-00444 function SaveStage2()
-00445 {
-00446 echo_debug('class_action',__LINE__,'saveStage2() :'.var_export($_POST,true));
-00447 echo_debug('class_action',__LINE__,' saveStage2() $this :'.var_export($this,true));
-00448
-00449 // Get The sequence id,
-00450 $seq_name="seq_doc_type_".$this->dt_id;
-00451 $str_file="";
-00452 $add_file='';
-00453 // f_id
-00454 $tiers=new fiche($this->db);
-00455 $tiers->GetByQCode($this->qcode);
-00456 if ( trim($this->ag_title) == "")
-00457 {
-00458 $doc_mod=new document_type($this->db);
-00459 $doc_mod->dt_id=$this->dt_id;
-00460 $doc_mod->get();
-00461 $this->ag_title=$doc_mod->dt_value;
-00462 }
-00463 echo_debug('class_action',__LINE__," tiers->id ".$tiers->id);
-00464 $this->ag_id=NextSequence($this->db,'action_gestion_ag_id_seq');
-00465 // Create the reference
-00466 $ref=$this->dt_id.'/'.$this->ag_id;
-00467 $this->ag_ref=$ref;
-00470 //we remove newline
-00471 $this->ag_comment=str_replace("+%OA+","",$this->ag_comment);
-00472 $this->ag_comment=str_replace("+%OD+","",$this->ag_comment);
-00473 $this->ag_comment=str_replace("%OD","",$this->ag_comment);
-00474 $this->ag_comment=str_replace("%OA","",$this->ag_comment);
-00475 // save into the database
-00476 $sql=sprintf("insert into action_gestion(ag_id,ag_timestamp,ag_type,ag_title,f_id,ag_comment,ag_ref,ag_ref_ag_id) ".
-00477 " values (%d,to_date('%s','DD-MM-YYYY'),'%d','%s',%d,'%s','%s',%d)",
-00478 $this->ag_id,
-00479 $this->ag_timestamp,
-00480 $this->dt_id,
-00481 FormatString($this->ag_title),
-00482 $tiers->id,
-00483 $this->ag_comment,
-00484 $ref,
-00485 $this->ag_ref_ag_id
-00486 );
-00487 ExecSql($this->db,$sql);
-00488
-00489
-00490
-00491 // the lob filename and the mimetype needed if we want to generate a doc.
-00492 if ( $this->gen == 'on' )
-00493 {
-00494 $doc=new Document($this->db);
-00495 $doc->f_id=$tiers->id;
-00496 $doc->md_id=$this->md_id;
-00497 $doc->ag_id=$this->ag_id;
-00498 $doc->d_state=$this->d_state;
-00499 $str_file=$doc->Generate();
-00500 $d='<input type="hidden" name="d_id" value="'.$doc->d_id.'">';
-00501 }
-00502 $r="";
-00503 // readonly and upload of a file
-00504 $r.="<hr>";
-00505 $r.='<form enctype="multipart/form-data" method="post">';
-00506 $r.=$this->Display('READ',false);
-00507 // Add the hidden tag
-00508 $r.='<input type="hidden" name="sa" value="save_action_st3">';
-00509 $r.='<input type="hidden" name="p_action" value="suivi_courrier">';
-00510 // add the d_id
-00511 $r.='<input type="hidden" name="d_id" value="'.$this->d_id.'">';
-00512 // ag_comment must be saved in urlcode
-00513 $r.='<input type="hidden" name="ag_comment" value="'.urlencode($this->ag_comment).'">';
-00514 // Value for the generated document
-00515 if ( $this->gen == 'on' )
-00516 {
-00517 $r.='<input type="hidden" name="d_id" value="'.$doc->d_id.'">';
-00518 $r.="Sauver le document généré :";
-00519 $r.=$str_file;
-00520 $checkbox=new widget("checkbox");
-00521 $checkbox->name="save_generate";
-00522 $r.=$checkbox->IOValue();
-00523 $r.="<hr>";
-00524 }
-00525 $upload=new widget("file");
-00526 $upload->name="file_upload";
-00527 $upload->value="";
-00528 $r.="Enregistrer le fichier ".$upload->IOValue();
-00529 $r.=$upload->Submit("save","Sauve le fichier");
-00530 $r.="</form>";
-00531 return $r;
-00532 }
-00538 function SaveStage3($d_id)
-00539 {
-00540 echo_debug('class_action',__LINE__,'SaveStage3() :'.var_export($_POST,true));
-00541 echo_debug('class_action',__LINE__,'SaveStage3 :'.var_export($this,true));
+00421 // f_id
+00422 if ( trim($this->qcode_dest) =="")
+00423 {
+00424 // internal document
+00425 $f_id_dest=0; // internal document
+00426 $namedest="interne";
+00427 }
+00428 else // ( trim($this->qcode_dest) !="" )
+00429 {
+00430 $tiers=new fiche($this->db);
+00431 $tiers->GetByQCode($this->qcode_dest);
+00432 $f_id=$tiers->id;
+00433 $namedest=$tiers->strAttribut(1);
+00434 if ( $namedest == '- ERROR -') $this->f_id_dest=-1;
+00435 }
+00436
+00437 // f_id
+00438 if ( trim($this->qcode_exp) =="")
+00439 {
+00440 // internal document
+00441 $f_id_exp=0; // internal document
+00442 $nameexp="interne";
+00443 }
+00444 else // ( trim($this->qcode_exp) !="" )
+00445 {
+00446 $tiers=new fiche($this->db);
+00447 $tiers->GetByQCode($this->qcode_exp);
+00448 $f_id=$tiers->id;
+00449 $nameexp=$tiers->strAttribut(1);
+00450 if ( $nameexp == '- ERROR -') $this->f_id_exp=-1;
+00451 }
+00452
+00453
+00454
+00455 // Preparing the return string
+00456 $r=$retour."<form method=\"post\">";
+00457 $r.="<p>Date : ".$date->IOValue()."</p>";
+00458 $r.="<p>Etat $str_state".$state->IOValue()."</p>";
+00459 $r.="<p>Type du document $str_type".$doc_type->IOValue()."</p>";
+00460 $r.="<p> Expediteur : ".$this->qcode_exp." ".$nameexp.'</p>';
+00461 $r.="<p> Destinataire : ".$this->qcode_dest." ".$namedest.'</p>';
+00462 $r.="<p> Titre : ".$title->IOValue();
+00463 $r.="<p>Description :".$desc->IOValue()."</p>";
+00464
+00465 // if no document exist for this type then do not display the question
+00466 if ( sizeof($doc_gen->value) != 0)
+00467 $r.="<p> Générer un document ".$gen->IOValue()." ".$doc_gen->IOValue()."</p>";
+00468
+00469
+00470 // Add the hidden tag
+00471 $r.='<input type="hidden" name="sa" value="save_action_st2">';
+00472 $r.='<input type="hidden" name="p_action" value="suivi_courrier">';
+00473 $r.='<input type="hidden" name="tiers" value="'.$this->qcode_dest.'">';
+00474 $r.= $h_agrefid->IOValue("ag_ref_ag_id",$this->ag_ref_ag_id);
+00475
+00476 // retrieve customer
+00477
+00478
+00479 if ( $f_id != -1 )
+00480 $r.=$desc->Submit("Save","Sauve");
+00481 $r.=$desc->Submit("corr","Corrige");
+00482
+00483 $r.=$h_url."</form>";
+00484 return $r;
+00485 }
+00493 function SaveStage2()
+00494 {
+00495 echo_debug('class_action',__LINE__,'saveStage2() :'.var_export($_POST,true));
+00496 echo_debug('class_action',__LINE__,' saveStage2() $this :'.var_export($this,true));
+00497
+00498 // Get The sequence id,
+00499 $seq_name="seq_doc_type_".$this->dt_id;
+00500 $str_file="";
+00501 $add_file='';
+00502 // f_id dest
+00503 $tiers=new fiche($this->db);
+00504 $tiers->GetByQCode($this->qcode_dest);
+00505
+00506 // f_id exp
+00507 $exp=new fiche($this->db);
+00508 $exp->GetByQCode($this->qcode_exp);
+00509
+00510 if ( trim($this->ag_title) == "")
+00511 {
+00512 $doc_mod=new document_type($this->db);
+00513 $doc_mod->dt_id=$this->dt_id;
+00514 $doc_mod->get();
+00515 $this->ag_title=$doc_mod->dt_value;
+00516 }
+00517 echo_debug('class_action',__LINE__," tiers->id ".$tiers->id);
+00518 $this->ag_id=NextSequence($this->db,'action_gestion_ag_id_seq');
+00519 // Create the reference
+00520 $ref=$this->dt_id.'/'.$this->ag_id;
+00521 $this->ag_ref=$ref;
+00524 //we remove newline
+00525 $this->ag_comment=str_replace("%OD","",$this->ag_comment);
+00526 $this->ag_comment=str_replace("%OA","",$this->ag_comment);
+00527 // save into the database
+00528 $sql=sprintf("insert into action_gestion".
+00529 "(ag_id,ag_timestamp,ag_type,ag_title,f_id_dest,f_id_exp,ag_comment,ag_ref,ag_ref_ag_id) ".
+00530 " values (%d,to_date('%s','DD-MM-YYYY'),'%d','%s',%d,%d,'%s','%s',%d)",
+00531 $this->ag_id,
+00532 $this->ag_timestamp,
+00533 $this->dt_id,
+00534 FormatString($this->ag_title),
+00535 $tiers->id,
+00536 $exp->id,
+00537 $this->ag_comment,
+00538 $ref,
+00539 $this->ag_ref_ag_id
+00540 );
+00541 ExecSql($this->db,$sql);
00542
-00543 // if we save the generated doc
-00544 if ( isset($_POST['save_generate']))
-00545 {
-00546 return;
-00547 }
-00548
-00549 // Upload a new document
-00550 $doc=new Document($this->db);
-00551 $doc->ag_id=$this->ag_id;
-00552 // if there is a document and it is not an update
-00553 if ( sizeof($_FILES) !=0 && $d_id==0)
-00554 {
-00555 $doc->md_type=$this->dt_id;
-00556 $doc->blank();
-00557 }
-00558 else
-00559 $doc->d_id=$d_id;
-00560
-00561 $doc->Upload($this->ag_id);
-00562 }
-00563
-00572 function myList($p_filter="",$p_search="")
-00573 {
-00574 $sql="
-00575 select ag_id,to_char(ag_timestamp,'DD-MM-YYYY') as my_date,ag_ref_ag_id,f_id,ag_title,d_id,md_type,dt_value,ag_ref
-00576 from action_gestion
-00577 left outer join document using (ag_id)
-00578 left outer join document_modele on (ag_type=md_type)
-00579 join document_type on (ag_type=dt_id)
-00580 where dt_id in ($p_filter) $p_search order by ag_timestamp desc,ag_ref desc";
-00581 $max_line=CountSql($this->db,$sql);
-00582 $step=$_SESSION['g_pagesize'];
-00583 $page=(isset($_GET['offset']))?$_GET['page']:1;
-00584 $offset=(isset($_GET['offset']))?$_GET['offset']:0;
-00585 $limit=" LIMIT $step OFFSET $offset ";
-00586 $bar=jrn_navigation_bar($offset,$max_line,$step,$page);
-00587
-00588 $Res=ExecSql($this->db,$sql.$limit);
-00589 $a_row=pg_fetch_all($Res);
-00590 // $r='<div class="u_redcontent">';
-00591 $r="";
-00592 $r.=$bar;
-00593 $r.="<table>";
-00594 $r.="<tr>";
-00595 $r.="<th>Date</th>";
-00596 $r.="<th>Société</th>";
-00597 $r.="<th>Titre</th>";
-00598 $r.="<th>type</th>";
-00599 $r.="<th>Référence</th>";
-00600 $r.="<th>concerne</th>";
-00601 $r.="<th>Document</th>";
-00602 $r.="</tr>";
-00603
-00604 // if there are no records return a message
-00605 if ( sizeof ($a_row) == 0 or $a_row == false )
-00606 {
-00607 $r='<div class="u_redcontent">';
-00608 $r.='<hr>Aucun enregistrement trouvé';
-00609 $r.="</div>";
-00610 return $r;
-00611
-00612 }
-00613 echo JS_SEARCH_CARD;
-00614 foreach ($a_row as $row )
-00615 {
-00616 $f=new fiche($this->db);
-00617 $f->id=$row['f_id'];
-00618 $qcode=$f->strAttribut(ATTR_DEF_QUICKCODE);
-00619
-00620 $r.="<tr>";
-00621 $r.="<td>".$row['my_date']."</td>";
-00622 $q=($qcode=="- ERROR -")?"Interne":$qcode;
-00623 $js=sprintf("javascript:showfiche('%s','%s')",
-00624 $_REQUEST['PHPSESSID'],$q);
-00625 if ( $q != 'Interne' )
-00626 {
-00627 $r.="<td>".'<A HREF="'.$js.'">'.$q." : ".$f->getName().'</A></td>';
-00628 }
-00629 else
-00630 $r.="<td>Interne </td>";
-00631
-00632 // show reference
-00633 if ( $row['ag_ref_ag_id'] != 0 )
-00634 {
-00635 $retSqlStmt=ExecSql($this->db,
-00636 "select ag_ref from action_gestion where ag_id=".$row['ag_ref_ag_id']);
-00637 $retSql=pg_fetch_all($retSqlStmt);
-00638 $ref="";
-00639 foreach ($retSql as $line)
-00640 {
-00641 $ref.='<A href="commercial.php?p_action=suivi_courrier&query='.$line['ag_ref'].'">'.
-00642 $line['ag_ref']."<A>";
-00643 }
-00644 }
-00645 else
-00646 $ref="";
-00647
-00648 $r.='<td><A HREF="commercial.php?p_action=suivi_courrier&sa=detail&ag_id='.$row['ag_id'].'">'.
-00649 $row['ag_title']."</A></td>";
-00650 $r.="<td>".$row['dt_value']."</td>";
-00651 $r.="<td>".$row['ag_ref']."</td>";
-00652 $r.="<td>".$ref."</td>";
-00653 $doc=new Document($this->db,$row['d_id']);
-00654 $r.="<td>".$doc->a_ref()."</td>";
-00655 $r.="</tr>";
-00656
-00657 }
-00658 $r.="</table>";
+00543
+00544
+00545 // the lob filename and the mimetype needed if we want to generate a doc.
+00546 if ( $this->gen == 'on' )
+00547 {
+00548 $doc=new Document($this->db);
+00549 $doc->f_id=$tiers->id;
+00550 $doc->md_id=$this->md_id;
+00551 $doc->ag_id=$this->ag_id;
+00552 $doc->d_state=$this->d_state;
+00553 $str_file=$doc->Generate();
+00554 $d='<input type="hidden" name="d_id" value="'.$doc->d_id.'">';
+00555 }
+00556 $r="";
+00557 // readonly and upload of a file
+00558 $r.="<hr>";
+00559 $r.='<form enctype="multipart/form-data" method="post">';
+00560 $r.=$this->Display('READ',false);
+00561 // Add the hidden tag
+00562 $r.='<input type="hidden" name="sa" value="save_action_st3">';
+00563 $r.='<input type="hidden" name="p_action" value="suivi_courrier">';
+00564 // add the d_id
+00565 $r.='<input type="hidden" name="d_id" value="'.$this->d_id.'">';
+00566 // ag_comment must be saved in urlcode
+00567 $r.='<input type="hidden" name="ag_comment" value="'.urlencode($this->ag_comment).'">';
+00568 // Value for the generated document
+00569 if ( $this->gen == 'on' )
+00570 {
+00571 $r.='<input type="hidden" name="d_id" value="'.$doc->d_id.'">';
+00572 $r.="Sauver le document généré :";
+00573 $r.=$str_file;
+00574 $checkbox=new widget("checkbox");
+00575 $checkbox->name="save_generate";
+00576 $r.=$checkbox->IOValue();
+00577 $r.="<hr>";
+00578 }
+00579 $upload=new widget("file");
+00580 $upload->name="file_upload";
+00581 $upload->value="";
+00582 $r.="Enregistrer le fichier ".$upload->IOValue();
+00583 $r.=$upload->Submit("save","Sauve le fichier");
+00584 $r.="</form>";
+00585 return $r;
+00586 }
+00592 function SaveStage3($d_id)
+00593 {
+00594 echo_debug('class_action',__LINE__,'SaveStage3() :'.var_export($_POST,true));
+00595 echo_debug('class_action',__LINE__,'SaveStage3 :'.var_export($this,true));
+00596
+00597 // if we save the generated doc
+00598 if ( isset($_POST['save_generate']))
+00599 {
+00600 return;
+00601 }
+00602
+00603 // Upload a new document
+00604 $doc=new Document($this->db);
+00605 $doc->ag_id=$this->ag_id;
+00606 // if there is a document and it is not an update
+00607 if ( sizeof($_FILES) !=0 && $d_id==0)
+00608 {
+00609 $doc->md_type=$this->dt_id;
+00610 $doc->blank();
+00611 }
+00612 else
+00613 $doc->d_id=$d_id;
+00614
+00615 $doc->Upload($this->ag_id);
+00616 }
+00617
+00626 function myList($p_filter="",$p_search="")
+00627 {
+00628 $sql="
+00629 select ag_id,to_char(ag_timestamp,'DD-MM-YYYY') as my_date,ag_ref_ag_id,f_id_dest,f_id_exp".
+00630 ",ag_title,d_id,md_type,dt_value,ag_ref
+00631 from action_gestion
+00632 left outer join document using (ag_id)
+00633 left outer join document_modele on (ag_type=md_type)
+00634 join document_type on (ag_type=dt_id)
+00635 where dt_id in ($p_filter) $p_search order by ag_timestamp desc,ag_ref desc";
+00636 $max_line=CountSql($this->db,$sql);
+00637 $step=$_SESSION['g_pagesize'];
+00638 $page=(isset($_GET['offset']))?$_GET['page']:1;
+00639 $offset=(isset($_GET['offset']))?$_GET['offset']:0;
+00640 $limit=" LIMIT $step OFFSET $offset ";
+00641 $bar=jrn_navigation_bar($offset,$max_line,$step,$page);
+00642
+00643 $Res=ExecSql($this->db,$sql.$limit);
+00644 $a_row=pg_fetch_all($Res);
+00645 // $r='<div class="u_redcontent">';
+00646 $r="";
+00647 $r.=$bar;
+00648 $r.="<table>";
+00649 $r.="<tr>";
+00650 $r.="<th>Date</th>";
+00651 $r.="<th>Destinataire</th>";
+00652 $r.="<th>Expéditeur</th>";
+00653 $r.="<th>Titre</th>";
+00654 $r.="<th>type</th>";
+00655 $r.="<th>Référence</th>";
+00656 $r.="<th>concerne</th>";
+00657 $r.="<th>Document</th>";
+00658 $r.="</tr>";
00659
-00660 $r.=$bar;
-00661 //$r.="</div>";
-00662 return $r;
-00663 }
-00664 //----------------------------------------------------------------------
-00669 function Update()
-00670 {
-00671 echo_debug('class_action',__LINE__,'Update() $_POST() :'.var_export($_POST,true));
-00672 echo_debug('class_action',__LINE__,'Update() $this :'.var_export($this,true));
-00673
-00674 // if ag_id == 0 nothing to do
-00675 if ( $this->ag_id == 0 ) return ;
-00676
-00677
-00678 // retrieve customer
-00679 // f_id
-00680
-00681 if ( trim($this->qcode) =="" )
-00682 {
-00683 // internal document
-00684 $this->f_id=0; // internal document
-00685 }
-00686 else
-00687 {
-00688 $tiers=new fiche($this->db);
-00689 if ( $tiers->GetByQCode($this->qcode) ==1 ) // Error we cannot retrieve this qcode
-00690 return false;
-00691 else
-00692 $this->f_id=$tiers->id;
+00660 // if there are no records return a message
+00661 if ( sizeof ($a_row) == 0 or $a_row == false )
+00662 {
+00663 $r='<div class="u_redcontent">';
+00664 $r.='<hr>Aucun enregistrement trouvé';
+00665 $r.="</div>";
+00666 return $r;
+00667
+00668 }
+00669 echo JS_SEARCH_CARD;
+00670 foreach ($a_row as $row )
+00671 {
+00672
+00673 $r.="<tr>";
+00674 $r.="<td>".$row['my_date']."</td>";
+00675 // Expediteur
+00676 $fexp=new fiche($this->db);
+00677 $fexp->id=$row['f_id_exp'];
+00678 $qcode_exp=$f->strAttribut(ATTR_DEF_QUICKCODE);
+00679
+00680 $qexp=($qcode_exp=="- ERROR -")?"Interne":$qcode_exp;
+00681 $jsexp=sprintf("javascript:showfiche('%s','%s')",
+00682 $_REQUEST['PHPSESSID'],$qexp);
+00683 if ( $qexp != 'Interne' )
+00684 {
+00685 $r.="<td>".'<A HREF="'.$jsexp.'">'.$qexp." : ".$fexp->getName().'</A></td>';
+00686 }
+00687 else
+00688 $r.="<td>Interne </td>";
+00689 // Destinataire
+00690 $fdest=new fiche($this->db);
+00691 $fdest->id=$row['f_id_dest'];
+00692 $qcode_dest=$fdest->strAttribut(ATTR_DEF_QUICKCODE);
00693
-00694 }
-00695
-00696 //remove newline from ag_comment
-00697 $this->ag_comment=str_replace("\n","",$this->ag_comment);
-00698 $this->ag_comment=str_replace("\r","",$this->ag_comment);
-00699
-00700 // url encoded
-00701 $this->ag_comment=urlencode($this->ag_comment);
-00702
-00703 // bug PHP : sometimes the newline remains
-00704 $this->ag_comment=str_replace("%A0","",$this->ag_comment);
-00705 $this->ag_comment=str_replace("%0D","",$this->ag_comment);
-00706 $this->ag_comment=str_replace("+%A0+","",$this->ag_comment);
-00707 $this->ag_comment=str_replace("+%0D+","",$this->ag_comment);
-00708
-00709
-00710 $sql=sprintf("update action_gestion set ag_comment='%s',".
-00711 " ag_timestamp=to_date('%s','DD.MM.YYYY'),".
-00712 " ag_title='%s',".
-00713 " ag_type=%d, ".
-00714 " f_id=%d, ".
-00715 " ag_ref_ag_id=%d".
-00716 " where ag_id = %d",
-00717 $this->ag_comment,
-00718 $this->ag_timestamp,
-00719 FormatString($this->ag_title),
-00720 $this->dt_id,
-00721 $this->f_id,
-00722 $this->ag_ref_ag_id,
-00723 $this->ag_id);
-00724 ExecSql($this->db,$sql);
-00725
-00726 if ( sizeof($_FILES) !=0 )
-00727 {
-00728 // Upload a new document
-00729 $doc=new Document($this->db);
-00730 if ( $this->d_id !=0 )
-00731 {
-00732 $doc->d_id=$this->d_id;
-00733 } else {
-00734 // we need to increment the counter
-00735 $doc->ag_id=$this->ag_id;
-00736 $doc->md_type=$this->dt_id;
-00737 $doc->blank();
-00738 }
-00739 $doc->Upload($this->ag_id);
-00740
-00741 }
-00742
-00743 return true;
-00744 }
-00750 function GetAgRef($p_method)
-00751 {
-00752 if ($p_method=="ag_ref_ag_id")
-00753 $sql="select ag_ref from action_gestion where ag_id=".$this->ag_ref_ag_id;
-00754 elseif ($p_method=="ag_id")
-00755 $sql="select ag_ref from action_gestion where ag_id=".$this->ag_id;
-00756 return Getdbvalue($this->db,$sql);
-00757
-00758 }
-00759
-00760 }
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+00694 $qdest=($qcode_dest=="- ERROR -")?"Interne":$qcode_dest;
+00695 $jsdest=sprintf("javascript:showfiche('%s','%s')",
+00696 $_REQUEST['PHPSESSID'],$qdest);
+00697 if ( $qdest != 'Interne' )
+00698 {
+00699 $r.="<td>".'<A HREF="'.$jsdest.'">'.$qdest." : ".$fdest->getName().'</A></td>';
+00700 }
+00701 else
+00702 $r.="<td>Interne </td>";
+00703
+00704 // show reference
+00705 if ( $row['ag_ref_ag_id'] != 0 )
+00706 {
+00707 $retSqlStmt=ExecSql($this->db,
+00708 "select ag_ref from action_gestion where ag_id=".$row['ag_ref_ag_id']);
+00709 $retSql=pg_fetch_all($retSqlStmt);
+00710 $ref="";
+00711 foreach ($retSql as $line)
+00712 {
+00713 $ref.='<A href="commercial.php?p_action=suivi_courrier&query='.$line['ag_ref'].'">'.
+00714 $line['ag_ref']."<A>";
+00715 }
+00716 }
+00717 else
+00718 $ref="";
+00719
+00720 $r.='<td><A HREF="commercial.php?p_action=suivi_courrier&sa=detail&ag_id='.$row['ag_id'].'">'.
+00721 $row['ag_title']."</A></td>";
+00722 $r.="<td>".$row['dt_value']."</td>";
+00723 $r.="<td>".$row['ag_ref']."</td>";
+00724 $r.="<td>".$ref."</td>";
+00725 $doc=new Document($this->db,$row['d_id']);
+00726 $r.="<td>".$doc->a_ref()."</td>";
+00727 $r.="</tr>";
+00728
+00729 }
+00730 $r.="</table>";
+00731
+00732 $r.=$bar;
+00733 //$r.="</div>";
+00734 return $r;
+00735 }
+00736 //----------------------------------------------------------------------
+00741 function Update()
+00742 {
+00743 echo_debug('class_action',__LINE__,'Update() $_POST() :'.var_export($_POST,true));
+00744 echo_debug('class_action',__LINE__,'Update() $this :'.var_export($this,true));
+00745
+00746 // if ag_id == 0 nothing to do
+00747 if ( $this->ag_id == 0 ) return ;
+00748
+00749
+00750 // retrieve customer
+00751 // f_id
+00752
+00753 if ( trim($this->qcode) =="" )
+00754 {
+00755 // internal document
+00756 $this->f_id=0; // internal document
+00757 }
+00758 else
+00759 {
+00760 $tiers=new fiche($this->db);
+00761 if ( $tiers->GetByQCode($this->qcode) ==1 ) // Error we cannot retrieve this qcode
+00762 return false;
+00763 else
+00764 $this->f_id=$tiers->id;
+00765
+00766 }
+00767
+00768 //remove newline from ag_comment
+00769 $this->ag_comment=str_replace("\n","",$this->ag_comment);
+00770 $this->ag_comment=str_replace("\r","",$this->ag_comment);
+00771
+00772 // url encoded
+00773 $this->ag_comment=urlencode($this->ag_comment);
+00774
+00775 // bug PHP : sometimes the newline remains
+00776 $this->ag_comment=str_replace("%A0","",$this->ag_comment);
+00777 $this->ag_comment=str_replace("%0D","",$this->ag_comment);
+00778 $this->ag_comment=str_replace("+%A0+","",$this->ag_comment);
+00779 $this->ag_comment=str_replace("+%0D+","",$this->ag_comment);
+00780
+00781
+00782 $sql=sprintf("update action_gestion set ag_comment='%s',".
+00783 " ag_timestamp=to_date('%s','DD.MM.YYYY'),".
+00784 " ag_title='%s',".
+00785 " ag_type=%d, ".
+00786 " f_id_exp=%d, ".
+00787 " f_id_dest=%d, ".
+00788 " ag_ref_ag_id=%d".
+00789 " where ag_id = %d",
+00790 $this->ag_comment,
+00791 $this->ag_timestamp,
+00792 FormatString($this->ag_title),
+00793 $this->dt_id,
+00794 $this->f_id_exp,
+00795 $this->f_id_dest,
+00796 $this->ag_ref_ag_id,
+00797 $this->ag_id);
+00798 ExecSql($this->db,$sql);
+00799
+00800 if ( sizeof($_FILES) !=0 )
+00801 {
+00802 // Upload a new document
+00803 $doc=new Document($this->db);
+00804 if ( $this->d_id !=0 )
+00805 {
+00806 $doc->d_id=$this->d_id;
+00807 } else {
+00808 // we need to increment the counter
+00809 $doc->ag_id=$this->ag_id;
+00810 $doc->md_type=$this->dt_id;
+00811 $doc->blank();
+00812 }
+00813 $doc->Upload($this->ag_id);
+00814
+00815 }
+00816
+00817 return true;
+00818 }
+00824 // function GetAgRef($p_method)
+00825 // {
+00826 // if ($p_method=="ag_ref_ag_id")
+00827 // $sql="select ag_ref from action_gestion where ag_id=".$this->ag_ref_ag_id;
+00828 // elseif ($p_method=="ag_id")
+00829 // $sql="select ag_ref from action_gestion where ag_id=".$this->ag_id;
+00830 // return Getdbvalue($this->db,$sql);
+00831
+00832 // }
+00833
+00834 }
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__action_8php.html b/doc/developper/html/class__action_8php.html
index e05d3257f..3a9a9efae 100644
--- a/doc/developper/html/class__action_8php.html
+++ b/doc/developper/html/class__action_8php.html
@@ -1,12 +1,12 @@
-class_action.php File Reference
class_action for manipulating actions action can be :
More...
@@ -29,7 +29,7 @@ class_action for manipulating actions action can be :
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+Definition in file class_action.php.
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__attribut_8php-source.html b/doc/developper/html/class__attribut_8php-source.html
index ce6f28a35..5e7be2771 100644
--- a/doc/developper/html/class__attribut_8php-source.html
+++ b/doc/developper/html/class__attribut_8php-source.html
@@ -1,12 +1,12 @@
-class_attribut.php
Go to the documentation of this file.00001 <?
00002 /*
00003 * This file is part of PhpCompta.
@@ -52,7 +52,7 @@
00060
00061 return $p_attribut;
00062 }
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__attribut_8php.html b/doc/developper/html/class__attribut_8php.html
index 036bfbbef..6b5c94dbb 100644
--- a/doc/developper/html/class__attribut_8php.html
+++ b/doc/developper/html/class__attribut_8php.html
@@ -1,12 +1,12 @@
-class_attribut.php File Reference
Manage the attribut of the card. More...
00050 {
+00051 for ($i=0;$i< sizeof($p_attribut)-1;$i++) {
+00052 if ( $p_attribut[$i]->ad_id > $p_attribut[$i+1]->ad_id ) {
+00053 // then swap them
+00054 $t=$p_attribut[$i];
+00055 $p_attribut[$i]=$p_attribut[$i+1];
+00056 $p_attribut[$i+1] = $t;
+00057 $i=0;
+00058 }
+00059 }
+00060
+00061 return $p_attribut;
+00062 }
+
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__balance_8php-source.html b/doc/developper/html/class__balance_8php-source.html
index a81dc5b2c..2c3bb2572 100644
--- a/doc/developper/html/class__balance_8php-source.html
+++ b/doc/developper/html/class__balance_8php-source.html
@@ -1,12 +1,12 @@
-class_balance.php
Go to the documentation of this file.00001 <?
00002 /*
00003 * This file is part of PhpCompta.
@@ -100,7 +100,7 @@
00112
00113 }
00114 }
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__balance_8php.html b/doc/developper/html/class__balance_8php.html
index 863e03b7d..75a16892d 100644
--- a/doc/developper/html/class__balance_8php.html
+++ b/doc/developper/html/class__balance_8php.html
@@ -1,12 +1,12 @@
-class_balance.php File Reference
Class for manipulating data to print the balance of account. More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+Definition in file class_balance.php.
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__contact_8php-source.html b/doc/developper/html/class__contact_8php-source.html
index 989002b98..f102e1aab 100644
--- a/doc/developper/html/class__contact_8php-source.html
+++ b/doc/developper/html/class__contact_8php-source.html
@@ -1,12 +1,12 @@
-class_contact.php
Go to the documentation of this file.00001 <?
00002 /*
00003 * This file is part of PhpCompta.
@@ -86,9 +86,9 @@
00094 $and="?";
00095 $get=$_GET;
00096 if ( isset ($get) ) {
-00097 foreach ($get as $name=>$value ) {
+00097 foreach ($get as $name=>$value ) {
00098 // we clean the parameter offset, step, page and size
-00099 if ( ! in_array($name,array('f_id','detail'))) {
+00099 if ( ! in_array($name,array('f_id','detail'))) {
00100 $url.=$and.$name."=".$value;
00101 $and="&";
00102 }// if
@@ -129,7 +129,7 @@
00137 }
00138
00139 }
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__contact_8php.html b/doc/developper/html/class__contact_8php.html
index c22726e41..42ad74c2f 100644
--- a/doc/developper/html/class__contact_8php.html
+++ b/doc/developper/html/class__contact_8php.html
@@ -1,12 +1,12 @@
-class_contact.php File Reference
class for the contact, contact are derived from ficheContact are a card which are own by a another card (customer, supplier...) More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+Definition in file class_contact.php.
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__customer_8php-source.html b/doc/developper/html/class__customer_8php-source.html
index d53492bf2..43ee4f30e 100644
--- a/doc/developper/html/class__customer_8php-source.html
+++ b/doc/developper/html/class__customer_8php-source.html
@@ -1,12 +1,12 @@
-class_customer.php
Go to the documentation of this file.00001 <?
00002 /*
00003 * This file is part of PhpCompta.
@@ -57,7 +57,7 @@
00061 if ( pg_NumRows($Res) == 0) return null;
00062 // There is only _one_ row by customer
00063 $row=pg_fetch_array($Res,0);
-00064 $this->name=$row['name'];
+00064 $this->name=$row['name'];
00065 $this->id=$row['f_id'];
00066 $this->street=$row['rue'];
00067 $this->cp=$row['code_postal'];
@@ -122,7 +122,7 @@
00138 $customer=$e['j_poste'];
00139 // Retrieve name and vat number
00140 $this->GetFromPoste($customer);
-00141 $a_Res[$customer]['name']=$this->name;
+00141 $a_Res[$customer]['name']=$this->name;
00142 $a_Res[$customer]['vat_number']=$this->vat_number;
00143 break;
00144
@@ -242,7 +242,7 @@
00268 }
00269
00270 ?>
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__customer_8php.html b/doc/developper/html/class__customer_8php.html
index 77aad7501..b92eddcba 100644
--- a/doc/developper/html/class__customer_8php.html
+++ b/doc/developper/html/class__customer_8php.html
@@ -1,12 +1,12 @@
-class_customer.php File Reference
Derived from class fiche Customer are a specific kind of card. More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+Definition in file class_customer.php.
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__document_8php-source.html b/doc/developper/html/class__document_8php-source.html
index dcbaa9120..8aeae2fbe 100644
--- a/doc/developper/html/class__document_8php-source.html
+++ b/doc/developper/html/class__document_8php-source.html
@@ -1,12 +1,12 @@
-class_document.php
Go to the documentation of this file.00001 <?
00002 /*
00003 * This file is part of PhpCompta.
@@ -45,14 +45,14 @@
00042 function Document($p_cn,$p_d_id=0)
00043 {
00044 $this->db=$p_cn;
-00045 $this->d_id=$p_d_id;
+00045 $this->d_id=$p_d_id;
00046 }
00049 function blank()
00050 {
-00051 $this->d_id=NextSequence($this->db,"document_d_id_seq");
+00051 $this->d_id=NextSequence($this->db,"document_d_id_seq");
00052 // affect a number
00053 $this->d_number=NextSequence($this->db,"seq_doc_type_".$this->md_type);
-00054 $sql=sprintf('insert into document(d_id,ag_id,d_number) values(%d,%d,%d)',
+00054 $sql=sprintf('insert into document(d_id,ag_id,d_number) values(%d,%d,%d)',
00055 $this->d_id,
00056 $this->ag_id,
00057 $this->d_number);
@@ -185,7 +185,7 @@
00211 $pos=strpos($buffer,$to_remove);
00212 // get the length of the string to remove
00213 $len=strlen($to_remove);
-00214 $buffer=substr_replace($buffer,$value,$pos,$len);
+00214 $buffer=substr_replace($buffer,$value,$pos,$len);
00215
00216 // echo_debug('class_document',__LINE__, $buffer);
00217 // if the pattern if found we replace it
@@ -223,8 +223,8 @@
00256 $this->d_state
00257 );
00258 ExecSql($this->db,$sql);
-00259 $this->d_id=GetSequence($this->db,"document_d_id_seq");
-00260 echo_debug('class_document',__LINE__,'document sauvé : d_id'.$this->d_id);
+00259 $this->d_id=GetSequence($this->db,"document_d_id_seq");
+00260 echo_debug('class_document',__LINE__,'document sauvé : d_id'.$this->d_id);
00261 Commit($this->db);
00262 return 0;
00263 }
@@ -255,7 +255,7 @@
00295 }
00296 // the upload in the database is successfull
00297 $this->d_lob=$oid;
-00298 $this->d_filename=$_FILES['file_upload']['name'];
+00298 $this->d_filename=$_FILES['file_upload']['name'];
00299 $this->d_mimetype=$_FILES['file_upload']['type'];
00300 // now we have to update the col.
00301 // We retrieve the row to remove a possible existing lob (replace)
@@ -404,7 +404,7 @@
00483 case 'SOLDE':
00484 $tiers=new fiche($this->db);
00485 $qcode=isset($_REQUEST['tiers'])?$_REQUEST['tiers']:$_REQUEST['e_client'];
-00486 $tiers->Getbyqcode($qcode,false);
+00486 $tiers->Getbyqcode($qcode,false);
00487 $p=$tiers->strAttribut(ATTR_DEF_ACCOUNT);
00488 $poste=new Poste($this->db,$p);
00489 $r=$poste->GetSolde(' true' );
@@ -412,34 +412,34 @@
00491 case 'CUST_NAME':
00492 $tiers=new fiche($this->db);
00493 $qcode=isset($_REQUEST['tiers'])?$_REQUEST['tiers']:$_REQUEST['e_client'];
-00494 $tiers->getByQcode($qcode,false);
+00494 $tiers->getByQcode($qcode,false);
00495 $r=$tiers->strAttribut(ATTR_DEF_NAME);
00496 break;
00497 case 'CUST_ADDR_1':
00498 $tiers=new fiche($this->db);
00499 $qcode=isset($_REQUEST['tiers'])?$_REQUEST['tiers']:$_REQUEST['e_client'];
-00500 $tiers->getByQcode($qcode,false);
+00500 $tiers->getByQcode($qcode,false);
00501 $r=$tiers->strAttribut(ATTR_DEF_ADRESS);
00502
00503 break ;
00504 case 'CUST_CP':
00505 $tiers=new fiche($this->db);
00506 $qcode=isset($_REQUEST['tiers'])?$_REQUEST['tiers']:$_REQUEST['e_client'];
-00507 $tiers->getByQcode($qcode,false);
+00507 $tiers->getByQcode($qcode,false);
00508 $r=$tiers->strAttribut(ATTR_DEF_CP);
00509
00510 break;
00511 case 'CUST_CO':
00512 $tiers=new fiche($this->db);
00513 $qcode=isset($_REQUEST['tiers'])?$_REQUEST['tiers']:$_REQUEST['e_client'];
-00514 $tiers->getByQcode($qcode,false);
+00514 $tiers->getByQcode($qcode,false);
00515 $r=$tiers->strAttribut(ATTR_DEF_PAYS);
00516
00517 break;
00518 case 'CUST_VAT':
00519 $tiers=new fiche($this->db);
00520 $qcode=isset($_REQUEST['tiers'])?$_REQUEST['tiers']:$_REQUEST['e_client'];
-00521 $tiers->getByQcode($qcode,false);
+00521 $tiers->getByQcode($qcode,false);
00522 $r=$tiers->strAttribut(ATTR_DEF_NUMTVA);
00523 break;
00524 // Marchandise in $_POST['e_march*']
@@ -630,7 +630,7 @@
00718 }
00722 function remove()
00723 {
-00724 $sql='delete from document where d_id='.$this->d_id;
+00724 $sql='delete from document where d_id='.$this->d_id;
00725 ExecSql($this->db,$sql);
00726 }
00733 function MoveDocumentPj($p_internal)
@@ -645,7 +645,7 @@
00742
00743
00744 }
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__document_8php.html b/doc/developper/html/class__document_8php.html
index e7826b6ad..15b763ea1 100644
--- a/doc/developper/html/class__document_8php.html
+++ b/doc/developper/html/class__document_8php.html
@@ -1,12 +1,12 @@
-class_document.php File Reference
Class Document corresponds to the table document. More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+Definition in file class_document.php.
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__document__modele_8php-source.html b/doc/developper/html/class__document__modele_8php-source.html
index a17898f59..1020c8221 100644
--- a/doc/developper/html/class__document__modele_8php-source.html
+++ b/doc/developper/html/class__document__modele_8php-source.html
@@ -1,12 +1,12 @@
-class_document_modele.php
Go to the documentation of this file.00001 <?
00002 /*
00003 * This file is part of PhpCompta.
@@ -38,7 +38,7 @@
00036 //Constructor parameter = database connexion
00037 function Document_modele($p_cn,$p_id=-1) {
00038 $this->cn=$p_cn;
-00039 $this->md_id=$p_id;
+00039 $this->md_id=$p_id;
00040 }
00041
00049 function myList() {
@@ -63,7 +63,7 @@
00068 $r.="</td>";
00069 $r.="<TD>";
00070 $c=new widget("checkbox");
-00071 $c->name="dm_remove_".$row['md_id'];
+00071 $c->name="dm_remove_".$row['md_id'];
00072 $r.=$c->IOValue();
00073 $r.="</td>";
00074 $r.="</tr>";
@@ -94,8 +94,8 @@
00115 {
00116
00117 // insert into the table document_modele
-00118 $this->name=FormatString($this->md_name);
-00119 $this->md_id=NextSequence($this->cn,'document_modele_md_id_seq');
+00118 $this->name=FormatString($this->md_name);
+00119 $this->md_id=NextSequence($this->cn,'document_modele_md_id_seq');
00120 $sql=sprintf("insert into document_modele(md_id,md_name,md_type)
00121 values (%d,'%s',%d)",
00122 $this->md_id,$this->name,$this->md_type);
@@ -140,7 +140,7 @@
00161 pg_lo_unlink($this->cn,$old_oid);
00162 }
00163 // Load new document
-00164 ExecSql($this->cn,"update document_modele set md_lob=".$oid.", md_mimetype='".$_FILES['doc']['type']."' ,md_filename='".$_FILES['doc']['name']."' where md_id=".$this->md_id);
+00164 ExecSql($this->cn,"update document_modele set md_lob=".$oid.", md_mimetype='".$_FILES['doc']['type']."' ,md_filename='".$_FILES['doc']['name']."' where md_id=".$this->md_id);
00165 Commit($this->cn);
00166 }
00167 else
@@ -242,7 +242,7 @@
00282
00283 }
00284 ?>
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__document__modele_8php.html b/doc/developper/html/class__document__modele_8php.html
index f1085fb1c..c4be43c07 100644
--- a/doc/developper/html/class__document__modele_8php.html
+++ b/doc/developper/html/class__document__modele_8php.html
@@ -1,12 +1,12 @@
-class_document_modele.php File Reference
Class for the document template. More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+Definition in file class_document_modele.php.
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__document__type_8php-source.html b/doc/developper/html/class__document__type_8php-source.html
index 4d2c5ad2d..fc21f36be 100644
--- a/doc/developper/html/class__document__type_8php-source.html
+++ b/doc/developper/html/class__document__type_8php-source.html
@@ -1,12 +1,12 @@
-class_document_type.php
Go to the documentation of this file.
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__document__type_8php.html b/doc/developper/html/class__document__type_8php.html
index 8e5d85d0f..f49e6e470 100644
--- a/doc/developper/html/class__document__type_8php.html
+++ b/doc/developper/html/class__document__type_8php.html
@@ -1,12 +1,12 @@
-class_document_type.php File Reference
class for the table document_type More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+Definition in file class_document_type.php.
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__fiche_8php-source.html b/doc/developper/html/class__fiche_8php-source.html
index dd958e42e..f75623c13 100644
--- a/doc/developper/html/class__fiche_8php-source.html
+++ b/doc/developper/html/class__fiche_8php-source.html
@@ -1,12 +1,12 @@
-class_fiche.php
Go to the documentation of this file.00001 <?
00002 /*
00003 * This file is part of PhpCompta.
@@ -430,10 +430,10 @@
00550 $fiche_id,$p_fiche_def);
00551 $Ret=ExecSql($this->cn,$sql);
00552 // parse the $_POST array
-00553 foreach ($_POST as $name=>$value )
+00553 foreach ($_POST as $name=>$value )
00554 {
00555 echo_debug ("class_fiche",__LINE__,"Name = $name value $value") ;
-00556 list ($id) = sscanf ($name,"av_text%d");
+00556 list ($id) = sscanf ($name,"av_text%d");
00557 if ( $id == null ) continue;
00558 echo_debug("class_fiche",__LINE__,"add $id");
00559
@@ -443,7 +443,7 @@
00563 {
00564 echo_debug("Modify ATTR_DEF_QUICKCODE");
00565 $sql=sprintf("select insert_quick_code(%d,'%s')",
-00566 $fiche_id,FormatString($value));
+00566 $fiche_id,FormatString($value));
00567 ExecSql($this->cn,$sql);
00568 continue;
00569 }
@@ -451,7 +451,7 @@
00571 if ( $id == ATTR_DEF_NAME )
00572 {
00573 echo_debug("Modify ATTR_DEF_NAME");
-00574 if ( strlen(trim($value)) == 0 )
+00574 if ( strlen(trim($value)) == 0 )
00575 $value="pas de nom";
00576
00577 }
@@ -459,7 +459,7 @@
00579 if ( $id == ATTR_DEF_ACCOUNT )
00580 {
00581 echo_debug("Modify ATTR_DEF_ACCOUNT");
-00582 $v=FormatString($value);
+00582 $v=FormatString($value);
00583 if ( isNumber($v) == 1 )
00584 {
00585 $sql=sprintf("select account_insert(%d,%d)",
@@ -480,7 +480,7 @@
00600 {
00601 echo_debug("Modify ATTR_DEF_TVA");
00602 // Verify if the rate exists, if not then do not update
-00603 if ( strlen(trim($value)) != 0 )
+00603 if ( strlen(trim($value)) != 0 )
00604 {
00605 if ( CountSql($this->cn,"select * from tva_rate where tva_id=".$value) == 0)
00606 {
@@ -495,14 +495,14 @@
00615 $exist=CountSql($this->cn,"select f_id from fiche join fiche_def using (fd_id) ".
00616 " join jnt_fic_att_value using (f_id) join attr_value using (jft_id) ".
00617 " where frd_id in (8,9,14) and ad_id=".ATTR_DEF_QUICKCODE.
-00618 " and av_text='".FormatString($value)."'");
+00618 " and av_text='".FormatString($value)."'");
00619 if ( $exist == 0 )
00620 {
00621 $value="Attention : pas de société ";
00622 }
00623 }
00624 // Normal traitement
-00625 $value2=FormatString($value);
+00625 $value2=FormatString($value);
00626
00627 $sql=sprintf("select attribut_insert(%d,%d,'%s')",
00628 $fiche_id,$id,$value2);
@@ -519,10 +519,10 @@
00642 function update()
00643 {
00644 // parse the $_POST array
-00645 foreach ($_POST as $name=>$value )
+00645 foreach ($_POST as $name=>$value )
00646 {
00647 echo_debug ("class_fiche",__LINE__,"Name = $name value $value") ;
-00648 list ($id) = sscanf ($name,"av_text%d");
+00648 list ($id) = sscanf ($name,"av_text%d");
00649 if ( $id == null ) continue;
00650 echo_debug("class_fiche",__LINE__,"modify $id");
00651
@@ -542,7 +542,7 @@
00665 {
00666 echo_debug("Modify ATTR_DEF_QUICKCODE");
00667 $sql=sprintf("select update_quick_code(%d,'%s')",
-00668 $jft_id,FormatString($value));
+00668 $jft_id,FormatString($value));
00669 ExecSql($this->cn,$sql);
00670 continue;
00671 }
@@ -550,7 +550,7 @@
00673 if ( $id == ATTR_DEF_NAME )
00674 {
00675 echo_debug("Modify ATTR_DEF_NAME");
-00676 if ( strlen(trim($value)) == 0 )
+00676 if ( strlen(trim($value)) == 0 )
00677 continue;
00678
00679 }
@@ -558,7 +558,7 @@
00681 if ( $id == ATTR_DEF_ACCOUNT )
00682 {
00683 echo_debug("Modify ATTR_DEF_ACCOUNT");
-00684 $v=FormatString($value);
+00684 $v=FormatString($value);
00685 if ( isNumber($v) == 1 )
00686 {
00687 $sql=sprintf("select account_update(%d,%d)",
@@ -578,7 +578,7 @@
00701 {
00702 echo_debug("Modify ATTR_DEF_TVA");
00703 // Verify if the rate exists, if not then do not update
-00704 if ( strlen(trim($value)) != 0 )
+00704 if ( strlen(trim($value)) != 0 )
00705 {
00706 if ( CountSql($this->cn,"select * from tva_rate where tva_id=".$value) == 0)
00707 {
@@ -592,7 +592,7 @@
00715 $exist=CountSql($this->cn,"select f_id from fiche join fiche_def using (fd_id) ".
00716 " join jnt_fic_att_value using (f_id) join attr_value using (jft_id) ".
00717 " where frd_id in (8,9,14) and ad_id=".ATTR_DEF_QUICKCODE.
-00718 " and av_text='".FormatString($value)."'");
+00718 " and av_text='".FormatString($value)."'");
00719
00720
00721 if ( $exist == 0 )
@@ -602,7 +602,7 @@
00725 }
00726
00727 // Normal traitement
-00728 $value2=FormatString($value);
+00728 $value2=FormatString($value);
00729 $sql=sprintf("update attr_value set av_text='%s' where jft_id=%d",
00730 $value2,$jft_id);
00731 ExecSql($this->cn,$sql);
@@ -649,7 +649,7 @@
00783 }
00784 }
00785 ?>
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__fiche_8php.html b/doc/developper/html/class__fiche_8php.html
index 9585f2b80..cfbc223eb 100644
--- a/doc/developper/html/class__fiche_8php.html
+++ b/doc/developper/html/class__fiche_8php.html
@@ -1,12 +1,12 @@
-class_fiche.php File Reference
define Class fiche and fiche def, those class are using class attribut More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+Definition in file class_fiche.php.
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__fiche__def_8php-source.html b/doc/developper/html/class__fiche__def_8php-source.html
index 2709ae7fe..476f9f99c 100644
--- a/doc/developper/html/class__fiche__def_8php-source.html
+++ b/doc/developper/html/class__fiche__def_8php-source.html
@@ -1,12 +1,12 @@
-class_fiche_def.php
Go to the documentation of this file.00001 <?
00002 /*
00003 * This file is part of PhpCompta.
@@ -53,7 +53,7 @@
00060 {
00061 $o=new fiche_def_ref($this->db);
00062
-00063 foreach ( $this->attribut as $value)
+00063 foreach ( $this->attribut as $value)
00064 {
00065 $o->$value=$row[$value];
00066 }
@@ -65,7 +65,7 @@
00078 function Display()
00079 {
00080 $r="";
-00081 foreach ( $this->attribut as $value)
+00081 foreach ( $this->attribut as $value)
00082 {
00083 $r.="<TD>".$this->$value.'</TD>';
00084 }
@@ -103,7 +103,7 @@
00141
00142 }
00143 ?>
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__fiche__def_8php.html b/doc/developper/html/class__fiche__def_8php.html
index 41a6e2a43..b3e16f761 100644
--- a/doc/developper/html/class__fiche__def_8php.html
+++ b/doc/developper/html/class__fiche__def_8php.html
@@ -1,12 +1,12 @@
-class_fiche_def.php File Reference
fiche_def_ref, a fiche is owned by fiche_def which is owned by fiche_def_ref More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+Definition in file class_fiche_def.php.
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__jrn_8php-source.html b/doc/developper/html/class__jrn_8php-source.html
index 85fcf7349..5c63a76d4 100644
--- a/doc/developper/html/class__jrn_8php-source.html
+++ b/doc/developper/html/class__jrn_8php-source.html
@@ -1,12 +1,12 @@
-class_jrn.php
Go to the documentation of this file.00001 <?
00002 /*
00003 * This file is part of PhpCompta.
@@ -39,8 +39,8 @@
00033 }
00034 function GetName() {
00035 if ( $this->id==0 ) {
-00036 $this->name=" Grand Livre ";
-00037 return $this->name;
+00036 $this->name=" Grand Livre ";
+00037 return $this->name;
00038 }
00039
00040 $Res=ExecSql($this->db,"select jrn_def_name from ".
@@ -49,7 +49,7 @@
00043 $Max=pg_NumRows($Res);
00044 if ($Max==0) return null;
00045 $ret=pg_fetch_array($Res,0);
-00046 $this->name=$ret['jrn_def_name'];
+00046 $this->name=$ret['jrn_def_name'];
00047 return $ret['jrn_def_name'];
00048 }
00049
@@ -294,10 +294,10 @@
00326 $Res=pg_fetch_all($r);
00327 echo_debug('class_jrn',__LINE__,$Res);
00328 if ( sizeof($Res) == 0 ) return 1;
-00329 return $Res[0]['value'];
+00329 return $Res[0]['value'];
00330 }
00331 }
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__jrn_8php.html b/doc/developper/html/class__jrn_8php.html
index 28909c28b..b8900c3ec 100644
--- a/doc/developper/html/class__jrn_8php.html
+++ b/doc/developper/html/class__jrn_8php.html
@@ -1,12 +1,12 @@
-class_jrn.php File Reference
@@ -16,7 +16,7 @@
- Class for jrn. More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__own_8php-source.html b/doc/developper/html/class__own_8php-source.html
index d2863f0b7..9de2f5ee8 100644
--- a/doc/developper/html/class__own_8php-source.html
+++ b/doc/developper/html/class__own_8php-source.html
@@ -1,12 +1,12 @@
-class_own.php
Go to the documentation of this file.
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__own_8php.html b/doc/developper/html/class__own_8php.html
index 14dd2ce3a..e21fc0104 100644
--- a/doc/developper/html/class__own_8php.html
+++ b/doc/developper/html/class__own_8php.html
@@ -1,12 +1,12 @@
-class_own.php File Reference
Class to manage the company parameter (address, name...). More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+Definition in file class_own.php.
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__parm__code_8php-source.html b/doc/developper/html/class__parm__code_8php-source.html
index 01fd11033..f7b0063ce 100644
--- a/doc/developper/html/class__parm__code_8php-source.html
+++ b/doc/developper/html/class__parm__code_8php-source.html
@@ -1,12 +1,12 @@
-class_parm_code.php
Go to the documentation of this file.00001 <?
00002 /*
00003 * This file is part of PhpCompta.
@@ -114,7 +114,7 @@
00152 }
00153
00154 }
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__parm__code_8php.html b/doc/developper/html/class__parm__code_8php.html
index ba853f05a..ccc800e4c 100644
--- a/doc/developper/html/class__parm__code_8php.html
+++ b/doc/developper/html/class__parm__code_8php.html
@@ -1,12 +1,12 @@
-class_parm_code.php File Reference
Manage the table parm_code which contains the custom parameter for the module accountancy. More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+Definition in file class_parm_code.php.
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__poste_8php-source.html b/doc/developper/html/class__poste_8php-source.html
index 304505381..82bdf3652 100644
--- a/doc/developper/html/class__poste_8php-source.html
+++ b/doc/developper/html/class__poste_8php-source.html
@@ -1,12 +1,12 @@
-class_poste.php
Go to the documentation of this file.00001 <?
00002 /*
00003 * This file is part of PhpCompta.
@@ -76,11 +76,11 @@
00087 pcm_val=".$this->id);
00088 if ( pg_NumRows($ret) != 0) {
00089 $r=pg_fetch_array($ret);
-00090 $this->name=$r['pcm_lib'];
+00090 $this->name=$r['pcm_lib'];
00091 } else {
-00092 $this->name="Poste inconnu";
+00092 $this->name="Poste inconnu";
00093 }
-00094 return $this->name;
+00094 return $this->name;
00095 }
00100 function get()
00101 {
@@ -130,7 +130,7 @@
00158 'solde'=>abs($r['sum_deb']-$r['sum_cred']));
00159 }
00160 }
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__poste_8php.html b/doc/developper/html/class__poste_8php.html
index 361686eed..34a2555a7 100644
--- a/doc/developper/html/class__poste_8php.html
+++ b/doc/developper/html/class__poste_8php.html
@@ -1,12 +1,12 @@
-class_poste.php File Reference
Manage the account. More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+Definition in file class_poste.php.
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__rapport_8php-source.html b/doc/developper/html/class__rapport_8php-source.html
index 4905733c7..d1310bbcd 100644
--- a/doc/developper/html/class__rapport_8php-source.html
+++ b/doc/developper/html/class__rapport_8php-source.html
@@ -1,12 +1,12 @@
-class_rapport.php
Go to the documentation of this file.00001 <?
00002 /*
00003 * This file is part of PhpCompta.
@@ -34,14 +34,14 @@
00033 function rapport($p_cn,$p_id) {
00034 $this->db=$p_cn;
00035 $this->id=$p_id;
-00036 $this->name='UNDEF';
+00036 $this->name='UNDEF';
00037 }
00040 function GetName() {
00041 $ret=execSql($this->db,"select fr_label from formdef where fr_id=".$this->id);
-00042 if (pg_NumRows($ret) == 0) return $this->name;
+00042 if (pg_NumRows($ret) == 0) return $this->name;
00043 $a=pg_fetch_array($ret,0);
-00044 $this->name=$a['fr_label'];
-00045 return $this->name;
+00044 $this->name=$a['fr_label'];
+00045 return $this->name;
00046 }
00053 function GetRow($p_start,$p_end) {
00054
@@ -72,7 +72,7 @@
00079 }
00080 }
00081 ?>
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__rapport_8php.html b/doc/developper/html/class__rapport_8php.html
index 83ec7e3a2..825d0ef8b 100644
--- a/doc/developper/html/class__rapport_8php.html
+++ b/doc/developper/html/class__rapport_8php.html
@@ -1,12 +1,12 @@
-class_rapport.php File Reference
Create, view, modify and parse report. More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+Definition in file class_rapport.php.
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__user_8php-source.html b/doc/developper/html/class__user_8php-source.html
index cb6824917..4a89b9897 100644
--- a/doc/developper/html/class__user_8php-source.html
+++ b/doc/developper/html/class__user_8php-source.html
@@ -1,12 +1,12 @@
-class_user.php
Go to the documentation of this file.00001 <?
00002 /*
00003 * This file is part of PhpCompta.
@@ -50,7 +50,7 @@
00051 $this->admin=( isset($_SESSION['use_admin']) )?$_SESSION['use_admin']:0;
00052
00053 if ( isset($_SESSION['use_name']) )
-00054 $this->name=$_SESSION['use_name'];
+00054 $this->name=$_SESSION['use_name'];
00055 if ( isset($_SESSION['use_first_name']) )
00056 $this->first_name=$_SESSION['use_first_name'];
00057 }
@@ -70,7 +70,7 @@
00071 if (($Max=pg_NumRows($Res)) == 0 ) return -1;
00072 $row=pg_fetch_array($Res,0);
00073 $this->first_name=$row['use_first_name'];
-00074 $this->name=$row['use_name'];
+00074 $this->name=$row['use_name'];
00075 $this->active=$row['use_active'];
00076 $this->login=$row['use_login'];
00077 $this->admin=$row['use_admin'];
@@ -101,7 +101,7 @@
00107 $_SESSION['use_first_name']=$r['use_first_name'];
00108
00109 $this->admin=$_SESSION['use_admin'];
-00110 $this->name=$_SESSION['use_name'];
+00110 $this->name=$_SESSION['use_name'];
00111 $this->first_name=$_SESSION['use_first_name'];
00112 $this->GetGlobalPref();
00113
@@ -220,7 +220,7 @@
00277 }
00278 // save array into g_ variable
00279 $array_pref=array ('g_theme'=>'THEME','g_pagesize'=>'PAGESIZE');
-00280 foreach ($array_pref as $name=>$parameter ) {
+00280 foreach ($array_pref as $name=>$parameter ) {
00281 if ( ! isset ($line[$parameter]) ) {
00282 echo_debug("Missing pref : ".$parameter);
00283 $this->insert_default_global_pref($parameter);
@@ -241,14 +241,14 @@
00306 $Sql="insert into user_global_pref(user_id,parameter_type,parameter_value)
00307 values ('%s','%s','%s')";
00308 if ( $p_type == "" ) {
-00309 foreach ( $default_parameter as $name=>$value) {
-00310 $Insert=sprintf($Sql,$this->id,$name,$value);
+00309 foreach ( $default_parameter as $name=>$value) {
+00310 $Insert=sprintf($Sql,$this->id,$name,$value);
00311 ExecSql($cn,$Insert);
00312 }
00313 }
00314 else {
00315 $value=($p_value=="")?$default_parameter[$p_type]:$p_value;
-00316 $Insert=sprintf($Sql,$this->id,$p_type,$value);
+00316 $Insert=sprintf($Sql,$this->id,$p_type,$value);
00317 ExecSql($cn,$Insert);
00318 }
00319
@@ -263,7 +263,7 @@
00336 where parameter_type='%s' and
00337 user_id='%s'";
00338 $value=($p_value=="")?$default_parameter[$p_type]:$p_value;
-00339 $Update=sprintf($Sql,$value,$p_type,$this->id);
+00339 $Update=sprintf($Sql,$value,$p_type,$this->id);
00340 ExecSql($cn,$Update);
00341
00342 }//end function
@@ -277,7 +277,7 @@
00353
00354 }
00355 ?>
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__user_8php.html b/doc/developper/html/class__user_8php.html
index a59360034..a6533d993 100644
--- a/doc/developper/html/class__user_8php.html
+++ b/doc/developper/html/class__user_8php.html
@@ -1,12 +1,12 @@
-class_user.php File Reference
Data & function about connected users. More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+Definition in file class_user.php.
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__widget_8php-source.html b/doc/developper/html/class__widget_8php-source.html
index 670bdad5c..dbdb8c185 100644
--- a/doc/developper/html/class__widget_8php-source.html
+++ b/doc/developper/html/class__widget_8php-source.html
@@ -1,12 +1,12 @@
-class_widget.php
Go to the documentation of this file.00001 <?
00002 /*
00003 * This file is part of PhpCompta.
@@ -47,7 +47,7 @@
00067 $this->size=20;
00068 $this->width=50;
00069 $this->heigh=20;
-00070 $this->value="";
+00070 $this->value="";
00071 $this->selected="";
00072 $this->table=0;
00073 $this->label="";
@@ -60,8 +60,8 @@
00089 function IOValue($p_name=null,$p_value=null,$p_label="") {
00090
00091 if ( $p_name != null)
-00092 $this->name=$p_name;
-00093 $this->value=($p_value===null)?$this->value:$p_value;
+00092 $this->name=$p_name;
+00093 $this->value=($p_value===null)?$this->value:$p_value;
00094 $this->label=($p_label == "")?$this->label:$p_label;
00095
00096 // Input text type
@@ -69,7 +69,7 @@
00098 if (strtoupper($this->type)=="TEXT") {
00099 if ( $this->readonly==false) {
00100 $r="<INPUT style=\"border:solid 1px blue;\" TYPE=\"TEXT\" NAME=\"$this->name\" VALUE=\"$this->value\" TABINDEX=\"$this->tabindex\" SIZE=\"$this->size\" ".$disabled.">";} else {
-00101 $r=sprintf('<span>%s</span><input type="hidden" name="%s" value="%s">', $this->value,$this->name,$this->value);
+00101 $r=sprintf('<span>%s</span><input type="hidden" name="%s" value="%s">', $this->value,$this->name,$this->value);
00102 }
00103
00104 if ($this->table==1) {
@@ -83,7 +83,7 @@
00112 }
00113 // Hidden field
00114 if (strtoupper($this->type)=="HIDDEN") {
-00115 $r='<INPUT TYPE="HIDDEN" name="'.$this->name.'" value="'.$this->value.'">';
+00115 $r='<INPUT TYPE="HIDDEN" name="'.$this->name.'" value="'.$this->value.'">';
00116 if ( $this->readonly==true) return "";
00117 return $r;
00118 }
@@ -95,9 +95,9 @@
00124 $r="<SELECT NAME=\"$this->name\">";
00125 for ( $i=0;$i<sizeof($this->value);$i++)
00126 {
-00127 $checked=($this->selected==$this->value[$i]['value'])?"SELECTED":"";
+00127 $checked=($this->selected==$this->value[$i]['value'])?"SELECTED":"";
00128 $r.='<OPTION VALUE="'.$this->value[$i]['value'].'" '.$checked.'>';
-00129 $r.=$this->value[$i]['label'];
+00129 $r.=$this->value[$i]['label'];
00130 }
00131 $r.="</SELECT>";
00132 } else
@@ -106,7 +106,7 @@
00135 echo_debug('class_widget.php',__LINE__,"this->selected = ".$this->selected);
00136 for ( $i=0;$i<sizeof($this->value);$i++)
00137 {
-00138 echo_debug('class_widget.php',__LINE__,"check for ".$this->value[$i]['value']);
+00138 echo_debug('class_widget.php',__LINE__,"check for ".$this->value[$i]['value']);
00139 if ($this->selected==$this->value[$i]['value'] )
00140 {
00141 $r=$this->value[$i]['label'];
@@ -123,7 +123,7 @@
00152 // Password
00153 if (strtoupper($this->type)=="PASSWORD") {
00154 if ( $this->readonly==true) return "";
-00155 $r='<input type="password" name="'.$this->name;
+00155 $r='<input type="password" name="'.$this->name;
00156 $r.='">';
00157 if ($this->table==1) {
00158 $r="<TD> $this->label </TD><TD> $r </TD>";
@@ -135,13 +135,13 @@
00164 if (strtoupper($this->type)=="CHECKBOX") {
00165 if ( $this->readonly == true) {
00166 $check=( $this->selected==true )?"checked":"unchecked";
-00167 $r='<input type="CHECKBOX" name="'.$this->name.'"';
+00167 $r='<input type="CHECKBOX" name="'.$this->name.'"';
00168 $r.=" $check";
00169 $r.=' disabled>';
00170
00171 } else {
00172 $check=( $this->selected==true )?"checked":"unchecked";
-00173 $r='<input type="CHECKBOX" name="'.$this->name.'"';
+00173 $r='<input type="CHECKBOX" name="'.$this->name.'"';
00174 $r.=" $check";
00175 $r.=' '.$disabled.'>';
00176 }
@@ -160,7 +160,7 @@
00189 $r=$check;
00190 } else {
00191 $check=( $this->selected==true||$this->selected=='t' )?"checked":"unchecked";
-00192 $r='<input type="RADIO" name="'.$this->name.'"';
+00192 $r='<input type="RADIO" name="'.$this->name.'"';
00193 $r.=" VALUE=\"$this->value\"";
00194 $r.=" $check";
00195 $r.=' '.$disabled.'>';
@@ -177,17 +177,17 @@
00206 if (strtoupper($this->type)=="TEXTAREA") {
00207 if ( $this->readonly == false ) {
00208 $r="";
-00209 $r.='<TEXTAREA name="'.$this->name.'"';
+00209 $r.='<TEXTAREA name="'.$this->name.'"';
00210 $r.=" rows=\"$this->heigh\" ";
00211 $r.=" cols=\"$this->width\" ";
00212 $r.=' '.$disabled.'>';
-00213 $r.=$this->value;
+00213 $r.=$this->value;
00214
00215 $r.="</TEXTAREA>";
00216 } else {
00217 $r='<p>';
-00218 $r.=$this->value;
-00219 $r.=sprintf('<input type="hidden" name="%s" value="%s">',
+00218 $r.=$this->value;
+00219 $r.=sprintf('<input type="hidden" name="%s" value="%s">',
00220 $this->name,urlencode($this->value));
00221 $r.='</p>';
00222
@@ -226,7 +226,7 @@
00260 // Removing new line
00261
00262 // $msg=urlencode($this->value);
-00263 $msg=$this->value;
+00263 $msg=$this->value;
00264 $msg=str_replace("%OA","",$msg);
00265 $msg=str_replace("%OD","",$msg);
00266 $msg=str_replace("\n","",$msg);
@@ -253,7 +253,7 @@
00287 //file
00288 if (strtoupper($this->type)=="FILE") {
00289 if ( $this->readonly == false ) {
-00290 $r='<INPUT TYPE="file" name="'.$this->name.'" VALUE="'.$this->value.'">';
+00290 $r='<INPUT TYPE="file" name="'.$this->name.'" VALUE="'.$this->value.'">';
00291
00292 }
00293 if ( $this->table==1) $r="<TD>$this->label</TD><TD>$r</TD>";
@@ -267,7 +267,7 @@
00301 // Do we need to filter ??
00302 if ( $this->extra2 == null ) {
00303 $r=sprintf('<TD>
-00304 <INPUT TYPE="button" onClick=SearchPoste(\'%s\',\'%s\',\'%s\') value="Search">
+00304 <INPUT TYPE="button" onClick=SearchPoste(\'%s\',\'%s\',\'%s\') value="Search">
00305 %s</TD><TD>
00306
00307 <INPUT TYPE="Text" NAME="%s" VALUE="%s" SIZE="8">
@@ -282,7 +282,7 @@
00316
00317 } else { // $p_list is not null, so we have a filter
00318 $r=sprintf('<TD>
-00319 <INPUT TYPE="button" onClick=SearchPosteFilter(\'%s\',\'%s\',\'%s\',\'%s\') value="Search">
+00319 <INPUT TYPE="button" onClick=SearchPosteFilter(\'%s\',\'%s\',\'%s\',\'%s\') value="Search">
00320 %s</TD><TD>
00321
00322 <INPUT TYPE="Text" NAME="%s" VALUE="%s" SIZE="8">
@@ -298,7 +298,7 @@
00332
00333 } //else
00334 } else {
-00335 $r=sprintf('<TD><input type="hidden" name="%s" value="%s">
+00335 $r=sprintf('<TD><input type="hidden" name="%s" value="%s">
00336 %s
00337
00338 </TD>',
@@ -317,9 +317,9 @@
00351 $l_sessid=$_REQUEST['PHPSESSID'];
00352 if ( $this->readonly == false ) {
00353 $r=sprintf('<TD>
-00354 <INPUT TYPE="button" onClick=NewCard(\'%s\',\'%s\',\'%s\',\'%s\') value="New">
+00354 <INPUT TYPE="button" onClick=NewCard(\'%s\',\'%s\',\'%s\',\'%s\') value="New">
00355 </TD><TD>
-00356 <INPUT TYPE="button" onClick=SearchCard(\'%s\',\'%s\',\'%s\',\'%s\') value="Search">
+00356 <INPUT TYPE="button" onClick=SearchCard(\'%s\',\'%s\',\'%s\',\'%s\') value="Search">
00357 %s <INPUT TYPE="Text" NAME="%s" VALUE="%s" SIZE="8" TABINDEX="%s">
00358 ',
00359 $l_sessid,
@@ -358,7 +358,7 @@
00394 if ( $this->table==1)
00395 {
00396 $r=sprintf('<TD>
-00397 <INPUT TYPE="button" onClick=SearchCard(\'%s\',\'%s\',\'%s\',\'%s\') value="Search">
+00397 <INPUT TYPE="button" onClick=SearchCard(\'%s\',\'%s\',\'%s\',\'%s\') value="Search">
00398 %s</TD><TD> <INPUT TYPE="Text" NAME="%s" VALUE="%s" SIZE="8" TABINDEX="%s">
00399 ',
00400 $l_sessid,
@@ -374,7 +374,7 @@
00410 else
00411 {
00412 $r=sprintf('
-00413 <INPUT TYPE="button" onClick=SearchCard(\'%s\',\'%s\',\'%s\',\'%s\') value="Search">
+00413 <INPUT TYPE="button" onClick=SearchCard(\'%s\',\'%s\',\'%s\',\'%s\') value="Search">
00414 %s <INPUT TYPE="Text" NAME="%s" VALUE="%s" SIZE="8" TABINDEX="%s"> ',
00415 $l_sessid,
00416 $this->extra,
@@ -437,7 +437,7 @@
00473 if ( $this->readonly == false) {
00474 $l_sessid=$_REQUEST['PHPSESSID'];
00475 $r=sprintf('<TD>
-00476 <INPUT TYPE="button" onClick=SearchJrn(\'%s\',\'%s\') value="Search">
+00476 <INPUT TYPE="button" onClick=SearchJrn(\'%s\',\'%s\') value="Search">
00477 %s</TD><TD>
00478
00479 <INPUT TYPE="Text" NAME="%s" VALUE="%s" SIZE="8">
@@ -450,7 +450,7 @@
00486 );
00487 } else {
00488 $r=sprintf("<TD><span>%s</span>",$this->value);
-00489 $r.=sprintf('<input type="hidden" name="%s" value="%s"></TD>', $this->name,$this->value);
+00489 $r.=sprintf('<input type="hidden" name="%s" value="%s"></TD>', $this->name,$this->value);
00490 }
00491
00492 return $r;
@@ -462,7 +462,7 @@
00498 function debug() {
00499 echo "Type ".$this->type."<br>";
00500 echo "name ".$this->name."<br>";
-00501 echo "value". $this->value."<br>";
+00501 echo "value". $this->value."<br>";
00502 $readonly=($this->readonly==false)?"false":"true";
00503 echo "read only".$readonly."<br>";
00504 }
@@ -474,7 +474,7 @@
00510 }
00511
00512 }
-
Generated on Thu Jun 29 00:04:07 2006 for phpcompta by
+
Generated on Thu Jun 29 21:21:21 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/class__widget_8php.html b/doc/developper/html/class__widget_8php.html
index 3b3af5c7d..a31407ae2 100644
--- a/doc/developper/html/class__widget_8php.html
+++ b/doc/developper/html/class__widget_8php.html
@@ -1,12 +1,12 @@
-class_widget.php File Reference
This class is used to create all the HTML INPUT TYPE. More...
Generated on Thu Jun 29 00:04:08 2006 for phpcompta by
+Definition in file class_widget.php.
Generated on Thu Jun 29 21:21:22 2006 for phpcompta by
1.4.4
diff --git a/doc/developper/html/classaction.html b/doc/developper/html/classaction.html
index c11f003e6..a7214c67a 100644
--- a/doc/developper/html/classaction.html
+++ b/doc/developper/html/classaction.html
@@ -28,7 +28,7 @@
SaveStage2 ()
- Save the document and propose to save the generated document or to upload one, the data are included except the file. Temporary the generated document is savethe ag_comment is already urlencoded.
+ SaveStage3 ($d_id) SaveStage3 ($d_id) Upload the document or save the generated document.
@@ -37,9 +37,6 @@
myList ($p_filter="", $p_search="") Update ()
- Update the data into the database.
-
- GetAgRef ($p_method) GetAgRef returns the ag_ref value of the ag_id or ag_ref_ag_id passed as parameter. This function doesn't change the current object. Data Fields
@@ -108,9 +105,16 @@ constructor $db 00079 {
+00080 $this->db=$p_cn;
+00081 $this->f_id=0;
+00082
+00083 }
+
Member Function Documentation
@@ -145,9 +149,137 @@ Confirm00359 {
+00360 echo_debug('class_action',__LINE__,'confirm() :'.var_export($_POST,true));
+00361 echo_debug('class_action',__LINE__,'confirm $this :'.var_export($this,true));
+00363 if ( isDate($this->ag_timestamp) == null )
+00364 {
+00365 // if the date is invalid, default date is today
+00366 $this->ag_timestamp=date("d.m.Y");
+00367 }
+00368 // Compute the widget
+00369 // Date
+00370 $date=new widget("text");
+00371 $date->readonly=true;
+00372 $date->name="ag_timestamp";
+00373 $date->value=$this->ag_timestamp;
+00374 // Doc Type
+00375 $doc_type=new widget("hidden");
+00376 $doc_type->name="dt_id";
+00377 $doc_type->value=$this->dt_id;
+00378 $a=ExecSql($this->db,"select dt_value from document_type where dt_id=".$this->dt_id);
+00379 $v=pg_fetch_array($a,0);
+00380 $str_type=$v[0];
+00381 if ( isset ($_REQUEST['url']))
+00382 {
+00383 $retour=sprintf('<A HREF="%s"><input type="button" value="Retour"></A>',urldecode($_REQUEST['url']));
+00384 $h_url=sprintf('<input type="hidden" name="url" value="%s">',urldecode($_REQUEST['url']));
+00385 }
+00386 else
+00387 {
+00388 $retour="";
+00389 $h_url="";
+00390 }
+00391
+00392 // state
+00393 $a=ExecSql($this->db,"select s_value from document_state where s_id=".$this->d_state);
+00394 $v=pg_fetch_array($a,0);
+00395 $str_state=$v[0];
+00396 $state=new widget("hidden");
+00397 $state->name="d_state";
+00398 $state->value=$this->d_state;
+00399
+00400 // title
+00401 $title=new widget("text");
+00402 $title->readonly=true;
+00403 $title->name="ag_title";
+00404 $title->value=FormatString($this->ag_title);
+00405
+00406 // Description
+00407 $desc=new widget('textarea');
+00408 $desc->name="ag_comment";
+00409 $desc->readonly=" disabled ";
+00410 $desc->value=$this->ag_comment;
+00411 // Propose to generate a document
+00412 $gen=new widget ("checkbox");
+00413 $gen->name="p_gen";
+00414 $doc_gen=new widget("select");
+00415 $doc_gen->name="gen_doc";
+00416 $doc_gen->value=make_array($this->db,
+00417 "select md_id,md_name from document_modele where md_type=".$this->dt_id);
+00418
+00419 $h_agrefid=new widget('hidden');
+00420
+00421 // f_id
+00422 if ( trim($this->qcode_dest) =="")
+00423 {
+00424 // internal document
+00425 $f_id_dest=0; // internal document
+00426 $namedest="interne";
+00427 }
+00428 else // ( trim($this->qcode_dest) !="" )
+00429 {
+00430 $tiers=new fiche($this->db);
+00431 $tiers->GetByQCode($this->qcode_dest);
+00432 $f_id=$tiers->id;
+00433 $namedest=$tiers->strAttribut(1);
+00434 if ( $namedest == '- ERROR -') $this->f_id_dest=-1;
+00435 }
+00436
+00437 // f_id
+00438 if ( trim($this->qcode_exp) =="")
+00439 {
+00440 // internal document
+00441 $f_id_exp=0; // internal document
+00442 $nameexp="interne";
+00443 }
+00444 else // ( trim($this->qcode_exp) !="" )
+00445 {
+00446 $tiers=new fiche($this->db);
+00447 $tiers->GetByQCode($this->qcode_exp);
+00448 $f_id=$tiers->id;
+00449 $nameexp=$tiers->strAttribut(1);
+00450 if ( $nameexp == '- ERROR -') $this->f_id_exp=-1;
+00451 }
+00452
+00453
+00454
+00455 // Preparing the return string
+00456 $r=$retour."<form method=\"post\">";
+00457 $r.="<p>Date : ".$date->IOValue()."</p>";
+00458 $r.="<p>Etat $str_state".$state->IOValue()."</p>";
+00459 $r.="<p>Type du document $str_type".$doc_type->IOValue()."</p>";
+00460 $r.="<p> Expediteur : ".$this->qcode_exp." ".$nameexp.'</p>';
+00461 $r.="<p> Destinataire : ".$this->qcode_dest." ".$namedest.'</p>';
+00462 $r.="<p> Titre : ".$title->IOValue();
+00463 $r.="<p>Description :".$desc->IOValue()."</p>";
+00464
+00465 // if no document exist for this type then do not display the question
+00466 if ( sizeof($doc_gen->value) != 0)
+00467 $r.="<p> Générer un document ".$gen->IOValue()." ".$doc_gen->IOValue()."</p>";
+00468
+00469
+00470 // Add the hidden tag
+00471 $r.='<input type="hidden" name="sa" value="save_action_st2">';
+00472 $r.='<input type="hidden" name="p_action" value="suivi_courrier">';
+00473 $r.='<input type="hidden" name="tiers" value="'.$this->qcode_dest.'">';
+00474 $r.= $h_agrefid->IOValue("ag_ref_ag_id",$this->ag_ref_ag_id);
+00475
+00476 // retrieve customer
+00477
+00478
+00479 if ( $f_id != -1 )
+00480 $r.=$desc->Submit("Save","Sauve");
+00481 $r.=$desc->Submit("corr","Corrige");
+00482
+00483 $r.=$h_url."</form>";
+00484 return $r;
+00485 }
+
00102 {
+00103 echo_debug('class_action',__LINE__,'Display() :'.var_export($_POST,true));
+00104 echo_debug('class_action',__LINE__,'Display $this :'.var_export($this,true));
+00105
+00106
+00107 if ( $p_view=='UPD')
+00108 {
+00109 $upd=true;
+00110 $readonly=false;
+00111 }
+00112 elseif ($p_view=="NEW")
+00113 {
+00114 $upd=false;
+00115 $readonly=false;
+00116 }
+00117 elseif ($p_view=='READ')
+00118 {
+00119 $upd=true;
+00120 $readonly=true;
+00121 }
+00122 else
+00123 {
+00124 exit('class_action'.__LINE__.'action::Display error unknown parameter'.$p_view);
+00125
+00126 }
+00127 // Compute the widget
+00128 // Date
+00129 $date=new widget("text");
+00130 $date->readonly=$readonly;
+00131 $date->name="ag_timestamp";
+00132 $date->value=$this->ag_timestamp;
+00133
+00134
+00135 // for insert mode only
+00136 if ( $upd == false )
+00137 {
+00138 // Doc Type
+00139 $doc_type=new widget("select");
+00140 $doc_type->name="dt_id";
+00141 $doc_type->value=make_array($this->db,"select dt_id,dt_value from document_type where dt_id in (".ACTION.")");
+00142 $doc_type->selected=$this->dt_id;
+00143 $doc_type->readonly=false;
+00144 $str_doc_type=$doc_type->IOValue();
+00145 echo_debug('class_action',__LINE__,var_export($doc_type,true));
+00146 }
+00147 else {
+00148 // Doc Type
+00149 $doc_type=new widget("hidden");
+00150 $doc_type->name="dt_id";
+00151 $doc_type->value=$this->dt_id;
+00152 $str_doc_type=$doc_type->IOValue()." ".getDbValue($this->db,"select dt_value from document_type where dt_id=".$this->dt_id);
+00153 }
+00154
+00155 // Description
+00156 $desc=new widget('RICHTEXT');
+00157 $desc->width=500;
+00158 $desc->heigh=250;
+00159 $desc->name="ag_comment";
+00160 $desc->readonly=$readonly;
+00161 $desc->value=urldecode($this->ag_comment);
+00162
+00163 // state
+00164 // Retrieve the value
+00165 if ( $p_view != 'READ' )
+00166 {
+00167 $a=make_array($this->db,"select s_id,s_value from document_state ");
+00168 $state=new widget("select");
+00169 $state->readonly=$readonly;
+00170 $state->name="d_state";
+00171 $state->value=$a;
+00172 $state->selected=$this->d_state;
+00173 $str_state=$state->IOValue();
+00174 } else {
+00175 $str_state=getDbValue($this->db,"select s_value from document_state where s_id=".$this->d_state);
+00176 $g=new widget("hidden");
+00177 $str_state.=$g->IOValue('d_state',$this->d_state);
+00178 }
+00179 // Retrieve the value if there is an attached doc
+00180 $doc_ref="";
+00181 // Document id
+00182
+00183 $h2=new widget("hidden");
+00184 $h2->name="d_id";
+00185 $h2->value=$this->d_id;
+00186
+00187 if ( $this->d_id != 0 && $this->d_id != "" )
+00188 {
+00189 $h2->readonly=($p_view=='NEW')?false:true;
+00190 $doc=new Document($this->db,$this->d_id);
+00191 $d_id=new widget("hidden");
+00192 $doc_ref="<p> Document ".$doc->a_ref().'</p>';
+00193 $doc_ref.=$h2->IOValue().$d_id->IOValue('d_id',$this->d_id);
+00194
+00195 }
+00196
+00197
+00198 // title
+00199 $title=new widget("text");
+00200 $title->readonly=$readonly;
+00201 $title->name="ag_title";
+00202 $title->value=FormatString($this->ag_title);
+00203
+00204 // ag_ref
+00205 // Always false for update
+00206 $ag_ref=new widget("text");
+00207 $ag_ref->readonly=true;
+00208 $ag_ref->name="ag_ref";
+00209 $ag_ref->value=FormatString($this->ag_ref);
+00210 $client_label=new widget("span");
+00211
+00212 // f_id_dest destination
+00213 if ( $this->qcode_dest != '- ERROR -' && trim($this->qcode_dest) != "")
+00214 {
+00215 $tiers=new fiche($this->db);
+00216 $tiers->GetByQCode($this->qcode_dest);
+00217 $qcode_dest_label=$tiers->strAttribut(1);
+00218 } else {
+00219 // echo "f_id $this->f_id";
+00220 $qcode_dest_label=($this->f_id==0 || trim($this->qcode_dest)=="")?'Interne ':'Error';
+00221 }
+00222 // f_id_exp sender
+00223 if ( $this->qcode_exp != '- ERROR -' && trim($this->qcode_exp) != "")
+00224 {
+00225 $tiers=new fiche($this->db);
+00226 $tiers->GetByQCode($this->qcode_exp);
+00227 $qcode_exp_label=$tiers->strAttribut(1);
+00228 } else {
+00229 echo "f_id $this->f_id";
+00230 $qcode_exp_label=($this->f_id_exp==0 || trim($this->qcode_exp)=="")?'Interne ':'Error';
+00231 }
+00232
+00233 $h_ag_id=new widget("hidden");
+00234 // if concerns another action : show the link otherwise nothing
+00235 $lag_ref_ag_id="";
+00236
+00237 if ( $this->ag_ref_ag_id != 0 )
+00238 {
+00239 // $this->GetAgRef("ag_ref_ag_id")."</A>";
+00240
+00241 $lag_ref_ag_id='<a class="mtitle" href="commercial.php?p_action=suivi_courrier&sa=detail&ag_id='.
+00242 $this->ag_ref_ag_id.'">'.
+00243 $this->getDBValue($this->db,"select ag_ref from action_gestion where ag_id=".$this->ag_ref_ag_id).
+00244 "</A>";
+00245 }
+00246 // sender
+00247 $w=new widget('js_search_only');
+00248 $w->readonly=$readonly;
+00249 $w->name='qcode_exp';
+00250 $w->value=($this->f_id_exp != 0)?$this->qcode_exp:"";
+00251 $w->label="";
+00252 $w->extra='4,8,9,14,16';
+00253 $sp= new widget("span");
+00254 $h_agrefid=new widget('hidden');
+00255 // destination
+00256 $wdest=new widget('js_search_only');
+00257 $wdest->readonly=$readonly;
+00258 $wdest->name='qcode_dest';
+00259 $wdest->value=($this->f_id_dest != 0)?$this->qcode_dest:"";
+00260 $wdest->label="";
+00261 $wdest->extra='4,8,9,14,16';
+00262 $spdest= new widget("span");
+00263 $h_agrefid=new widget('hidden');
+00264
+00265 // Preparing the return string
+00266 $r="";
+00267 $r.=JS_SEARCH_CARD;
+00268 $r.= "<p>Date : ".$date->IOValue()." Reference ". $this->ag_ref."</p>";
+00269 $r.="<p>Concerne :".$lag_ref_ag_id."</p>";
+00270 $r.= '<p>Type d\' action';
+00271 echo_debug('class_action',__LINE__,"str_doc_type $str_doc_type");
+00272 $r.= $str_doc_type."</p>";
+00273
+00274 // state
+00275 $r.="<p>Etat :".$str_state;
+00276
+00277
+00278 $r.= "</p><p> ";
+00279 $r.=$w->IOValue();
+00280 $r.=$sp->IOValue('qcode_exp_label',$qcode_exp_label)."</TD></TR>";
+00281
+00282 $r.=$wdest->IOValue();
+00283 $r.=$spdest->IOValue('qcode_dest_label',$qcode_dest_label)."</TD></TR>";
+00284
+00285
+00286 $r.="</p>";
+00287 echo_debug('class_action',__LINE__,' ag_id is '.$this->ag_id);
+00288
+00289 $r.= "<p> Titre : ".$title->IOValue().' Ref :'.$ag_ref->IOValue();
+00290 $r.= $doc_ref;
+00291 $r.= "<p>Description :".$desc->IOValue()."</p>";
+00292
+00293 //hidden
+00294 $r.="<p>";
+00295 $r.=$h2->IOValue();
+00296 $r.=$h_agrefid->IOValue("ag_ref_ag_id",$this->ag_ref_ag_id);
+00297 $r.=$h_ag_id->IOValue('ag_id',$this->ag_id);
+00298 $r.="</p>";
+00299
+00300 // show the list of the concern operation
+00301 if ( CountSql($this->db,'select * from action_gestion where ag_ref_ag_id!=0 and ag_ref_ag_id='.$this->ag_id);
+00302 $r.=$this->myList(ACTION," and ag_ref_ag_id=".$this->ag_id);
+00303 return $r;
+00304
+00305 }
+
00310 {
+00311 echo_debug('class_action',__LINE__,'Action::Get() ');
+00312 $sql="select ag_id, ag_comment,to_char (ag_timestamp,'DD-MM-YYYY') as ag_timestamp,".
+00313 " f_id_dest,f_id_exp,ag_title,ag_comment,ag_ref,d_id,ag_type,d_state, ".
+00314 " ag_ref_ag_id ".
+00315 " from action_gestion left join document using (ag_id) where ag_id=".$this->ag_id;
+00316 $r=ExecSql($this->db,$sql);
+00317 $row=pg_fetch_all($r);
+00318 if ( $row==false) return;
+00319 $this->ag_comment=$row[0]['ag_comment'];
+00320 $this->ag_timestamp=$row[0]['ag_timestamp'];
+00321 $this->f_id_dest=$row[0]['f_id_dest'];
+00322 $this->f_id_exp=$row[0]['f_id_exp'];
+00323 $this->ag_title=$row[0]['ag_title'];
+00324 $this->ag_type=$row[0]['ag_type'];
+00325 $this->ag_ref=$row[0]['ag_ref'];
+00326 $this->ag_ref_ag_id=$row[0]['ag_ref_ag_id'];
+00327 $this->d_id=$row[0]['d_id'];
+00328 //
+00329 echo_debug('class_action',__LINE__,' Document id = '.$this->d_id);
+00330 // if there is no document set 0 to d_id
+00331 if ( $this->d_id == "" )
+00332 $this->d_id=0;
+00333 // if there is a document fill the object
+00334 if ($this->d_id != 0 )
+00335 {
+00336 $this->state=$row['0']['d_state'];
+00337 $this->d_state=$row[0]['d_state'];
+00338 }
+00339 echo_debug('class_action',__LINE__,' After test Document id = '.$this->d_id);
+00340 $this->dt_id=$this->ag_type;
+00341 $adest=new fiche($this->db,$this->f_id_dest);
+00342 $this->qcode_dest=$adest->strAttribut(ATTR_DEF_QUICKCODE);
+00343 $aexp=new fiche($this->db,$this->f_id_exp);
+00344 $this->qcode_exp=$aexp->strAttribut(ATTR_DEF_QUICKCODE);
+00345
+00346 echo_debug('class_action',__LINE__,'Detail end () :'.var_export($_POST,true));
+00347 echo_debug('class_action',__LINE__,'Detail $this :'.var_export($this,true));
+00348
+00349 }
+
-
-
-
-
-
-
- action::GetAgRef
- (
- $
- p_method
- )
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $p_method : can be ag_ref_ag_id or ag_id
-
-
@@ -324,11 +662,120 @@ myList($p_filter="")
00627 {
+00628 $sql="
+00629 select ag_id,to_char(ag_timestamp,'DD-MM-YYYY') as my_date,ag_ref_ag_id,f_id_dest,f_id_exp".
+00630 ",ag_title,d_id,md_type,dt_value,ag_ref
+00631 from action_gestion
+00632 left outer join document using (ag_id)
+00633 left outer join document_modele on (ag_type=md_type)
+00634 join document_type on (ag_type=dt_id)
+00635 where dt_id in ($p_filter) $p_search order by ag_timestamp desc,ag_ref desc";
+00636 $max_line=CountSql($this->db,$sql);
+00637 $step=$_SESSION['g_pagesize'];
+00638 $page=(isset($_GET['offset']))?$_GET['page']:1;
+00639 $offset=(isset($_GET['offset']))?$_GET['offset']:0;
+00640 $limit=" LIMIT $step OFFSET $offset ";
+00641 $bar=jrn_navigation_bar($offset,$max_line,$step,$page);
+00642
+00643 $Res=ExecSql($this->db,$sql.$limit);
+00644 $a_row=pg_fetch_all($Res);
+00645 // $r='<div class="u_redcontent">';
+00646 $r="";
+00647 $r.=$bar;
+00648 $r.="<table>";
+00649 $r.="<tr>";
+00650 $r.="<th>Date</th>";
+00651 $r.="<th>Destinataire</th>";
+00652 $r.="<th>Expéditeur</th>";
+00653 $r.="<th>Titre</th>";
+00654 $r.="<th>type</th>";
+00655 $r.="<th>Référence</th>";
+00656 $r.="<th>concerne</th>";
+00657 $r.="<th>Document</th>";
+00658 $r.="</tr>";
+00659
+00660 // if there are no records return a message
+00661 if ( sizeof ($a_row) == 0 or $a_row == false )
+00662 {
+00663 $r='<div class="u_redcontent">';
+00664 $r.='<hr>Aucun enregistrement trouvé';
+00665 $r.="</div>";
+00666 return $r;
+00667
+00668 }
+00669 echo JS_SEARCH_CARD;
+00670 foreach ($a_row as $row )
+00671 {
+00672
+00673 $r.="<tr>";
+00674 $r.="<td>".$row['my_date']."</td>";
+00675 // Expediteur
+00676 $fexp=new fiche($this->db);
+00677 $fexp->id=$row['f_id_exp'];
+00678 $qcode_exp=$f->strAttribut(ATTR_DEF_QUICKCODE);
+00679
+00680 $qexp=($qcode_exp=="- ERROR -")?"Interne":$qcode_exp;
+00681 $jsexp=sprintf("javascript:showfiche('%s','%s')",
+00682 $_REQUEST['PHPSESSID'],$qexp);
+00683 if ( $qexp != 'Interne' )
+00684 {
+00685 $r.="<td>".'<A HREF="'.$jsexp.'">'.$qexp." : ".$fexp->getName().'</A></td>';
+00686 }
+00687 else
+00688 $r.="<td>Interne </td>";
+00689 // Destinataire
+00690 $fdest=new fiche($this->db);
+00691 $fdest->id=$row['f_id_dest'];
+00692 $qcode_dest=$fdest->strAttribut(ATTR_DEF_QUICKCODE);
+00693
+00694 $qdest=($qcode_dest=="- ERROR -")?"Interne":$qcode_dest;
+00695 $jsdest=sprintf("javascript:showfiche('%s','%s')",
+00696 $_REQUEST['PHPSESSID'],$qdest);
+00697 if ( $qdest != 'Interne' )
+00698 {
+00699 $r.="<td>".'<A HREF="'.$jsdest.'">'.$qdest." : ".$fdest->getName().'</A></td>';
+00700 }
+00701 else
+00702 $r.="<td>Interne </td>";
+00703
+00704 // show reference
+00705 if ( $row['ag_ref_ag_id'] != 0 )
+00706 {
+00707 $retSqlStmt=ExecSql($this->db,
+00708 "select ag_ref from action_gestion where ag_id=".$row['ag_ref_ag_id']);
+00709 $retSql=pg_fetch_all($retSqlStmt);
+00710 $ref="";
+00711 foreach ($retSql as $line)
+00712 {
+00713 $ref.='<A href="commercial.php?p_action=suivi_courrier&query='.$line['ag_ref'].'">'.
+00714 $line['ag_ref']."<A>";
+00715 }
+00716 }
+00717 else
+00718 $ref="";
+00719
+00720 $r.='<td><A HREF="commercial.php?p_action=suivi_courrier&sa=detail&ag_id='.$row['ag_id'].'">'.
+00721 $row['ag_title']."</A></td>";
+00722 $r.="<td>".$row['dt_value']."</td>";
+00723 $r.="<td>".$row['ag_ref']."</td>";
+00724 $r.="<td>".$ref."</td>";
+00725 $doc=new Document($this->db,$row['d_id']);
+00726 $r.="<td>".$doc->a_ref()."</td>";
+00727 $r.="</tr>";
+00728
+00729 }
+00730 $r.="</table>";
+00731
+00732 $r.=$bar;
+00733 //$r.="</div>";
+00734 return $r;
+00735 }
+
00494 {
+00495 echo_debug('class_action',__LINE__,'saveStage2() :'.var_export($_POST,true));
+00496 echo_debug('class_action',__LINE__,' saveStage2() $this :'.var_export($this,true));
+00497
+00498 // Get The sequence id,
+00499 $seq_name="seq_doc_type_".$this->dt_id;
+00500 $str_file="";
+00501 $add_file='';
+00502 // f_id dest
+00503 $tiers=new fiche($this->db);
+00504 $tiers->GetByQCode($this->qcode_dest);
+00505
+00506 // f_id exp
+00507 $exp=new fiche($this->db);
+00508 $exp->GetByQCode($this->qcode_exp);
+00509
+00510 if ( trim($this->ag_title) == "")
+00511 {
+00512 $doc_mod=new document_type($this->db);
+00513 $doc_mod->dt_id=$this->dt_id;
+00514 $doc_mod->get();
+00515 $this->ag_title=$doc_mod->dt_value;
+00516 }
+00517 echo_debug('class_action',__LINE__," tiers->id ".$tiers->id);
+00518 $this->ag_id=NextSequence($this->db,'action_gestion_ag_id_seq');
+00519 // Create the reference
+00520 $ref=$this->dt_id.'/'.$this->ag_id;
+00521 $this->ag_ref=$ref;
+00524 //we remove newline
+00525 $this->ag_comment=str_replace("%OD","",$this->ag_comment);
+00526 $this->ag_comment=str_replace("%OA","",$this->ag_comment);
+00527 // save into the database
+00528 $sql=sprintf("insert into action_gestion".
+00529 "(ag_id,ag_timestamp,ag_type,ag_title,f_id_dest,f_id_exp,ag_comment,ag_ref,ag_ref_ag_id) ".
+00530 " values (%d,to_date('%s','DD-MM-YYYY'),'%d','%s',%d,%d,'%s','%s',%d)",
+00531 $this->ag_id,
+00532 $this->ag_timestamp,
+00533 $this->dt_id,
+00534 FormatString($this->ag_title),
+00535 $tiers->id,
+00536 $exp->id,
+00537 $this->ag_comment,
+00538 $ref,
+00539 $this->ag_ref_ag_id
+00540 );
+00541 ExecSql($this->db,$sql);
+00542
+00543
+00544
+00545 // the lob filename and the mimetype needed if we want to generate a doc.
+00546 if ( $this->gen == 'on' )
+00547 {
+00548 $doc=new Document($this->db);
+00549 $doc->f_id=$tiers->id;
+00550 $doc->md_id=$this->md_id;
+00551 $doc->ag_id=$this->ag_id;
+00552 $doc->d_state=$this->d_state;
+00553 $str_file=$doc->Generate();
+00554 $d='<input type="hidden" name="d_id" value="'.$doc->d_id.'">';
+00555 }
+00556 $r="";
+00557 // readonly and upload of a file
+00558 $r.="<hr>";
+00559 $r.='<form enctype="multipart/form-data" method="post">';
+00560 $r.=$this->Display('READ',false);
+00561 // Add the hidden tag
+00562 $r.='<input type="hidden" name="sa" value="save_action_st3">';
+00563 $r.='<input type="hidden" name="p_action" value="suivi_courrier">';
+00564 // add the d_id
+00565 $r.='<input type="hidden" name="d_id" value="'.$this->d_id.'">';
+00566 // ag_comment must be saved in urlcode
+00567 $r.='<input type="hidden" name="ag_comment" value="'.urlencode($this->ag_comment).'">';
+00568 // Value for the generated document
+00569 if ( $this->gen == 'on' )
+00570 {
+00571 $r.='<input type="hidden" name="d_id" value="'.$doc->d_id.'">';
+00572 $r.="Sauver le document généré :";
+00573 $r.=$str_file;
+00574 $checkbox=new widget("checkbox");
+00575 $checkbox->name="save_generate";
+00576 $r.=$checkbox->IOValue();
+00577 $r.="<hr>";
+00578 }
+00579 $upload=new widget("file");
+00580 $upload->name="file_upload";
+00581 $upload->value="";
+00582 $r.="Enregistrer le fichier ".$upload->IOValue();
+00583 $r.=$upload->Submit("save","Sauve le fichier");
+00584 $r.="</form>";
+00585 return $r;
+00586 }
+
00593 {
+00594 echo_debug('class_action',__LINE__,'SaveStage3() :'.var_export($_POST,true));
+00595 echo_debug('class_action',__LINE__,'SaveStage3 :'.var_export($this,true));
+00596
+00597 // if we save the generated doc
+00598 if ( isset($_POST['save_generate']))
+00599 {
+00600 return;
+00601 }
+00602
+00603 // Upload a new document
+00604 $doc=new Document($this->db);
+00605 $doc->ag_id=$this->ag_id;
+00606 // if there is a document and it is not an update
+00607 if ( sizeof($_FILES) !=0 && $d_id==0)
+00608 {
+00609 $doc->md_type=$this->dt_id;
+00610 $doc->blank();
+00611 }
+00612 else
+00613 $doc->d_id=$d_id;
+00614
+00615 $doc->Upload($this->ag_id);
+00616 }
+
00742 {
+00743 echo_debug('class_action',__LINE__,'Update() $_POST() :'.var_export($_POST,true));
+00744 echo_debug('class_action',__LINE__,'Update() $this :'.var_export($this,true));
+00745
+00746 // if ag_id == 0 nothing to do
+00747 if ( $this->ag_id == 0 ) return ;
+00748
+00749
+00750 // retrieve customer
+00751 // f_id
+00752
+00753 if ( trim($this->qcode) =="" )
+00754 {
+00755 // internal document
+00756 $this->f_id=0; // internal document
+00757 }
+00758 else
+00759 {
+00760 $tiers=new fiche($this->db);
+00761 if ( $tiers->GetByQCode($this->qcode) ==1 ) // Error we cannot retrieve this qcode
+00762 return false;
+00763 else
+00764 $this->f_id=$tiers->id;
+00765
+00766 }
+00767
+00768 //remove newline from ag_comment
+00769 $this->ag_comment=str_replace("\n","",$this->ag_comment);
+00770 $this->ag_comment=str_replace("\r","",$this->ag_comment);
+00771
+00772 // url encoded
+00773 $this->ag_comment=urlencode($this->ag_comment);
+00774
+00775 // bug PHP : sometimes the newline remains
+00776 $this->ag_comment=str_replace("%A0","",$this->ag_comment);
+00777 $this->ag_comment=str_replace("%0D","",$this->ag_comment);
+00778 $this->ag_comment=str_replace("+%A0+","",$this->ag_comment);
+00779 $this->ag_comment=str_replace("+%0D+","",$this->ag_comment);
+00780
+00781
+00782 $sql=sprintf("update action_gestion set ag_comment='%s',".
+00783 " ag_timestamp=to_date('%s','DD.MM.YYYY'),".
+00784 " ag_title='%s',".
+00785 " ag_type=%d, ".
+00786 " f_id_exp=%d, ".
+00787 " f_id_dest=%d, ".
+00788 " ag_ref_ag_id=%d".
+00789 " where ag_id = %d",
+00790 $this->ag_comment,
+00791 $this->ag_timestamp,
+00792 FormatString($this->ag_title),
+00793 $this->dt_id,
+00794 $this->f_id_exp,
+00795 $this->f_id_dest,
+00796 $this->ag_ref_ag_id,
+00797 $this->ag_id);
+00798 ExecSql($this->db,$sql);
+00799
+00800 if ( sizeof($_FILES) !=0 )
+00801 {
+00802 // Upload a new document
+00803 $doc=new Document($this->db);
+00804 if ( $this->d_id !=0 )
+00805 {
+00806 $doc->d_id=$this->d_id;
+00807 } else {
+00808 // we need to increment the counter
+00809 $doc->ag_id=$this->ag_id;
+00810 $doc->md_type=$this->dt_id;
+00811 $doc->blank();
+00812 }
+00813 $doc->Upload($this->ag_id);
+00814
+00815 }
+00816
+00817 return true;
+00818 }
+
Field Documentation
@@ -462,7 +1107,7 @@ References $d
@@ -485,10 +1130,11 @@ Definition at line 62
-
action::$ag_ref_ag_id
+ action::$ag_ref_ag_id
+Definition at line 73 of file class_action.php.
+concern previous action
@@ -538,7 +1184,7 @@ Definition at line 63
-
action::$ag_title
+ action::$ag_title