Categories > OpenTBS with ODS >

TinyButStrong Error OpenTBS Plugin: The footer of the Central Directory is not found.

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Ambroise Maupate
Date: 2012-01-03
Time: 09:03

TinyButStrong Error OpenTBS Plugin: The footer of the Central Directory is not found.

I've used successfully OpenTBS for generating OpenOffice documents using OPENTBS_DOWNLOAD. But I'm trying to write a PHP script to send a OO document by mail using OPENTBS_FILE+TBS_EXIT and I get this error :

TinyButStrong Error OpenTBS Plugin: The footer of the Central Directory is not found. The process is ending, unless you set NoErr property to true.

Everything works fine with the OPENTBS_DOWNLOAD flag.

Here the generation script :
// différents bordereaux pour la génération automatique
$template = array("attachement.ods",
                "bordereau_serie.ods",
                "terrassements_ponctuels_sondage.ods",
                "terrassements_ponctuels.ods",
                "ordre_de_travail.odt",
                "permission_voirie.odt",
                "ficheAffaire.odt"
                );

$typeBordereau = intval($_POST["bordereautype"]);
   
$TBS = new clsTinyButStrong; // new instance of TBS
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN); // load OpenTBS plugin
   
$TBS->NoErr = false;
   
// Load the template
$templateFile = basename($template[$typeBordereau]);
   
$TBS->LoadTemplate($templatePath."/".$templateFile, "UTF-8");
   
$entrepriseName =     "Entreprise";
$clientName =         utf8_encode(html_entity_decode($_SESSION['nom_c']));
$adresse =             utf8_encode(html_entity_decode($_SESSION['adresse_c']));
$id_chantier =         utf8_encode(html_entity_decode($_SESSION['id_c']));
$codePostal =         utf8_encode(html_entity_decode($_SESSION['codePostal']));
$commune =             utf8_encode(html_entity_decode($_SESSION['libCommune']));
$dateDeb =             utf8_encode(date("d/m/Y", strtotime($_SESSION['datedeb_c'])));
$dateFin =             utf8_encode($_SESSION['datefin']);
$currentDate =         utf8_encode(date("d/m/Y"));
   
$aff_num_grdf =            utf8_encode(html_entity_decode($_SESSION["aff_num_grdf"]));
$aff_numero =             utf8_encode(html_entity_decode($_SESSION["aff_numero"]));
$aff_nom_moar =            utf8_encode(html_entity_decode($_SESSION["aff_nom_moar"]));   
$aff_entite_moar =        utf8_encode(html_entity_decode($_SESSION["aff_entite_moar"]));   
$aff_nom_prepa =         utf8_encode(html_entity_decode($_SESSION["aff_nom_prepa"]));   
$aff_comment_moar =        utf8_encode(html_entity_decode($_SESSION["aff_comment_moar"]));   
$aff_comment_bex =         utf8_encode(html_entity_decode($_SESSION["aff_comment_bex"]));   
$aff_dateprev =         utf8_encode(date("d/m/Y", strtotime($_SESSION["aff_dateprev"])));
$aff_annee =             utf8_encode(date("Y", strtotime($_SESSION["aff_dateprev"])));
   
$file_name = str_replace('.','_#'.$id_chantier.'_'.date('Y-m-d').'.',$templateFile);
   
//$TBS->Plugin(OPENTBS_DEBUG_XML_SHOW);
   
if (isset($_POST["send_Affaire"])) {
    $TBS->Show(OPENTBS_FILE, $templatePath."/".$file_name);
    sendPDFMail("test@test.fr", "Fiche Affaire #".$aff_numero, $file_path, $file_name, "Test");
    header("Location: ../index.php?action=aff_chantier&id_c=".$id_chantier);
}
else {   
    $TBS->Show(OPENTBS_DOWNLOAD, $file_name);
}

Thanks for helping me !!
Good Year to everybody !
By: Skrol29
Date: 2012-01-03
Time: 23:44

Re: TinyButStrong Error OpenTBS Plugin: The footer of the Central Directory is not found.

Hi Ambroise,

> TinyButStrong Error OpenTBS Plugin: The footer of the Central Directory is not found.
> The process is ending, unless you set NoErr property to true.

This error message sent during the LoadTemplate() method, when the asked template is found, but the structure of the Zip file is not recognized.

I suggest that you try to debug by placing an exit() statement in the code, move this statement until the message is not shown.
This way, you'll  find the line that makes the error.
May be your script  is continuing after that, and going into other mering.