Skip to content

Instantly share code, notes, and snippets.

@KpitanZanahoria
Last active December 21, 2024 19:24
Show Gist options
  • Save KpitanZanahoria/9d039ac2b86a25ec0dc5f79d57f8dbf6 to your computer and use it in GitHub Desktop.
Save KpitanZanahoria/9d039ac2b86a25ec0dc5f79d57f8dbf6 to your computer and use it in GitHub Desktop.
Change download path according to field value
$col = array();
$col["title"] = "Quarter";
$col["name"] = "Quarter";
$col["fixed"] = true;
$col["width"] = "140";
$col["editable"] = true; // this column is editable
$col["align"] = "center";
$col["hidden"] = false;
$col["editrules"] = array("edithidden"=>true, "required"=>true,"readonly"=>true,"readonly-when"=>array("bloqueado","==","Sí"));
$col["formatter"] = "select"; // render as select
$col["edittype"] = "select"; // render as select
$col["editoptions"] = array("value"=>":;Quarter_01:Quarter 01;Quarter_02:Quarter 02;Quarter_03:Quarter 03;Quarter_04:Quarter 04");
$cols[] = $col;
[...]
$col["title"] = "Documento";
$col["name"] = "documento";
$col["fixed"] = true;
$col["width"] = "100";
$col["editable"] = true; // this column is editable
$col["sortable"] = false; // this column is not sortable
$col["search"] = false;
$col["edittype"] = "file"; // render as file
$col["editrules"] = array("edithidden"=>true, "required"=>true,"readonly"=>true,"readonly-when"=>array("bloqueado","==","Sí"));
$col["upload_dir"] = "../invoices/2024" . DIRECTORY_SEPARATOR . [Content of $col Quarter];// upload here
$col["editrules"]["ifexist"] = "rename"; // "rename", "override" can also be set
$col["editrules"]["allowedext"] = "pdf,PDF"; // comma separated list of extensions
$col["editrules"] = array("ifexist"=>"rename"); // "rename", "override" can also be set
$col["editrules"]["allowedsize"] = 8 * 1024 * 1024; // allowed size in bytes e.g. 3 MB = 3 x 1024 x 1024
$col["show"] = array("list"=>true,"edit"=>true,"add"=>true); // only show in add/edit dialog
$cols[] = $col;
@KpitanZanahoria
Copy link
Author

KpitanZanahoria commented Dec 21, 2024

How could I manage to replace the data to achieve the address "../invoices/2024/Quarter_01 (or Quarter_02, Quarter_03, Quarter_04" ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment