Example #1
0
 +-------------------------------------------------------------------------+
*/
include "../../include/session.php";
include "include/tables.php";
include "include/fields.php";
include "include/files.php";
if (!isset($_GET["backurl"])) {
    $thetable = new files($db, "tbld:80b4f38d-b957-bced-c0a0-ed08a0db6475");
    $pageTitle = "File";
} else {
    include "include/attachments.php";
    $backurl = $_GET["backurl"];
    if (isset($_GET["refid"])) {
        $backurl .= "?refid=" . $_GET["refid"];
    }
    $thetable = new attachments($db, "tbld:80b4f38d-b957-bced-c0a0-ed08a0db6475", $backurl);
    $pageTitle = "File Attachment";
}
$therecord = $thetable->processAddEditPage();
if (!hasRights($therecord["roleid"])) {
    goURL("../../noaccess.php");
}
if (isset($therecord["phpbmsStatus"])) {
    $statusmessage = $therecord["phpbmsStatus"];
}
function getAttachments($db, $uuid)
{
    $querystatement = "\n\t\t\tSELECT\n\t\t\t\t`tabledefs`.`displayname`,\n\t\t\t\t`attachments`.`recordid`,\n\t\t\t\t`attachments`.`creationdate`,\n\t\t\t\t`tabledefs`.`editfile`\n\t\t\tFROM\n\t\t\t\t`attachments`INNER JOIN `tabledefs` ON `attachments`.`tabledefid`=`tabledefs`.`uuid`\n\t\t\tWHERE `attachments`.`fileid`='" . $uuid . "'\n\t\t\t";
    $queryresult = $db->query($querystatement);
    return $queryresult;
}
<?php

require_once "functions.php";
session_start();
security::redirect_if_not_loggedin();
# Delete & Modify
if (isset($_POST["TrModify"])) {
    $TrModify = $_POST["TrModify"];
    if (isset($_POST["TrDelete"]) && $TrModify == "Delete") {
        $TrDeleteArr = $_POST["TrDelete"];
        db_function::transaction_delete_group($TrDeleteArr);
        attachments::delete_group($TrDeleteArr);
        header("Location: show.php");
    }
    if (!isset($_POST["TrDelete"]) && $TrModify == "Delete") {
        $test = various::send_alert_and_redirect("No transaction selected!", "show.php");
    }
    if (isset($_POST["TrEdit"]) && $TrModify == "Edit") {
        $TrEdit = $_POST["TrEdit"];
        header("Location: new_transaction.php?TrEditNr={$TrEdit[0]}");
    }
    if (!isset($_POST["TrEdit"]) && $TrModify == "Edit") {
        $test = various::send_alert_and_redirect("No transaction selected!", "show.php");
    }
}
require_once "functions.php";
session_start();
security::redirect_if_not_loggedin();
$Guid = costant::desktop_guid();
if (isset($_GET["DeleteAttach"])) {
    attachments::delete_attachment_by_name($_GET["DeleteAttach"]);
}
if (isset($_FILES['UploadedAttachments']) && isset($_POST["Attachment_TrId"])) {
    $TrNumber = (int) $_POST['Attachment_TrId'];
    $FileName = $_FILES['UploadedAttachments']['name'];
    $FileExtension = substr($FileName, strpos($FileName, ".") + 1, strlen($FileName));
    $NewFileName = "Transaction_" . $TrNumber . "_Attach" . (attachments::get_number_of_attachments($TrNumber) + 1) . "." . $FileExtension;
    move_uploaded_file($_FILES['UploadedAttachments']['tmp_name'], "attachments/" . $NewFileName);
    echo $NewFileName;
}
if (isset($_GET["AttachmentsTable"])) {
    $TrId = $_GET["AttachmentsTable"];
    $Attachments = attachments::get_attachments_filename_array($TrId, true);
    echo "<table class = 'table'>";
    echo "<tbody>";
    for ($i = 0; $i < sizeof($Attachments); $i++) {
        echo "<tr>";
        $File = $Attachments[$i];
        design::table_cell(substr($File, strpos($File, "Attach"), strlen($File)), "");
        design::table_cell("<a href='services.php?guid={$Guid}&download_attachment={$File}'>\n                            <span class='glyphicon glyphicon-download-alt'> </span> Open</a>", "text_align_right");
        design::table_cell("<a href='#' onclick='attachment_delete(\"{$File}\",{$TrId});return false;'>\n                            <span class='glyphicon glyphicon-remove'> </span> Delete</a>", "text_align_right");
        echo "</tr>";
    }
    echo "</tbody>";
    echo "</table>";
}
Example #4
0
    #Download Attachments by name
    if (isset($_GET["download_attachment"])) {
        $AttachmentFileName = $_GET["download_attachment"];
        if (!empty($AttachmentFileName)) {
            $FullPath = costant::attachments_folder() . "/" . $AttachmentFileName;
            header("Content-Type:");
            header("Cache-Control: public");
            header("Content-Description: File Transfer");
            header("Content-Disposition: attachment; filename= " . $AttachmentFileName);
            header("Content-Transfer-Encoding: binary");
            readfile($FullPath);
        }
    }
    #Delete Attachments
    if (isset($_GET["delete_attachment"])) {
        $AttachmentFileName = $_GET["delete_attachment"];
        if (!empty($AttachmentFileName)) {
            attachments::delete_attachment_by_name($AttachmentFileName);
        }
    }
    #Delete transaction group
    if (isset($_GET["delete_group"])) {
        $deletegroup_string = $_GET["delete_group"];
        $deletegroup_array = explode(",", $deletegroup_string);
        db_function::transaction_delete_group($deletegroup_array);
        attachments::delete_group($deletegroup_array);
        echo $operation_succeded;
    }
} else {
    echo $wrong_guid;
}
Example #5
0
             design::table_cell("<span data-toggle='tooltip' title='Subcategory: {$TrSubCategoryShow}' id='tooltip_category_{$lineid}'>{$TrCategoryShow}*</span>", "");
         } else {
             if (costant::disable_category() == False) {
                 design::table_cell($TrCategoryShow, "");
             }
         }
         //AMOUNT
         $TrAmountShow = number_format($resultarray[$i]["Amount"], 2, ",", "");
         design::table_cell($TrAmountShow, "text_align_right td_size_5");
         //NOTES
         $TrNotesShow = $resultarray[$i]["Notes"];
         $NotesHTMLCode = "";
         if ($TrNotesShow != "" && $TrNotesShow != "None") {
             $NotesHTMLCode .= "<span class='glyphicon glyphicon-info-sign' data-toggle='tooltip' title='{$TrNotesShow}' id='tooltip_notes_{$lineid}'></span> ";
         }
         if (attachments::get_number_of_attachments($lineid) > 0) {
             $NotesHTMLCode .= "<span class='glyphicon glyphicon-paperclip'></span>";
         }
         design::table_cell($NotesHTMLCode, "text_align_center");
         //DELETE
         echo "<td class ='text_align_center'>";
         echo "<input type='checkbox' name='TrDelete[]' value='{$lineid}' />";
         echo "</td>";
         //EDIT
         echo "<td class ='text_align_center'>";
         echo "<input type='radio' name='TrEdit[]' value='{$lineid}' />";
         echo "</td>";
         echo "</tr>";
     }
 }
 echo "</tbody>";
Example #6
0
$TrNotes = $_POST["Notes"];
#Execute common insert
db_function::category_insert_single($TrCategory, $TrSubCategory);
db_function::payee_insert_single($TrPayee, $TrCategory, $TrSubCategory);
db_function::payee_update_single($TrPayee, $TrCategory, $TrSubCategory);
if (isset($_POST["TrEditedNr"])) {
    $TrEditedNr = $_POST["TrEditedNr"];
    # Update
    db_function::transaction_update($TrEditedNr, $TrDate, $TrStatus, $TrType, $TrAccount, $TrToAccount, $TrPayee, $TrCategory, $TrSubCategory, $TrAmount, $TrNotes);
    echo "<script type='text/javascript'>";
    echo "location.href='show.php'";
    echo "</script>";
} else {
    $TrEditedNr = db_function::transaction_insert($TrDate, $TrStatus, $TrType, $TrAccount, $TrToAccount, $TrPayee, $TrCategory, $TrSubCategory, $TrAmount, $TrNotes);
}
attachments::rename_zero($TrEditedNr);
?>
        
        <div class="container text_align_center">
            <br />
            <br />
            <h3>Transaction inserted successfully</h3>
            <br />
            <br />
            <input type="button" class="btn btn-lg btn-success btn-block" value="Insert new" onclick="top.location.href = 'new_transaction.php'" />
            <br />
            <input type="button" class="btn btn-lg btn-success btn-block" value="Show transaction" onclick="top.location.href = 'show.php'" />
            <br />
            <input type="button" class="btn btn-lg btn-success btn-block" value="Return to menu" onclick="top.location.href = 'landing.php'" />
            <br />
            <br />
    <link rel="stylesheet" type="text/css" href="res/style_global-0.9.9.css" />
    
    <script src="res/modernizr-2.8.3.js" type="text/javascript"></script>
    <script src="res/jquery-2.1.1.min.js" type="text/javascript"></script>
    <script src="res/typeahead.bundle-0.10.2.min.js" type="text/javascript"></script>
    <script src="res/functions-1.0.1.js" type="text/javascript"></script>
    <script src="res/app/new_transaction.js" type="text/javascript"></script>
</head>

<body>
	<script type="text/javascript">
        test_html5();
	</script>
    
    <?php 
attachments::delete_zero();
if (isset($_GET["TrEditNr"])) {
    $TrEditNr = $_GET["TrEditNr"];
    $FlagNew = False;
} else {
    $TrEditNr = 0;
    $FlagNew = True;
}
if ($FlagNew) {
    $resultarray = array();
    $TransactionHeaderText = "Insert new transcation";
    $TransactionDate = "2014-01-01";
    $TransactionStatus = costant::transaction_default_status();
    $TransactionType = costant::transaction_default_type();
    $TransactionAccount = costant::transaction_default_account();
    $TransactionToAccount = "None";
Example #8
0
 case 'buyvip-po-confirm':
     $fullpath = SP_BUYVIP_ARCHIVE_PATH . 'confirm/' . $filename;
     break;
 case 'amfr-bulk-items':
 case 'amfr-variations':
 case 'amfr-uploadimgs':
 case 'amfr-disc-prods':
     $fullpath = SP_AMAZONFR_UPLOAD_PATH . $filename;
     break;
 case 'amfr-po-confirm':
     $fullpath = SP_AMAZONFR_ARCHIVE_PATH . 'confirm/' . $filename;
     break;
 case 'attachments':
     use_class('attachments');
     $obj_path = $_GET['po'];
     $fullpath = attachments::generateFullPath($obj_path, $filename);
     $basename = basename($fullpath);
     $basenames = strstr($basename, '-');
     $fullpath_without_id = substr($basenames, 1);
     break;
 case 'archive-bookkeeping':
     use_class('ReportBookkeeping');
     $fullpath = DIR_FS_ARCHIVES . ReportBookkeeping::ARCHIVE_PATH . $filename;
     break;
 case 'report-sales-newcomer':
 case 'report-sales-weekly':
 case 'pick-n-pack':
     $fullpath = DIR_FS_ARCHIVES . $filename;
     break;
 case 'laid-uploadimgs':
     $fullpath = SP_LAZADAID_TEMP_IMAGE_DIR . $filename;